/* ==========================================================================
   Orçamento SO Angola — sistema visual
   Paleta: verde-petróleo clínico (identidade), tinta azul-ardósia, fundo menta-cinza.
   Uma só família (Inter) com algarismos tabulares para valores monetários.
   ========================================================================== */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500 600; font-display: swap; src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700 800; font-display: swap; src: url("../fonts/inter-latin-700-normal.woff2") format("woff2"); }

:root {
  --teal-950: #062C2A; --teal-900: #0A3B38; --teal-800: #0B4A46; --teal-700: #0E5E5A; --teal-600: #0F766E;
  --teal-500: #14958A; --teal-100: #D5EEEA; --teal-50: #EDF7F5;
  --ink: #13232B; --ink-2: #33464E; --muted: #5E6E74; --faint: #8A989C;
  --canvas: #F2F5F4; --surface: #FFFFFF; --surface-2: #F7F9F9; --line: #DDE5E3; --line-2: #EAF0EE;
  --amber: #B7791F; --amber-50: #FEF6E7; --red: #C0392B; --red-50: #FDEDEB; --green: #1E8449; --green-50: #E9F6EE;
  --blue: #1F5FAD; --blue-50: #EAF1FB;
  --radius: 10px; --radius-sm: 7px; --radius-lg: 14px;
  --shadow-1: 0 1px 2px rgba(19, 35, 43, .06), 0 0 0 1px rgba(19, 35, 43, .04);
  --shadow-2: 0 12px 32px -12px rgba(6, 44, 42, .28), 0 0 0 1px rgba(19, 35, 43, .06);
  --sidebar-w: 248px; --topbar-h: 60px;
  --focus: 0 0 0 3px rgba(20, 149, 138, .35);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14.5px;
  line-height: 1.5; color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
a { color: var(--teal-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.12rem; font-weight: 650; }
h3 { font-size: .98rem; font-weight: 650; }
p { margin: 0 0 .6em; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num, .money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
[x-cloak] { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Layout -------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--teal-950); color: #CFE3E0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 14px 12px 16px; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--teal-500); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-weight: 700; font-size: 1.02rem; line-height: 1.1; }
.brand-sub { font-size: .72rem; color: #8FB8B3; font-weight: 500; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav .nav-label { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: #CFE3E0;
  font-weight: 500; font-size: .92rem; text-decoration: none; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: var(--teal-700); color: #fff; }
.nav a .icon { opacity: .85; }
.nav .sub { margin: 0 0 4px 22px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .12); display: flex; flex-direction: column; gap: 1px; }
.nav .sub a { padding: 6px 10px; font-size: .86rem; color: #A9C9C5; }
.nav .sub a.active { background: rgba(255, 255, 255, .09); color: #fff; }
.nav-sep { height: 1px; background: rgba(255, 255, 255, .08); margin: 10px 6px; }
.nav-cta { margin: 4px 0 14px; display: flex; align-items: center; justify-content: center; gap: 8px; background: #fff; color: var(--teal-900);
  font-weight: 650; border-radius: 9px; padding: 10px; text-decoration: none; }
.nav-cta:hover { text-decoration: none; background: var(--teal-50); }
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; font-size: .74rem; color: #6F9893; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center;
  gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 30; }
.menu-btn { display: none; }
.gsearch { position: relative; flex: 1; max-width: 560px; }
.gsearch input[type=search] { width: 100%; padding: 9px 40px 9px 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2);
  font: inherit; color: var(--ink); }
.gsearch input[type=search]:focus { background: #fff; border-color: var(--teal-500); box-shadow: var(--focus); outline: none; }
.gsearch > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.gsearch kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 .7rem Inter, sans-serif; color: var(--faint);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: #fff; }
.dropdown { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-2);
  padding: 6px; z-index: 60; max-height: 70vh; overflow: auto; }
.dropdown .item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.dropdown .item:hover, .dropdown .item.hl { background: var(--teal-50); text-decoration: none; }
.dropdown .item .icon { color: var(--teal-600); margin-top: 2px; }
.dropdown .item b { display: block; font-weight: 600; font-size: .9rem; }
.dropdown .item span { display: block; font-size: .8rem; color: var(--muted); }
.dropdown .kind { font-size: .7rem; font-weight: 600; color: var(--faint); margin-left: auto; white-space: nowrap; }
.dropdown .empty-row { padding: 12px; color: var(--muted); font-size: .88rem; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 9px; border: 0; background: transparent; color: var(--ink-2);
  display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.dot { position: absolute; top: 5px; right: 5px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--red); color: #fff;
  font-size: .66rem; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid #fff; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 4px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; font: inherit; color: inherit; }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--teal-100); color: var(--teal-800); display: grid; place-items: center;
  font-weight: 700; font-size: .8rem; flex: none; }
.user-chip .who { text-align: left; line-height: 1.15; }
.user-chip .who b { font-size: .86rem; font-weight: 600; display: block; }
.user-chip .who span { font-size: .72rem; color: var(--muted); }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-2);
  min-width: 240px; padding: 6px; z-index: 60; }
.menu a, .menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--ink);
  background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.notif-menu { width: 380px; max-width: calc(100vw - 24px); }
