/* KLuxo Spa & bronze — interface.
   Geometria e tipografia seguem a referência aprovada (menu 256px, itens px-3/py-2, cabeçalho px-6/py-4,
   conteúdo p-6, botões 40px, cards raio 8px, Inter). Cores: preto, dourado e branco (tokens sugeridos,
   ajustáveis); amarelo e vermelho reservados a alertas, sempre com texto e ícone. */

@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/assets/fonts/inter-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/assets/fonts/inter-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --black: #171717; --black-2: #262626; --black-3: #333;
  --gold: #A67C32; --gold-text: #8A6422; --gold-400: #C9A24D; --gold-500: #B8923F; --gold-100: #F4EBDD; --gold-50: #FAF5EC;
  --bg: #FAFAF9; --surface: #FFFFFF; --text: #202020; --muted: #686868; --border: #E7E4DF; --border-strong: #D3CEC6;
  --warn-bg: #FFF6D6; --warn-border: #E8C547; --warn-text: #5E4400; --warn-solid: #F5C518;
  --danger-bg: #F4E9D2; --danger-border: #8A6422; --danger-text: #5A3C06; --danger-solid: #7A5412;
  --ok-bg: #E8F3EA; --ok-text: #1E5B2E; --info-bg: #F1EFEA;
  --radius: 8px; --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(23,23,23,.06); --shadow-soft: 0 2px 10px rgba(23,23,23,.08); --shadow-lg: 0 12px 40px rgba(23,23,23,.2);
  --sidebar-w: 256px; --sidebar-w-collapsed: 72px;
  --ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--gold);
}

*, *::before, *::after { box-sizing: border-box; border: 0 solid var(--border); }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
[hidden] { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); } .text-sm { font-size: 14px; } .text-xs { font-size: 12px; } .nowrap { white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--black); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 1000; }
.skip-link:focus { left: 8px; }
.icon { width: 16px; height: 16px; flex: none; }
.icon-lg { width: 20px; height: 20px; }
.btn.mobile-only { display: none; }

/* ---------------------------------------------------------------- layout */
.app { display: flex; min-height: 100vh; min-width: 0; }
.app-col { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex: none; background: var(--black); color: #E9E5DC; border-right: 1px solid var(--black-2);
  display: flex; flex-direction: column; transition: width .3s cubic-bezier(.4,0,.2,1); position: sticky; top: 0; height: 100vh; overflow: hidden; }
