/* =========================================================
   MINHA ROTINA - design system
   Fundo off-white, cards arredondados, tipografia elegante.
   Mobile first.
   ========================================================= */

:root {
    --bg: #F6F6FA;
    --surface: #FFFFFF;
    --surface-soft: #F1F0F8;
    --text: #1F1D2B;
    --text-soft: #6B6880;
    --text-faint: #9E9BB0;
    --primary: #6C63FF;
    --primary-soft: #EEEBFF;
    --primary-dark: #5A52E0;
    --green: #34C77B;
    --green-soft: #E4F7EE;
    --amber: #F5A623;
    --amber-soft: #FDF2DF;
    --red: #EF5B72;
    --red-soft: #FDE9EC;
    --blue: #3FA9F5;
    --blue-soft: #E6F3FE;
    --radius-lg: 24px;
    --radius: 18px;
    --radius-sm: 12px;
    --radius-pill: 999px;
    --shadow: 0 8px 30px rgba(31, 29, 43, .06);
    --shadow-soft: 0 4px 16px rgba(31, 29, 43, .04);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; opacity: .85; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* ---------- layout ---------- */
.app-shell {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 18px 120px;
    min-height: 100vh;
}

.app-shell.wide { max-width: 1100px; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 12px;
}

.brand {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--text);
}

.brand-dot { color: var(--primary); }

.greeting { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.greeting-sub { color: var(--text-soft); margin: 0 0 22px; font-size: 14.5px; }

.section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-faint);
    margin: 26px 0 12px;
}

/* ---------- cards ---------- */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 14px;
}

.card-lg { border-radius: var(--radius-lg); padding: 22px; }
.card-flat { box-shadow: none; border: 1px solid var(--surface-soft); }
.card-row { display: flex; align-items: center; gap: 14px; }
.card-row .grow { flex: 1; min-width: 0; }

.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 12px; }
.mb-2 { margin-bottom: 12px; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (min-width: 760px) {
    .grid-md-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- progress ---------- */
.progress-ring { display: flex; align-items: center; gap: 18px; }

.ring {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--primary) calc(var(--value, 0) * 1%), var(--surface-soft) 0);
    flex-shrink: 0;
}

.ring-inner {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--surface);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 19px;
}

.bar {
    height: 9px;
    border-radius: var(--radius-pill);
    background: var(--surface-soft);
    overflow: hidden;
}

.bar > span {
    display: block;
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--primary);
    transition: width .3s ease;
}

.bar.green > span { background: var(--green); }
.bar.blue > span { background: var(--blue); }
.bar.amber > span { background: var(--amber); }
.bar.red > span { background: var(--red); }

/* ---------- stat tiles ---------- */
.tile {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-soft);
}

.tile .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.tile .label { color: var(--text-soft); font-size: 13px; margin-top: 2px; }

.tile-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    margin-bottom: 10px;
    background: var(--primary-soft);
    color: var(--primary);
}

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 8px; }

.timeline-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 12px 0;
    position: relative;
}

.timeline-item + .timeline-item { border-top: 1px solid var(--surface-soft); }

.timeline-time {
    width: 52px;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-soft);
    font-variant-numeric: tabular-nums;
    padding-top: 2px;
}

.timeline-body { flex: 1; min-width: 0; }
.timeline-title { font-weight: 500; }
.timeline-item.done .timeline-title { color: var(--text-faint); text-decoration: line-through; }

/* ---------- lists ---------- */
.list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--surface);
    border-radius: var(--radius);
    margin-bottom: 10px;
    box-shadow: var(--shadow-soft);
}

.list-item .grow { flex: 1; min-width: 0; }

.check {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--surface-soft);
    background: transparent;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    color: transparent;
    transition: all .15s ease;
}

.check.checked {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: var(--radius-pill);
    font-size: 11.5px;
    font-weight: 600;
    background: var(--surface-soft);
    color: var(--text-soft);
    white-space: nowrap;
}

