/* ============================================================
   ObraIA — Design System
   ============================================================ */

:root {
  --brand: #2563eb;
  --brand-600: #1d4ed8;
  --brand-700: #1e40af;
  --brand-soft: #eff6ff;
  --accent: #f59e0b;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;

  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #1e293b;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, 0.14);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'SF Mono', ui-monospace, 'Cascadia Code', Menlo, monospace;
}

[data-theme='dark'] {
  --bg: #0b1220;
  --surface: #131c2e;
  --surface-2: #182238;
  --surface-3: #1e2a42;
  --border: #263349;
  --border-strong: #334155;
  --text: #e8eefc;
  --text-2: #a8b6cd;
  --text-3: #6d7f99;
  --brand-soft: #16233d;
  --sidebar-bg: #070d18;
  --sidebar-active: #16233d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 56px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
h1 { font-size: 28px; }
h2 { font-size: 21px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------------- Botões ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all .16s ease;
  white-space: nowrap; line-height: 1.2; text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .28); }
.btn-primary:hover { background: var(--brand-600); }
.btn-outline { border-color: var(--border-strong); background: var(--surface); color: var(--text); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-soft { background: var(--brand-soft); color: var(--brand-700); }
[data-theme='dark'] .btn-soft { color: #93b4ff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-xs { padding: 4px 8px; font-size: 11.5px; }
.btn-lg { padding: 13px 26px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { padding: 7px; width: 32px; height: 32px; }

/* ---------------- Formulários ---------------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field input, .field select, .field textarea,
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus,
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
.field input::placeholder, textarea::placeholder { color: var(--text-3); }
.field small { display: block; margin-top: 4px; color: var(--text-3); font-size: 11.5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.field-sm { max-width: 120px; }
textarea { resize: vertical; min-height: 70px; }

.check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; margin: 10px 0; }
.check input { width: 15px; height: 15px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--brand); }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.switch input { appearance: none; width: 38px; height: 21px; background: var(--border-strong); border-radius: 99px; position: relative; cursor: pointer; transition: background .2s; flex: 0 0 auto; }
.switch input:checked { background: var(--brand); }
.switch input::after { content: ''; position: absolute; top: 2.5px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .2s; }
.switch input:checked::after { transform: translateX(17px); }

/* ---------------- Alertas ---------------- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.alert[hidden] { display: none; }
.alert-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-info { background: var(--brand-soft); color: var(--brand-700); border-color: #bfdbfe; }
.alert-warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
[data-theme='dark'] .alert-error { background: #40161a; color: #fca5a5; border-color: #7f1d1d; }
[data-theme='dark'] .alert-success { background: #0d2e22; color: #6ee7b7; border-color: #065f46; }
[data-theme='dark'] .alert-info { background: #16233d; color: #93b4ff; border-color: #1o3a6b; }
[data-theme='dark'] .alert-warn { background: #3a2a0a; color: #fcd34d; border-color: #78530f; }

/* ---------------- Landing ---------------- */
.landing { background: var(--surface); }
.landing-header {
  max-width: 1160px; margin: 0 auto; padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--text); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; font-size: 12.5px; font-weight: 800;
}
.landing-nav { display: flex; gap: 10px; align-items: center; }

.hero {
  max-width: 1160px; margin: 0 auto; padding: 56px 24px 64px;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center;
}
.hero-content h1 { font-size: 46px; line-height: 1.08; margin-bottom: 18px; }
.grad { background: linear-gradient(135deg, #2563eb, #7c3aed 60%, #db2777); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-content > p { font-size: 16.5px; color: var(--text-2); max-width: 560px; }
.pill {
  display: inline-block; padding: 5px 12px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand-700); margin-bottom: 18px;
}
[data-theme='dark'] .pill { color: #93b4ff; }
.hero-actions { display: flex; gap: 12px; margin: 26px 0 14px; flex-wrap: wrap; }
.hero-note { font-size: 12.5px; color: var(--text-3); }

.hero-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 26px; box-shadow: var(--shadow);
}
.hero-card h3 { margin-bottom: 16px; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.hero-card-foot { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border-strong); font-size: 12px; color: var(--text-3); }

.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.check-list li { position: relative; padding-left: 24px; font-size: 13.5px; color: var(--text-2); }
.check-list li::before {
  content: '✓'; position: absolute; left: 0; top: -1px; width: 17px; height: 17px;
  display: grid; place-items: center; font-size: 10px; font-weight: 800;
  background: #d1fae5; color: #047857; border-radius: 50%;
}
[data-theme='dark'] .check-list li::before { background: #064e3b; color: #6ee7b7; }

.features {
  max-width: 1160px; margin: 0 auto; padding: 0 24px 80px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px;
}
.feature { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.feature h3 { margin-bottom: 8px; font-size: 15px; }
.feature p { font-size: 13px; color: var(--text-2); }
.landing-footer {
  border-top: 1px solid var(--border); padding: 22px 24px; max-width: 1160px; margin: 0 auto;
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-3);
}

/* ---------------- Auth ---------------- */
.auth-body { background: var(--bg); }
.auth-wrap { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-aside {
  background: linear-gradient(160deg, #0f172a, #1e293b 55%, #1e3a8a);
  color: #e2e8f0; padding: 48px; display: flex; flex-direction: column; gap: 22px; justify-content: center;
}
.auth-aside .brand { color: #fff; margin-bottom: 12px; }
.auth-aside .brand-mark { background: rgba(255,255,255,.14); }
.auth-aside h2 { font-size: 29px; line-height: 1.2; max-width: 420px; }
.auth-aside .check-list li { color: #cbd5e1; }
.auth-aside .check-list li::before { background: rgba(255,255,255,.14); color: #fff; }
.auth-aside-foot { font-size: 11.5px; color: #94a3b8; max-width: 380px; }
.auth-card {
  display: flex; flex-direction: column; justify-content: center;
  padding: 48px max(48px, 8vw); background: var(--surface); max-width: 560px; width: 100%;
  margin: 0 auto;
}
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-sub { color: var(--text-2); font-size: 13.5px; margin-bottom: 24px; }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; font-size: 12.5px; }
.auth-row .check { margin: 0; }
.auth-alt { margin-top: 20px; font-size: 13px; color: var(--text-2); text-align: center; }

/* ---------------- App shell ---------------- */
.app-body { background: var(--bg); }
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40;
}
.sidebar-head { padding: 20px 18px 16px; display: flex; align-items: center; justify-content: space-between; }
.sidebar .brand { color: #fff; font-size: 16px; }
.side-nav { padding: 8px 10px; flex: 1; overflow-y: auto; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: var(--sidebar-text); font-size: 13.5px; font-weight: 500; margin-bottom: 2px; cursor: pointer;
}
.side-nav a:hover { background: var(--sidebar-active); color: #fff; text-decoration: none; }
.side-nav a.active { background: var(--brand); color: #fff; font-weight: 600; }
.side-nav .nav-ico { width: 17px; text-align: center; font-size: 14px; opacity: .9; }
.side-nav .nav-label { flex: 1; }
.side-nav .nav-badge { background: rgba(255,255,255,.16); padding: 1px 7px; border-radius: 99px; font-size: 10.5px; font-weight: 700; }
.side-nav .nav-group { padding: 14px 12px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #64748b; font-weight: 700; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.side-user:hover { background: var(--sidebar-active); }
.avatar {
  width: 33px; height: 33px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: #fff; font-weight: 700; font-size: 12.5px; flex: 0 0 auto;
}
.side-user-info { min-width: 0; flex: 1; }
.side-user-info strong { display: block; font-size: 12.5px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-info span { font-size: 10.5px; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 22px; position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 16.5px; }
.topbar .crumbs { font-size: 12px; color: var(--text-3); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); display: grid; place-items: center;
  cursor: pointer; font-size: 14px;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.hamburger { display: none; }

.content { padding: 22px; max-width: 1440px; width: 100%; margin: 0 auto; flex: 1; }

/* ---------------- Cards / grids ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 15px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card-head h2, .card-head h3 { font-size: 14.5px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 13px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-end { margin-left: auto; }

/* KPI */
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; position: relative; overflow: hidden;
}
.kpi-label { font-size: 11.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 25px; font-weight: 800; letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.kpi-icon { position: absolute; right: 14px; top: 14px; font-size: 19px; opacity: .18; }
.kpi.ok .kpi-value { color: var(--ok); }
.kpi.warn .kpi-value { color: var(--warn); }
.kpi.danger .kpi-value { color: var(--danger); }

/* ---------------- Tabelas ---------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 700; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .05em; background: var(--surface-3);
  border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--border-strong); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .editable { padding: 4px 6px; }
table.data input[type=number], table.data input[type=text] {
  padding: 5px 7px; font-size: 12.5px; border-radius: 6px; border: 1px solid transparent; background: transparent;
  width: 100%; min-width: 68px;
}
table.data input:hover { border-color: var(--border-strong); background: var(--surface); }
table.data input:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.table-actions { display: flex; gap: 5px; justify-content: flex-end; }
.table-empty { padding: 40px 20px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------------- Badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: var(--surface-3); color: var(--text-2); }
.badge-purple { background: #ede9fe; color: #5b21b6; }
[data-theme='dark'] .badge-blue { background: #16233d; color: #93b4ff; }
[data-theme='dark'] .badge-green { background: #0d2e22; color: #6ee7b7; }
[data-theme='dark'] .badge-amber { background: #3a2a0a; color: #fcd34d; }
[data-theme='dark'] .badge-red { background: #40161a; color: #fca5a5; }
[data-theme='dark'] .badge-purple { background: #241a3d; color: #c4b5fd; }

/* ---------------- Progress ---------------- */
.bar { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #60a5fa); border-radius: 99px; transition: width .4s ease; }
.bar.ok > span { background: linear-gradient(90deg, #059669, #34d399); }
.bar.warn > span { background: linear-gradient(90deg, #d97706, #fbbf24); }
.bar.danger > span { background: linear-gradient(90deg, #dc2626, #f87171); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .bar { flex: 1; }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; margin-bottom: 18px; }
.tabs button {
  padding: 10px 15px; background: none; border: none; border-bottom 2px solid transparent;
  border-bottom: 2px solid transparent; font-size: 13.5px; font-weight: 600; color: var(--text-2);
  cursor: pointer; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 20px; z-index: 100; animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 620px; max-height: 90vh; display: flex; flex-direction: column;
  animation: pop .18s ease;
}
.modal.wide { max-width: 980px; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: .6 } to { transform: none; opacity: 1 } }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.modal-head h2 { font-size: 16.5px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 15px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------------- Toasts ---------------- */
.toast-root { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm); padding: 12px 16px; box-shadow: var(--shadow-lg);
  font-size: 13px; max-width: 380px; animation: slideIn .22s ease;
}
.toast.success { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ---------------- Splash / empty ---------------- */
.boot-splash { min-height: 100vh; display: grid; place-items: center; gap: 14px; color: var(--text-3); }
.spinner {
  width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg) } }
.empty {
  padding: 46px 24px; text-align: center; color: var(--text-3);
}
.empty h3 { color: var(--text-2); margin-bottom: 6px; font-size: 15px; }
.empty p { font-size: 13px; margin-bottom: 18px; }

/* ---------------- Charts (SVG/CSS) ---------------- */
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 8px; }
.chart-bars .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.chart-bars .col .barv {
  width: 100%; max-width: 42px; background: linear-gradient(180deg, #60a5fa, #2563eb);
  border-radius: 5px 5px 0 0; min-height: 3px; transition: height .4s ease; position: relative;
}
.chart-bars .col .lab { font-size: 10px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.chart-bars .col .val { font-size: 10px; font-weight: 700; color: var(--text-2); }

.donut { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.donut svg { flex: 0 0 auto; }
.legend { display: grid; gap: 7px; font-size: 12.5px; flex: 1; min-width: 150px; }
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.legend-item .v { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------- Timeline / cronograma ---------------- */
.timeline { display: grid; gap: 10px; }
.tl-item {
  display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.tl-item.late { border-color: #fca5a5; background: #fef2f2; }
[data-theme='dark'] .tl-item.late { background: #2a1215; border-color: #7f1d1d; }
.tl-marker {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; background: var(--surface-3); color: var(--text-2);
}
.tl-item.done .tl-marker { background: #d1fae5; color: #065f46; }
.tl-item.active .tl-marker { background: #dbeafe; color: #1e40af; }
.tl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 7px; }
.tl-head h4 { font-size: 13.5px; }
.tl-dates { font-size: 11.5px; color: var(--text-3); }
.tl-controls { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.tl-controls input[type=range] { flex: 1; accent-color: var(--brand); max-width: 240px; }

/* ---------------- Misc ---------------- */
.sep { height: 1px; background: var(--border); margin: 14px 0; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.formula { font-size: 11.5px; color: var(--text-3); font-family: var(--mono); line-height: 1.45; word-break: break-word; }
.callout { border-left: 3px solid var(--brand); background: var(--brand-soft); padding: 12px 14px; border-radius: 0 8px 8px 0; font-size: 12.5px; color: var(--text-2); }
[data-theme='dark'] .callout { background: #16233d; }
.chat-log { display: flex; flex-direction: column; gap: 12px; max-height: 480px; overflow-y: auto; padding: 4px; }
.msg { padding: 11px 14px; border-radius: 12px; font-size: 13px; max-width: 88%; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--surface-3); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 9px; align-items: flex-end; margin-top: 14px; }
.chat-input textarea { flex: 1; min-height: 44px; max-height: 140px; }

.doc-item { display: flex; align-items: center; gap: 11px; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.doc-item:last-child { border-bottom: none; }
.doc-ico { width: 34px; height: 34px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; font-size: 14px; flex: 0 0 auto; }
.doc-meta { flex: 1; min-width: 0; }
.doc-meta strong { display: block; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta span { font-size: 11px; color: var(--text-3); }

.scroll-y { max-height: 320px; overflow-y: auto; }
.tiny { font-size: 11.5px; }
.w-100 { width: 100%; }
.mt-0 { margin-top: 0 } .mt-8 { margin-top: 8px } .mt-16 { margin-top: 16px } .mt-24 { margin-top: 24px }
.mb-8 { margin-bottom: 8px } .mb-16 { margin-bottom: 16px } .mb-24 { margin-bottom: 24px }
.gap-4 { gap: 4px } .gap-8 { gap: 8px } .gap-16 { gap: 16px }

/* ---------------- Responsivo ---------------- */
@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 32px; }
  .hero-content h1 { font-size: 36px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 262px; transform: translateX(-104%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .hamburger { display: grid; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 35; }
}

@media (max-width: 640px) {
  .content { padding: 14px; }
  .topbar { padding: 0 14px; height: 56px; }
  .topbar h1 { font-size: 14.5px; }
  .hero { padding: 26px 18px 40px; }
  .hero-content h1 { font-size: 30px; }
  .hero-content > p { font-size: 14.5px; }
  .landing-header, .features, .landing-footer { padding-left: 18px; padding-right: 18px; }
  .auth-card { padding: 32px 20px; }
  .grid-4, .grid-3 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .kpi-value { font-size: 21px; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .modal { max-height: 94vh; }
  .modal-body { padding: 16px; }
  .toast-root { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; }
  table.data { font-size: 12px; }
  table.data th, table.data td { padding: 7px 8px; }
}

@media print {
  .sidebar, .topbar, .btn, .tabs { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .card { box-shadow: none; border-color: #ddd; }
}