.sidebar-head { padding: 16px; border-bottom: 1px solid var(--black-2); display: flex; align-items: center; justify-content: space-between; min-height: 73px; }
.sidebar-nav { padding: 16px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; }
.sidebar-nav { scrollbar-width: none; -ms-overflow-style: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--black-2); padding: 16px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 6px; color: #E9E5DC; transition: background-color .15s, color .15s; min-height: 40px; }
.nav-item:hover { background: var(--black-3); }
.nav-item.is-active { background: var(--gold-400); color: var(--black); font-weight: 500; }
.nav-item .nav-label { flex: 1; min-width: 0; }
.nav-item-planned { opacity: .55; cursor: not-allowed; }
.nav-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; border: 1px solid #5a5a5a; border-radius: 999px; padding: 1px 6px; color: #cfc8b8; white-space: nowrap; }
.nav-badge { background: var(--danger-solid); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 600; padding: 0 6px; min-width: 20px; text-align: center; }
.nav-item.is-active .nav-badge { background: var(--black); color: #fff; }
.sidebar .btn-ghost { color: #E9E5DC; } .sidebar .btn-ghost:hover { background: var(--black-3); color: #fff; }
.health { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #cfc8b8; }
.health.is-ok .icon { color: #7fd18f; } .health.is-bad { color: #ffd0cc; } .health.is-bad .icon { color: #ff8a80; }
.app.is-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.app.is-collapsed .nav-label, .app.is-collapsed .nav-tag, .app.is-collapsed .wm-sub, .app.is-collapsed .nav-badge { display: none; }
.app.is-collapsed .sidebar-head { justify-content: center; padding: 16px 8px; flex-direction: column; gap: 8px; }
.app.is-collapsed .wordmark { font-size: 0; } .app.is-collapsed .wm-name { font-size: 18px; }
.app.is-collapsed .nav-item { justify-content: center; padding: 8px; }
.wordmark { display: flex; flex-direction: column; line-height: 1.05; }
.wm-name { font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: 26px; letter-spacing: .02em; color: var(--gold-400); }
.wm-sub { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: #cfc8b8; margin-top: 2px; }
.wordmark-lg .wm-name { font-size: 40px; color: var(--gold-text); } .wordmark-lg .wm-sub { color: var(--muted); font-size: 12px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 16px 24px; position: relative; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 73px; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-right { gap: 4px; flex: none; }
.topbar-title { font-size: 20px; font-weight: 600; line-height: 28px; }
.conn { display: inline-flex; align-items: center; gap: 6px; background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; margin-right: 8px; }
.bell { position: relative; }
.bell-count { position: absolute; top: 2px; right: 2px; background: var(--danger-solid); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 4px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--black); color: var(--gold-400); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.user-btn { display: inline-flex; align-items: center; gap: 8px; }
.user-menu { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 220px; padding: 4px; z-index: 60; }
.menu-head { padding: 8px 12px; display: flex; flex-direction: column; border-bottom: 1px solid var(--border); margin-bottom: 4px; } .menu-head span { color: var(--muted); font-size: 12px; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 12px; border-radius: 6px; min-height: 40px; }
.menu-item:hover { background: var(--hover); }
.offline-banner { background: var(--danger-bg); color: var(--danger-text); border-bottom: 1px solid var(--danger-border); padding: 10px 24px; font-weight: 500; }
.main { flex: 1; padding: 24px; min-width: 0; outline: none; }
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 16px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- componentes */
.stack { display: flex; flex-direction: column; gap: 24px; } .stack-sm { display: flex; flex-direction: column; gap: 12px; } .stack-xs { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; } .row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; } .right { margin-left: auto; }
.grid { display: grid; gap: 24px; } .grid-sm { display: grid; gap: 12px; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 30px; font-weight: 700; letter-spacing: -.01em; line-height: 36px; }
.page-sub { color: var(--muted); margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { padding: 24px 24px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { font-size: 18px; font-weight: 600; line-height: 1.2; letter-spacing: -.005em; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 24px; } .card-body.tight { padding: 0; }
.card.hoverable:hover { box-shadow: var(--shadow-soft); } a.card, button.card { display: block; text-align: left; width: 100%; transition: box-shadow .3s; }
.stat { padding: 24px; display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 14px; font-weight: 500; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text); }
.stat-label .icon { color: var(--gold-text); }
.stat-value { font-size: 24px; font-weight: 700; line-height: 32px; } .stat-help { font-size: 12px; color: var(--muted); }
.na { color: var(--muted); font-weight: 500; font-size: 15px; } /* "Sem informação" */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; height: 40px; padding: 0 16px; border-radius: 6px; font-size: 14px; font-weight: 500;
  border: 1px solid transparent; transition: background-color .3s, color .3s, box-shadow .3s; text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--gold-400); color: var(--black); } .btn-primary:hover { background: var(--gold-500); }
.btn-dark { background: var(--black); color: #fff; } .btn-dark:hover { background: var(--black-3); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); } .btn-outline:hover { background: var(--hover); }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { background: var(--danger-solid); color: #fff; } .btn-danger:hover { background: #5F410D; }
.btn-warn { background: var(--warn-solid); color: var(--black); } .btn-warn:hover { background: #e3b513; }
.btn-sm { height: 36px; padding: 0 12px; } .btn-lg { height: 44px; padding: 0 32px; } .btn-icon { width: 40px; padding: 0; }
.btn .icon { width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; } .label { font-size: 14px; font-weight: 500; }
.hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea { width: 100%; height: 40px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); padding: 8px 12px; font-size: 16px; }
.textarea { height: auto; min-height: 80px; resize: vertical; }
.input::placeholder { color: var(--muted); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { box-shadow: var(--ring); }
.input.sm, .select.sm { height: 36px; font-size: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; } .check input { width: 18px; height: 18px; accent-color: var(--gold); }
.form { display: flex; flex-direction: column; gap: 16px; } .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-error { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); border-radius: 6px; padding: 10px 12px; font-size: 14px; }
.fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; } .fieldset legend { font-weight: 500; padding: 0 6px; }
@media (min-width: 769px) { .input, .select, .textarea { font-size: 14px; } }

.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; background: var(--info-bg); color: var(--text); border: 1px solid var(--border); white-space: nowrap; }
.badge .icon { width: 12px; height: 12px; }
.badge-gold { background: var(--chip); color: var(--gold-text); border-color: #E3D2B0; }
.badge-ok { background: var(--ok-bg); color: var(--ok-text); border-color: #BFDDC6; }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-border); }
.badge-dark { background: var(--black); color: var(--gold-400); border-color: var(--black); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; } .table tbody tr.clickable { cursor: pointer; } .table tbody tr.clickable:hover { background: var(--hover); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; } .empty .icon { width: 28px; height: 28px; color: var(--border-strong); }
.alert-box { border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; display: flex; gap: 10px; align-items: flex-start; background: var(--surface); }
.alert-box.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.alert-box.danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.alert-box.info { background: var(--hover); border-color: #E3D2B0; }
.notice { background: var(--hover); border: 1px solid #E3D2B0; border-radius: 8px; padding: 12px 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 10px 16px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; min-height: 44px; }
.tab:hover { color: var(--text); } .tab[aria-selected="true"] { color: var(--black); border-bottom-color: var(--gold); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg button { padding: 0 14px; height: 38px; font-weight: 500; } .seg button + button { border-left: 1px solid var(--border-strong); }
.seg button[aria-pressed="true"] { background: var(--black); color: var(--gold-400); }
.list { display: flex; flex-direction: column; } .list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); } .list-item:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 14px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }

/* ---------------------------------------------------------------- overlays */
.overlay { position: fixed; inset: 0; background: rgba(23,23,23,.55); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { width: min(820px, 100%); }
.modal-head { padding: 20px 24px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; } .modal-title { font-size: 18px; font-weight: 600; }
.modal-body { padding: 16px 24px; overflow-y: auto; } .modal-foot { padding: 0 24px 20px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.drawer { margin: auto; background: var(--surface); width: min(820px, 100%); max-height: calc(100vh - 32px); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; border-radius: var(--radius-lg); }
.overlay.is-drawer { padding: 16px; justify-content: center; align-items: center; }
.drawer .modal-body { flex: 1; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--black); color: #fff; border-radius: 8px; padding: 12px 16px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; }
.toast.error { border-left-color: var(--danger-solid); background: #3a2a0a; } .toast.warn { border-left-color: var(--warn-solid); }

/* ---------------------------------------------------------------- cronometros e alertas */
.timer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.timer { background: var(--surface); border: 1px solid var(--border);  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.timer.phase-warning { border-left-color: var(--warn-solid); background: var(--warn-bg); }
.timer.phase-due, .timer.phase-escalated { border-left-color: var(--danger-solid); background: var(--danger-bg); }
.timer.phase-interrupted, .timer.phase-finished { border-left-color: var(--border-strong); background: var(--surface); }
.timer-clock { font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.1; }
.phase-due .timer-clock, .phase-escalated .timer-clock { color: var(--danger-text); } .phase-warning .timer-clock { color: var(--warn-text); }
.timer-meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; color: var(--muted); } .timer-meta dt { font-weight: 500; } .timer-meta dd { margin: 0; color: var(--text); }
.timer-msg { font-weight: 600; display: flex; gap: 6px; align-items: center; }
.timer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.alert-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.alert-item.critical { background: var(--danger-bg); } .alert-item.warning { background: var(--warn-bg); } .alert-item.resolved { background: var(--surface); opacity: .8; }
.pipeline { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* ---------------------------------------------------------------- kanban */
.board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col { flex: 0 0 280px; background: #F3F1EC; border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 260px); min-height: 160px; }
.col.drag-over { outline: 2px dashed var(--gold); outline-offset: -2px; }
.col-head { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; font-weight: 600; } .col-count { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.col-body { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px; box-shadow: var(--shadow-sm); cursor: grab; display: flex; flex-direction: column; gap: 6px; }
.kcard:hover { box-shadow: var(--shadow-soft); } .kcard.dragging { opacity: .5; } .kcard.delayed { border-color: var(--warn-border); background: var(--warn-bg); }
.kcard.has-timer-due { border-color: var(--danger-border); }
.kcard-title { font-weight: 600; } .kcard-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.kcard-actions { display: flex; gap: 6px; align-items: center; }
.steps { display: flex; flex-direction: column; gap: 8px; } .step { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; } .step .grow { min-width: 0; }

/* ---------------------------------------------------------------- agenda */
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.day-list { display: flex; flex-direction: column; gap: 8px; }
.appt { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; width: 100%; text-align: left; }
.appt:hover { background: var(--hover); } .appt .time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 96px; }
.appt.s-cancelled, .appt.s-no_show { opacity: .6; border-left-color: var(--border-strong); } .appt.s-arrived, .appt.s-in_service { border-color: var(--border); }
.week { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 8px; overflow-x: auto; } .week-col { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px; min-height: 160px; display: flex; flex-direction: column; gap: 6px; }
.week-col h3 { font-size: 13px; font-weight: 600; } .week-col.today { border-color: var(--gold); background: var(--hover); }
.mini-appt { display: block; text-align: left; width: 100%; font-size: 12px; padding: 6px 8px; border-radius: 6px; background: var(--hover); border: 1px solid #E3D2B0; } .mini-appt.s-cancelled, .mini-appt.s-no_show { opacity: .55; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; } .month-h { font-size: 12px; color: var(--muted); text-align: center; font-weight: 600; }
.month-cell { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; min-height: 84px; padding: 6px 8px; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.month-cell:hover { background: var(--hover); } .month-cell.dim { opacity: .45; } .month-cell.today { border-color: var(--gold); }

.login-body { min-height: 100vh; display: grid; place-items: center; background: var(--black); padding: 16px; }
.login-card { width: min(420px, 100%); padding: 32px; display: flex; flex-direction: column; gap: 16px; } .login-title { font-size: 24px; font-weight: 700; }
#alert-strip { padding: 0 24px; } #alert-strip:not(:empty) { padding-top: 16px; }
.scrollbox { max-height: 360px; overflow: auto; }
.sidebar-scrim { position: fixed; inset: 0; background: rgba(23,23,23,.55); z-index: 70; }

/* ---------------------------------------------------------------- responsivo */
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1023px) {
  .btn.mobile-only { display: inline-flex; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 80; transform: translateX(-100%); transition: transform .3s; width: min(300px, 86vw); }
  .app.menu-open .sidebar { transform: none; }
  .sidebar-collapse { display: none; }
  .app.is-collapsed .sidebar { width: min(300px, 86vw); } .app.is-collapsed .nav-label, .app.is-collapsed .nav-tag, .app.is-collapsed .wm-sub { display: initial; }
  .topbar { padding: 12px 16px; } .user-name { display: none; }
}
@media (max-width: 768px) {
  .main { padding: 16px; } .page-title { font-size: 24px; line-height: 30px; }
  .cols-4, .cols-3, .cols-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .grid { gap: 16px; } .stack { gap: 16px; }
  .card-body, .stat { padding: 16px; } .card-head { padding: 16px 16px 0; }
  .timer-grid { grid-template-columns: minmax(0, 1fr); } .timer-clock { font-size: 40px; }
  .btn { height: 44px; } .btn-sm { height: 40px; } .btn-icon { width: 44px; }
  .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: 8px; }
  .col { flex-basis: 84vw; max-height: none; } .week { grid-template-columns: repeat(7, 78vw); }
  .modal { max-height: calc(100vh - 16px); } .overlay { padding: 8px; align-items: flex-end; } .modal { border-radius: 12px 12px 0 0; }
  .drawer { border-radius: 12px 12px 0 0; width: 100%; margin: auto 0 0; max-height: 92vh; }
  .overlay.is-drawer { padding: 8px; align-items: flex-end; }
  .offline-banner { padding: 10px 16px; } #alert-strip { padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* =====================================================================================================
   REFINO SÓBRIO + TEMAS
   Interface operacional: sem fundos tingidos, sem pílulas, sem sombras decorativas e sem bordas coloridas
   grossas. Amarelo e vermelho existem SÓ para alertas operacionais (blocos sólidos com texto e ícone).
   Temas (html[data-theme]): preto (padrão) · dourado · branco · escuro.
   ===================================================================================================== */
:root {
  --radius-lg: 8px;
  --hover: #F4F2EE; --chip: #F4F2EE; --col-bg: #F3F1EC; --warn-edge: #B88700;
  color-scheme: light;
  /* menu lateral: tema "preto" */
  --sb-bg: #171717; --sb-text: #E9E5DC; --sb-border: #2A2A2A; --sb-hover: #2C2C2C;
  --sb-active-bg: #C9A24D; --sb-active-text: #171717; --sb-tag: #5A5A5A;
  --sb-brand: #C9A24D; --sb-sub: #CFC8B8; --sb-ok: #7FD18F; --sb-bad: #E2B866; --sb-group: #C9A24D;
}
html[data-theme="dourado"] {
  --sb-bg: #C9A24D; --sb-text: #171717; --sb-border: #B08A38; --sb-hover: #B8923F;
  --sb-active-bg: #171717; --sb-active-text: #F0D58C; --sb-tag: #171717;
  --sb-brand: #171717; --sb-sub: #3B2C0B; --sb-group: #2A1E05; --sb-ok: #14401F; --sb-bad: #4A3205;
}
html[data-theme="branco"] {
  --sb-bg: #FFFFFF; --sb-text: #202020; --sb-border: #E7E4DF; --sb-hover: #F4F2EE;
  --sb-active-bg: #C9A24D; --sb-active-text: #171717; --sb-tag: #BDB7AB;
  --sb-brand: #8A6422; --sb-sub: #686868; --sb-group: #8A6422; --sb-ok: #1E5B2E; --sb-bad: #7A5412;
}
html[data-theme="escuro"] {
  color-scheme: dark;
  --bg: #0E0E0E; --surface: #171717; --text: #ECECEC; --muted: #A3A3A3; --border: #2B2B2B; --border-strong: #404040;
  --hover: #222222; --chip: #262626; --col-bg: #121212; --info-bg: #1F1F1F;
  --gold-text: #D9B45F; --warn-text: #F5C518; --danger-text: #E2B866; --warn-edge: #F5C518;
  --warn-bg: #2A2306; --warn-border: #8A6F10; --danger-bg: #2B2108; --danger-border: #B8923F;
  --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
  --sb-bg: #0B0B0B; --sb-text: #E6E6E6; --sb-border: #242424; --sb-hover: #1E1E1E;
  --sb-active-bg: #C9A24D; --sb-active-text: #171717; --sb-tag: #4A4A4A;
  --sb-brand: #C9A24D; --sb-sub: #A3A3A3; --sb-group: #C9A24D; --sb-ok: #7FD18F; --sb-bad: #E2B866;
}

/* ---- navegador: seleção, cursor, barras ---- */
::selection { background: var(--gold-400); color: #171717; }
input, textarea, select { caret-color: var(--gold); }
html { scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }

/* ---- menu lateral por variáveis (todos os temas) ---- */
.sidebar { background: var(--sb-bg); color: var(--sb-text); border-right-color: var(--sb-border); }
.sidebar-head { border-bottom-color: var(--sb-border); }
.sidebar-foot { border-top-color: var(--sb-border); }
.nav-item { color: var(--sb-text); }
.nav-item:hover { background: var(--sb-hover); }
.nav-item.is-active { background: var(--sb-active-bg); color: var(--sb-active-text); }
.nav-tag { border-color: var(--sb-tag); color: var(--sb-text); border-radius: 4px; }
.nav-badge { border-radius: 4px; }
.nav-item.is-active .nav-badge { background: var(--sb-active-text); color: var(--sb-active-bg); }
.sidebar .btn-ghost { color: var(--sb-text); }
.sidebar .btn-ghost:hover { background: var(--sb-hover); color: var(--sb-text); }
.health { color: var(--sb-text); }
.health.is-ok .icon { color: var(--sb-ok); }
.health.is-bad, .health.is-bad .icon { color: var(--sb-bad); }
.wm-name { color: var(--sb-brand); }
.wm-sub { color: var(--sb-sub); }

/* ---- seletor de tema ---- */
.menu-theme { min-width: 220px; }
.menu-theme .menu-item[aria-checked="true"] { font-weight: 600; }
.swatch { width: 28px; height: 20px; border-radius: 3px; border: 1px solid var(--border-strong); flex: none; }
.swatch-preto { background: linear-gradient(90deg, #171717 36%, #FAFAF9 36%); }
.swatch-dourado { background: linear-gradient(90deg, #C9A24D 36%, #FAFAF9 36%); }
.swatch-branco { background: linear-gradient(90deg, #FFFFFF 36%, #F1EFEA 36%); }
.swatch-escuro { background: linear-gradient(90deg, #0B0B0B 36%, #1E1E1E 36%); }

/* ---- estrutura: sem sombra decorativa, raios curtos ---- */
.card, .timer, .kcard { box-shadow: none; }
.card.hoverable:hover, a.card:hover, .kcard:hover { box-shadow: none; border-color: var(--text); }
.stat-label .icon, .empty .icon { display: none; }
.avatar { border-radius: 6px; background: var(--text); color: var(--surface); }
.bell-count, .col-count { border-radius: 4px; }
.menu-item:hover, .appt:hover, .month-cell:hover, .table tbody tr.clickable:hover, .btn-ghost:hover, .btn-outline:hover { background: var(--hover); }
.btn-dark { background: var(--text); color: var(--surface); }
.btn-dark:hover { background: var(--text); opacity: .88; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--surface); }
.tab[aria-selected="true"] { color: var(--text); }
.col { background: var(--col-bg); }
.form-error { background: transparent; border: 1px solid var(--danger-solid); color: var(--danger-text); }

/* ---- status: texto com borda fina, sem fundo tingido nem ícone ---- */
.badge { border-radius: 4px; background: transparent; color: var(--text); border: 1px solid var(--border-strong); font-weight: 500; padding: 1px 8px; }
.badge .icon { display: none; }
.badge-gold { background: transparent; color: var(--gold-text); border-color: var(--gold); }
.badge-ok { background: transparent; color: var(--text); border-color: var(--text); }
.badge-dark { background: var(--text); color: var(--surface); border-color: var(--text); }
/* alertas operacionais: bloco sólido, com ícone */
.badge-warn { background: var(--warn-solid); color: #171717; border-color: var(--warn-solid); font-weight: 600; }
.badge-danger { background: var(--danger-solid); color: #fff; border-color: var(--danger-solid); font-weight: 600; }
.badge-warn .icon, .badge-danger .icon { display: inline-block; }

/* ---- avisos: neutros; só os "live" (alerta operacional) são sólidos ---- */
.alert-box { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; color: var(--text); }
.alert-box.warn, .alert-box.danger { border-color: var(--text); }
.alert-box.info { border-color: var(--border); }
.alert-box .icon { color: var(--muted); }
.alert-box.live.warn { background: var(--warn-solid); border-color: var(--warn-solid); color: #171717; }
.alert-box.live.danger { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.alert-box.live .icon { color: inherit; }
.notice { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; }

/* ---- central de alertas ---- */
.alert-item.critical, .alert-item.warning, .alert-item.resolved { background: transparent; }
.alert-item.resolved { opacity: .7; }
.alert-item > .icon { width: 32px; height: 32px; padding: 7px; border-radius: 4px; flex: none; }
.alert-item.critical > .icon { background: var(--danger-solid); color: #fff; }
.alert-item.warning > .icon { background: var(--warn-solid); color: #171717; }
.alert-item.resolved > .icon { background: var(--chip); color: var(--muted); }

/* ---- cronômetros: a fase aparece no contorno e na cor do relógio, não em fundo pastel ---- */
.timer, .timer.phase-warning, .timer.phase-due, .timer.phase-escalated, .timer.phase-interrupted, .timer.phase-finished { background: var(--surface); border-radius: 6px; }
.timer { border: 1px solid var(--border-strong); }
.timer.phase-warning { border: 2px solid var(--warn-edge); }
.timer.phase-due, .timer.phase-escalated { border: 2px solid var(--danger-solid); }
.timer.phase-interrupted, .timer.phase-finished { border: 1px solid var(--border-strong); }

/* ---- kanban e agenda ---- */
.kcard.delayed { background: var(--surface); border-color: var(--warn-edge); }
.appt, .appt.s-arrived, .appt.s-in_service, .appt.s-cancelled, .appt.s-no_show { border: 1px solid var(--border); border-radius: 6px; }
.mini-appt { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; }
.week-col.today, .month-cell.today { background: var(--surface); border: 2px solid var(--gold); }

/* ---- avisos de sistema ---- */
.conn { background: var(--danger-solid); color: #fff; border-color: var(--danger-solid); border-radius: 4px; }
.offline-banner { background: var(--danger-solid); color: #fff; border-bottom-color: var(--danger-solid); }
.toast { border: 1px solid #333; border-radius: 6px; background: #171717; color: #fff; }
.toast.error { background: var(--danger-solid); border-color: var(--danger-solid); }
.toast.warn { background: var(--warn-solid); color: #171717; border-color: var(--warn-solid); }

/* ---- tema escuro: ajustes que dependem de cor fixa ---- */
html[data-theme="escuro"] .login-card { border-color: var(--border-strong); }
html[data-theme="escuro"] .table th { color: var(--muted); }
html[data-theme="escuro"] .nav-item-planned { opacity: .6; }

/* ---- impressão / PDF dos relatórios (o navegador salva como PDF) ---- */
@media print {
  .sidebar, .topbar, .footer, .offline-banner, #alert-strip, .no-print, .tabs, #toast-root, #overlay-root, .page-head .btn, .skip-link { display: none !important; }
  body, .main { background: #fff !important; color: #000 !important; padding: 0 !important; }
  .app, .app-col { display: block !important; }
  .card, .table td, .table th { border-color: #999 !important; box-shadow: none !important; }
  .alert-box { border: 1px solid #999 !important; background: #fff !important; color: #000 !important; }
  .badge { border-color: #666 !important; color: #000 !important; background: transparent !important; }
  .table-wrap { overflow: visible !important; }
  a { text-decoration: none; }
}

/* ---------------------------------------------------------------- Entrega 3: páginas públicas e funil */
.public-body { min-height: 100vh; background: var(--bg); padding: 24px 16px 48px; }
.public-wrap { width: min(640px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.public-wrap .wordmark { align-self: flex-start; color: var(--black); }
.pre { white-space: pre-wrap; margin-top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.kcard { text-align: left; width: 100%; }
.card-body.stack-sm { padding-top: 16px; }

/* ---------------------------------------------------------------- login com vídeo de fundo (opcional) */
.login-bg { position: fixed; inset: 0; overflow: hidden; background: var(--black); }
.login-bg video { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s ease; }
.login-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(10,10,10,.74), rgba(10,10,10,.84)); } /* escurece para o formulário continuar legível */
.has-video .login-bg video { opacity: 1; }
.login-body { position: relative; }
.login-card { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- logotipo (3 cores, troca por tema) */
.brand img { display: none; width: auto; height: 100%; max-width: 100%; object-fit: contain; }
/* menu lateral: fundo escuro (preto/escuro) = branca · fundo branco = dourada · fundo dourado = preta */
.brand-side { display: block; height: 56px; min-width: 0; }
.brand-side .logo-w { display: block; }
html[data-theme="branco"] .brand-side .logo-w { display: none; } html[data-theme="branco"] .brand-side .logo-g { display: block; }
html[data-theme="dourado"] .brand-side .logo-w { display: none; } html[data-theme="dourado"] .brand-side .logo-b { display: block; }
.app.is-collapsed .brand-side { height: 40px; width: 40px; }
/* páginas de login e públicas: superfície clara = dourada · tema escuro = branca */
.brand-page { height: 96px; align-self: flex-start; } .login-card .brand-page { align-self: center; height: 104px; }
.brand-page .logo-g { display: block; }
html[data-theme="escuro"] .brand-page .logo-g { display: none; } html[data-theme="escuro"] .brand-page .logo-w { display: block; }
.public-wrap .brand-page { margin-bottom: 8px; }

/* ---------------------------------------------------------------- login: textos centralizados, olhinho da senha, links */
.login-view { display: flex; flex-direction: column; gap: 16px; }
.login-title, .login-sub { text-align: center; }
.login-sub { color: var(--muted); }
.login-card .field { text-align: left; }
.pw-wrap { position: relative; } .pw-wrap .input { width: 100%; padding-right: 48px; }
.pw-toggle { position: absolute; right: 2px; top: 0; height: 100%; width: 44px; display: grid; place-items: center; color: var(--muted); border-radius: 6px; }
.pw-toggle:hover { color: var(--text); } .pw-toggle .icon { width: 18px; height: 18px; }
.login-links { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); }
.link-btn { color: var(--gold-text); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; min-height: 32px; padding: 0 4px; }
.link-btn:hover { color: var(--text); }
a.btn.btn-lg { display: inline-flex; justify-content: center; }

/* ---------------------------------------------------------------- menu lateral: logo centralizada e maior */
.sidebar-head { position: relative; justify-content: center; padding: 14px 16px; min-height: 0; }
.brand-side { height: 92px; display: flex; justify-content: center; }
.sidebar-head .sidebar-collapse { position: absolute; top: 8px; right: 8px; }
.app.is-collapsed .sidebar-head { padding: 12px 8px; }
.app.is-collapsed .sidebar-head .sidebar-collapse { position: static; }
.app.is-collapsed .brand-side { height: 40px; width: 40px; }

/* ---------------------------------------------------------------- ajustes da revisão visual */
/* campos dentro de uma linha não esticam a largura toda (datas e filtros lado a lado) */
.row > .input, .row > .select { width: auto; min-width: 150px; flex: 0 1 auto; }
.row > .input.grow, .row > .select.grow { flex: 1 1 0; }
/* grupos de botões de filtro ficam do tamanho do conteúdo, mesmo dentro de colunas */
.stack > .seg, .stack-sm > .seg { align-self: flex-start; }
.row-nowrap { flex-wrap: nowrap; gap: 4px; }
.list-item-col { flex-direction: column; align-items: flex-start; gap: 2px; }
/* funil: as cinco colunas dividem a largura (rola só em tela estreita) */
.board-fit .col { flex: 1 1 0; min-width: 200px; }
/* menu lateral mais compacto: todos os itens cabem em 900px de altura */
.brand-side { height: 72px; }
.sidebar-head { padding: 10px 16px; }
.sidebar-nav { padding: 12px 16px; gap: 4px; }
.nav-item { min-height: 38px; padding: 6px 12px; }
.app.is-collapsed .brand-side { height: 40px; }

/* ---------------------------------------------------------------- revisão de usabilidade: som, toque e cartão do cronômetro */
.sound-btn { gap: 8px; padding: 0 12px; }
.sound-btn.is-off { color: var(--danger-text); font-weight: 600; }
@media (max-width: 640px) { .sound-label { display: none; } .sound-btn { padding: 0; width: 44px; } }
/* alvos de toque de 44px em tablet e celular */
@media (pointer: coarse), (max-width: 1023px) {
  .btn-sm, .seg button, .select.sm, .input.sm, .nav-item, .tab, .btn-icon { min-height: 44px; height: 44px; }
  .btn-icon { min-width: 44px; width: 44px; }
  #open-menu { min-width: 44px; width: 44px; }
  .check { min-height: 44px; } .check input { width: 22px; height: 22px; }
}
/* cartão do cronômetro: uma ação principal grande; o resto fica em "Mais ações" */
.timer-actions { flex-direction: column; align-items: stretch; gap: 8px; }
.timer-primary { width: 100%; height: 56px; font-size: 16px; font-weight: 600; }
.timer-secondary { display: flex; gap: 8px; flex-wrap: wrap; }
.timer-secondary > * { flex: 1 1 auto; }
.timer-more summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; height: 44px; border: 1px solid var(--border-strong); border-radius: 6px; font-weight: 500; }
.timer-more summary::-webkit-details-marker { display: none; }
.timer-more[open] summary { background: var(--hover); }
.timer-more-list { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; }
.timer-more-list .btn { justify-content: flex-start; height: 44px; }

/* ---------------------------------------------------------------- agenda em grade (uma coluna por ambiente) */
.dgrid-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.dgrid { display: grid; grid-template-columns: 64px repeat(var(--dcols), minmax(170px, 1fr)); min-width: min-content; }
.dgrid-col { border-left: 1px solid var(--border); min-width: 0; }
.daxis { border-left: 0; position: sticky; left: 0; background: var(--surface); z-index: 3; }
.dgrid-head { height: 56px; padding: 8px 12px; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid var(--border-strong); background: var(--surface); }
.dcol { position: relative; }
.dslot { display: block; width: 100%; height: var(--drow); border-bottom: 1px solid var(--border); text-align: left; padding: 0 8px; font-size: 12px; line-height: var(--drow); }
.dslot.is-axis { border-bottom-color: transparent; color: var(--muted); line-height: 20px; padding: 0 8px; }
button.dslot:hover, button.dslot:focus-visible { background: var(--hover); }
.dslot-hint { opacity: 0; color: var(--muted); } button.dslot:hover .dslot-hint, button.dslot:focus-visible .dslot-hint { opacity: 1; }
.dslot.is-busy { pointer-events: none; }
.dblock { position: absolute; z-index: 1; margin: 1px 0 0 2px; padding: 4px 8px; border-radius: 4px; overflow: hidden; text-align: left; display: flex; flex-direction: column; gap: 1px; font-size: 12px; line-height: 1.25; background: var(--text); color: var(--surface); border: 1px solid var(--text); }
.dblock strong { font-weight: 600; display: flex; gap: 4px; align-items: center; } .dblock span { opacity: .85; }
.dblock.s-requested, .dblock.s-awaiting_deposit { background: var(--surface); color: var(--text); border: 1px dashed var(--text); }
.dblock.s-arrived, .dblock.s-in_service { background: var(--gold); border-color: var(--gold); color: #171717; }
.dblock.s-completed { opacity: .6; }
.dblock.is-block { background: var(--hover); color: var(--muted); border: 1px solid var(--border-strong); }

/* ---------------------------------------------------------------- dashboard e menu por grupos */
.dash-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 1100px) { .dash-top { grid-template-columns: minmax(0, 1fr); } }
.next-name { font-size: 18px; }
.stat-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 32px; padding: 16px 24px; }
.stat-inline { display: inline-flex; align-items: baseline; gap: 8px; } .stat-inline strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.nav-group { margin: 10px 12px 2px; font-size: 12px; font-weight: 500; color: var(--sb-sub); }
.nav-group:first-child { margin-top: 0; }
.app.is-collapsed .nav-group { display: none; }
@media (pointer: fine) and (min-width: 1024px) { .nav-item { min-height: 36px; height: auto; } }
/* menu: cabe inteiro em 900px de altura, mesmo com os quatro grupos (no toque os itens voltam a 44px) */
.brand-side { height: 56px; }
.sidebar-head { padding: 8px 16px; }
.sidebar-nav { gap: 2px; padding: 8px 16px; }
@media (pointer: fine) and (min-width: 1024px) { .nav-item { min-height: 32px; padding: 4px 12px; } .nav-group { margin: 8px 12px 0; } }

/* ---------------------------------------------------------------- faixa de alerta ao vivo: botões legíveis e celular */
.alert-box.live .btn-outline, .alert-box.live .btn-ghost { background: transparent; color: inherit; border-color: currentColor; }
.alert-box.live .btn-outline:hover, .alert-box.live .btn-ghost:hover { background: rgba(255,255,255,.16); color: inherit; }
.alert-box.live.warn .btn-outline:hover, .alert-box.live.warn .btn-ghost:hover { background: rgba(0,0,0,.08); }
.alert-box.live .btn-dark { background: #171717; color: #fff; border-color: #171717; }
@media (max-width: 640px) {
  .alert-box.live { flex-wrap: wrap; }
  .alert-box.live > .grow { flex: 1 1 calc(100% - 40px); }
  .alert-box.live > .row { width: 100%; }
  .alert-box.live > .row > .btn { flex: 1 1 auto; }
  .d-long { display: none; }
}
@media (min-width: 641px) { .d-short { display: none; } }
@media (max-width: 640px) { .topbar-title { font-size: 16px; } }

/* alerta crítico em bronze escuro (sem vermelho): o que diferencia do aviso amarelo é o tom escuro, o ícone de sirene, o texto e a borda dupla */
.alert-box.live.danger { border-color: var(--danger-solid); }
.timer.phase-due, .timer.phase-escalated { border-color: var(--danger-solid); }
.shortcuts { display: flex; flex-direction: column; gap: 8px; } .shortcuts .btn { justify-content: flex-start; }

/* ---------------------------------------------------------------- dashboard: barra de atalhos no alto e cronômetros em largura total */
.dash-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 12px 16px; }
.dash-next { display: flex; align-items: center; gap: 12px; min-width: 0; } .dash-next .icon-lg { flex: none; }
.dash-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; }
/* muitos cronômetros ao mesmo tempo: cartões compactos (nome, relógio, situação e ações), mais cartões por tela */
.timer-grid.is-dense { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.is-dense .timer { padding: 12px; gap: 6px; }
.is-dense .timer-meta { display: none; }
.is-dense .timer-clock { font-size: 28px; }
.is-dense .timer-primary { height: 48px; }

/* ---------------------------------------------------------------- página de cronômetros: abas com contagem, filtros e cartões compactos */
.tab-count { display: inline-block; margin-left: 8px; min-width: 22px; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 4px; font-size: 12px; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] .tab-count { border-color: var(--text); }
.tab-count.is-alert { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; font-weight: 600; }
.timer-controls .input.sm { min-width: 200px; }
.is-dense .timer-msg { display: none; }
/* sino com texto: a Central de alertas fica no topo, ao lado do som, e não ocupa lugar no menu */
@media (min-width: 641px) { .bell { padding: 0 12px; gap: 8px; width: auto; } .bell .bell-count { position: static; } }
@media (max-width: 640px) { .bell-label { display: none; } }
/* cabeçalho do cartão do cronômetro: sempre nome à esquerda e situação à direita, na mesma linha (nome longo é cortado com …) */
.timer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: nowrap; min-width: 0; }
.timer-head > strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-head > .badge { flex: none; }

/* grupos do menu: título na cor do tema, com seta para abrir e fechar */
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-section-body { display: flex; flex-direction: column; gap: 2px; }
.nav-section .nav-group { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left; margin: 8px 0 0; padding: 4px 12px; font-size: 12px; font-weight: 600; color: var(--sb-group); border-radius: 6px; min-height: 28px; }
.nav-section:first-child .nav-group { margin-top: 0; }
.nav-group:hover { background: var(--sb-hover); }
.nav-chevron { width: 14px; height: 14px; transition: transform .2s ease; }
.nav-group[aria-expanded="false"] .nav-chevron { transform: rotate(-90deg); }
.app.is-collapsed .nav-group { display: none; }
.app.is-collapsed .nav-section-body[hidden] { display: flex !important; } /* menu recolhido (só ícones): todos os itens ficam visíveis */
@media (prefers-reduced-motion: reduce) { .nav-chevron { transition: none; } }

/* dashboard: cinco números de cronômetros */
.grid.cols-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1280px) { .grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat.is-alert { border-color: var(--danger-solid); }
.stat.is-alert .stat-value { color: var(--danger-text); }

.alert-box.live .alert-close { border-color: transparent; width: 36px; min-width: 36px; padding: 0; align-self: flex-start; }
.alert-box.live .alert-close:hover { background: rgba(255,255,255,.16); }

.timer-clock-label { font-size: 12px; color: var(--muted); line-height: 1.3; margin-bottom: -4px; }
.phase-due .timer-clock-label, .phase-escalated .timer-clock-label { color: var(--danger-text); font-weight: 600; }

/* cartão compacto (opcional): ao passar o mouse, tocar ou focar, ele se abre inteiro */
.timer-grid.is-dense { align-items: start; }
.is-dense .timer:hover .timer-meta, .is-dense .timer:focus-within .timer-meta { display: grid; }
.is-dense .timer:hover .timer-msg, .is-dense .timer:focus-within .timer-msg { display: block; }

/* cartão padrão do cronômetro: mesma altura e mesma posição em qualquer situação */
.timer { border-width: 2px; }
.timer-secondary { display: flex; flex-wrap: wrap; gap: 8px; }
.timer-secondary > .btn, .timer-secondary > .timer-more { flex: 1 1 0; min-width: 0; }
.timer-secondary > .timer-more[open] { flex-basis: 100%; }
.timer-meta { min-height: 110px; align-content: start; }
.timer-secondary > .btn { height: 44px; }
.timer-secondary > .timer-more > summary { height: 44px; box-sizing: border-box; }
.timer-head { min-height: 26px; }

/* "Mais ações" aberto: painel no lugar da linha (com X), sem o "Vi o alerta" por perto */
.timer-secondary > .timer-more-btn { flex: 1 1 0; }
.timer-more-panel { width: 100%; border: 1px solid var(--border-strong); border-radius: 6px; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.timer-more-head { display: flex; align-items: center; justify-content: space-between; padding-left: 4px; }
.timer-more-close { width: 44px; height: 44px; }

/* Atendimento: o quadro tem altura própria e a barra de rolar fica dentro da tela, bem visível */
.board-kanban { height: calc(100vh - 300px); min-height: 240px; overflow-x: scroll; overflow-y: hidden; padding-bottom: 14px; scrollbar-width: auto; scrollbar-color: var(--gold) var(--col-bg, #F3F1EC); }
.board-kanban .col { max-height: 100%; }
.board-kanban::-webkit-scrollbar { height: 14px; }
.board-kanban::-webkit-scrollbar-track { background: var(--col-bg, #F3F1EC); border-radius: 7px; }
.board-kanban::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 7px; border: 2px solid var(--col-bg, #F3F1EC); }
.board-kanban::-webkit-scrollbar-thumb:hover { background: var(--gold-text); }

/* REGRA DE COR: ou contorno ou fundo, nunca os dois.
   avisos e alertas = fundo dourado escuro (bronze) sólido, texto branco, sem contorno; avisos informativos = fundo cinza, sem contorno */
.alert-box { border-color: transparent; }
.alert-box.info, .alert-box:not(.warn):not(.danger):not(.live) { background: var(--hover); }
.alert-box.danger:not(.live) { background: var(--danger-solid); color: #fff; border-color: transparent; }
.alert-box.danger:not(.live) .icon { color: #fff; }
/* aviso comum (atenção) = fundo amarelo sólido, sem contorno: continua diferente do crítico (bronze) */
.alert-box.warn:not(.live) { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.alert-box.warn:not(.live) .icon { color: var(--warn-text); }
/* cartão atrasado do Atendimento: só o contorno bronze, fundo normal */
.kcard.delayed { background: var(--surface); border: 2px solid var(--danger-solid); }

/* central de alertas: uma linha limpa por cronômetro (título, uma linha de caminho em texto cinza e um selo de situação) */
.alert-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alert-sub { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.status-chip .icon { width: 14px; height: 14px; }
.status-chip.is-alert { background: var(--danger-solid); color: #fff; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.alert-actions { margin-left: auto; align-self: center; flex-wrap: wrap; justify-content: flex-end; }

/* clientes: filtros prontos */
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-chips .btn[aria-pressed="true"] { background: var(--black); color: var(--gold-400); border-color: var(--black); }
html[data-theme="escuro"] .filter-chips .btn[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.filter-chips > .select { width: auto; min-width: 180px; }

/* serviços e pacotes: abas, busca e linhas com subtítulo */
.list-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.list-toolbar .input { max-width: 320px; }
.cell-sub { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.cell-clip { max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-toolbar .select { width: auto; min-width: 160px; }
.list-toolbar .input { flex: 0 1 320px; }

.plain-list { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
/* login: fundo padrão estático da marca (preto com brilho dourado) e espaço para uma foto */
.login-bg { background: radial-gradient(ellipse 70% 60% at 78% 12%, rgba(201,162,75,.24), transparent 62%), radial-gradient(ellipse 60% 55% at 12% 95%, rgba(122,84,18,.30), transparent 65%), var(--black); }
.login-bg img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s ease; }
.has-photo .login-bg img { opacity: 1; }
.login-bg::after { opacity: 0; }
.has-photo .login-bg::after, .has-video .login-bg::after { opacity: 1; }
/* login: efeito de luz dourada (movimento lento) e faíscas; ligados pelo login-bg.js */
.fx-luz .login-bg::before { content: ""; position: absolute; inset: -30%; pointer-events: none; background: radial-gradient(circle at 70% 25%, rgba(201,162,75,.30), transparent 42%), radial-gradient(circle at 25% 80%, rgba(160,110,30,.26), transparent 45%); animation: luz-drift 26s ease-in-out infinite alternate; will-change: transform; }
@keyframes luz-drift { from { transform: translate3d(-6%, -4%, 0) scale(1); } to { transform: translate3d(7%, 5%, 0) scale(1.12); } }
.spark { position: absolute; bottom: -12px; border-radius: 50%; pointer-events: none; opacity: 0; background: radial-gradient(circle, rgba(244,214,140,.95), rgba(201,162,75,0) 70%); animation: spark-rise linear infinite; will-change: transform, opacity; }
@keyframes spark-rise { 0% { transform: translate3d(0, 0, 0) scale(.6); opacity: 0; } 15% { opacity: .85; } 85% { opacity: .45; } 100% { transform: translate3d(var(--dx, 0px), -105vh, 0) scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .fx-luz .login-bg::before, .spark { animation: none; } .spark { display: none; } }
/* trocar de tela sem piscar: a nova é montada escondida enquanto a antiga segue visível */
#page-root { position: relative; }
.page-staging { position: absolute; top: 0; left: 0; right: 0; visibility: hidden; pointer-events: none; }
#page-root.is-loading > :not(.page-staging) { opacity: .6; transition: opacity .15s ease .25s; }
/* login: o cartão aparece já com o formulário */
.login-card { transition: opacity .25s ease; }
.login-body:not(.login-ready) .login-card { opacity: 0; }

/* ---------------------------------------------------------------- celular: telas mais compactas */
@media (max-width: 640px) {
  /* aviso de cronômetros: compacto (ocupava ~275 px no alto de todas as telas) */
  #alert-strip:not(:empty) { padding-top: 12px; }
  .alert-box.live { position: relative; gap: 8px 10px; padding: 12px 44px 12px 12px; }
  .alert-box.live .icon-lg { width: 20px; height: 20px; }
  .alert-box.live > .grow > strong { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; line-height: 20px; }
  .alert-box.live > .grow > .text-sm { display: none; }
  .alert-box.live > .row { gap: 8px; }
  .alert-box.live > .row > .btn { height: 38px; font-size: 13px; padding: 0 12px; }
  .alert-box.live .alert-close { position: absolute; top: 6px; right: 6px; }
  .alert-box.live > .row > .btn-ghost { display: none; } /* silenciar: use o ícone de som do topo */

  /* textos de apoio do topo da tela: no máximo 2 linhas */
  .page-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; line-height: 20px; }

  /* tabelas viram lista: o primeiro campo é o título e os demais aparecem como "rótulo: valor" */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table-cards tr:last-child { border-bottom: 0; }
  .table-cards td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; text-align: right; }
  .table-cards td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; flex: none; }
  .table-cards td:first-child { display: block; text-align: left; font-weight: 600; padding-bottom: 6px; }
  .table-cards td:first-child::before { content: none; }

  /* abas e filtros: uma linha que rola para o lado, em vez de empilhar */
  .tabs { padding-right: 28px; scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  .tabs::-webkit-scrollbar { display: none; }
  .filter-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .filter-chips::-webkit-scrollbar { display: none; }
  .filter-chips > * { flex: none; }
  .filter-chips .select { width: auto; }
}
@media (max-width: 640px) {
  /* indicadores (A receber, Gerado no mês...): dois por linha em vez de um cartão alto por indicador */
  .grid:has(> .stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .grid:has(> .stat) > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .grid:has(> .stat) .stat { padding: 12px 14px; }
  .grid:has(> .stat) .stat-value { font-size: 20px; line-height: 28px; }
}

/* ---------------------------------------------------------------- celular: um botão no lugar de várias opções (ver js/mobile.js) */
.pick-btn, .btn.more-btn { display: none; }
.pick-list { display: flex; flex-direction: column; }
.pick-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; padding: 0 4px; border-bottom: 1px solid var(--border); text-align: left; font-size: 16px; }
.pick-item:last-child { border-bottom: 0; }
.pick-item[aria-pressed="true"] { font-weight: 700; }
.pick-select { display: flex; flex-direction: column; gap: 6px; padding-top: 14px; font-weight: 500; }
@media (max-width: 640px) {
  .is-picked, .more-src { display: none !important; }
  .pick-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); font-weight: 500; text-align: left; }
  .pick-btn .icon { flex: none; }
  .btn.more-btn { display: inline-flex; }
}

/* popups no celular: a tela de trás fica parada e as listas de opções são um cartão no meio, não a tela inteira */
.modal-body { overscroll-behavior: contain; }
@media (max-width: 768px) { html.has-overlay, html.has-overlay body { overflow: hidden; } }
.overlay.is-pick { align-items: center; padding: 24px 16px; }
.overlay.is-pick .pick-modal { width: min(100%, 380px); max-height: min(72vh, 560px); border-radius: var(--radius-lg); }

/* agenda e telas parecidas: título da data numa linha, setas + "Visualizar" na seguinte */
.cal-title-m { display: none; }
.opts-body { display: flex; flex-direction: column; gap: 8px; }
.opts-body > .select { width: 100%; }
.opts-body > .seg { display: flex; } .opts-body > .seg button { flex: 1; }
.opts-label { font-size: 13px; color: var(--muted); font-weight: 500; margin-top: 8px; }
.opts-label:first-child { margin-top: 0; }
@media (max-width: 640px) {
  .cal-title-m { display: block; flex-basis: 100%; }
  .cal-nav strong { display: none; }
  .pick-btn.opts-btn { width: auto; flex: 1 1 140px; }
  .clamp-m { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}

/* login no celular: cartão compacto, com respiro dos lados (não a tela inteira) */
@media (max-width: 640px) {
  .login-body { padding: 24px; }
  .login-card { padding: 24px 20px; gap: 12px; }
  .login-card .brand-page { height: 72px; }
  .login-view { gap: 12px; }
  .login-title { font-size: 20px; line-height: 26px; }
  .login-sub { display: none; }
}
