/* ==========================================================================
   Diário Aurora · Identidade visual
   Papel creme, títulos em serifa clássica, terracota, linhas douradas
   e o mosaico colorido do sol nascente.
   ========================================================================== */

:root {
    --cream: #fcf3e1;
    --cream-2: #fff8ec;
    --paper: #fffdf8;
    --ink: #4b3427;
    --muted: #8a7262;
    --brown: #7a3e22;
    --terracotta: #a9643f;
    --terracotta-dark: #8a4c2d;
    --gold: #f4b547;
    --gold-line: #f3d79d;
    --gold-soft: #fcebc6;
    --line: #f0e0c2;

    --blue: #3069bf;
    --sky: #55aee6;
    --teal: #33b0b8;
    --aqua: #4cc7d3;
    --coral: #ee6f67;
    --pink: #f27d8a;
    --salmon: #f59a7b;
    --orange: #f5a26b;
    --purple: #7558a3;
    --lilac: #c98bc2;
    --navy: #2a55a3;
    --green: #3f9d6b;

    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 1px 2px rgba(122, 62, 34, .05), 0 8px 24px -12px rgba(122, 62, 34, .18);
    --shadow-lg: 0 24px 60px -24px rgba(122, 62, 34, .35);
    --font-title: 'Cinzel', 'Trajan Pro', Georgia, serif;
    --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
    --font-script: 'Great Vibes', cursive;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--cream);
    background-image: radial-gradient(ellipse 80% 60% at 50% 35%, #fffaf0 0%, rgba(255, 250, 240, 0) 70%);
    background-attachment: fixed;
    min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--terracotta-dark); text-decoration: none; }
a:hover { color: var(--brown); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-title); color: var(--brown); font-weight: 600; letter-spacing: .04em; margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: clamp(1.5rem, 2.6vw, 2rem); text-transform: uppercase; }
h2 { font-size: 1.25rem; text-transform: uppercase; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--gold-line); margin: 1.5rem 0; }
::selection { background: var(--gold-soft); }
:focus-visible { outline: 3px solid rgba(244, 181, 71, .7); outline-offset: 2px; border-radius: 6px; }

.icon { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1; }
.pre { white-space: pre-line; }

.tile {
    --c: var(--terracotta);
    display: inline-grid; place-items: center;
    width: 2.4rem; height: 2.4rem; flex: none;
    border-radius: 9px 11px 8px 12px;
    background: var(--c); color: #fff;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .08);
}
.tile .icon { width: 1.2rem; height: 1.2rem; }
.tile.sm { width: 1.9rem; height: 1.9rem; border-radius: 7px 9px 6px 9px; }
.tile.sm .icon { width: 1rem; height: 1rem; }
.tile.lg { width: 3.2rem; height: 3.2rem; border-radius: 12px 15px 11px 16px; }
.tile.lg .icon { width: 1.6rem; height: 1.6rem; }

.mosaic-bar { display: flex; gap: 4px; height: 7px; margin: .9rem 0 0; max-width: 340px; }
.mosaic-bar span { flex: 1; border-radius: 2px 3px 2px 3px; }
.mosaic-bar span:nth-child(1) { background: var(--purple); } .mosaic-bar span:nth-child(2) { background: var(--coral); }
.mosaic-bar span:nth-child(3) { background: var(--orange); } .mosaic-bar span:nth-child(4) { background: var(--gold); flex: 2; }
.mosaic-bar span:nth-child(5) { background: var(--teal); } .mosaic-bar span:nth-child(6) { background: var(--sky); }
.mosaic-bar span:nth-child(7) { background: var(--blue); } .mosaic-bar span:nth-child(8) { background: var(--lilac); }

.sun-mark { display: block; width: 26px; height: 26px; margin: 0 auto; color: var(--gold); }

