:root {
  --bg: #070b14;
  --bg-2: #0c1220;
  --panel: #10182a;
  --panel-2: #141e33;
  --line: #1e2c48;
  --line-2: #2a3c5e;
  --text: #e7eefc;
  --muted: #8b9bb8;
  --faint: #5d6e8c;
  --gold: #d4a017;
  --gold-2: #f0c14b;
  --blue: #3d9cf0;
  --cyan: #2ee6c8;
  --ok: #2ee6a6;
  --warn: #ffb020;
  --danger: #ff5d6c;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  --radius: 14px;
  --sidebar: 260px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 500px at 10% -10%, #18284a 0%, transparent 50%),
              radial-gradient(900px 400px at 100% 0%, #1a1608 0%, transparent 42%),
              var(--bg);
  color: var(--text);
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: #7ec0ff; }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: linear-gradient(180deg, #0e1628 0%, #0a101c 100%);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.brand {
  display: flex; gap: 12px; align-items: center;
  padding: 6px 8px 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(145deg, var(--gold-2), var(--gold));
  color: #1a1200; font-weight: 700; display: grid; place-items: center;
  letter-spacing: .04em; font-size: 13px;
  box-shadow: 0 0 24px rgba(212, 160, 23, .35);
}
.brand h1 { margin: 0; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a, .nav summary {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); padding: 10px 12px; border-radius: 10px;
  font-size: 13.5px; cursor: pointer;
}
.nav a:hover, .nav summary:hover, .nav a.active {
  background: rgba(61, 156, 240, .1);
  color: var(--text);
}
.nav a.active { box-shadow: inset 3px 0 0 var(--gold); }
.nav details { margin-top: 4px; }
.nav details summary { list-style: none; }
.nav details summary::-webkit-details-marker { display: none; }
.nav .sub { padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
.nav .sub a { font-size: 12.5px; padding: 7px 12px; }

.side-foot {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-size: 12px; color: var(--muted);
}
.side-foot form { margin-top: 8px; }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px 8px;
}
.topbar h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.topbar .crumb { color: var(--muted); font-size: 12px; margin-top: 4px; letter-spacing: .12em; text-transform: uppercase; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 999px; font-size: 13px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.content { padding: 12px 28px 40px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.kpi {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -20px; top: -20px;
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(212,160,23,.18), transparent 70%);
}
.kpi .label { color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.kpi .value { font-size: 28px; font-weight: 600; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .meta { color: var(--faint); font-size: 12px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-h {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.panel-h h3 { margin: 0; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.panel-b { padding: 16px 18px; }

.grid-2 { display: grid; grid-template-columns: 1.4fr .8fr; gap: 16px; }
.grid-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-form .full { grid-column: 1 / -1; }
.grid-form .half { grid-column: span 1; }

label { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; background: #0b1220; color: var(--text);
  border: 1px solid var(--line-2); border-radius: 10px;
  padding: 10px 12px; font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,160,23,.15);
}
textarea { min-height: 88px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 10px 14px;
  font: inherit; font-size: 13px; cursor: pointer;
  background: var(--line-2); color: var(--text);
}
.btn:hover { filter: brightness(1.08); }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1a1200; font-weight: 600; }
.btn-blue { background: #1b4e86; }
.btn-ok { background: #0f5c48; }
.btn-danger { background: #6d1d28; }
.btn-ghost { background: transparent; border: 1px solid var(--line-2); }
.btn-sm { padding: 7px 10px; font-size: 12px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; color: var(--faint); font-weight: 600; font-size: 11px;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
td { padding: 11px 12px; border-bottom: 1px solid rgba(30,44,72,.7); vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,.015); }
.num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.right { text-align: right; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  border: 1px solid transparent;
}
.badge.ghost { background: #1a2233; color: #b7c3d9; }
.badge.info { background: rgba(61,156,240,.15); color: #8cc7ff; }
.badge.ok { background: rgba(46,230,166,.12); color: #7df0c8; }
.badge.warn { background: rgba(255,176,32,.14); color: #ffd27a; }
.badge.accent { background: rgba(212,160,23,.16); color: #f0c14b; }
.badge.danger { background: rgba(255,93,108,.14); color: #ff9aa4; }
.badge.muted { background: #151b28; color: #7d8aa3; }

.alert {
  padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13px;
  border: 1px solid var(--line);
}
.alert.ok { background: rgba(46,230,166,.08); border-color: #1c5c49; }
.alert.error { background: rgba(255,93,108,.08); border-color: #6d1d28; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters .field { min-width: 180px; }

.pkg-table input, .pkg-table select { padding: 8px; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }

.dl { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0 10px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); position: absolute; left: -5px; top: 16px;
}

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 420px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 32px; box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-card p { color: var(--muted); margin: 0 0 22px; }
.login-card .btn { width: 100%; margin-top: 8px; padding: 12px; }

.print-doc { background: #fff; color: #111; }
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}

.empty { padding: 28px; text-align: center; color: var(--muted); }

@media (max-width: 1100px) {
  .kpis, .grid-form, .grid-2, .split { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
