/* Área do Cliente — local styles */
body { background: var(--bg-page); }

.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

/* Sidebar */
.sidebar { background: var(--petroleo-700); color: var(--areia-200); padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 24px; }
.sidebar .brand img { height: 28px; }
.sidebar .navlink { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--areia-200); cursor: pointer; font: 500 14px var(--font-body); text-decoration: none; }
.sidebar .navlink:hover { background: rgba(255,253,248,0.06); color: var(--areia-0); }
.sidebar .navlink.active { background: var(--petroleo-500); color: var(--areia-0); font-weight: 600; }
.sidebar .navlink i { width: 18px; height: 18px; }
.sidebar .sep { flex: 1; }
.sidebar .user { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; align-items: center; cursor: pointer; }
.sidebar .user:hover { background: rgba(255,253,248,0.06); }
.sidebar .user .av { width: 32px; height: 32px; border-radius: 50%; background: var(--chama-400); display: grid; place-items: center; font: 700 13px var(--font-body); color: white; flex-shrink: 0; }
.sidebar .user .who { display: flex; flex-direction: column; min-width: 0; }
.sidebar .user .name { font: 600 13px var(--font-body); color: var(--areia-0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .user .where { font: 500 11px var(--font-mono); color: var(--areia-300); letter-spacing: 0.04em; }

/* Main */
.main { padding: 28px 40px 64px; max-width: 1100px; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.topbar h1 { font-size: 32px; }
.topbar .right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.iconbtn { width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; background: var(--bg-paper); border: 1px solid var(--line-1); color: var(--ink-2); cursor: pointer; position: relative; }
.iconbtn .dot { position: absolute; top: 7px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--chama-400); }

/* Dashboard layout */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.section-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.section-h h3 { font-size: 18px; }
.section-h a { font: 600 13px var(--font-body); color: var(--petroleo-500); text-decoration: none; }

/* Next delivery card */
.next-card { background: var(--petroleo-500); color: var(--areia-0); border-radius: var(--r-lg); padding: 28px; position: relative; overflow: hidden; box-shadow: var(--shadow-cool); isolation: isolate; }
.next-card .body { position: relative; z-index: 2; }
.next-card .eyebrow { color: var(--chama-300); }
.next-card .when { font-family: var(--font-display); font-size: 42px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; margin-top: 8px; }
.next-card .where { color: var(--areia-200); font-size: 14px; margin-top: 6px; }
.next-card .who { display: flex; gap: 12px; align-items: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line-on-dark); position: relative; z-index: 2; }
.next-card .who .av { width: 40px; height: 40px; border-radius: 50%; background: var(--chama-400); display: grid; place-items: center; font: 700 14px var(--font-body); color: white; flex-shrink: 0; }
.next-card .who .meta { font-size: 13px; color: var(--areia-200); }
.next-card .who .meta strong { color: var(--areia-0); font-weight: 600; }
.next-card .ctas { display: flex; gap: 8px; margin-top: 18px; position: relative; z-index: 2; }
.next-card .ctas .btn { white-space: nowrap; }

/* Background watermark — product icons live behind everything */
.next-card .watermark { position: absolute; right: -20px; bottom: -20px; display: flex; gap: 4px; align-items: flex-end; opacity: 0.16; pointer-events: none; z-index: 1; }
.next-card .watermark img { height: 220px; filter: brightness(0) invert(1); }
.next-card .watermark img.b { height: 240px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; font: 600 14px var(--font-body); border: 0; cursor: pointer; transition: background var(--t-base) var(--ease-out); text-decoration: none; }
.btn.primary { background: var(--chama-400); color: white; }
.btn.primary:hover { background: var(--chama-500); }
.btn.brand { background: var(--petroleo-500); color: var(--areia-0); }
.btn.brand:hover { background: var(--petroleo-600); }
.btn.secondary { background: transparent; color: var(--petroleo-500); border: 1.5px solid var(--petroleo-500); }
.btn.secondary:hover { background: var(--petroleo-50); }
.btn.ghost { background: transparent; color: var(--ink-2); padding: 8px 12px; }
.btn.ghost:hover { color: var(--ink-1); text-decoration: underline; text-underline-offset: 4px; }
.btn.on-dark { background: rgba(255,253,248,0.12); color: var(--areia-0); }
.btn.on-dark:hover { background: rgba(255,253,248,0.2); }
.btn.lg { padding: 14px 24px; font-size: 15px; }
.btn.sm { padding: 7px 14px; font-size: 13px; }

/* Plan summary cards */
.plan-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.psum { background: var(--bg-paper); border: 1px solid var(--line-1); border-radius: var(--r-md); padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.psum img { height: 48px; }
.psum .nm { font: 600 14px var(--font-body); color: var(--ink-1); }
.psum .mt { font: 500 12px var(--font-mono); color: var(--ink-3); letter-spacing: 0.02em; }
.psum .gauge { margin-top: 8px; height: 6px; background: var(--areia-200); border-radius: 999px; overflow: hidden; }
.psum .gauge .fill { height: 100%; background: var(--chama-400); border-radius: 999px; transition: width var(--t-slow) var(--ease-out); }
.psum .gauge .fill.full { background: var(--sucesso); }

/* Activity feed */
.feed { background: var(--bg-paper); border-radius: var(--r-md); border: 1px solid var(--line-1); }
.feed-item { display: grid; grid-template-columns: 32px 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-1); }
.feed-item:last-child { border-bottom: none; }
.feed-item .ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--areia-100); color: var(--ink-2); }
.feed-item .ico.ok { background: var(--sucesso-bg); color: var(--sucesso); }
.feed-item .ico.alert { background: var(--alerta-bg); color: var(--alerta); }
.feed-item .ico.routing { background: var(--petroleo-50); color: var(--petroleo-500); }
.feed-item .ico i { width: 18px; height: 18px; }
.feed-item .lines .t1 { font: 600 14px var(--font-body); color: var(--ink-1); }
.feed-item .lines .t2 { font: 500 12px var(--font-body); color: var(--ink-3); margin-top: 2px; }
.feed-item .when { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--bg-paper); border: 1px solid var(--line-1); border-radius: var(--r-md); padding: 16px 18px; }
.stat .v { font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; color: var(--ink-1); }
.stat .l { font: 500 12px var(--font-body); color: var(--ink-3); margin-top: 6px; }
.stat .d { font: 500 11px var(--font-mono); color: var(--sucesso); margin-top: 4px; letter-spacing: 0.02em; }

