/* =========================================================
   Gestão da Obra · Apto 808 — design tokens e componentes
   ========================================================= */
/* Paleta e escala inspiradas na referência visual do dashboard (SaaS, azul vivo + navy). */
:root {
  --bg: #F3F6FC;
  --surface: #FFFFFF;
  --surface-2: #F7F8FC;
  --line: #E4E9F2;
  --line-strong: #D5DAE7;
  --text: #14213D;
  --text-2: #3B4766;
  --muted: #71809F;
  --accent: #246BFD;
  --accent-2: #1557E6;
  --accent-soft: #E8F0FF;
  --success: #13B76A;
  --success-2: #0E8A50;
  --success-soft: #E2F8EC;
  --purple: #873CFF;
  --purple-soft: #F0E7FF;
  --amber: #F59E0B;
  --orange: #F97316;
  --amber-soft: #FFF3D6;
  --navy-900: #0B1B49;
  --navy-800: #142D67;
  --navy-700: #1A3478;
  --sand: #B98D5C;
  --sand-soft: #F5EDE3;
  --warn: #B26A00;
  --warn-soft: #FFF4DC;
  --danger: #D93D3D;
  --danger-soft: #FDECEC;
  --info: #2457C5;
  --info-soft: #E8F0FF;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 27, 61, .04), 0 6px 20px rgba(16, 27, 61, .05);
  --shadow-lg: 0 24px 60px rgba(16, 27, 61, .22);
  --sidebar: 252px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'tnum' 1, 'cv11' 1;
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

/* Menu lateral escuro (navy) com ilustração de obra ao fundo */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); overflow: hidden;
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 55%, var(--navy-700) 100%);
  color: #E4EAFB; display: flex; flex-direction: column; padding: 22px 16px 18px; z-index: 40;
}
.sidebar > * { position: relative; z-index: 1; }
.sidebar-art { position: absolute !important; left: 0; right: 0; bottom: 120px; z-index: 0 !important; opacity: .55; pointer-events: none; }
.sidebar-art svg { width: 100%; height: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 30px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 13px; color: #fff; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #3B86FF 0%, #1557E6 100%); box-shadow: 0 8px 20px rgba(30, 107, 255, .35);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-title { font-weight: 700; font-size: 17px; letter-spacing: -.01em; color: #fff; }
.brand-sub { color: #9FB0DA; font-size: 12.5px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px;
  color: #DCE4F8; font-weight: 500; font-size: 14.5px; transition: background .15s, color .15s;
}
.nav a svg { width: 20px; height: 20px; color: #B9C6EA; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.active { background: linear-gradient(90deg, #2F7BFF, #1E6BFF); color: #fff; font-weight: 600; box-shadow: 0 8px 18px rgba(30, 107, 255, .35); }
.nav a.active svg { color: #fff; }
.nav-bottom { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 14px; }
.source { font-size: 12px; color: #9FB0DA; padding: 12px 6px 0; line-height: 1.5; }
.source .src-status { color: #fff; font-weight: 600; font-size: 13px; display: flex; align-items: center; }
.source .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; box-shadow: 0 0 0 3px rgba(255,255,255,.08); }
.btn-reload {
  margin-top: 12px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .04); color: #fff;
  border-radius: 10px; padding: 9px 12px; font-weight: 600; font-size: 13px; cursor: pointer; transition: background .15s;
}
.btn-reload:hover { background: rgba(255, 255, 255, .12); }
.btn-reload svg { width: 16px; height: 16px; }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; }
.topbar { display: none; }
.content { max-width: 1320px; margin: 0 auto; padding: 30px 36px 60px; outline: none; }
.scrim { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; letter-spacing: -.02em; margin: 0 0 4px; font-weight: 650; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong);
  background: var(--surface); padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 500;
  font-size: 13px; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  border: 0; background: transparent; width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center;
  cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 18px 22px 0; }
.card-head h2, .card-head h3 { font-size: 14px; font-weight: 600; margin: 0; letter-spacing: -.005em; }
.card-head .hint { font-size: 12px; color: var(--muted); }
.card-body { padding: 14px 22px 20px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi { padding: 18px 20px; position: relative; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi-label svg { width: 15px; height: 15px; }
.kpi-value { font-size: 25px; font-weight: 650; letter-spacing: -.025em; margin-top: 8px; white-space: nowrap; }
.kpi-value.na { font-size: 16px; font-weight: 500; color: var(--muted); letter-spacing: 0; padding: 7px 0 3px; }
.kpi-foot { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.primary { background: linear-gradient(135deg, #2F7BFF, var(--accent-2)); border-color: transparent; color: #fff; }
.kpi.primary .kpi-label, .kpi.primary .kpi-foot { color: rgba(255, 255, 255, .78); }

.strip { display: grid; grid-template-columns: repeat(4, 1fr) 1.6fr; align-items: center; margin-bottom: 14px; }
.strip > div { padding: 16px 20px; border-right: 1px solid var(--line); }
.strip > div:last-child { border-right: 0; }
.strip .s-label { font-size: 12px; color: var(--muted); }
.strip .s-value { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, #34D27A, var(--success)); border-radius: 99px; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }

.chart-box { position: relative; height: 290px; }
.chart-box.tall { height: 340px; }
.chart-note { font-size: 12px; color: var(--muted); padding: 0 22px 16px; margin-top: -6px; }
.chart-empty { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; font-size: 13px; padding: 0 20px; }

/* Lists */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.feed li:first-child { border-top: 0; }
.feed .f-main { flex: 1; min-width: 0; }
.feed .f-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .f-sub { color: var(--muted); font-size: 12px; }
.feed .f-val { font-weight: 600; white-space: nowrap; }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alerts li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-2); }
.alerts svg { width: 16px; height: 16px; color: var(--warn); flex: none; margin-top: 2px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 99px;
  font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--line);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.s-pendente { color: #59647F; background: #EEF0F6; border-color: #E1E5EF; }
.badge.s-orcando, .badge.s-em-andamento { color: var(--warn); background: var(--warn-soft); border-color: #F6DFA6; }
.badge.s-comprado, .badge.s-contratado, .badge.s-pago { color: var(--success-2); background: var(--success-soft); border-color: #C3EBD6; }
.badge.s-entregue, .badge.s-concluido, .badge.s-concluida { color: #fff; background: var(--success); border-color: var(--success); }
.badge.s-a-pagar { color: var(--info); background: var(--info-soft); border-color: #D3DDEA; }
.badge.s-pausada { color: var(--danger); background: var(--danger-soft); border-color: #EFCFCA; }
.badge.plain::before { display: none; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search { position: relative; flex: 1 1 260px; max-width: 420px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search input { padding-left: 34px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 9px; padding: 8px 11px;
  outline: none; transition: border-color .15s, box-shadow .15s; min-height: 38px;
}
.select { width: auto; padding-right: 30px; 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='%237A807D' stroke-width='2.2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { min-height: 76px; resize: vertical; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); padding: 6px 12px; border-radius: 99px; cursor: pointer;
  font-size: 12.5px; color: var(--text-2); font-weight: 500;
}
.chip .n { color: var(--muted); margin-left: 4px; font-weight: 400; }
.chip.active { background: var(--text); border-color: var(--text); color: #fff; }
.chip.active .n { color: rgba(255,255,255,.7); }

/* Category groups + item rows */
.group { margin-bottom: 14px; overflow: hidden; }
.group-head {
  display: flex; align-items: center; gap: 14px; padding: 15px 20px; cursor: pointer; user-select: none; border: 0; width: 100%;
  background: transparent; text-align: left;
}
.group-head .chev { width: 18px; height: 18px; color: var(--muted); transition: transform .2s; flex: none; }
.group.closed .chev { transform: rotate(-90deg); }
.group-title { font-weight: 600; font-size: 15px; }
.group-meta { color: var(--muted); font-size: 12.5px; }
.group-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.mini-progress { width: 110px; }
.group-body { border-top: 1px solid var(--line); }
.group.closed .group-body { display: none; }
.rows { width: 100%; border-collapse: collapse; }
.rows th { text-align: left; font-size: 11.5px; font-weight: 500; color: var(--muted); padding: 9px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.rows td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rows tr:last-child td { border-bottom: 0; }
.rows tbody tr { cursor: pointer; transition: background .12s; }
.rows tbody tr:hover { background: var(--surface-2); }
.rows .num { text-align: right; white-space: nowrap; }
.rows th:first-child, .rows td:first-child { padding-left: 20px; }
.rows th:last-child, .rows td:last-child { padding-right: 20px; }
.it-name { font-weight: 500; }
.it-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.na { color: var(--muted); font-style: normal; font-size: 12.5px; }
.tag { font-size: 11px; color: var(--sand); background: var(--sand-soft); padding: 1px 7px; border-radius: 6px; margin-left: 6px; font-weight: 500; }
.obs-dot { color: var(--muted); }
.obs-dot svg { width: 15px; height: 15px; }

/* Tables (finance) */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 500; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); }
.tbl th:first-child, .tbl td:first-child { padding-left: 22px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 22px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 16px; }
.tab { border: 0; background: transparent; padding: 12px 10px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab .n { font-weight: 400; margin-left: 4px; }

/* Empty / notices */
.empty { text-align: center; padding: 44px 24px; color: var(--muted); }
.empty svg { width: 30px; height: 30px; margin: 0 auto 10px; color: var(--line-strong); }
.empty h3 { color: var(--text); font-size: 15px; margin: 0 0 6px; font-weight: 600; }
.empty p { max-width: 520px; margin: 0 auto 14px; font-size: 13px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 11px; font-size: 13px; margin-bottom: 16px; border: 1px solid; }
.notice svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.notice.info { background: var(--info-soft); border-color: #CFDDFB; color: #1E3F8A; }
.notice.warn { background: var(--warn-soft); border-color: #F6DFA6; color: #7A4A00; }
.notice.error { background: var(--danger-soft); border-color: #F6C9C9; color: #8A1F1F; }
.notice b { font-weight: 600; }
#banner .notice { margin: 16px 36px 0; max-width: 1248px; }
@media (min-width: 1392px) { #banner .notice { margin-left: auto; margin-right: auto; } }

/* Supplier cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.sup { padding: 18px 20px; }
.sup-name { font-weight: 600; font-size: 15px; }
.sup-meta { color: var(--muted); font-size: 12.5px; margin: 4px 0 12px; }
.sup-row { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; border-top: 1px solid var(--line); }
.avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--sand-soft); color: var(--sand); display: grid; place-items: center; font-weight: 600; margin-bottom: 12px; }

/* Definition list (detail) */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 0; }
.dl dt, .dl dd { padding: 9px 0; border-top: 1px solid var(--line); margin: 0; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dt:first-of-type, .dl dd:first-of-type { border-top: 0; }

/* ---------- Modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(20, 26, 24, .38); animation: fade .15s; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(620px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: rise .18s; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.modal-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field .help { font-size: 11.5px; color: var(--muted); }
.form-error { grid-column: 1 / -1; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* Toast */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 120; }
.toast { background: var(--text); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px; max-width: 360px; animation: rise .18s; }
.toast.error { background: var(--danger); }

/* Loading */
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 120px 0; color: var(--muted); }
.spinner { width: 20px; height: 20px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #E9ECF4 0, #F3F5FA 50%, #E9ECF4 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.muted { color: var(--muted); }
.mt { margin-top: 14px; }
.right { text-align: right; }
.section-title { font-size: 13px; font-weight: 600; margin: 26px 0 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Responsivo ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .strip { grid-template-columns: repeat(4, 1fr); }
  .strip > div:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .strip > div:nth-child(4) { border-right: 0; }
  .span-7, .span-5, .span-8, .span-4 { grid-column: span 12; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(20, 26, 24, .32); z-index: 30; }
  .main { margin-left: 0; }
  .topbar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20; padding: 8px 10px;
    background: rgba(244, 246, 251, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  }
  .topbar-title { font-weight: 600; flex: 1; }
  .content { padding: 18px 16px 48px; }
  #banner .notice { margin: 12px 16px 0; }
  .page-head h1 { font-size: 21px; }
  .page-head .actions .btn-refresh { display: none; }
}
@media (max-width: 640px) {
  .kpis { gap: 10px; }
  .kpi { padding: 14px 15px; }
  .kpi-value { font-size: 19px; }
  .strip { grid-template-columns: 1fr 1fr; }
  .strip > div { padding: 12px 15px; border-bottom: 1px solid var(--line); }
  .strip > div:nth-child(2) { border-right: 0; }
  .chart-box { height: 260px; }
  .form-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { border-top: 1px solid var(--line); padding-bottom: 0; font-size: 12px; }
  .dl dd { border-top: 0; padding-top: 2px; }
  .modal-root { padding: 0; place-items: end stretch; }
  .modal { width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; }
  .group-head { padding: 14px 16px; flex-wrap: wrap; }
  .group-right { width: 100%; margin-left: 32px; justify-content: space-between; }
  /* tabela → cartões */
  .rows thead, .tbl.stack thead { display: none; }
  .rows, .rows tbody, .rows tr, .rows td, .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
  .rows tr, .tbl.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
  .rows td, .tbl.stack td { padding: 0 !important; border: 0; text-align: left; }
  .rows td.c-main, .tbl.stack td.c-main { grid-column: 1 / -1; }
  .rows td.c-hide, .tbl.stack td.c-hide { display: none; }
  .rows td.num, .tbl.stack td.num { text-align: right; }
  .rows td[data-l]::before, .tbl.stack td[data-l]::before { content: attr(data-l) ' '; color: var(--muted); font-size: 11.5px; }
  .tbl.stack tfoot { display: block; }
  .tbl.stack tfoot tr { background: var(--surface-2); }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
}

/* =========================================================
   Notas fiscais — envio, revisão e documentos
   ========================================================= */
.modal.wide { width: min(1040px, 100%); }
.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2);
  padding: 34px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  transition: border-color .15s, background .15s; outline: none;
}
.dropzone:focus-visible, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dz-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 4px; }
.dz-icon svg { width: 22px; height: 22px; }
.dz-title { font-weight: 600; font-size: 15px; }
.dz-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.file-card { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.fc-thumb { width: 52px; height: 52px; border-radius: 9px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; }
.fc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fc-thumb svg { width: 24px; height: 24px; }
.fc-main { flex: 1; min-width: 0; }
.fc-main .it-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#nf-err .notice { margin: 12px 0 0; }

.processing { padding: 18px 4px 6px; }
.steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 12px; }
.steps li { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.steps li.active { color: var(--text); font-weight: 500; }
.steps li.done { color: var(--text-2); }
.st-dot { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; flex: none; }
.steps li.active .st-dot { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.steps li.done .st-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.st-dot svg { width: 13px; height: 13px; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; border-top-color: #fff; border-color: rgba(255,255,255,.4); border-top-color: #fff; }

.nf-head { grid-template-columns: repeat(4, 1fr); }
.nf-head .span2 { grid-column: span 2; }
.input.missing { border-color: #E7CF9F; background: #FFFCF5; }
.input.missing::placeholder { color: var(--warn); opacity: .8; }

.nf-line { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 14px 16px; margin-bottom: 10px; display: grid; gap: 10px; transition: opacity .15s; }
.nf-line.off { opacity: .55; background: var(--surface-2); }
.nl-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.nl-n { color: var(--muted); font-size: 12px; }
.nl-top .conf { margin-left: auto; }
.nl-desc { font-weight: 500; }
.nl-nums { display: grid; grid-template-columns: 90px 80px 1fr 1fr auto; gap: 10px; align-items: end; }
.nl-assoc, .nl-new { display: flex; gap: 10px; flex-wrap: wrap; }
.mini { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.mini.grow { flex: 1 1 260px; }
.mini .select { width: 100%; }
.nl-warn { display: inline-flex; align-items: center; gap: 6px; color: var(--warn); font-size: 12px; padding-bottom: 9px; }
.nl-warn svg { width: 15px; height: 15px; }
.nl-sug, .nl-info { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.nl-sug { background: var(--warn-soft); border: 1px solid #F1E0BE; border-radius: 9px; padding: 8px 10px; }
.nl-sug svg { width: 15px; height: 15px; color: var(--warn); flex: none; }
.nl-sug span { flex: 1 1 260px; }
.nl-info { color: var(--muted); }
.conf { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.c-alta { background: var(--success-soft); color: var(--success-2); }
.c-provavel { background: var(--warn-soft); color: var(--warn); }
.c-nenhuma { background: #F2F2EF; color: var(--muted); }
.c-manual { background: var(--info-soft); color: var(--info); }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.chk input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

.tg { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.tg:first-child { border-top: 0; padding-top: 0; }
.tg-head { display: flex; justify-content: space-between; gap: 14px; }
.tg-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.tg-row svg { width: 15px; height: 15px; color: var(--accent); }
.tg-conflict { display: flex; gap: 10px; background: var(--warn-soft); border: 1px solid #F1E0BE; border-radius: 10px; padding: 10px 12px; font-size: 13px; color: #6F4B12; }
.tg-conflict > svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--warn); }
.radios { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

details.raw { margin-top: 18px; font-size: 12.5px; }
details.raw summary { cursor: pointer; color: var(--muted); }
details.raw pre { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 260px; overflow: auto; font-size: 11.5px; }
.foot-err { margin-right: auto; color: var(--danger); font-size: 12.5px; align-self: center; }
.confirm-box { margin-right: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); max-width: 640px; }
.confirm-box svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.doc-ic { width: 32px; height: 32px; border-radius: 9px; background: var(--sand-soft); color: var(--sand); display: grid; place-items: center; flex: none; }
.doc-ic svg { width: 16px; height: 16px; }
.modal .feed li { align-items: center; }

@media (max-width: 640px) {
  .nf-head { grid-template-columns: 1fr 1fr; }
  .nf-head .span2, .nf-head .full { grid-column: 1 / -1; }
  .nl-nums { grid-template-columns: 1fr 1fr; }
  .nl-top .conf { margin-left: 0; }
  .modal-foot { flex-wrap: wrap; }
  .confirm-box, .foot-err { flex-basis: 100%; }
  .tg-head { flex-direction: column; gap: 4px; }
  .tg-head .right { text-align: left; }
}

/* =========================================================
   Visão geral (dashboard) — identidade da referência visual
   ========================================================= */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Tons reutilizáveis (ícones em círculo, painéis, barras) */
.t-blue   { --tone: #246BFD; --tone-soft: #E8F0FF; }
.t-green  { --tone: #13B76A; --tone-soft: #E2F8EC; }
.t-purple { --tone: #873CFF; --tone-soft: #F0E7FF; }
.t-pink   { --tone: #EC4899; --tone-soft: #FDE7F3; }
.t-red    { --tone: #EF4444; --tone-soft: #FDE8E8; }
.t-cyan   { --tone: #0EA5E9; --tone-soft: #E0F4FD; }
.t-gray   { --tone: #71809F; --tone-soft: #EEF1F7; }
.t-orange { --tone: #F97316; --tone-soft: #FFEEDF; }
.t-amber  { --tone: #F59E0B; --tone-soft: #FFF4DC; }

.page { display: grid; gap: 18px; }
.ph { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px 18px; flex-wrap: wrap; }
.ph > .ph-text { flex: 1 1 320px; min-width: 0; }
.ph-actions { flex: 0 1 auto; justify-content: flex-end; }
.ph h1 { margin: 0; font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -.025em; color: var(--text); }
.ph-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; color: var(--muted); font-size: 13.5px; }
.ph-meta span { display: inline-flex; align-items: center; gap: 6px; }
.ph-meta svg { width: 15px; height: 15px; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.period {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 10px; cursor: default;
  background: var(--surface); border: 1px solid var(--line-strong); font-weight: 600; font-size: 13px; color: var(--text);
}
.period svg, .ph-actions .btn svg { width: 17px; height: 17px; }
.ph-actions .btn { height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px; }
.btn-o-purple { border: 1.5px solid #8B5CF6; color: #6D28D9; background: var(--surface); }
.btn-o-purple:hover { background: var(--purple-soft); border-color: #7C3AED; }
.btn-o-green { border: 1.5px solid #22B573; color: var(--success-2); background: var(--surface); }
.btn-o-green:hover { background: var(--success-soft); border-color: var(--success); }
.btn-blue { background: linear-gradient(135deg, #2F7BFF, var(--accent-2)); border: 0; color: #fff; box-shadow: 0 6px 16px rgba(30, 107, 255, .3); }
.btn-blue:hover { filter: brightness(1.06); background: linear-gradient(135deg, #2F7BFF, var(--accent-2)); }

/* Cards de indicador */
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi-card {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 22px 20px 26px;
  display: flex; gap: 14px; align-items: flex-start; min-height: 138px; box-shadow: var(--shadow);
  --k-t: var(--text); --k-v: var(--text); --k-f: var(--text-2); --k-ic: var(--accent); --k-wave: rgba(255,255,255,.5);
}
.kpi-ic { width: 46px; height: 46px; border-radius: 50%; background: var(--k-ic); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 6px 14px rgba(16,27,61,.12); }
.kpi-ic svg { width: 22px; height: 22px; }
.kpi-body { position: relative; z-index: 1; min-width: 0; }
.kpi-t { font-weight: 700; font-size: 15px; color: var(--k-t); }
.kpi-v { font-weight: 800; font-size: 27px; letter-spacing: -.02em; line-height: 1.2; margin-top: 6px; color: var(--k-v); white-space: nowrap; }
.kpi-v.na { font-size: 19px; font-weight: 700; opacity: .75; }
.kpi-f { font-size: 13px; line-height: 1.4; margin-top: 6px; color: var(--k-f); }
.kpi-wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 46px; z-index: 0; }
.kpi-wave path { fill: var(--k-wave); }
.kpi-wave .w2 { opacity: .6; }
.k-blue   { background: linear-gradient(135deg, #2F7BFF 0%, #1557E6 100%); --k-t: #fff; --k-v: #fff; --k-f: rgba(255,255,255,.88); --k-ic: rgba(255,255,255,.2); --k-wave: rgba(255,255,255,.12); }
.k-blue .kpi-ic { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35); }
.k-green  { background: linear-gradient(135deg, #E9FBF2 0%, #C8F1DB 100%); --k-t: #0E7A47; --k-v: #0A3D2A; --k-f: #2F5B47; --k-ic: #16B26A; --k-wave: rgba(22,168,100,.14); }
.k-purple { background: linear-gradient(135deg, #F5EEFF 0%, #E2D3FF 100%); --k-t: #6D28D9; --k-v: #5B21B6; --k-f: #4C3A72; --k-ic: #8B5CF6; --k-wave: rgba(124,58,237,.12); }
.k-amber  { background: linear-gradient(135deg, #FFF8E6 0%, #FFE3A6 100%); --k-t: #B45309; --k-v: #C2410C; --k-f: #6B4A1B; --k-ic: #F59E0B; --k-wave: rgba(245,158,11,.16); }
.kpi-card.sk { background: linear-gradient(90deg, #E9ECF4 0, #F3F5FA 50%, #E9ECF4 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; box-shadow: none; }

/* Faixa de itens */
.stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.25fr) minmax(0, 1.3fr); align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 6px;
}
.st { display: flex; align-items: center; gap: 12px; padding: 4px 16px; border-right: 1px solid var(--line); min-width: 0; }
.st:last-child { border-right: 0; }
.st-ic { width: 42px; height: 42px; border-radius: 50%; background: var(--tone-soft); color: var(--tone); display: grid; place-items: center; flex: none; }
.st-ic svg { width: 21px; height: 21px; stroke-width: 2.1; }
.st-l { font-size: 13px; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.st-v { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.2; letter-spacing: -.01em; }
.st-of { color: #4F6BD8; font-weight: 700; font-size: 18px; }
.st-progress { flex-direction: column; align-items: stretch; gap: 10px; }
.st-progress .st-l { display: flex; justify-content: space-between; }
.st-progress .st-l b { color: var(--text); font-weight: 800; font-size: 15px; }
.st-progress .progress { height: 10px; background: var(--track, #E7EAF2); }

/* Painéis (gráficos e listas) */
.grid12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.g-7 { grid-column: span 7; } .g-5 { grid-column: span 5; }
.g-8 { grid-column: span 8; } .g-4 { grid-column: span 4; } .g-12 { grid-column: span 12; } .g-6 { grid-column: span 6; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px 18px; min-width: 0; }
.panel-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.panel-h h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.panel-h .hint { margin-left: auto; font-size: 12.5px; color: var(--muted); text-align: right; }
.panel-ic { color: var(--tone); display: grid; place-items: center; }
.panel-ic svg { width: 24px; height: 24px; stroke-width: 2; }
.panel .chart-note { padding: 6px 0 0; margin: 0; }
.panel .chart-box.tall { height: 310px; }

/* Linha do tempo */
.timeline { list-style: none; margin: 6px 0 0; padding: 0; }
.timeline li { position: relative; display: flex; gap: 14px; align-items: flex-start; padding: 8px 0 14px; }
.timeline li:not(:last-child)::before { content: ''; position: absolute; left: 21px; top: 52px; bottom: -6px; width: 2px; background: #E3E6F0; }
.tl-ic { width: 44px; height: 44px; border-radius: 50%; background: var(--tone-soft); color: var(--tone); display: grid; place-items: center; flex: none; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.tl-ic svg { width: 20px; height: 20px; }
.tl-main { flex: 1; min-width: 0; padding-top: 3px; }
.tl-t { font-weight: 700; color: var(--text); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tl-v { font-weight: 700; white-space: nowrap; padding-top: 3px; }

/* Pontos de atenção */
.attention {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 18px 24px; border-radius: var(--radius);
  background: linear-gradient(90deg, #FFF6E0 0%, #FFF9EE 60%, #FFF4DC 100%); border: 1px solid #F8DFA2; box-shadow: var(--shadow);
}
.at-head { display: flex; align-items: center; gap: 14px; padding-right: 22px; border-right: 1px solid #F3D99A; }
.at-big { color: var(--orange); }
.at-big svg { width: 44px; height: 44px; }
.at-head h2 { margin: 0; font-size: 20px; font-weight: 800; color: var(--text); white-space: nowrap; }
.at-list { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 0; overflow: hidden; }
/* divisor à esquerda; o da 1ª coluna fica fora da área visível (overflow) */
.at-item { display: flex; align-items: center; gap: 12px; padding: 4px 18px; box-shadow: -1px 0 0 #F3D99A; font-size: 14px; color: var(--text); font-weight: 500; }
.at-ic { width: 42px; height: 42px; border-radius: 50%; background: #FFE7CC; color: #EA580C; display: grid; place-items: center; flex: none; }
.at-ic.ok { background: var(--success-soft); color: var(--success); }
.at-ic svg { width: 20px; height: 20px; }

/* Responsivo do dashboard */
@media (max-width: 1280px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 14px; }
  .st-progress { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 14px; }
  .st:nth-child(4) { border-right: 0; }
  .st-l { white-space: normal; }
}
@media (max-width: 1080px) {
  .g-7, .g-5, .g-8, .g-4, .g-6 { grid-column: span 12; }
  .at-head { border-right: 0; padding-right: 0; flex-basis: 100%; }
  .at-item { box-shadow: none; padding-left: 0; }
}
@media (max-width: 760px) {
  .ph h1 { font-size: 24px; }
  .ph-actions { width: 100%; }
  .ph-actions .btn { flex: 1 1 auto; justify-content: center; }
  .period { flex: 1 1 100%; justify-content: center; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px 4px; }
  .st { border-right: 0; padding: 10px 12px; }
  .panel { padding: 16px; }
  .panel-h { flex-wrap: wrap; }
  .panel-h .hint { flex-basis: 100%; margin-left: 34px; text-align: left; }
  .panel .chart-box.tall { height: 280px; }
}
@media (max-width: 560px) {
  .kpi-row { grid-template-columns: 1fr; }
  .kpi-card { min-height: 0; }
  .kpi-v { font-size: 24px; }
  .attention { padding: 16px; }
}

/* =========================================================
   Componentes compartilhados entre as telas
   ========================================================= */
.ph-meta p { margin: 0; }
.panel-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel-h .hint + .panel-actions { margin-left: 12px; }
.panel-b > .table-wrap { margin: 0 -22px -18px; }
.panel-b .tbl th { background: var(--surface-2); }
.kpi-row.c5 { grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.25fr); }
.kpi-card .progress { margin-top: 12px; background: rgba(19, 183, 106, .18); height: 10px; }
.kpi-row.compact .kpi-card { min-height: 112px; padding: 18px 18px 22px; }
.kpi-row.compact .kpi-v { font-size: 25px; }

/* Barras de progresso por tom */
.progress { background: #E7EAF2; }
.progress.p-amber > span { background: linear-gradient(90deg, #FBBF24, var(--amber)); }
.progress.p-blue > span { background: linear-gradient(90deg, #4C8BFF, var(--accent)); }
.progress.p-purple > span { background: linear-gradient(90deg, #A66BFF, var(--purple)); }
.progress.p-gray > span { background: #C9CEDD; }
.pct { font-weight: 800; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Filtros */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters .search { flex: 1 1 280px; max-width: 460px; }
.filters .search .input, .filters .select { height: 42px; border-radius: 11px; background-color: var(--surface); }
.filters .chips { flex-basis: 100%; }
.chip { height: 34px; padding: 0 14px; border-radius: 99px; font-weight: 600; font-size: 13px; color: var(--text); border-color: var(--line-strong); background: var(--surface); }
.chip .n { color: var(--muted); font-weight: 500; }
.chip.active { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 11px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; height: 40px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--text-2); cursor: pointer; }
.seg button svg { width: 17px; height: 17px; }
.seg button.active { background: var(--accent); color: #fff; }

/* Tabelas dentro de painéis */
.tbl td { color: var(--text); }
.tbl tfoot td { background: var(--surface-2); font-weight: 800; }
.tbl .money { font-weight: 700; white-space: nowrap; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover td { background: #F7F9FE; }
.icon-act { width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); display: inline-grid; place-items: center; cursor: pointer; }
.icon-act:hover { background: var(--accent-soft); color: var(--accent); }
.icon-act svg { width: 17px; height: 17px; }
.th-ic { display: inline-flex; align-items: center; gap: 6px; }
.th-ic svg { width: 14px; height: 14px; }

/* Estado vazio dentro de painel */
.panel .empty { padding: 34px 20px; }
.empty .empty-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--tone-soft, var(--accent-soft)); color: var(--tone, var(--accent)); display: grid; place-items: center; margin: 0 auto 14px; }
.empty .empty-ic svg { width: 28px; height: 28px; margin: 0; color: inherit; }

/* Seção com título (fora de painel) */
.section-h { display: flex; align-items: center; gap: 10px; margin: 6px 0 -4px; }
.section-h h2 { margin: 0; font-size: 19px; font-weight: 800; color: var(--text); }
.section-h h2 span { color: var(--muted); font-weight: 600; }
.section-h .panel-ic svg { width: 26px; height: 26px; }

@media (max-width: 1280px) {
  .kpi-row.c5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .filters .chips { margin-left: 0; }
  .filters .search { max-width: none; }
  .kpi-row.c5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-b > .table-wrap { margin: 0 -16px -16px; }
}
@media (max-width: 560px) {
  .kpi-row.c5 { grid-template-columns: 1fr; }
}

/* =========================================================
   Materiais e itens — cards de categoria (recolhidos/abertos)
   ========================================================= */
.cats { display: grid; gap: 12px; }
.cat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cat-head {
  width: 100%; border: 0; background: transparent; cursor: pointer; text-align: left; display: grid; align-items: center; gap: 16px;
  grid-template-columns: 22px 48px minmax(0, 1fr) 150px minmax(120px, 170px) 104px; padding: 16px 22px;
}
.cat-head:hover { background: #FAFBFE; }
.cat-chev { color: var(--text-2); transition: transform .2s; display: grid; place-items: center; }
.cat-chev svg { width: 20px; height: 20px; stroke-width: 2.2; }
.cat.open .cat-chev { transform: rotate(90deg); }
.cat-ic { width: 48px; height: 48px; border-radius: 13px; background: var(--tone-soft); color: var(--tone); display: grid; place-items: center; }
.cat-ic svg { width: 25px; height: 25px; stroke-width: 2; }
.cat-title { min-width: 0; display: flex; flex-direction: column; }
.cat-title b { font-size: 18px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.cat-title small { font-size: 13px; color: var(--muted); margin-top: 2px; }
.cat-status { justify-self: center; }
.cat-status .badge { font-size: 13px; padding: 4px 12px 4px 10px; }
.cat .pct { text-align: right; font-size: 17px; }
.cat .pct small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.cat-body { display: none; border-top: 1px solid var(--line); }
.cat.open .cat-body { display: block; animation: fade .18s; }
.tbl.items th { background: var(--surface-2); font-size: 12px; }
.tbl.items td { padding-top: 11px; padding-bottom: 11px; vertical-align: middle; }
.tbl.items .c-spec { color: var(--text-2); max-width: 220px; min-width: 140px; }
.tbl.items td.c-main { min-width: 250px; }
.tbl.items .it-name { display: flex; align-items: center; gap: 6px; }
.tbl.items .obs-dot svg { width: 14px; height: 14px; }
.tbl.items .it-sub { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .acts { text-align: right; white-space: nowrap; }

@media (max-width: 1080px) {
  .cat-head { grid-template-columns: 22px 44px minmax(0, 1fr) 120px 88px; }
  .cat-status { display: none; }
}
@media (max-width: 640px) {
  .cat-head { grid-template-columns: 18px 40px minmax(0, 1fr) auto; gap: 10px 12px; padding: 14px; }
  .cat-ic { width: 40px; height: 40px; border-radius: 11px; }
  .cat-title b { font-size: 16px; }
  .cat-prog { grid-column: 2 / 4; }
  .cat .pct { grid-row: 2; grid-column: 4; font-size: 14px; }
  .tbl.stack.items td.acts { grid-column: 2; grid-row: 1; text-align: right; }
  .tbl.items .it-sub, .tbl.items .c-spec { max-width: none; white-space: normal; }
}

/* =========================================================
   Financeiro
   ========================================================= */
.stack-col { display: grid; gap: 16px; align-content: start; }
.panel .chart-box { height: 230px; }
.panel .chart-box.short { height: 220px; }
.tabs-panel { padding: 0; overflow: hidden; }
.tabs-bar { display: flex; align-items: center; gap: 14px; padding: 0 18px 0 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs-bar .tabs { border-bottom: 0; padding: 0 8px; }
.tabs-bar .search { margin-left: auto; flex: 0 1 340px; margin-top: 8px; margin-bottom: 8px; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 16px 12px; font-weight: 600; font-size: 14px; }
.tab svg { width: 17px; height: 17px; }
.tab.active { color: var(--accent); border-bottom-width: 2.5px; }
.tab .n { font-weight: 700; }
.tabs-panel .table-wrap { margin: 0; }
.tabs-panel .empty { padding: 40px 20px; }
@media (max-width: 760px) {
  .tabs-bar { padding: 0 12px; }
  .tabs-bar .search { flex: 1 1 100%; margin-top: 0; }
}
.tbl.compact th, .tbl.compact td { padding: 9px 8px; font-size: 13px; }
.tbl.compact th:first-child, .tbl.compact td:first-child { padding-left: 22px; }
.tbl.compact th:last-child, .tbl.compact td:last-child { padding-right: 22px; }
.tbl.compact td.c-main b { font-weight: 700; white-space: nowrap; }
.tbl.compact .it-sub { white-space: nowrap; font-size: 11.5px; }
.panel .chart-box { height: 260px; }
.tabs-panel .tbl td.c-main { min-width: 260px; }

/* =========================================================
   Fornecedores — cards de prestadores e fornecedores
   ========================================================= */
.sup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.sup-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; }
.sup-h { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.sup-av { width: 42px; height: 42px; border-radius: 11px; background: var(--tone-soft); color: var(--tone); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.sup-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sup-t b { font-size: 15px; font-weight: 800; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-t small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sup-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.sup-k { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); white-space: nowrap; }
.sup-k svg { width: 15px; height: 15px; }
.sup-v { text-align: right; color: var(--text); }
.sup-v b { font-weight: 800; }
.sup-f { display: flex; gap: 10px; margin-top: auto; padding-top: 14px; }
.sup-f .btn { flex: 1; justify-content: center; height: 38px; }
.tbl .sup-av { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; }
.empty .actions { margin-top: 6px; }

/* =========================================================
   Andamento da obra
   ========================================================= */
.step { display: flex; align-items: center; gap: 12px; }
.step-dot { width: 30px; height: 30px; border-radius: 50%; background: var(--tone); color: #fff; display: grid; place-items: center; flex: none; }
.step-dot svg { width: 16px; height: 16px; stroke-width: 2.6; }
.steps-tbl .c-obs { max-width: 260px; color: var(--text-2); font-size: 12.5px; }
.prog-line { display: flex; align-items: center; gap: 12px; min-width: 180px; }
.prog-line .progress { flex: 1; height: 9px; }
.prog-line .pct { min-width: 40px; text-align: right; }
.attention.vertical { flex-direction: column; align-items: stretch; height: 100%; gap: 14px; }
.attention.vertical .at-head { border-right: 0; padding-right: 0; }
.attention.vertical .at-list { grid-template-columns: 1fr; gap: 8px; overflow: visible; }
.attention.vertical .at-item { box-shadow: none; background: rgba(255, 255, 255, .7); border-radius: 12px; padding: 10px 14px; }
