:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --sidebar: #0b1220;
  --sidebar-text: #cbd5e1;
  --sidebar-dim: #64748b;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --ok-bg: #dcfce7;
  --ok: #166534;
  --warn-bg: #fef3c7;
  --warn: #92400e;
  --bad-bg: #fee2e2;
  --bad: #991b1b;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
  --radius: 10px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* Login */
body.login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, #1e3a8a22, transparent),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 32px 28px;
}
.login-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 8px;
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
}
.login-card .lede {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
}
.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  margin: 0 0 12px;
}
.login-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
.login-card input:focus {
  outline: 2px solid #93c5fd;
  border-color: var(--accent);
}
.login-card button[type="submit"] {
  width: 100%;
  margin-top: 8px;
  padding: 11px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font: inherit;
  cursor: pointer;
}
.login-card button[type="submit"]:hover { background: var(--accent-hover); }
.alert {
  background: var(--bad-bg);
  color: var(--bad);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 14px;
  font-size: 13px;
}

/* Shell */
.shell { display: flex; min-height: 100vh; }
.nav {
  width: 248px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 18px;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 16px;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.04em;
}
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-text strong { color: #f8fafc; font-size: 13px; letter-spacing: 0.02em; }
.brand-text span { color: var(--sidebar-dim); font-size: 11px; }
.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sidebar-dim);
  padding: 8px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}
.nav-item svg { width: 18px; height: 18px; opacity: 0.85; flex-shrink: 0; }
.nav-item:hover { background: #1e293b; color: #fff; }
.nav-item.active {
  background: #1e3a8a;
  color: #fff;
}
.nav-foot {
  margin-top: auto;
  padding: 14px 10px 4px;
  border-top: 1px solid #1e293b;
}
.nav-foot .who {
  color: #94a3b8;
  font-size: 12px;
  margin: 0 0 10px;
  word-break: break-all;
}
.btn-ghost {
  width: 100%;
  background: transparent;
  color: #cbd5e1;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost:hover { background: #1e293b; color: #fff; }

.workspace { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.stage { padding: 24px 28px 56px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-h {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-h h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #334155;
}
.panel-b { padding: 16px 18px 18px; }
.panel-b.padless { padding: 0; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.toolbar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.toolbar input, .toolbar select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-width: 140px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: #fff;
  color: #334155;
  border: 1px solid var(--line-strong);
}
.btn-secondary:hover { background: #f8fafc; }
.btn-danger { background: #fff; color: var(--bad); border: 1px solid #fecaca; }
.btn-sm { padding: 5px 9px; font-size: 12px; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f8fafc;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
table.data td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #f8fafc; }
.mono { font-family: var(--mono); font-size: 12px; }
.empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cell-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.cell-link:hover { text-decoration: underline; }
.back-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 13px;
}
.back-link:hover { text-decoration: underline; }
.kv {
  display: grid;
  grid-template-columns: 200px 1fr;
}
.kv dt {
  margin: 0;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}
.kv dd {
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  word-break: break-word;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}
.badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-approved { background: var(--ok-bg); color: var(--ok); }
.badge-rejected { background: var(--bad-bg); color: var(--bad); }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.field { display: block; margin: 0 0 12px; font-size: 12px; font-weight: 600; color: #334155; }
.field input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font: inherit;
  font-weight: 400;
}
.lic {
  margin: 0 0 20px;
  padding: 12px 14px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
}
.lic.flush {
  margin: 0;
  border-radius: 0;
  max-height: 280px;
  overflow: auto;
}

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .nav { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .brand { border: 0; margin: 0; padding: 0 8px 0 0; }
  .nav-label { display: none; }
  .nav-foot { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; gap: 10px; align-items: center; }
  .split { grid-template-columns: 1fr; }
  .topbar, .stage { padding-left: 16px; padding-right: 16px; }
}