.pill-primary { background: var(--primary-soft); color: var(--primary); }
.pill-green { background: var(--green-soft); color: #1E8A55; }
.pill-amber { background: var(--amber-soft); color: #A9700F; }
.pill-red { background: var(--red-soft); color: #C0392B; }
.pill-blue { background: var(--blue-soft); color: #1F7FB8; }

/* ---------- water ---------- */
.water-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin: 8px 0 4px;
}

.water-value { font-size: 44px; font-weight: 700; letter-spacing: -.03em; }

.round-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--surface-soft);
    color: var(--text);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform .1s ease;
}

.round-btn:active { transform: scale(.94); }
.round-btn.primary { background: var(--primary); color: #fff; }

.cups { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

.cup {
    width: 26px;
    height: 34px;
    border-radius: 6px 6px 10px 10px;
    background: var(--surface-soft);
    border: 2px solid transparent;
}

.cup.filled { background: var(--blue-soft); border-color: var(--blue); }

/* ---------- forms ---------- */
.field { margin-bottom: 15px; }
.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--surface-soft);
    background: var(--surface);
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(108, 99, 255, .12);
}

.field textarea { min-height: 90px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; }
.field .error { font-size: 12.5px; color: var(--red); margin-top: 5px; }

.field-row { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-soft);
    margin-bottom: 12px;
}

.checkbox input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: transform .1s ease, background .15s ease;
    text-align: center;
}

.btn:hover { background: var(--primary-dark); opacity: 1; }
.btn:active { transform: scale(.985); }
.btn-block { width: 100%; }
.btn-ghost { background: var(--surface-soft); color: var(--text); }
.btn-ghost:hover { background: #E7E6F2; }
.btn-outline { background: transparent; border: 1.5px solid var(--surface-soft); color: var(--text); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #D84A60; }
.btn-sm { padding: 9px 14px; font-size: 13.5px; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 12px; }

/* ---------- bottom nav ---------- */
.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    width: min(560px, calc(100% - 24px));
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(14px);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(31, 29, 43, .12);
    display: flex;
    padding: 8px;
    z-index: 60;
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px;
    border-radius: var(--radius);
    color: var(--text-faint);
    font-size: 10.5px;
    font-weight: 600;
    transition: color .15s ease, background .15s ease;
}

.bottom-nav a.active { color: var(--primary); background: var(--primary-soft); }
.bottom-nav svg { width: 22px; height: 22px; }

.fab-add {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 6px 18px rgba(108, 99, 255, .35);
    margin-top: -14px;
}

/* ---------- sheets / modals ---------- */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(31, 29, 43, .35);
    backdrop-filter: blur(2px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 100%);
    width: min(560px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 22px;
    z-index: 91;
    transition: transform .26s cubic-bezier(.22, 1, .36, 1);
}

.sheet.open { transform: translate(-50%, 0); }

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.sheet-title { font-size: 19px; font-weight: 600; margin: 0; }

/* ---------- alerts ---------- */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.alert-success { background: var(--green-soft); color: #1E8A55; }
.alert-error { background: var(--red-soft); color: #C0392B; }
.alert-info { background: var(--blue-soft); color: #1F7FB8; }
.alert-warn { background: var(--amber-soft); color: #A9700F; }

/* ---------- empty state ---------- */
.empty {
    text-align: center;
    padding: 42px 20px;
    color: var(--text-faint);
}

.empty svg { margin: 0 auto 14px; color: var(--text-faint); }
.empty-title { font-weight: 600; color: var(--text-soft); margin-bottom: 4px; }

/* ---------- segment control ---------- */
.segment {
    display: flex;
    gap: 6px;
    background: var(--surface-soft);
    padding: 4px;
    border-radius: var(--radius-pill);
    overflow-x: auto;
    margin-bottom: 16px;
    scrollbar-width: none;
}

.segment::-webkit-scrollbar { display: none; }

.segment a {
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    white-space: nowrap;
}

.segment a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-soft); }

/* ---------- toast ---------- */
.toast-wrap {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(420px, calc(100% - 32px));
}

.toast {
    background: var(--text);
    color: #fff;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    box-shadow: var(--shadow);
    animation: toast-in .22s ease;
}

.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- misc ---------- */
.divider { height: 1px; background: var(--surface-soft); margin: 18px 0; }
.avatar {
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary);
    display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.badge-count {
    background: var(--red); color: #fff; border-radius: var(--radius-pill);
    font-size: 10px; padding: 1px 6px; font-weight: 700;
}
.spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

@media (min-width: 900px) {
    .app-shell { padding-bottom: 40px; }
    .bottom-nav { position: sticky; bottom: 14px; transform: none; left: auto; margin: 26px auto 0; }
}