/* ---------- Botões ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .7rem 1.15rem; min-height: 44px;
    border-radius: 999px; border: 1.5px solid transparent;
    font: 700 .95rem/1.1 var(--font-body); letter-spacing: .01em;
    cursor: pointer; text-decoration: none !important; white-space: nowrap;
    transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--terracotta); color: #fff; box-shadow: 0 6px 16px -8px rgba(138, 76, 45, .8); }
.btn-primary:hover { background: var(--terracotta-dark); color: #fff; }
.btn-sunrise { background: linear-gradient(120deg, var(--gold) 0%, var(--orange) 45%, var(--coral) 100%); color: #fff; box-shadow: 0 10px 24px -10px rgba(238, 111, 103, .8); text-shadow: 0 1px 1px rgba(122, 62, 34, .25); }
.btn-sunrise:hover { color: #fff; filter: saturate(1.1) brightness(1.03); }
.btn-outline { background: var(--paper); color: var(--terracotta-dark); border-color: var(--gold-line); }
.btn-outline:hover { background: var(--cream-2); border-color: var(--gold); color: var(--brown); }
.btn-ghost { background: transparent; color: var(--terracotta-dark); }
.btn-ghost:hover { background: rgba(244, 181, 71, .15); color: var(--brown); }
.btn-danger { background: #fff; color: #b3412f; border-color: #f2c2b8; }
.btn-danger:hover { background: #fdeeea; color: #8f2e1f; }
.btn-sm { padding: .45rem .8rem; min-height: 36px; font-size: .85rem; }
.btn-icon { padding: 0; width: 40px; min-height: 40px; height: 40px; border-radius: 12px; }
.btn-block { width: 100%; }

/* ---------- Estrutura do sistema ---------- */
.app-shell { display: grid; grid-template-columns: 272px 1fr; min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: linear-gradient(180deg, #fffaf0 0%, var(--cream-2) 100%);
    border-right: 1px solid var(--line);
    padding: 1.25rem 1rem 1.5rem;
    display: flex; flex-direction: column; gap: .25rem;
    scrollbar-width: thin;
}
.sidebar-brand { display: block; padding: 0 .5rem .5rem; text-align: center; }
.sidebar-brand img { width: 150px; margin: 0 auto; }
.nav-group { margin-top: .6rem; }
.nav-label { font: 600 .68rem/1 var(--font-title); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); padding: 0 .75rem .45rem; }
.nav-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .34rem .6rem; border-radius: 12px;
    color: var(--ink); font-weight: 600; font-size: .94rem;
    text-decoration: none !important;
}
.nav-link:hover { background: rgba(244, 181, 71, .14); color: var(--brown); }
.nav-link.active { background: #fff; color: var(--brown); box-shadow: var(--shadow); }
.nav-link .tile { width: 1.85rem; height: 1.85rem; border-radius: 7px 9px 6px 9px; }
.nav-link .tile .icon { width: 1rem; height: 1rem; }
.sidebar-foot { margin-top: auto; padding-top: 1.25rem; }
.user-chip { display: flex; align-items: center; gap: .65rem; padding: .6rem; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.avatar { width: 2.3rem; height: 2.3rem; border-radius: 50%; display: grid; place-items: center; font: 700 1rem var(--font-title); color: #fff; background: conic-gradient(from 200deg, var(--gold), var(--orange), var(--coral), var(--purple), var(--blue), var(--teal), var(--gold)); flex: none; }
.user-chip .who { min-width: 0; line-height: 1.2; }
.user-chip .who strong { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who span { font-size: .78rem; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.scrim { display: none; }
.topbar { display: none; }
.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 2rem 2.25rem 1rem; flex: 1; }
.page-foot { text-align: center; padding: 1.5rem 1rem 2rem; font: 600 .72rem/1.4 var(--font-title); letter-spacing: .18em; text-transform: uppercase; color: var(--terracotta); }
.page-foot .sun-mark { margin-top: .5rem; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem 1.5rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.page-head .eyebrow { font: 600 .74rem var(--font-title); letter-spacing: .2em; text-transform: uppercase; color: var(--terracotta); margin-bottom: .35rem; display: flex; align-items: center; gap: .5rem; }
.page-head h1 { margin: 0; }
.page-head .lead { margin: .4rem 0 0; color: var(--muted); max-width: 640px; }
.page-head .actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .88rem; margin-bottom: .75rem; }

/* ---------- Cartões ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem; }
.card + .card { margin-top: 1.25rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.card-head h2, .card-head h3 { margin: 0; display: flex; align-items: center; gap: .6rem; }
.card-title { font: 600 .95rem var(--font-title); letter-spacing: .1em; text-transform: uppercase; color: var(--brown); }
.card.flat { box-shadow: none; }
.card.tight { padding: 1rem; }
.card-art { position: relative; overflow: hidden; border: 0; color: #fff; min-height: 220px; background: #3d2a5c center/cover no-repeat; }
.card-art::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(60, 30, 20, .78) 0%, rgba(80, 40, 30, .45) 45%, rgba(0, 0, 0, 0) 75%); }
.card-art > * { position: relative; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }

/* ---------- Indicadores ---------- */
.stat { --c: var(--terracotta); position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); overflow: hidden; }
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.stat .label { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font: 700 1.45rem/1.2 var(--font-body); color: var(--ink); margin-top: .25rem; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: .8rem; color: var(--muted); margin-top: .2rem; }

/* ---------- Tabelas no estilo da agenda impressa ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); -webkit-overflow-scrolling: touch; }
table.agenda { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .93rem; background: var(--paper); }
table.agenda thead th {
    background: var(--terracotta); color: #fff; text-align: left;
    font: 700 .78rem/1.2 var(--font-body); letter-spacing: .05em; text-transform: uppercase;
    padding: .7rem .8rem; white-space: nowrap;
}
table.agenda thead th:first-child { border-top-left-radius: 10px; }
table.agenda thead th:last-child { border-top-right-radius: 10px; }
table.agenda td { padding: .7rem .8rem; border-bottom: 1px solid var(--gold-line); vertical-align: top; }
table.agenda td + td, table.agenda th + th { border-left: 1px solid rgba(243, 215, 157, .55); }
table.agenda thead th + th { border-left-color: rgba(255, 255, 255, .25); }
table.agenda tbody tr:hover td { background: #fff8e9; }
table.agenda tfoot td { font-weight: 800; background: var(--cream-2); border-bottom: 0; }
table.agenda .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.agenda .check { width: 38px; text-align: center; }
table.agenda .row-actions { white-space: nowrap; text-align: right; width: 1%; }
table.agenda a.row-link { color: var(--ink); font-weight: 700; }
table.agenda a.row-link:hover { color: var(--terracotta-dark); }
table.agenda.compact td { padding: .5rem .65rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty img { width: 110px; margin: 0 auto 1rem; opacity: .9; }
.empty strong { display: block; font: 600 1rem var(--font-title); letter-spacing: .08em; color: var(--brown); margin-bottom: .3rem; text-transform: uppercase; }

/* ---------- Selos de situação ---------- */
.badge { --c: var(--terracotta); display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 800; white-space: nowrap; color: var(--c); background: color-mix(in srgb, var(--c) 13%, #fff); border: 1px solid color-mix(in srgb, var(--c) 30%, #fff); }
.badge::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: var(--c); }
.badge.plain::before { display: none; }

/* ---------- Formulários ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem 1.25rem; }
.form-grid .full { grid-column: 1 / -1; }
.field label, .label { display: block; font-weight: 800; font-size: .88rem; color: var(--brown); margin-bottom: .35rem; }
.field .req { color: var(--coral); }
.field .help { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.field .error, .error-text { font-size: .83rem; color: #b3412f; font-weight: 700; margin-top: .3rem; }
.input, select.input, textarea.input {
    width: 100%; min-height: 46px; padding: .65rem .9rem;
    font: 500 1rem/1.4 var(--font-body); color: var(--ink);
    background: #fff; border: 1.5px solid var(--gold-line); border-radius: 12px;
    transition: border-color .15s, box-shadow .15s;
    appearance: none; -webkit-appearance: none;
}
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23a9643f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.4rem; }
textarea.input { min-height: 110px; resize: vertical; }
.input:hover { border-color: #ecc77d; }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(244, 181, 71, .22); }
.input.is-invalid { border-color: #e39a8c; background: #fffaf8; }
.input-money { position: relative; }
.input-money::before { content: "R$"; position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; font-size: .9rem; }
.input-money .input { padding-left: 2.6rem; font-variant-numeric: tabular-nums; }
.checkbox { display: flex; gap: .6rem; align-items: flex-start; font-weight: 600; cursor: pointer; }
.checkbox input { width: 1.2rem; height: 1.2rem; accent-color: var(--terracotta); margin-top: .15rem; flex: none; }
.form-actions { display: flex; gap: .75rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px dashed var(--gold-line); }
.times-list { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.times-list .time-item { display: flex; align-items: center; gap: .25rem; background: var(--cream-2); border: 1.5px solid var(--gold-line); border-radius: 12px; padding: .2rem .25rem .2rem .55rem; }
.times-list .time-item input { border: 0; background: transparent; font: 700 1rem var(--font-body); color: var(--ink); width: 6.2rem; min-height: 38px; }
.times-list .time-item input:focus { outline: none; }
.times-list .time-item button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: .3rem; border-radius: 8px; }
.times-list .time-item button:hover { color: #b3412f; background: #fdeeea; }

/* ---------- Filtros ---------- */
.filters { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; align-items: end; margin-bottom: 1.25rem; }
.filters > * { min-width: 0; }
.filters .field label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.filters .input { min-height: 42px; padding-top: .5rem; padding-bottom: .5rem; }
.filters .filter-actions { display: flex; gap: .5rem; }
.search-input { position: relative; }
.search-input .icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input .input { padding-left: 2.5rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .9rem; }
.toolbar .count { color: var(--muted); font-size: .9rem; }

/* ---------- Alertas ---------- */
.alert { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1.1rem; border-radius: 14px; margin-bottom: 1.25rem; font-weight: 600; border: 1px solid; }
.alert .icon { margin-top: .15rem; }
.alert-success { background: #eff8f1; border-color: #bfe3cb; color: #2e6b47; }
.alert-error { background: #fdf0ec; border-color: #f2c2b8; color: #8f2e1f; }
.alert-info { background: #fff6e2; border-color: var(--gold-line); color: var(--brown); }
.alert ul { margin: .3rem 0 0; padding-left: 1.1rem; font-weight: 500; }
.alert .close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; opacity: .6; }

/* ---------- Detalhes ---------- */
.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; margin: 0; }
.details > div { padding: .75rem 0; border-bottom: 1px solid var(--gold-line); }
.details > div.full { grid-column: 1 / -1; }
.details dt { font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .15rem; }
.details dd { margin: 0; font-weight: 600; white-space: pre-line; word-break: break-word; }
.details dd:empty::before { content: "—"; color: #c9b8a9; font-weight: 400; }

/* ---------- Página inicial ---------- */
.welcome { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1.5rem; padding: 0; min-height: 250px; }
.welcome .text { padding: 2rem 2.2rem; display: flex; flex-direction: column; justify-content: center; }
.welcome h1 { color: #fff; font-size: clamp(1.4rem, 2.6vw, 2.1rem); text-transform: none; letter-spacing: .02em; }
.welcome .day { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .8rem; border-radius: 999px; background: rgba(255, 255, 255, .18); backdrop-filter: blur(6px); font-weight: 800; font-size: .85rem; width: fit-content; margin-bottom: .8rem; border: 1px solid rgba(255, 255, 255, .3); }
.welcome .quote { font-family: var(--font-title); letter-spacing: .08em; text-transform: uppercase; font-size: .82rem; opacity: .92; margin-top: .4rem; }
.intention { position: relative; padding: 1.2rem 1.3rem 1.2rem 1.5rem; background: #fff; border-radius: 16px; border: 1px dashed var(--gold); }
.intention::before { content: "\201C"; position: absolute; left: .55rem; top: -.35rem; font: 700 3rem/1 Georgia, serif; color: var(--gold); }
.intention p { font-style: italic; font-size: 1.02rem; color: var(--brown); margin: 0; white-space: pre-line; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 62px 1fr; gap: .9rem; padding: .7rem 0; border-bottom: 1px solid var(--gold-line); align-items: center; }
.timeline li:last-child { border-bottom: 0; }
.date-chip { --c: var(--terracotta); text-align: center; border-radius: 12px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--c) 35%, #fff); background: #fff; }
.date-chip .m { display: block; background: var(--c); color: #fff; font: 700 .64rem/1.6 var(--font-body); text-transform: uppercase; letter-spacing: .08em; }
.date-chip .d { display: block; font: 700 1.3rem/1.35 var(--font-title); color: var(--ink); }
.timeline .title { font-weight: 800; color: var(--ink); }
.timeline .meta { font-size: .85rem; color: var(--muted); display: flex; gap: .3rem .8rem; flex-wrap: wrap; }
.timeline .meta span { display: inline-flex; align-items: center; gap: .25rem; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.quick { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1rem .5rem; text-align: center; border-radius: 16px; background: #fff; border: 1px solid var(--line); font-weight: 800; font-size: .85rem; color: var(--ink); text-decoration: none !important; transition: transform .15s, box-shadow .15s; }
.quick:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--brown); }

.progress { height: 9px; background: var(--gold-soft); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--orange), var(--coral)); border-radius: 999px; }

.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: .6rem 0; border-bottom: 1px solid var(--gold-line); display: flex; justify-content: space-between; gap: .75rem; align-items: center; }
.list-plain li:last-child { border-bottom: 0; }

/* ---------- Diário (papel pautado) ---------- */
.journal-list { display: grid; gap: 1.25rem; }
.journal-page {
    position: relative; background-color: #fffdf7;
    background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, var(--gold-line) 31px, var(--gold-line) 32px);
    background-position: 0 14px;
    border: 1px solid var(--line); border-radius: 6px 18px 18px 6px;
    box-shadow: var(--shadow); padding: 1.1rem 1.6rem 1.4rem 2.4rem;
}
.journal-page::before { content: ""; position: absolute; left: 1.2rem; top: 0; bottom: 0; width: 2px; background: rgba(238, 111, 103, .35); }
.journal-page header { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; flex-wrap: wrap; line-height: 32px; }
.journal-page .jdate { font: 600 .82rem var(--font-title); letter-spacing: .14em; text-transform: uppercase; color: var(--terracotta); }
.journal-page h3 { margin: 0; line-height: 32px; }
.journal-page .jtext { line-height: 32px; white-space: pre-line; margin: 0; font-size: 1.02rem; }
.journal-page .jtext.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.journal-page footer { display: flex; justify-content: space-between; align-items: center; margin-top: .4rem; }
textarea.input.lined {
    background-color: #fffdf7; line-height: 32px; padding-top: 4px;
    background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, var(--gold-line) 31px, var(--gold-line) 32px);
    background-attachment: local; background-position: 0 4px;
}

/* ---------- Medicamentos: quadro de horários ---------- */
.hours-grid { width: 100%; border-collapse: collapse; font-size: .82rem; }
.hours-grid th, .hours-grid td { border: 1px solid var(--gold-line); text-align: center; padding: .35rem .2rem; }
.hours-grid thead th { background: var(--terracotta); color: #fff; font-weight: 800; border-color: rgba(255, 255, 255, .25); }
.hours-grid th.med { text-align: left; padding: .4rem .7rem; min-width: 160px; background: var(--cream-2); color: var(--ink); }
.hours-grid thead th.med { background: var(--terracotta-dark); color: #fff; }
.hours-grid td.on { background: var(--pink); color: #fff; font-weight: 800; }

/* ---------- Calendário ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cal-head .month-title { font: 600 1.4rem var(--font-title); letter-spacing: .1em; text-transform: uppercase; color: var(--brown); margin: 0; min-width: 230px; text-align: center; }
.cal-nav { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.cal-types { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.cal-type { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .75rem; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-size: .85rem; font-weight: 700; cursor: pointer; user-select: none; }
.cal-type input { position: absolute; opacity: 0; pointer-events: none; }
.cal-type .dot { width: .7rem; height: .7rem; border-radius: 3px; background: var(--c); }
.cal-type:has(input:not(:checked)) { opacity: .45; text-decoration: line-through; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--gold-line); border-radius: var(--radius-sm); overflow: hidden; background: var(--paper); }
.calendar .dow { background: var(--terracotta); color: #fff; text-align: center; font: 800 .75rem/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; padding: .65rem .2rem; }
.calendar .day { min-height: 118px; padding: .4rem .4rem .5rem; border-top: 1px solid var(--gold-line); border-left: 1px solid var(--gold-line); position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.calendar .day:nth-child(7n + 1) { border-left: 0; }
.calendar .day.other { background: #fbf4e6; }
.calendar .day.other .num { color: #c9b8a9; }
.calendar .day.weekend .num { color: var(--coral); }
.calendar .day .num { font: 700 .9rem var(--font-title); color: var(--ink); display: flex; justify-content: space-between; align-items: center; text-decoration: none !important; }
.calendar .day .num .add { opacity: 0; color: var(--terracotta); font-family: var(--font-body); font-size: 1.1rem; line-height: 1; }
.calendar .day:hover .num .add { opacity: 1; }
.calendar .day.today { background: #fff6dd; }
.calendar .day.today .num span:first-child { background: var(--gold); color: #fff; border-radius: 50%; width: 1.75rem; height: 1.75rem; display: inline-grid; place-items: center; }
.calendar .day.selected { box-shadow: inset 0 0 0 2px var(--gold); }
.ev { --c: var(--terracotta); display: block; font-size: .74rem; line-height: 1.3; font-weight: 700; padding: 2px 6px; border-radius: 5px; color: #fff; background: var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none !important; }
.ev:hover { color: #fff; filter: brightness(.95); }
.ev.faixa { background: color-mix(in srgb, var(--c) 22%, #fff); color: color-mix(in srgb, var(--c) 70%, #000); font-weight: 600; }
.ev.cancelado { text-decoration: line-through !important; opacity: .55; }
.ev .t { opacity: .85; font-weight: 800; margin-right: 3px; }
.more { font-size: .72rem; font-weight: 800; color: var(--terracotta); }
.day-panel .ev { font-size: .9rem; padding: .5rem .75rem; border-radius: 10px; white-space: normal; margin-bottom: .4rem; }

/* ---------- Anexos ---------- */
.files { display: grid; gap: .6rem; }
.file-item { display: flex; align-items: center; gap: .8rem; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.file-item .meta { min-width: 0; flex: 1; }
.file-item .meta a { font-weight: 800; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.file-item .meta span { font-size: .8rem; color: var(--muted); }
.dropzone { border: 2px dashed var(--gold-line); border-radius: 16px; padding: 1.1rem; background: var(--cream-2); }

/* ---------- Paginação ---------- */
.pagination { display: flex; gap: .35rem; justify-content: center; flex-wrap: wrap; margin-top: 1.25rem; list-style: none; padding: 0; }
.pagination a, .pagination span { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 .7rem; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-weight: 800; color: var(--ink); text-decoration: none !important; }
.pagination .active span { background: var(--terracotta); color: #fff; border-color: var(--terracotta); }
.pagination .disabled span { opacity: .4; }

/* ---------- Diálogo de confirmação ---------- */
dialog.confirm { border: 0; border-radius: 22px; padding: 0; max-width: 420px; width: calc(100% - 2rem); box-shadow: var(--shadow-lg); background: var(--paper); color: var(--ink); }
dialog.confirm::backdrop { background: rgba(60, 35, 20, .45); backdrop-filter: blur(3px); }
dialog.confirm .body { padding: 1.6rem 1.6rem 1rem; text-align: center; }
dialog.confirm .body .tile { margin: 0 auto 1rem; }
dialog.confirm .body h3 { text-transform: uppercase; letter-spacing: .08em; }
dialog.confirm .foot { display: flex; gap: .6rem; padding: 1rem 1.6rem 1.5rem; justify-content: center; }

/* ---------- Telas de acesso ---------- */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-art { position: relative; background: #3d2a5c url('/images/arte-capa.jpg?v=2') center/cover no-repeat; color: #fff; display: flex; flex-direction: column; justify-content: flex-end; padding: 3rem; }
.auth-art::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(40, 20, 15, 0) 35%, rgba(40, 20, 15, .75) 100%); }
.auth-art > * { position: relative; }
.auth-art blockquote { margin: 0; font: 600 1.35rem/1.45 var(--font-title); letter-spacing: .04em; max-width: 480px; }
.auth-art cite { display: block; margin-top: .9rem; font-family: var(--font-script); font-size: 1.9rem; font-style: normal; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.25rem; }
.auth-box { width: 100%; max-width: 440px; }
.auth-box .logo { width: 230px; margin: 0 auto 1.6rem; }
.auth-box h1 { text-align: center; font-size: 1.35rem; letter-spacing: .12em; }
.auth-box .sub { text-align: center; color: var(--muted); margin-bottom: 1.6rem; }
.auth-box .card { padding: 1.75rem; }
.auth-box .stack > * + * { margin-top: 1rem; }
.auth-links { text-align: center; margin-top: 1.25rem; font-weight: 700; }
.pass-toggle { position: relative; }
.pass-toggle button { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); padding: .5rem; cursor: pointer; border-radius: 8px; }

/* ---------- Administração ---------- */
.admin-badge { display: inline-flex; align-items: center; gap: .35rem; font: 700 .7rem var(--font-body); background: var(--navy); color: #fff; border-radius: 999px; padding: .2rem .6rem; letter-spacing: .05em; text-transform: uppercase; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main { grid-template-columns: 1fr; }
    .quick-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 960px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 290px; transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .scrim { opacity: 1; pointer-events: auto; }
    .scrim { display: block; position: fixed; inset: 0; background: rgba(60, 35, 20, .4); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .25s; }
    .topbar { display: flex; position: sticky; top: 0; z-index: 40; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem 1rem; background: rgba(255, 250, 240, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
    .topbar img { height: 40px; }
    .content { padding: 1.25rem 1rem 1rem; }
    .welcome { grid-template-columns: 1fr; }
    .auth { grid-template-columns: 1fr; }
    .auth-art { min-height: 220px; padding: 1.5rem; }
    .auth-art blockquote { font-size: 1.05rem; }
    .auth-art cite { font-size: 1.5rem; }
}
@media (max-width: 720px) {
    .grid-2, .grid-3, .form-grid, .details { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
    .quick-grid { grid-template-columns: repeat(3, 1fr); }
    .filters { grid-template-columns: 1fr 1fr; }
    .filters > :first-child { grid-column: 1 / -1; }
    .filters .filter-actions { grid-column: 1 / -1; }
    .filters .filter-actions .btn { flex: 1; }
    .card { padding: 1.1rem; }
    .page-head .actions { width: 100%; }
    .page-head .actions .btn { flex: 1; }
    .stat .value { font-size: 1.2rem; }
    .calendar .day { min-height: 64px; padding: .25rem; }
    .calendar .ev { font-size: 0; padding: 0; height: 6px; border-radius: 3px; }
    .calendar .ev .t { display: none; }
    .calendar .more { font-size: .6rem; }
    .calendar .dow { font-size: .62rem; letter-spacing: .02em; }
    .cal-head .month-title { font-size: 1.1rem; min-width: 0; }
    table.agenda.responsive thead { display: none; }
    table.agenda.responsive, table.agenda.responsive tbody, table.agenda.responsive tr, table.agenda.responsive td { display: block; width: 100%; }
    table.agenda.responsive tr { border: 1px solid var(--line); border-radius: 14px; margin-bottom: .75rem; padding: .4rem .8rem; background: #fff; }
    table.agenda.responsive td { border: 0 !important; padding: .3rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
    table.agenda.responsive td::before { content: attr(data-label); font-weight: 800; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; flex: none; max-width: 45%; }
    table.agenda.responsive td.check, table.agenda.responsive td.row-actions { justify-content: flex-end; width: 100%; }
    table.agenda.responsive td.check::before { content: "Selecionar"; }
    table.agenda.responsive td.row-actions::before { content: none; }
    table.agenda.responsive tbody tr:hover td { background: transparent; }
    table.agenda.responsive tfoot { display: block; }
    .journal-page { padding: 1rem 1rem 1.2rem 1.9rem; }
    .journal-page::before { left: .9rem; }
}

/* ---------- Impressão ---------- */
@media print {
    @page { margin: 14mm; }
    body { background: #fff; font-size: 11pt; }
    .sidebar, .topbar, .no-print, .filters, .page-head .actions, .pagination, .row-actions, .check, .alert { display: none !important; }
    .app-shell { display: block; }
    .content { padding: 0; max-width: none; }
    .card { box-shadow: none; border: 0; padding: 0; }
    table.agenda thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a { color: inherit; }
}

/* ---------- Barras do resumo financeiro (série única, valor em texto) ---------- */
.bars { display: grid; gap: .65rem; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 180px) 1fr auto; gap: .75rem; align-items: center; font-size: .9rem; }
.bar-row .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 14px; border-radius: 4px; background: var(--gold-soft); overflow: hidden; }
.bar-track span { display: block; height: 100%; background: var(--terracotta); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-row .val { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.bar-row:hover .bar-track span { background: var(--terracotta-dark); }
.formula { background: var(--cream-2); border: 1px dashed var(--gold); border-radius: 14px; padding: 1rem 1.2rem; font-size: .9rem; }
.formula strong { color: var(--brown); }
@media (max-width: 720px) { .bar-row { grid-template-columns: 1fr auto; } .bar-row .bar-track { grid-column: 1 / -1; order: 3; } }

/* ---------- Paleta de destaque (mosaico) · vem por último para prevalecer ---------- */
[class].c-blue { --c: var(--blue); } [class].c-sky { --c: var(--sky); } [class].c-teal { --c: var(--teal); } [class].c-aqua { --c: var(--aqua); }
[class].c-coral { --c: var(--coral); } [class].c-pink { --c: var(--pink); } [class].c-salmon { --c: var(--salmon); } [class].c-orange { --c: var(--orange); }
[class].c-gold { --c: var(--gold); } [class].c-purple { --c: var(--purple); } [class].c-lilac { --c: var(--lilac); } [class].c-navy { --c: var(--navy); }
[class].c-terracotta { --c: var(--terracotta); } [class].c-green { --c: var(--green); }
