/* Sistema Pryme — design system */
:root {
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bg: #F5F6FB;
  --surface: #FFFFFF;
  --surface-2: #F8F9FD;
  --surface-3: #EEF0F7;
  --border: #E5E7F0;
  --border-strong: #D3D7E5;
  --text: #121527;
  --text-2: #3B4160;
  --muted: #6B7290;
  --primary: #6D5DF6;
  --primary-600: #5A49E8;
  --primary-50: #F0EEFF;
  --primary-100: #E2DDFF;
  --on-primary: #FFFFFF;
  --accent: #FF7A59;
  --accent-50: #FFF1EC;
  --success: #12A150;
  --success-50: #E8F8EF;
  --warning: #D97706;
  --warning-50: #FFF6E5;
  --danger: #E5484D;
  --danger-50: #FDECEC;
  --info: #0EA5E9;
  --info-50: #E7F6FD;
  --teal: #0EA5A4;
  --teal-50: #E3F7F6;
  --side-bg: #15122E;
  --side-bg-2: #1C1840;
  --side-text: #C9C6E8;
  --side-muted: #8C88B5;
  --side-active: rgba(139, 124, 255, .18);
  --shadow-sm: 0 1px 2px rgba(18, 21, 39, .05);
  --shadow: 0 1px 3px rgba(18, 21, 39, .06), 0 6px 16px -8px rgba(18, 21, 39, .10);
  --shadow-lg: 0 24px 60px -12px rgba(18, 21, 39, .30);
  --radius: 14px;
  --radius-sm: 10px;
  --ring: 0 0 0 3px rgba(109, 93, 246, .25);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B0C16;
  --surface: #141625;
  --surface-2: #181A2B;
  --surface-3: #20233A;
  --border: #252840;
  --border-strong: #33375A;
  --text: #ECEDF7;
  --text-2: #C3C6DD;
  --muted: #8E93B3;
  --primary: #8B7CFF;
  --primary-600: #7A6AF5;
  --primary-50: #1F1B42;
  --primary-100: #2A2560;
  --accent-50: #3A2019;
  --success-50: #0F2E1E;
  --warning-50: #33250C;
  --danger-50: #3A1517;
  --info-50: #0C2938;
  --teal-50: #0C2C2C;
  --side-bg: #0E0C20;
  --side-bg-2: #141130;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px -10px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.app.collapsed { grid-template-columns: 76px 1fr; }
.sidebar { background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%); color: var(--side-text); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 40; }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #8B7CFF 0%, #6D5DF6 45%, #FF7A59 100%); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 19px; box-shadow: 0 8px 20px -6px rgba(139, 124, 255, .7); flex: none; }
.brand-name { color: #fff; font-weight: 800; font-size: 16px; letter-spacing: -.02em; line-height: 1.1; }
.brand-name small { display: block; color: var(--side-muted); font-weight: 500; font-size: 11.5px; letter-spacing: 0; margin-top: 2px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; scrollbar-color: #2f2a5c transparent; }
.nav-group { margin-top: 14px; }
.nav-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--side-muted); padding: 0 10px 6px; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--side-text); font-weight: 500; font-size: 13.5px; text-decoration: none; position: relative; white-space: nowrap; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #8B7CFF; }
.nav a .icon { opacity: .85; }
.nav .badge-count { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 7px; line-height: 18px; }
.app.collapsed .nav-title, .app.collapsed .nav a span, .app.collapsed .brand-name, .app.collapsed .nav .badge-count { display: none; }
.app.collapsed .nav a { justify-content: center; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .07); }
.side-foot button { width: 100%; background: transparent; border: 0; color: var(--side-muted); display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; font: inherit; font-size: 13px; }
.side-foot button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.app.collapsed .side-foot button span { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(180%) blur(10px); position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--border); }
.searchbox { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 0 12px; height: 40px; color: var(--muted); cursor: text; box-shadow: var(--shadow-sm); }
.searchbox:hover { border-color: var(--border-strong); }
.searchbox span { flex: 1; font-size: 13.5px; }
.kbd { font-size: 11px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; color: var(--muted); background: var(--surface-2); font-family: var(--font); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: grid; place-items: center; cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.user-chip b { font-size: 13px; display: block; line-height: 1.1; }
.user-chip small { color: var(--muted); font-size: 11.5px; }
.menu-toggle { display: none; }
.content { padding: 28px; max-width: 1480px; width: 100%; margin: 0 auto; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 800; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 13.5px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 6px 16px -8px var(--primary); }
.btn.primary:hover { background: var(--primary-600); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-50); border-color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 31px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.icon-only { width: 34px; padding: 0; }
.btn.sm.icon-only { width: 31px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-group { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.btn-group button { border: 0; background: transparent; padding: 0 14px; height: 36px; font: inherit; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; border-right: 1px solid var(--border); }
.btn-group button:last-child { border-right: 0; }
.btn-group button.on { background: var(--primary-50); color: var(--primary); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; }
.card-body { padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.kpi { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; position: relative; overflow: hidden; text-decoration: none !important; color: inherit; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.kpi-top { display: flex; align-items: center; gap: 10px; }
.kpi-label { color: var(--muted); font-weight: 600; font-size: 12.5px; line-height: 1.3; }
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chip-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.tone-primary { background: var(--primary-50); color: var(--primary); }
.tone-accent { background: var(--accent-50); color: var(--accent); }
.tone-success { background: var(--success-50); color: var(--success); }
.tone-warning { background: var(--warning-50); color: var(--warning); }
.tone-danger { background: var(--danger-50); color: var(--danger); }
.tone-info { background: var(--info-50); color: var(--info); }
.tone-teal { background: var(--teal-50); color: var(--teal); }

.hero { background: radial-gradient(1200px 200px at 0% 0%, rgba(139, 124, 255, .35), transparent 60%), linear-gradient(120deg, #1C1840 0%, #2A1F63 55%, #4B2B7A 100%); color: #fff; border: 0; padding: 24px 26px; border-radius: 18px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 122, 89, .45), transparent 65%); }
.hero h2 { font-size: 22px; font-weight: 800; }
.hero p { margin: 6px 0 0; color: #CFCBF2; }
.hero .actions { margin-left: auto; display: flex; gap: 8px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero .btn { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .18); color: #fff; }
.hero .btn:hover { background: rgba(255, 255, 255, .18); }
.hero .btn.accent { background: var(--accent); border-color: var(--accent); }

/* ---------- Tables ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 380px; }
.toolbar .search .icon { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.toolbar .search input { padding-left: 36px; }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; cursor: default; user-select: none; }
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--text); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl td.actions { text-align: right; white-space: nowrap; width: 1%; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--muted); }
.person { display: flex; align-items: center; gap: 10px; }
.pager { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.pager .btns { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .chip-icon { margin: 0 auto 12px; width: 52px; height: 52px; border-radius: 16px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.no-dot::before { display: none; }
.pill.green { background: var(--success-50); color: var(--success); }
.pill.red { background: var(--danger-50); color: var(--danger); }
.pill.amber { background: var(--warning-50); color: var(--warning); }
.pill.blue { background: var(--info-50); color: var(--info); }
.pill.violet { background: var(--primary-50); color: var(--primary); }
.pill.gray { background: var(--surface-3); color: var(--muted); }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 5px; vertical-align: middle; border: 1px solid rgba(0, 0, 0, .08); }
.tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: #fff; margin: 1px 2px 1px 0; }

/* ---------- Forms ---------- */
.input, select.input, textarea.input { width: 100%; height: 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); padding: 0 12px; font: inherit; font-size: 13.5px; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:hover { border-color: var(--border-strong); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
input[type="color"].input { padding: 4px; width: 64px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field > label .req { color: var(--danger); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field.error .input { border-color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-section { margin-top: 22px; }
.form-section:first-child { margin-top: 0; }
.form-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.form-section h4::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; font-size: 13.5px; user-select: none; min-height: 38px; }
.switch { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(16px); }
.switch:focus-visible { box-shadow: var(--ring); outline: none; }
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; z-index: 80; padding: 4px; }
.combo-list div { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.combo-list div:hover, .combo-list div.on { background: var(--primary-50); color: var(--primary); }
.combo-list .none { color: var(--muted); cursor: default; }
.combo-list .none:hover { background: transparent; color: var(--muted); }
.combo .clear { position: absolute; right: 6px; top: 6px; }
.rich { min-height: 280px; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: var(--surface); line-height: 1.6; overflow: auto; max-height: 60vh; }
.rich:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.rich-bar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; display: inline-flex; gap: 8px; align-items: center; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs .on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .count { background: var(--surface-3); color: var(--muted); border-radius: 999px; font-size: 11px; padding: 0 7px; }

/* ---------- Drawer / modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(12, 10, 30, .45); backdrop-filter: blur(2px); z-index: 90; animation: fade .15s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 100vw); background: var(--surface); z-index: 91; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide .2s ease; }
.drawer.wide { width: min(980px, 100vw); }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { font-size: 17px; font-weight: 800; }
.drawer-head .sub { font-size: 12.5px; color: var(--muted); }
.drawer-head .x { margin-left: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; background: var(--surface-2); }
.drawer-foot .spacer { flex: 1; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); background: var(--surface); border-radius: 16px; z-index: 95; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: pop .16s ease; }
.modal.wide { width: min(860px, calc(100vw - 32px)); }
.modal .drawer-body { padding: 20px 22px; }
.modal-overlay { z-index: 94; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes pop { from { transform: translate(-50%, -48%) scale(.97); opacity: 0; } }

/* ---------- Command palette ---------- */
.palette { position: fixed; left: 50%; top: 12vh; transform: translateX(-50%); width: min(640px, calc(100vw - 32px)); background: var(--surface); border-radius: 16px; z-index: 96; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--border); }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent; padding: 18px 20px 18px 52px; font: inherit; font-size: 16px; color: var(--text); outline: none; }
.palette .ico { position: absolute; left: 20px; top: 20px; color: var(--muted); }
.palette .results { max-height: 52vh; overflow-y: auto; padding: 8px; }
.palette .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 12px 4px; font-weight: 700; }
.palette .item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.palette .item.on { background: var(--primary-50); color: var(--primary); }
.palette .item small { color: var(--muted); margin-left: auto; font-size: 12px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #1A1733; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; font-weight: 500; max-width: 420px; animation: slide .2s ease; }
.toast.ok .icon { color: #4ADE80; }
.toast.err { background: #3B1114; }
.toast.err .icon { color: #F87171; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: radial-gradient(700px 400px at 20% 10%, rgba(139, 124, 255, .55), transparent 60%), radial-gradient(600px 400px at 90% 90%, rgba(255, 122, 89, .45), transparent 60%), #15122E; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; max-width: 480px; }
.login-art p { color: #CFCBF2; font-size: 16px; max-width: 460px; }
.login-art ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; color: #E4E1FF; }
.login-art li { display: flex; gap: 10px; align-items: center; }
.login-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login-form form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; }
.login-form h2 { font-size: 26px; font-weight: 800; }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: 56px repeat(7, minmax(110px, 1fr)); border-top: 1px solid var(--border); position: relative; min-width: 860px; }
.cal-head { position: sticky; top: 0; background: var(--surface-2); z-index: 2; padding: 10px 8px; font-weight: 700; font-size: 12.5px; text-align: center; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal-head.today { color: var(--primary); }
.cal-head small { display: block; color: var(--muted); font-weight: 500; }
.cal-time { font-size: 11px; color: var(--muted); text-align: right; padding: 0 8px; height: 52px; transform: translateY(-7px); }
.cal-col { position: relative; border-left: 1px solid var(--border); }
.cal-slot { height: 52px; border-bottom: 1px dashed var(--border); }
.cal-ev { position: absolute; left: 3px; right: 3px; border-radius: 8px; padding: 4px 7px; font-size: 11.5px; line-height: 1.3; overflow: hidden; cursor: pointer; color: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); border-left: 3px solid rgba(0, 0, 0, .2); }
.cal-ev:hover { filter: brightness(1.06); z-index: 3; }
.cal-ev b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.done { opacity: .62; }
.cal-ev.cancel { text-decoration: line-through; opacity: .45; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month .d { min-height: 110px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; font-size: 12px; }
.month .d.out { background: var(--surface-2); color: var(--muted); }
.month .d .n { font-weight: 700; margin-bottom: 4px; }
.month .d.today .n { color: #fff; background: var(--primary); border-radius: 999px; display: inline-block; padding: 0 7px; }
.month .ev { border-radius: 6px; padding: 1px 6px; color: #fff; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; font-size: 11px; }

/* ---------- Misc ---------- */
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: 0; }
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 220px; padding: 10px 4px 0; }
.bar-chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar-chart .bars { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bar-chart .bar { width: 100%; max-width: 18px; border-radius: 5px 5px 2px 2px; min-height: 2px; transition: filter .15s; }
.bar-chart .bar:hover { filter: brightness(1.1); }
.bar-chart .lbl { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; }
.stat-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.stat-line:last-child { border-bottom: 0; }
.att { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.att button { border: 0; background: var(--surface); width: 40px; height: 32px; font: inherit; font-weight: 700; cursor: pointer; color: var(--muted); border-right: 1px solid var(--border); }
.att button:last-child { border-right: 0; }
.att button.on.P { background: var(--success); color: #fff; }
.att button.on.F { background: var(--danger); color: #fff; }
.att button.on.J { background: var(--warning); color: #fff; }
.callout { border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.callout.info { background: var(--info-50); color: var(--text-2); }
.callout.warn { background: var(--warning-50); color: var(--text-2); }
.callout .icon { margin-top: 1px; }
.callout.info .icon { color: var(--info); }
.callout.warn .icon { color: var(--warning); }
.dropdown { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 85; min-width: 220px; }
.dropdown button, .dropdown a { display: flex; width: 100%; gap: 10px; align-items: center; border: 0; background: none; font: inherit; color: var(--text); padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; text-decoration: none !important; font-size: 13.5px; }
.dropdown button:hover, .dropdown a:hover { background: var(--surface-3); }
.dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.loading { padding: 60px; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--primary-100); border-top-color: var(--primary); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.doc-page { background: #fff; color: #111; max-width: 800px; margin: 0 auto; padding: 56px 64px; box-shadow: var(--shadow); border-radius: 6px; line-height: 1.6; font-family: Georgia, 'Times New Roman', serif; font-size: 15px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .grid.main-side, .grid.three { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app, .app.collapsed { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .app.mobile-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .app.collapsed .nav-title, .app.collapsed .nav a span, .app.collapsed .brand-name { display: revert; }
  .menu-toggle { display: grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px; }
  .grid.two { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .user-chip div, .searchbox .kbd { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .page-head h1 { font-size: 21px; }
  .page-head .actions { margin-left: 0; }
  .hide-mobile { display: none !important; }
}
@media print {
  .sidebar, .topbar, .no-print, .toolbar, .pager, .page-head .actions { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { border: 0; box-shadow: none; }
  .doc-page { box-shadow: none; padding: 0; max-width: none; }
}
