/* =========================================================================
   MH Central · folha única
   Linha UP4 / SF Technology: ferramenta clara, cards brancos, marca nos detalhes.
   Identidade MH: grafite (menu) + âmbar (ação e item ativo).
   Ordem: tokens → base → controles → estrutura → componentes → telas → responsivo
   ========================================================================= */

:root {
  /* Superfícies */
  --canvas: #f6f7f9;
  --surface: #ffffff;
  --sunken: #f2f3f6;
  --line: #e6e8ee;
  --line-soft: #eef0f4;
  /* Texto */
  --ink: #14161c;
  --ink-2: #464b57;
  --muted: #737987;
  --faint: #9ca1ad;
  /* Marca MH */
  --brand: #f5b700;
  --brand-600: #dba300;
  --brand-ink: #6b4e00;
  --brand-50: #fff8df;
  --brand-100: #ffecb0;
  /* Menu lateral */
  --side: #121318;
  --side-2: #1b1d23;
  --side-line: rgba(255, 255, 255, 0.07);
  --side-text: #a2a6b2;
  /* Estados */
  --ok: #0b8a57;
  --ok-bg: #e6f6ee;
  --bad: #cf3546;
  --bad-bg: #fdecee;
  --warn: #9a5c00;
  --warn-bg: #fff3d9;
  --info: #3150d8;
  --info-bg: #ebf0ff;
  /* Forma */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-card: 0 1px 2px rgba(20, 22, 28, 0.04), 0 1px 1px rgba(20, 22, 28, 0.02);
  --shadow-float: 0 12px 32px -8px rgba(20, 22, 28, 0.16), 0 2px 6px rgba(20, 22, 28, 0.06);
  --shadow-modal: 0 32px 80px -16px rgba(20, 22, 28, 0.32);
  --ring: 0 0 0 3px rgba(245, 183, 0, 0.28);
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sidebar: 244px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--canvas); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--canvas); color: var(--ink);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; color: var(--ink); letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 750; }
h2 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num, .money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
i.ti { font-size: 18px; line-height: 1; }
:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 2px; }
::selection { background: var(--brand-100); }

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 650; line-height: 1.2; white-space: nowrap; cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--sunken); border-color: #d6d9e1; color: var(--ink); }
.btn:active { transform: translateY(.5px); }
.btn i.ti { font-size: 17px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--ink); box-shadow: 0 1px 2px rgba(155, 110, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background: var(--sunken); color: var(--ink); }
.btn.sm { min-height: 32px; padding: 6px 11px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: #f2c5cb; }
.btn.is-busy { opacity: .6; pointer-events: none; }
.kbd { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: rgba(20, 22, 28, .1); }

.field {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field:hover { border-color: #d6d9e1; }
.field:focus { border-color: var(--brand-600); box-shadow: var(--ring); }
.field::placeholder { color: var(--faint); }
select.field {
  appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23737987' stroke-width='1.8' 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 12px center;
}
.field.code { text-align: center; font-size: 24px; font-weight: 700; letter-spacing: .4em; min-height: 54px; font-variant-numeric: tabular-nums; }
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.formgrid > label, .stack > label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.formgrid .full { grid-column: 1 / -1; }
.stack { display: grid; gap: 14px; }
.form-error { min-height: 18px; color: var(--bad); font-size: 13px; }

.segmented {
  display: inline-flex; gap: 2px; padding: 3px;
  border-radius: var(--r-md); background: #eceef3;
  overflow-x: auto; max-width: 100%; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 34px; padding: 6px 12px;
  border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 22, 28, .08), 0 0 0 1px rgba(20, 22, 28, .03); }
.segmented button span { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: rgba(20, 22, 28, .06); color: var(--muted); font-size: 11.5px; font-weight: 700; text-align: center; }
.segmented button[aria-selected="true"] span { background: var(--brand-50); color: var(--brand-ink); }
.segmented button span.hot { background: var(--bad-bg); color: var(--bad); }
.segmented.full { display: flex; width: 100%; }
.segmented.full button { flex: 1; justify-content: center; }

/* ---------- Etiquetas ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 8px; border-radius: 999px;
  background: var(--sunken); color: var(--ink-2);
  font-size: 12px; font-weight: 650; white-space: nowrap; line-height: 1.4;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.amber { background: var(--brand-50); color: var(--brand-ink); }
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px;
  background: var(--sunken); color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag .dot { width: 7px; height: 7px; border-radius: 2px; background: var(--cor, var(--faint)); }

/* ---------- Estrutura ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 12px 12px;
  background: var(--side); color: var(--side-text);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 18px; }
.brand > div { display: grid; line-height: 1.25; }
.brand strong { color: #fff; font-size: 15px; font-weight: 750; letter-spacing: -.01em; }
.brand small { color: #6f7380; font-size: 12px; }
.brand-mark {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--brand); color: var(--ink);
  font-weight: 800; font-size: 13px; letter-spacing: .02em;
  box-shadow: 0 6px 16px -6px rgba(245, 183, 0, .6);
}
.nav { display: grid; gap: 14px; }
.nav-group { display: grid; gap: 2px; }
.nav-label { padding: 0 10px 4px; color: #5d616c; font-size: 12px; font-weight: 600; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 10px; border-radius: var(--r-sm);
  color: var(--side-text); font-size: 13.5px; font-weight: 550;
  transition: background .15s, color .15s;
}
.nav a i.ti { color: #6f7380; transition: color .15s; }
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a:hover i.ti { color: #c9ccd4; }
.nav a.active { background: rgba(245, 183, 0, .1); color: #fff; font-weight: 650; }
.nav a.active i.ti { color: var(--brand); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav .count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--side-2); color: #c9ccd4; font-size: 11.5px; font-weight: 700; text-align: center; }
.nav .count.alert { background: rgba(207, 53, 70, .2); color: #ff8f9b; }
.nav .soon { margin-left: auto; font-size: 11px; color: #5d616c; }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 12px 6px 4px 8px; border-top: 1px solid var(--side-line); }
.sidebar-user > div { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.sidebar-user strong { color: #fff; font-size: 13px; }
.sidebar-user small { color: #6f7380; font-size: 12px; }
.sidebar-user .btn { background: transparent; border-color: transparent; box-shadow: none; color: #6f7380; }
.sidebar-user .btn:hover { background: var(--side-2); color: #fff; }
.avatar { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-100); color: var(--brand-ink); font-size: 12px; font-weight: 750; }
.sidebar .avatar { background: var(--side-2); color: #fff; }

.workspace { min-width: 0; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  min-height: 76px; padding: 14px 32px;
  background: rgba(246, 247, 249, .88); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.top-title { flex: 1; min-width: 0; }
.top-title p { margin-top: 2px; color: var(--muted); font-size: 13px; }
.top-title p b { color: var(--ink-2); font-weight: 650; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.content { max-width: 1320px; padding: 24px 32px 64px; }

/* ---------- Superfícies ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 18px 12px; }
.panel-head h2 { display: flex; align-items: center; gap: 8px; }
.panel-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.panel-body { padding: 0 18px 18px; }
.panel-foot { padding: 10px 12px; border-top: 1px solid var(--line-soft); }
.notice {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 14px 12px 16px; margin-bottom: 16px;
  border: 1px solid #f3cdd2; border-radius: var(--r-lg); background: #fff8f9;
}
.notice > i.ti { color: var(--bad); font-size: 20px; }
.notice > div { flex: 1; min-width: 220px; }
.notice strong { color: var(--bad); font-size: 13.5px; }
.notice p { color: var(--ink-2); font-size: 13px; margin-top: 1px; }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty i.ti { display: block; margin: 0 auto 8px; font-size: 22px; color: var(--faint); }
.empty strong { display: block; color: var(--ink-2); margin-bottom: 2px; }

/* ---------- Métricas ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  display: grid; align-content: start; gap: 2px; width: 100%;
  padding: 16px 18px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-card);
  transition: border-color .15s, box-shadow .15s;
}
.stat:hover { border-color: #d6d9e1; box-shadow: var(--shadow-float); }
.stat.is-active { border-color: var(--brand); box-shadow: var(--ring); }
.stat-label { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-label i.ti { font-size: 17px; color: var(--faint); }
.stat-value { margin-top: 6px; font-size: 24px; font-weight: 750; letter-spacing: -.02em; color: var(--ink); line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-value small { font-size: 15px; font-weight: 650; color: var(--muted); }
.stat-sub { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat.positive .stat-value { color: var(--ok); }
.stat.negative .stat-value { color: var(--bad); }
.stat.alert { border-color: #f3cdd2; }
.stat.alert .stat-value, .stat.alert .stat-label i.ti { color: var(--bad); }
.stat.alert.is-active { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(207, 53, 70, .15); }

/* ---------- Layout do painel ---------- */
.dash { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-side { display: grid; gap: 16px; min-width: 0; }
.dash > *, .panel, .panel-head > * { min-width: 0; }

/* ---------- Lista em tabela (vira cartão no celular) ---------- */
.rows { display: grid; }
.rows-head, .row {
  display: grid; align-items: center; gap: 14px;
  grid-template-columns: var(--cols);
  padding: 0 18px;
}
.rows-head { min-height: 38px; background: #fafbfc; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600; }
.row { min-height: 58px; border-bottom: 1px solid var(--line-soft); transition: background .12s; }
.row:last-child { border-bottom: 0; }
.row:hover { background: #fbfbfc; }
.rows .right { text-align: right; justify-self: end; }
.row-main { display: grid; min-width: 0; }
.row-main strong { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-date { display: grid; line-height: 1.25; }
.row-date strong { font-size: 13px; font-weight: 650; }
.row-date small { color: var(--muted); font-size: 12px; }
.row-date.late strong { color: var(--bad); }
.row-date.today strong { color: var(--brand-ink); }
.val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.val.in { color: var(--ok); }
.val.out { color: var(--bad); }
.row.is-busy { opacity: .45; pointer-events: none; }
.c-badge-m { display: none; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------- Tarefas ---------- */
.tasks { display: grid; padding: 0 8px 8px; }
.task { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 52px; padding: 6px 10px; border-radius: var(--r-md); }
.task:hover { background: var(--sunken); }
.check {
  display: grid; place-items: center; width: 20px; height: 20px; padding: 0;
  border: 1.5px solid #c9cdd6; border-radius: 6px; background: var(--surface); color: transparent; cursor: pointer;
  transition: .15s;
}
.check i.ti { font-size: 13px; }
.check:hover { border-color: var(--brand-600); }
.task.done .check { background: var(--brand); border-color: var(--brand); color: var(--ink); }
.task.done .task-title { color: var(--faint); text-decoration: line-through; }
.task-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; color: var(--muted); font-size: 12px; }
.task-meta .hi { display: inline-flex; align-items: center; gap: 3px; color: var(--warn); font-weight: 650; }
.task-meta i.ti { font-size: 13px; }
.task.is-busy { opacity: .45; pointer-events: none; }
.group-label { padding: 12px 10px 4px; color: var(--faint); font-size: 12px; font-weight: 600; }

/* ---------- Progresso ---------- */
.progress-list { display: grid; gap: 16px; padding: 4px 18px 18px; }
.progress-item header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; }
.progress-item header span { color: var(--muted); font-weight: 600; }
.progress-item header strong { font-variant-numeric: tabular-nums; }
.progress-item header strong small { color: var(--muted); font-weight: 500; }
.bar { height: 8px; margin-top: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--ok); transition: width .5s ease; }
.bar.out span { background: var(--ink-2); }

/* ---------- Servidores ---------- */
.site { display: flex; align-items: center; gap: 11px; min-width: 0; }
.site .avatar { border-radius: 9px; background: var(--sunken); color: var(--ink-2); text-transform: uppercase; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

/* ---------- Modal ---------- */
.modalback {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 20px;
  background: rgba(20, 22, 28, .45); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modalback.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(520px, 100%); max-height: 92vh; overflow: auto;
  border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-modal);
  transform: translateY(8px); transition: transform .2s;
}
.modalback.open .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.modal-head h2 { font-size: 17px; }
.modal-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.modal-body { padding: 12px 20px 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-radius: 12px;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 550;
  box-shadow: var(--shadow-float);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: .25s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast i.ti { color: #5fe0a6; }
.toast.erro i.ti { color: #ff8f9b; }

/* ---------- Celular: barra inferior ---------- */
.bottom-nav { display: none; }

/* ---------- Telas de acesso (login / autorizar) ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(400px, 100%); padding: 28px; }
.auth-card .brand { padding: 0 0 22px; }
.auth-card .brand strong { color: var(--ink); }
.auth-card .brand small { color: var(--muted); }
.auth-card h1 { font-size: 21px; }
.auth-card > form > p.sub, .auth-card p.sub { color: var(--muted); margin: 4px 0 20px; }
.auth-card .btn.primary { width: 100%; min-height: 44px; margin-top: 6px; }
.auth-foot { margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--faint); font-size: 12px; }
.auth-foot i.ti { font-size: 14px; }
.etapa { display: none; }
.etapa.on { display: block; }
.qr { width: 196px; margin: 0 auto 10px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.qr img { display: block; width: 100%; }
.secret { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 14px; word-break: break-all; }
.link-btn { display: block; width: 100%; margin-top: 12px; padding: 6px; border: 0; background: none; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.link-btn:hover { color: var(--ink); }
.perms { display: grid; gap: 8px; margin: 0 0 18px; padding: 14px; list-style: none; border-radius: var(--r-md); background: var(--sunken); }
.perms li { display: flex; gap: 9px; font-size: 13px; color: var(--ink-2); }
.perms li i.ti { font-size: 16px; color: var(--ok); }
.perms li.nao i.ti { color: var(--bad); }

/* ---------- Responsivo ---------- */
@media (max-width: 1180px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .top { min-height: 64px; padding: 12px 16px; }
  .top h1 { font-size: 19px; }
  .hide-m { display: none !important; }
  .panel-head > .segmented { width: 100%; }
  .workspace { overflow-x: clip; }
  .content { padding: 16px 14px 104px; }
  .stats { gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat-value { font-size: 19px; }
  .stat-sub { font-size: 12px; }
  .rows-head { display: none; }
  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "main val" "meta act";
    gap: 6px 12px; padding: 12px 16px;
  }
  .row > .c-main { grid-area: main; }
  .row > .c-val { grid-area: val; }
  .row > .c-meta { grid-area: meta; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .row > .c-act { grid-area: act; justify-self: end; }
  .row > .c-hide-m { display: none; }
  .row .row-date { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
  .row .c-badge-m { display: inline-flex; }
  .site-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "meta" "act"; }
  .site-row > .c-act { justify-self: stretch; }
  .site-row > .c-act .btn:last-child { flex: 1; }
  .formgrid { grid-template-columns: 1fr; }
  .modalback { align-items: end; padding: 0; }
  .modal { width: 100%; border-radius: 18px 18px 0 0; max-height: 88vh; }
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
  }
  .bottom-nav a, .bottom-nav button {
    display: grid; justify-items: center; gap: 2px; padding: 6px 0;
    border: 0; background: none; color: var(--muted); font-size: 10.5px; font-weight: 600; cursor: pointer;
  }
  .bottom-nav a.active { color: var(--ink); }
  .bottom-nav a.active i.ti { color: var(--brand-600); }
  .bottom-nav i.ti { font-size: 21px; }
  .bottom-nav .fab { width: 48px; height: 48px; margin: -18px auto 0; border-radius: 14px; place-items: center; background: var(--brand); color: var(--ink); box-shadow: 0 8px 20px -6px rgba(155, 110, 0, .55); }
  .bottom-nav .fab i.ti { font-size: 24px; }
  .toast { bottom: 90px; }
}

/* =========================================================================
   Telas de gestão (Tarefas, Contas, Recebimentos, Cofre)
   ========================================================================= */
textarea.field { min-height: 84px; resize: vertical; line-height: 1.5; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 18px 14px; }
.toolbar .grow { flex: 1; }
.search { position: relative; flex: 1 1 220px; max-width: 320px; }
.search i.ti { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 16px; pointer-events: none; }
.search .field { padding-left: 34px; min-height: 38px; }
.toolbar select.field { width: auto; min-height: 38px; min-width: 150px; }
.icon-toggle { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-md); background: #eceef3; }
.icon-toggle button { display: grid; place-items: center; width: 34px; height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(20,22,28,.08); }
.row.clickable { cursor: pointer; }
.row .tag { justify-self: start; }
.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.prio::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: #cfd3db; }
.prio.alta { color: var(--warn); } .prio.alta::before { background: var(--brand); }
.prio.baixa::before { background: #e5e7ec; }
.row .task-title { white-space: nowrap; }
.row.done .task-title { color: var(--faint); text-decoration: line-through; }
.row.done .check { background: var(--brand); border-color: var(--brand); color: var(--ink); }

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0 14px 14px; }
.board-col { display: grid; align-content: start; gap: 8px; min-height: 220px; padding: 10px; border-radius: 12px; background: var(--sunken); }
.board-col.drop { outline: 2px dashed var(--brand-600); outline-offset: -2px; }
.board-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 4px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.board-head span { min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--surface); color: var(--muted); font-size: 12px; text-align: center; }
.kcard { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-card); cursor: grab; }
.kcard:hover { border-color: #d6d9e1; }
.kcard.dragging { opacity: .5; }
.kcard strong { font-size: 13.5px; font-weight: 650; line-height: 1.35; }
.kcard .k-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kcard .k-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kcard .k-move { display: flex; gap: 4px; }
.kcard.done strong { color: var(--faint); text-decoration: line-through; }

.monthnav { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-card); }
.monthnav button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); cursor: pointer; }
.monthnav button:hover { background: var(--sunken); }
.monthnav strong { min-width: 132px; text-align: center; font-size: 13.5px; }
.rows-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafbfc; border-radius: 0 0 var(--r-lg) var(--r-lg); font-size: 13px; color: var(--muted); }
.rows-foot strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.menu-wrap { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 190px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-float); }
.menu-pop button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; text-align: left; font-size: 13px; font-weight: 550; color: var(--ink-2); cursor: pointer; }
.menu-pop button:hover { background: var(--sunken); color: var(--ink); }
.menu-pop button.danger { color: var(--bad); }
.menu-pop button.danger:hover { background: var(--bad-bg); }
.menu-pop i.ti { font-size: 16px; }
.inline-new { display: none; margin-top: 6px; }
.inline-new.on { display: block; }
.hint-box { padding: 10px 12px; border-radius: var(--r-md); background: var(--sunken); color: var(--ink-2); font-size: 13px; }