/* Calendar */
.calendar { background: var(--bg-paper); border: 1px solid var(--line-1); border-radius: var(--r-md); padding: 18px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cal-head h4 { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .dow { font: 600 11px var(--font-mono); color: var(--ink-3); text-align: center; padding: 6px 0; letter-spacing: 0.04em; }
.cal-grid .day { aspect-ratio: 1; display: grid; place-items: center; border-radius: 8px; font: 500 13px var(--font-body); color: var(--ink-1); cursor: pointer; position: relative; }
.cal-grid .day.muted { color: var(--ink-4); }
.cal-grid .day:hover:not(.muted):not(.locked) { background: var(--areia-100); }
.cal-grid .day.suggested { background: var(--chama-100); color: var(--chama-700); font-weight: 600; }
.cal-grid .day.selected { background: var(--chama-400); color: white; font-weight: 700; }
.cal-grid .day.locked { color: var(--ink-4); cursor: not-allowed; }
.cal-grid .day.today::after { content: ''; position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--petroleo-500); }

/* Schedule view */
.schedule-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; }
.window-pick { display: flex; gap: 8px; margin-top: 8px; }
.window { padding: 10px 14px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--bg-paper); font: 600 13px var(--font-body); color: var(--ink-2); cursor: pointer; }
.window.on { background: var(--petroleo-500); color: var(--areia-0); border-color: var(--petroleo-500); }
.schedule-summary { background: var(--areia-100); border-radius: var(--r-md); padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.schedule-summary .label { font: 600 11px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.schedule-summary .val { font: 600 16px var(--font-body); color: var(--ink-1); }

/* Plan view */
.plan-page { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.plan-card2 { background: var(--bg-paper); border: 1px solid var(--line-1); border-radius: var(--r-md); padding: 24px; }
.plan-card2 .head { display: flex; gap: 16px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line-1); margin-bottom: 18px; }
.plan-card2 .head img { height: 64px; }
.plan-card2 .head .nm { font: 600 18px var(--font-body); color: var(--ink-1); }
.plan-card2 .head .pr { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.row-item { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line-1); align-items: center; }
.row-item:last-child { border-bottom: none; }
.row-item .l { font: 500 14px var(--font-body); color: var(--ink-2); }
.row-item .v { font: 600 14px var(--font-body); color: var(--ink-1); }
.danger-card { background: var(--bg-paper); border: 1px solid var(--line-1); border-radius: var(--r-md); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.danger-card h4 { color: var(--ink-1); }
.danger-card p { font-size: 13px; color: var(--ink-3); line-height: 1.5; }

/* History */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { display: grid; grid-template-columns: 44px 1fr auto auto; gap: 16px; align-items: center; padding: 14px 18px; background: var(--bg-paper); border-radius: var(--r-md); border: 1px solid var(--line-1); }
.history-item .ico { width: 36px; height: 36px; border-radius: 8px; background: var(--areia-100); display: grid; place-items: center; }
.history-item .ico img { width: 22px; height: 28px; }
.history-item .lines .t1 { font: 600 14px var(--font-body); color: var(--ink-1); }
.history-item .lines .t2 { font: 500 12px var(--font-mono); color: var(--ink-3); letter-spacing: 0.02em; margin-top: 2px; }
.history-item .amt { font-family: var(--font-mono); font-size: 13px; color: var(--ink-1); font-weight: 500; }

/* Login modal — reuse marketing modal but simpler */
.modal-scrim { position: fixed; inset: 0; background: rgba(15,76,92,0.55); z-index: 50; display: grid; place-items: center; padding: 24px; }
.modal { background: var(--bg-paper); border-radius: var(--r-xl); max-width: 380px; width: 100%; padding: 32px; box-shadow: var(--shadow-3); }
.modal h2 { font-size: 24px; margin-bottom: 6px; }
.modal p { font-size: 14px; color: var(--ink-2); margin-bottom: 18px; }
.modal input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--bg-paper); font: 500 16px var(--font-body); margin-top: 6px; }
.modal input:focus { outline: 2px solid var(--chama-400); outline-offset: 1px; border-color: var(--petroleo-500); }
.pin-row { display: flex; gap: 8px; margin-top: 8px; }
.pin-row input { text-align: center; font-family: var(--font-mono); font-size: 24px; font-weight: 700; letter-spacing: 0.04em; padding: 16px 0; }

/* =========================================================
   Ray & Luz — dark-luxury overrides (loads last, wins)
   ========================================================= */

/* Gold fills → near-black text (never white) */
.btn.primary { background: var(--gold-400); color: var(--on-gold); letter-spacing: 0.02em; }
.btn.primary:hover { background: var(--gold-300); color: var(--on-gold); }
.btn.brand { background: var(--carvao-900); color: var(--areia-0); }
.btn.brand:hover { background: var(--petroleo-500); }
.btn.secondary { color: var(--carvao-900); border-color: var(--carvao-900); }
.btn.secondary:hover { background: var(--carvao-900); color: var(--areia-0); }
.sidebar .user .av { color: var(--on-gold); }
.next-card .who .av { color: var(--on-gold); }
.cal-grid .day.selected { background: var(--gold-400); color: var(--on-gold); }
.cal-grid .day.suggested { background: var(--gold-100); color: var(--gold-700); }
.cal-grid .day.today::after { background: var(--gold-400); }
.window.on { background: var(--carvao-900); border-color: var(--carvao-900); }

/* Accents & links → gold */
.iconbtn .dot { background: var(--gold-400); }
.psum .gauge .fill { background: var(--gold-400); }
.section-h a { color: var(--accent-press); }
.section-h a:hover { color: var(--accent); }
.next-card .eyebrow { color: var(--gold-300); }
.next-card { border: 1px solid rgba(196,148,60,0.16); }

/* Serif display — refined Cormorant weight */
.next-card .when, .stat .v, .cal-head h4, .plan-card2 .head .pr { font-weight: 500; }

/* Sidebar active in gold-hairline dark */
.sidebar .navlink.active { background: var(--petroleo-500); color: var(--gold-200); box-shadow: inset 2px 0 0 var(--gold-400); }

/* Focus rings + scrim */
.modal input:focus { outline-color: var(--gold-400); border-color: var(--carvao-900); }
.modal-scrim { background: rgba(15,13,11,0.55); backdrop-filter: blur(3px); }

/* ---------------------------------------------------------
   DARK THEME overrides — Área do Cliente
   --------------------------------------------------------- */
:root[data-theme="dark"] .btn.secondary { color: var(--areia-0); border-color: rgba(232,201,122,0.5); }
:root[data-theme="dark"] .btn.secondary:hover { background: var(--gold-400); color: var(--on-gold); border-color: var(--gold-400); }
:root[data-theme="dark"] .btn.brand { background: #221B12; border: 1px solid rgba(232,201,122,0.32); color: var(--gold-100); }
:root[data-theme="dark"] .btn.brand:hover { background: #2C2216; }
:root[data-theme="dark"] .feed-item .ico,
:root[data-theme="dark"] .history-item .ico { background: rgba(232,201,122,0.10); color: var(--gold-200); }
:root[data-theme="dark"] .feed-item .ico.ok { background: var(--sucesso-bg); color: var(--sucesso); }
:root[data-theme="dark"] .feed-item .ico.alert { background: var(--alerta-bg); color: var(--gold-300); }
:root[data-theme="dark"] .cal-grid .day:hover:not(.muted):not(.locked) { background: rgba(232,201,122,0.12); }
:root[data-theme="dark"] .cal-grid .day.suggested { background: rgba(232,201,122,0.16); color: var(--gold-200); }
:root[data-theme="dark"] .schedule-summary { background: var(--bg-sunken); }
:root[data-theme="dark"] .psum .gauge { background: var(--line-2); }
:root[data-theme="dark"] .window.on { background: #221B12; border-color: rgba(232,201,122,0.4); color: var(--gold-100); }
