/* Painel Pryme — mesmo design do Sistema Pryme */
: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; --ring: 0 0 0 3px rgba(109, 93, 246, .25);
  --code-bg: #15122E; --code-text: #E4E1FF;
  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);
  --code-bg: #07060F;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-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; }
.code-inline { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; word-break: break-all; }
.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; }
.mt { margin-top: 16px; }
.mt-sm { margin-top: 8px; }
.mb { margin-bottom: 16px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.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; flex-direction: column; gap: 6px; padding: 18px 20px 12px; }
.brand-logo { display: block; height: 54px; width: auto; align-self: flex-start; }
.brand small { color: var(--side-muted); font-weight: 600; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; padding-left: 2px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.nav-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--side-muted); padding: 14px 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; }
.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 .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; }
.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; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; 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); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.menu-toggle { display: none; }
.content { padding: 28px; max-width: 1400px; width: 100%; margin: 0 auto; }
.modo-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.modo-chip.simulacao { background: var(--warning-50); color: var(--warning); }
.modo-chip.local { background: var(--info-50); color: var(--info); }
.modo-chip.servidor { background: var(--success-50); color: var(--success); }

/* ---------- 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; }
.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; }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.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[disabled] { opacity: .55; pointer-events: none; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.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(210px, 1fr)); margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(2, 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; color: inherit; text-decoration: none !important; }
a.kpi:hover { 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: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 12px; color: var(--muted); }
.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); }

/* ---------- Tables ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .input { max-width: 320px; }
.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; }
.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.clickable { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.actions { text-align: right; white-space: nowrap; width: 1%; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--muted); }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.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); }

/* ---------- 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); }
.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); }
.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: 24px; }
.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; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.input-sufixo { display: flex; align-items: center; gap: 8px; }
.input-sufixo span { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.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; display: inline-flex; gap: 8px; align-items: center; }
.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; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(12, 10, 30, .45); backdrop-filter: blur(2px); z-index: 90; animation: fade .15s ease; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, 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(920px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; font-weight: 800; }
.modal-head .x { margin-left: auto; }
.modal-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 16px 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translate(-50%, -48%) scale(.97); opacity: 0; } }

/* ---------- Passos de uma ação ---------- */
.passo { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.passo-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface-2); font-weight: 700; }
.passo-head .pill { margin-left: auto; }
.passo-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.passo-body .rot { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
pre.code { margin: 0; background: var(--code-bg); color: var(--code-text); padding: 12px 14px; border-radius: 10px; font: 12.5px/1.55 ui-monospace, Consolas, monospace; overflow-x: auto; white-space: pre; max-height: 360px; }
pre.code.saida { white-space: pre-wrap; word-break: break-word; }
details summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--primary); }
details[open] summary { margin-bottom: 8px; }
.link-box { display: flex; gap: 8px; align-items: center; }
.link-box .input { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

/* ---------- 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; }
.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; gap: 24px; }
.login-art h1 { font-size: 38px; 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: 24px 0 0; display: grid; gap: 12px; color: #E4E1FF; }
.login-art li { display: flex; gap: 10px; align-items: center; }
.login-logo { display: block; height: 70px; width: auto; align-self: flex-start; }
.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; }

/* ---------- Misc ---------- */
.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.err { background: var(--danger-50); color: var(--text-2); }
.callout.ok { background: var(--success-50); color: var(--text-2); }
.callout .icon { margin-top: 1px; }
.callout.info .icon { color: var(--info); }
.callout.warn .icon { color: var(--warning); }
.callout.err .icon { color: var(--danger); }
.callout.ok .icon { color: var(--success); }
.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; }
.list-plain li .grow { flex: 1; min-width: 0; }
.stat-line { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.stat-line:last-child { border-bottom: 0; }
.stat-line span:first-child { color: var(--muted); }
.stat-line span:last-child { text-align: right; font-weight: 600; word-break: break-word; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.on { background: var(--success); box-shadow: 0 0 0 3px var(--success-50); }
.dot.off { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-50); }
.dot.na { background: var(--border-strong); }
.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; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.alerta-item { display: flex; gap: 10px; align-items: flex-start; }
.alerta-item .icon { margin-top: 2px; }
.alerta-item.erro .icon { color: var(--danger); }
.alerta-item.aviso .icon { color: var(--warning); }
.acoes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.acao-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.acao-card p { margin: 0; color: var(--muted); font-size: 13px; flex: 1; }
.acao-card h4 { font-size: 14px; display: flex; gap: 8px; align-items: center; }

/* ---------- Responsivo ---------- */
@media (max-width: 1000px) {
  .grid.main-side, .grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .app.menu-aberto .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-toggle { display: grid; }
  .content { padding: 18px 16px; }
  .topbar { padding: 0 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 32px 24px; }
  .login-art h1 { font-size: 28px; }
  .login-art ul { display: none; }
}
.status-sis { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 12.5px; }
.stat-line span:first-child { flex: none; max-width: 45%; }