.notif { display: block; padding: 10px; border-radius: 8px; color: var(--ink); }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif b { font-weight: 600; font-size: .88rem; display: block; }
.notif span { font-size: .8rem; color: var(--muted); display: block; }
.notif.unread b::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--teal-500); margin-right: 7px; vertical-align: 2px; }

.content { padding: 24px 28px 48px; width: 100%; max-width: 1440px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .lead { color: var(--muted); margin-top: 4px; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: .82rem; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs .icon { width: 13px; height: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Botões --------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border-radius: 9px; font: inherit;
  font-weight: 600; font-size: .9rem; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none;
  line-height: 1.2; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { text-decoration: none; background: var(--surface-2); border-color: #C9D5D2; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.btn.primary:hover { background: var(--teal-800); border-color: var(--teal-800); }
.btn.big { padding: 13px 22px; font-size: 1rem; border-radius: 11px; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-50); border-color: #F2C2BC; }
.btn.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 6px 10px; font-size: .82rem; border-radius: 8px; gap: 6px; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--teal-700); cursor: pointer; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Cartões e grelhas --------------------------------------------- */
.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; flex-wrap: wrap; }
.card-head .sub { color: var(--muted); font-size: .84rem; margin-top: 2px; }
.card-body { padding: 16px 20px 20px; }
.card-body.flush { padding: 8px 0 4px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

/* ---------- Indicadores ---------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-1); }
.kpi { background: #fff; padding: 16px 18px; min-width: 0; }
.kpi .k-label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.kpi .k-value { font-size: 1.5rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.kpi .k-value small { font-size: .78rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi .k-foot { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mini-stats > div { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.mini-stats b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.mini-stats span { font-size: .78rem; color: var(--muted); }

/* ---------- Tabelas -------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-weight: 600; font-size: .78rem; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:hover td { background: #FAFCFB; }
.tbl tr.clickable { cursor: pointer; }
.tbl .num, .tbl th.num { text-align: right; }
.tbl td.strong, .tbl .strong { font-weight: 600; }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0; }
.tbl.compact td, .tbl.compact th { padding: 7px 10px; }
.tbl .sub-row td { background: var(--surface-2); font-weight: 600; font-size: .8rem; color: var(--teal-700); padding-top: 8px; padding-bottom: 6px; }
.cell-title { font-weight: 600; color: var(--ink); }
.cell-title:hover { color: var(--teal-700); }
.cell-sub { font-size: .8rem; color: var(--muted); }

/* ---------- Estados -------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 99px; font-size: .78rem; font-weight: 600;
  white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.st-grey { background: #EEF1F1; color: #5E6E74; }
.st-blue { background: #E8F0FB; color: #2360B0; }
.st-orange { background: #FDF0E1; color: #B85C00; }
.st-purple { background: #F1ECFB; color: #6B3FC0; }
.st-sky { background: #E5F4FA; color: #0E7490; }
.st-yellow { background: #FBF5DB; color: #8A6A00; }
.st-green { background: #E6F5EC; color: #1E7A45; }
.st-red { background: #FCEBE9; color: #B3321F; }
.st-black { background: #E4E6E8; color: #2B3136; }
.st-teal { background: var(--teal-50); color: var(--teal-700); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); font-size: .76rem; font-weight: 600; }
.tag.teal { background: var(--teal-50); color: var(--teal-700); }
.tag.amber { background: var(--amber-50); color: var(--amber); }
.status-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.status-tabs a { padding: 6px 12px; border-radius: 99px; background: #fff; box-shadow: var(--shadow-1); color: var(--ink-2); font-size: .84rem; font-weight: 500; }
.status-tabs a.on { background: var(--teal-700); color: #fff; box-shadow: none; }
.status-tabs a:hover { text-decoration: none; }
.status-tabs a span { color: inherit; opacity: .6; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Formulários ---------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: .78rem; color: var(--muted); }
.input, input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel],
input[type=url], select, textarea { width: 100%; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid #CFD9D7; background: #fff;
  font: inherit; color: var(--ink); min-height: 40px; }
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--teal-500); box-shadow: var(--focus); outline: none; }
input[readonly] { background: var(--surface-2); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235E6E74' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; }
.c8 { grid-column: span 8; } .c9 { grid-column: span 9; } .c12 { grid-column: span 12; } .c2 { grid-column: span 2; } .c7 { grid-column: span 7; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--teal-600); margin: 0; flex: none; }
.input-group { display: flex; }
.input-group > * { border-radius: 0; }
.input-group > :first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > :last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group > * + * { margin-left: -1px; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid #CFD9D7; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .85rem; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button, .seg a { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font: inherit; font-size: .84rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on, .seg a.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-1); }
.seg a:hover { text-decoration: none; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 8px; flex-wrap: wrap; }
fieldset { border: 0; padding: 0; margin: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 150px; }
.filters .grow { flex: 1; min-width: 220px; }
.search-input { position: relative; }
.search-input .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search-input input { padding-left: 36px; }

/* ---------- Mensagens ------------------------------------------------------ */
.flashes { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; max-width: min(440px, calc(100vw - 40px)); }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 11px; background: var(--ink); color: #fff;
  box-shadow: var(--shadow-2); font-size: .9rem; animation: pop .18s ease-out; }
.flash.sucesso .icon { color: #7EE2B0; } .flash.erro { background: #7A1F14; } .flash.aviso { background: #6B4A06; }
.flash button { margin-left: auto; background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 0; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.alert { display: flex; gap: 10px; padding: 11px 14px; border-radius: 10px; font-size: .88rem; align-items: flex-start; }
.alert .icon { margin-top: 1px; }
.alert.erro { background: var(--red-50); color: #8E2415; }
.alert.aviso { background: var(--amber-50); color: #7A4D05; }
.alert.info { background: var(--blue-50); color: #1C4F8C; }
.alert.sucesso { background: var(--green-50); color: #17633A; }
.alert + .alert { margin-top: 8px; }
.alert b { font-weight: 650; }
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .icon { width: 34px; height: 34px; color: var(--faint); margin-bottom: 8px; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }

/* ---------- Separadores ---------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; font: inherit; font-weight: 600; font-size: .9rem; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs .on { color: var(--teal-700); border-bottom-color: var(--teal-600); }
.tabs .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 99px; background: var(--surface-2); font-size: .74rem; }
.tab-panel { display: none; }
.tab-panel.on { display: block; }

/* ---------- Modais --------------------------------------------------------- */
dialog.modal { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(560px, calc(100vw - 24px)); box-shadow: var(--shadow-2); color: var(--ink); }
dialog.modal.wide { width: min(820px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(6, 44, 42, .45); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.modal-body { padding: 10px 20px 8px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px 18px; flex-wrap: wrap; }

/* ---------- Listas de definição e cronologia ------------------------------- */
.dl { display: grid; grid-template-columns: 170px 1fr; gap: 9px 16px; font-size: .9rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { display: grid; grid-template-columns: 112px 1fr; gap: 14px; padding: 8px 0; position: relative; font-size: .88rem; }
.timeline .when { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .82rem; }
.timeline .what b { font-weight: 600; }
.timeline .what span { color: var(--muted); font-size: .8rem; display: block; }
.timeline li + li { border-top: 1px dashed var(--line); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 11px 20px; border-top: 1px solid var(--line-2); }
.list-plain li:first-child { border-top: 0; }
.list-plain .l-main { min-width: 0; }
.list-plain .l-main b { display: block; font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-plain .l-main span { font-size: .8rem; color: var(--muted); }

/* ---------- Dashboard ------------------------------------------------------ */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; background: var(--teal-900); color: #E3F1EF;
  border-radius: var(--radius-lg); padding: 22px 26px; margin-bottom: 18px; position: relative; overflow: hidden; }
.hero h1 { color: #fff; font-size: 1.45rem; }
.hero p { margin: 6px 0 0; color: #A8CEC9; }
.hero .pulse { position: absolute; right: 0; bottom: 0; width: 520px; height: 100%; opacity: .16; pointer-events: none; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; position: relative; }
.hero .btn { border-color: rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .08); color: #fff; }
.hero .btn:hover { background: rgba(255, 255, 255, .16); }
.hero .btn.cta { background: #fff; color: var(--teal-900); border-color: #fff; padding: 13px 20px; font-size: 1rem; }
.hero .btn.cta:hover { background: var(--teal-50); }
.chart-box { position: relative; height: 240px; }
.bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bar-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: .86rem; }
.bar-list .bar { grid-column: 1 / -1; height: 7px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.bar-list .bar i { display: block; height: 100%; background: var(--teal-600); border-radius: 4px; }
.bar-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Assistente de orçamento --------------------------------------- */
.steps { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; padding-bottom: 2px; }
.step { flex: 1; min-width: 132px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: #fff;
  box-shadow: var(--shadow-1); border: 0; font: inherit; color: var(--muted); cursor: pointer; text-align: left; }
.step .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; font-size: .82rem; flex: none; color: var(--ink-2); }
.step b { display: block; font-size: .86rem; color: var(--ink); font-weight: 600; }
.step span { font-size: .74rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.step.on { box-shadow: 0 0 0 2px var(--teal-600); }
.step.on .n { background: var(--teal-600); color: #fff; }
.step.done .n { background: var(--teal-100); color: var(--teal-800); }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.editor-main { min-width: 0; }
.save-state { font-size: .8rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.save-state.ok { color: var(--green); }
.save-state.err { color: var(--red); }

/* O totalizador — elemento distintivo: um talão clínico sempre visível */
.tally { position: sticky; top: calc(var(--topbar-h) + 16px); background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.tally-head { background: var(--teal-900); color: #CFE6E3; padding: 16px 18px 14px; }
.tally-head .t-num { font-weight: 600; font-size: .82rem; color: #9CC7C1; }
.tally-head .t-client { color: #fff; font-weight: 650; font-size: 1rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tally-body { padding: 6px 18px 4px; max-height: 42vh; overflow: auto; }
.tally-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: .86rem; }
.tally-line .t-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tally-line .t-meta { grid-column: 1; font-size: .76rem; color: var(--muted); }
.tally-line .money { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-weight: 600; }
.tally-sum { padding: 10px 18px 4px; font-size: .88rem; }
.tally-sum div { display: flex; justify-content: space-between; padding: 3px 0; }
.tally-sum .neg { color: var(--green); }
.tally-total { margin: 8px 12px 12px; padding: 14px 14px 12px; border-radius: 11px; background: var(--teal-50); }
.tally-total .lbl { font-size: .8rem; font-weight: 600; color: var(--teal-800); display: flex; justify-content: space-between; }
.tally-total .val { font-size: 1.7rem; font-weight: 750; letter-spacing: -.02em; color: var(--teal-900); font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 2px; overflow-wrap: anywhere; }
.tally-total .val small { font-size: .9rem; font-weight: 650; }
.tally-foot { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.tally .warn { margin: 0 12px 10px; }

.client-pick { position: relative; }
.client-card { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--teal-50); }
.client-card .ico { width: 42px; height: 42px; border-radius: 10px; background: #fff; display: grid; place-items: center; color: var(--teal-700); flex: none; }
.client-card b { display: block; font-size: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font: inherit;
  font-size: .85rem; font-weight: 500; cursor: pointer; color: var(--ink); }
.chip:hover { border-color: var(--teal-500); background: var(--teal-50); }
.chip .icon { width: 14px; height: 14px; color: var(--amber); }

.group-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 40px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.group-row:last-of-type { border-bottom: 0; }
.stepper { display: flex; align-items: stretch; border: 1px solid #CFD9D7; border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.stepper button { width: 36px; border: 0; background: var(--surface-2); cursor: pointer; font-size: 1.1rem; color: var(--ink-2); font-weight: 600; }
.stepper button:hover { background: var(--teal-50); }
.stepper input { border: 0; border-radius: 0; text-align: center; font-weight: 650; min-width: 0; padding: 8px 4px; font-variant-numeric: tabular-nums; }
.stepper input:focus { box-shadow: none; }
.total-strip { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding: 12px 16px; background: var(--surface-2); border-radius: 10px; font-weight: 600; }
.total-strip b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }

.exam-group { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; background: #fff; }
.exam-group-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.exam-group-head h3 { font-size: 1rem; }
.exam-group-head .money { margin-left: auto; font-weight: 650; }
.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 8px; padding: 14px 16px 16px; }
.exam { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); cursor: pointer; background: #fff;
  user-select: none; min-width: 0; }
.exam:hover { border-color: #B7CCC8; }
.exam input { width: 17px; height: 17px; accent-color: var(--teal-600); margin: 0; flex: none; }
.exam .e-name { font-size: .86rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exam .e-price { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.exam .e-txt { min-width: 0; flex: 1; }
.exam.on { border-color: var(--teal-500); background: var(--teal-50); }
.exam.missing { border-color: #F0B7AE; }
.exam.missing .e-price { color: var(--red); font-weight: 600; }
.exam.off-default { box-shadow: inset 3px 0 0 var(--amber); }
.exam-cat { grid-column: 1 / -1; font-size: .76rem; font-weight: 650; color: var(--muted); margin-top: 4px; }
.exam-cat:first-child { margin-top: 0; }

.review-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.review-grid > div { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.review-grid span { font-size: .78rem; color: var(--muted); display: block; }
.review-grid b { font-size: 1rem; display: block; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; line-height: 1.3; }
.bottom-bar { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.mobile-total { display: none; }
@media (max-width: 1024px) {
  .mobile-total { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--teal-900); color: #fff;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); align-items: center; gap: 12px; box-shadow: 0 -6px 20px rgba(6,44,42,.25); }
  .mobile-total .mt-lbl { font-size: .74rem; color: #A8CEC9; }
  .mobile-total .mt-val { font-weight: 750; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
  .mobile-total .btn { margin-left: auto; background: #fff; color: var(--teal-900); border-color: #fff; }
  .content { padding-bottom: 96px; }
}

/* ---------- Simulador / comparador ---------------------------------------- */
.scenarios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.scenario { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-1); padding: 16px 18px; border: 2px solid transparent; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.scenario.on { border-color: var(--teal-600); }
.scenario .s-tag { font-size: .8rem; font-weight: 650; color: var(--teal-700); }
.scenario .s-total { font-size: 1.45rem; font-weight: 750; font-variant-numeric: tabular-nums; margin-top: 6px; letter-spacing: -.02em; }
.scenario .s-meta { font-size: .8rem; color: var(--muted); }
.scenario .s-diff { font-size: .78rem; font-weight: 600; margin-top: 4px; }

/* ---------- Páginas de autenticação e públicas ---------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-side { background: var(--teal-950); color: #CFE6E3; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side h1 { color: #fff; font-size: 2.1rem; max-width: 440px; letter-spacing: -.02em; }
.auth-side p { color: #9CC7C1; max-width: 420px; font-size: 1rem; }
.auth-side .pulse { position: absolute; left: 0; right: 0; bottom: 18%; width: 100%; opacity: .5; }
.auth-form { display: grid; place-items: center; padding: 32px; background: var(--surface); }
.auth-form form { width: min(380px, 100%); }
.auth-form h2 { font-size: 1.4rem; margin-bottom: 6px; }
.demo-box { margin-top: 22px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); font-size: .8rem; color: var(--muted); }
.demo-box code { font-size: .78rem; color: var(--ink); }
.public { max-width: 960px; margin: 0 auto; padding: 32px 20px 60px; }
.public-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.public-head img { max-height: 48px; max-width: 240px; }

/* ---------- Matriz de perfis ---------------------------------------------- */
.matrix { border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.matrix th, .matrix td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: center; background: #fff; }
.matrix thead th { position: sticky; top: 0; z-index: 2; font-weight: 600; color: var(--muted); vertical-align: bottom; }
.matrix thead th.rot { white-space: nowrap; padding: 10px 6px; }
.matrix thead th.rot > div { writing-mode: vertical-rl; transform: rotate(180deg); margin: 0 auto; text-align: left; max-height: 170px; overflow: hidden; text-overflow: ellipsis; }
.matrix th:first-child, .matrix td:first-child { text-align: left; position: sticky; left: 0; z-index: 1; min-width: 230px; }
.matrix tbody tr:hover td { background: var(--teal-50); }
.matrix input { width: 17px; height: 17px; accent-color: var(--teal-600); }
.matrix .cat-col { border-left: 1px solid var(--line); }

.perm-table td { text-align: center; }
.perm-table td:first-child { text-align: left; }
.perm-table input { width: 18px; height: 18px; accent-color: var(--teal-600); }

.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: 0; margin-right: 6px; }
.logo-preview { max-height: 56px; max-width: 220px; border-radius: 6px; background: var(--surface-2); padding: 6px; }
.pager { display: flex; gap: 6px; justify-content: space-between; align-items: center; padding: 12px 20px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.diff-novo td { background: var(--green-50) !important; }
.diff-removido td { background: var(--red-50) !important; text-decoration: line-through; color: var(--muted); }
.diff-alterado td { background: var(--amber-50) !important; }
.copy-box { display: flex; gap: 8px; }
.copy-box input { font-size: .82rem; }

/* ---------- Responsivo ----------------------------------------------------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .editor { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-2); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(6, 44, 42, .4); z-index: 35; }
  .menu-btn { display: grid; }
  .editor, .g-main { grid-template-columns: 1fr; }
  .tally { position: static; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scenarios { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 28px 24px; min-height: 180px; }
  .auth-side h1 { font-size: 1.5rem; }
}
@media (max-width: 720px) {
  body { font-size: 14px; }
  .content { padding: 16px 14px 90px; }
  .topbar { padding: 0 10px; gap: 6px; }
  .gsearch kbd, .user-chip .who { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid > * { grid-column: 1 / -1 !important; }
  .hero { grid-template-columns: 1fr; padding: 18px; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
  .group-row { grid-template-columns: minmax(0, 1fr) 120px 36px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .page-head h1 { font-size: 1.3rem; }
  .step > span:last-child { display: none; }
  .step { min-width: 0; padding: 8px; justify-content: center; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .tbl.stack-mobile thead { display: none; }
  .tbl.stack-mobile tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 14px; border-bottom: 1px solid var(--line-2); gap: 2px 10px; }
  .tbl.stack-mobile td { border: 0; padding: 0; }
  .tbl.stack-mobile td.hide-m { display: none; }
}
@media print {
  .sidebar, .topbar, .no-print, .flashes { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  body { background: #fff; }
}