/* Cofre */
.vault-lock { max-width: 440px; margin: 40px auto; padding: 28px; text-align: center; }
.vault-lock .lock-ico { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; background: var(--brand-50); color: var(--brand-ink); }
.vault-lock .lock-ico i.ti { font-size: 28px; }
.vault-lock h2 { font-size: 19px; }
.vault-lock p { color: var(--muted); margin: 6px 0 18px; }
.vault-lock form { display: grid; gap: 12px; text-align: left; }
.vault-lock .btn.primary { width: 100%; min-height: 44px; }
.vault-warn { display: flex; gap: 10px; padding: 12px; border-radius: var(--r-md); background: var(--warn-bg); color: var(--warn); font-size: 12.5px; text-align: left; }
.vault-warn i.ti { font-size: 18px; flex: none; }
.secret-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.secret-cell code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pw-field { position: relative; }
.pw-field .field { padding-right: 84px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.pw-field .pw-actions { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); display: flex; gap: 2px; }
.strength { height: 4px; margin-top: 6px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.strength span { display: block; height: 100%; transition: width .3s, background .3s; }
.lock-timer { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .toolbar { padding: 0 14px 12px; }
  .search { max-width: none; flex-basis: 100%; }
  .toolbar select.field { flex: 1; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .monthnav strong { min-width: 110px; }
  .rows-foot { flex-wrap: wrap; }
  .top { flex-wrap: wrap; }
  .top-actions .btn.primary { display: none; }
  .top-actions:has(.monthnav) { width: 100%; }
  .monthnav { width: 100%; justify-content: space-between; }
  .row.task-row { grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: none; padding: 10px 14px; }
  .row.task-row > * { grid-area: auto; }
}
