:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1f2937;
  --line: #243244;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --blue: #2563eb;
  --slate: #475569;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: #0b1220; border-right: 1px solid var(--line); padding: 24px 18px; }
.brand { font-size: 1.3rem; font-weight: 700; margin-bottom: 24px; }
.nav-item { display: block; padding: 10px 12px; border-radius: 12px; margin-bottom: 8px; color: var(--muted); }
.nav-item.active, .nav-item:hover { background: var(--panel-2); color: var(--text); }
.main { padding: 24px; }
.topbar h1 { margin: 0 0 6px; font-size: 2rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.75rem; }
.grid { display: grid; gap: 16px; }
.urgent-strip { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 18px; }
.kpis { margin-bottom: 18px; }
.kpis.cols-5 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.card { background: linear-gradient(180deg, rgba(31,41,55,0.95), rgba(17,24,39,0.95)); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: 0 10px 24px rgba(0,0,0,0.15); }
.card .label { color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }
.card .value { font-size: 1.4rem; font-weight: 700; }
.card .value.small { font-size: 1rem; }
.section-card { margin-bottom: 18px; }
.two-col { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; align-items: start; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2, .section-card h2 { margin: 0; font-size: 1.15rem; }
.list { display: grid; gap: 12px; }
.list-row { display: flex; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(2,6,23,0.2); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions.stack { flex-direction: column; align-items: stretch; }
.button { background: var(--accent); color: white; border: 0; border-radius: 12px; padding: 9px 12px; cursor: pointer; font-weight: 600; display: inline-flex; justify-content: center; }
.button.subtle { background: transparent; border: 1px solid var(--line); color: var(--text); }
.button.amber { background: var(--amber); }
.flash-stack { display: grid; gap: 10px; margin: 12px 0 18px; }
.flash { border-radius: 12px; padding: 10px 12px; }
.flash.success { background: rgba(22,163,74,0.15); border: 1px solid rgba(22,163,74,0.35); }
.flash.error { background: rgba(220,38,38,0.15); border: 1px solid rgba(220,38,38,0.35); }
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; vertical-align: top; }
.table.compact th, .table.compact td { padding: 8px; }
.ledger-table .sticky-col { position: sticky; left: 0; background: #111827; z-index: 2; }
.ledger-table .sticky-col.second { left: 180px; }
.ledger-table td.sticky-col, .ledger-table th.sticky-col { min-width: 180px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
input[type='text'], input[type='number'], input[type='password'], select, textarea { width: 100%; background: #0b1220; color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
textarea { resize: vertical; }
label { display: grid; gap: 8px; color: var(--muted); }
label input[type='checkbox'] { width: auto; margin-right: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.pill { display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.pill.green { background: rgba(22,163,74,0.18); color: #86efac; }
.pill.amber { background: rgba(217,119,6,0.18); color: #fdba74; }
.pill.red { background: rgba(220,38,38,0.18); color: #fca5a5; }
.pill.blue { background: rgba(37,99,235,0.18); color: #93c5fd; }
.pill.slate { background: rgba(71,85,105,0.25); color: #cbd5e1; }
.timeline { display: grid; gap: 10px; }
.timeline-item { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(2,6,23,0.18); }
.review-row { align-items: start; }
.review-main { flex: 1; }
.review-actions { width: 320px; display: grid; gap: 12px; }
.review-box { white-space: pre-wrap; background: #0b1220; border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 10px 0; }
.compact-form { gap: 8px; }
.stack { display: grid; }
.gap-lg { gap: 20px; }
@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .review-actions { width: 100%; }
}

.renewal-row.overdue { border-color: rgba(220,38,38,0.75); background: rgba(127,29,29,0.18); }

.metric-stack {
  display: grid;
  gap: 4px;
  justify-items: end;
}

.metric-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.danger-text { color: #fca5a5; }
.resolve-box { display: grid; gap: 10px; width: 100%; }
.resolve-box summary { list-style: none; }
.resolve-box summary::-webkit-details-marker { display: none; }
.resolve-box[open] { padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: rgba(2,6,23,0.28); }
.resolve-box[open] summary { margin-bottom: 10px; }


.metric-card.alert-red {
  border-color: rgba(220,38,38,0.7);
  background: linear-gradient(180deg, rgba(127,29,29,0.38), rgba(69,10,10,0.34));
}

.attention-row {
  transition: background 0.15s ease, border-color 0.15s ease;
}

.attention-row.urgency-green td {
  background: rgba(21, 128, 61, 0.16);
}

.attention-row.urgency-yellow td {
  background: rgba(202, 138, 4, 0.16);
}

.attention-row.urgency-orange td {
  background: rgba(234, 88, 12, 0.18);
}

.attention-row.urgency-red td {
  background: rgba(185, 28, 28, 0.2);
}
