:root {
  --bg: #0a0f1c;
  --bg-elevated: #0d1424;
  --surface: #121a2c;
  --surface-2: #182338;
  --surface-hover: #1c2941;
  --border: #253148;
  --border-strong: #34435f;
  --text: #eef2fa;
  --text-muted: #8ea0c2;
  --text-faint: #5d6c8c;

  --primary: #4f7fe8;
  --primary-hover: #3d6bd6;
  --primary-soft: rgba(79, 127, 232, 0.14);
  --accent: #cf8a3f;
  --accent-soft: rgba(207, 138, 63, 0.16);
  --success: #34c07c;
  --success-soft: rgba(52, 192, 124, 0.14);
  --danger: #ef5257;
  --danger-soft: rgba(239, 82, 87, 0.14);
  --warning: #e0ab4c;
  --warning-soft: rgba(224, 171, 76, 0.16);

  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 12px 28px -14px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(79, 127, 232, 0.10), transparent),
    radial-gradient(900px 500px at 100% 0%, rgba(207, 138, 63, 0.06), transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 15, 28, 0.82);
  backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: linear-gradient(155deg, var(--primary), #2c4faa);
  box-shadow: var(--shadow-sm);
}
.brand-text { line-height: 1.15; }
.brand-title { font-size: 14.5px; font-weight: 650; letter-spacing: 0.1px; }
.brand-subtitle { font-size: 11px; color: var(--text-faint); font-weight: 500; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 650; letter-spacing: 0.3px; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
  background: var(--warning-soft); color: var(--warning);
  border: 1px solid rgba(224, 171, 76, 0.28);
}
.pill-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.topbar-actions { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.topbar-actions a { color: var(--text-muted); text-decoration: none; font-weight: 500; }
.topbar-actions a:hover { color: var(--text); }

/* ---------- Layout ---------- */
main { max-width: 760px; margin: 0 auto; padding: 36px 20px 60px; }
main.wide { max-width: 900px; }

.hero { text-align: center; margin: 28px 0 36px; }
.hero h1 { font-size: 27px; font-weight: 700; letter-spacing: -0.3px; margin: 0 0 8px; }
.hero p { color: var(--text-muted); font-size: 14.5px; max-width: 480px; margin: 0 auto; line-height: 1.55; }

.panel {
  background: linear-gradient(180deg, var(--surface), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

h2.panel-title {
  font-size: 15px; font-weight: 650; margin: 0 0 4px; letter-spacing: -0.1px;
  display: flex; align-items: center; gap: 8px;
}
.panel-subtitle { font-size: 12.5px; color: var(--text-faint); margin: 0 0 18px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 550; color: var(--text-muted); margin: 14px 0 5px; }
label:first-child { margin-top: 0; }

input, select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.15s ease;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input[type="checkbox"] { width: auto; accent-color: var(--primary); }
input[type="file"] { padding: 8px; font-size: 12.5px; color: var(--text-muted); }

/* ---------- Buttons ---------- */
button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  background: var(--primary);
  color: #fff;
  margin-top: 18px;
  transition: background 0.15s ease, transform 0.05s ease;
}
button:hover { background: var(--primary-hover); }
button:active { transform: translateY(1px); }
button.secondary { background: transparent; border: 1px solid var(--border-strong); color: var(--text); margin-left: 8px; }
button.secondary:hover { background: var(--surface-hover); }
button.approve { background: var(--success); }
button.approve:hover { background: #29a868; }
button.deny { background: var(--danger); }
button.deny:hover { background: #d83d42; }

/* ---------- Messages ---------- */
.msg { font-size: 12.5px; margin-top: 12px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--success); }

/* ---------- Application list ---------- */
.app-list a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
  background: var(--surface-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.app-list a:hover { border-color: var(--primary); background: var(--surface-hover); }
.app-list .app-meta { color: var(--text-faint); font-weight: 500; text-transform: capitalize; margin-left: 6px; }

/* ---------- Status / result pills ---------- */
.status, .tag {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
  padding: 3px 8px; border-radius: 999px;
}
.status.draft, .status.submitted { background: var(--surface-2); color: var(--text-muted); }
.status.review { background: var(--warning-soft); color: var(--warning); }
.status.approved, .status.auto_approved { background: var(--success-soft); color: var(--success); }
.status.denied { background: var(--danger-soft); color: var(--danger); }

.tag.PASS { background: var(--success-soft); color: var(--success); }
.tag.FAIL { background: var(--danger-soft); color: var(--danger); }
.tag.EXCEPTION { background: var(--warning-soft); color: var(--warning); }

/* ---------- Rule / doc rows ---------- */
.rule-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 13px; gap: 12px;
}
.rule-row:last-child { border-bottom: none; }
.rule-row > span:first-child { color: var(--text); }

/* ---------- License box ---------- */
.license-box {
  background: var(--bg-elevated);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  padding: 18px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-muted);
}
.license-box b { color: var(--text); }

/* ---------- Footer ---------- */
footer {
  text-align: center; color: var(--text-faint); font-size: 11.5px;
  padding: 28px 20px 40px; border-top: 1px solid var(--border); margin-top: 20px;
}

/* ---------- Misc ---------- */
.empty { color: var(--text-faint); font-size: 13px; padding: 4px 0; }
.section-label { font-size: 12px; font-weight: 650; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin: 26px 0 12px; }
