:root {
  --navy: #0f172a;
  --navy-deep: #0a1020;
  --slate: #1e293b;
  --slate-light: #334155;
  --border: #cbd5e1;
  --border-dark: #1e293b;
  --bg: #eef1f6;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --amber-soft: #fef3c7;
  --amber-text: #92400e;
  --green: #059669;
  --green-soft: #d1fae5;
  --red: #dc2626;
  --mono: ui-monospace, "Cascadia Code", monospace;
  --sans: "Public Sans", system-ui, sans-serif;
  --rail-w: 240px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 10px 16px;
  background: #fff;
  color: #000;
  font-weight: 600;
}

.skip:focus {
  left: 12px;
  top: 12px;
}

.shell {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
}

.rail {
  background: var(--navy-deep);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 1rem 0.75rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid #1e293b;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0.5rem 1.25rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.rail-brand span {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #1d4ed8);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
}

.rail nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.rail nav a {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #94a3b8;
  transition: background 0.15s, color 0.15s;
}

.rail nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
}

.rail nav a[aria-current="page"] {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
  font-weight: 600;
}

.rail-foot {
  margin-top: auto;
  padding: 1rem 0.5rem 0;
  border-top: 1px solid var(--slate);
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.55;
}

.rail-foot strong {
  display: block;
  color: #cbd5e1;
  margin-bottom: 0.25rem;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.top h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chip {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.chip-admin {
  background: var(--accent-soft);
  color: #1d4ed8;
}

.chip-ops {
  background: var(--amber-soft);
  color: var(--amber-text);
}

.menu-toggle {
  display: none;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
}

main {
  flex: 1;
  padding: 1.25rem 1.5rem 2rem;
}

.demo-footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.demo-footer a {
  color: var(--accent);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}

.stat label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.stat strong {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stat span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.card-head h2 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

.card-head a {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 500;
}

.card-body {
  padding: 0.5rem 0;
}

.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.queue-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  align-items: center;
}

.queue-list li:last-child {
  border-bottom: 0;
}

.queue-list strong {
  font-size: 0.9rem;
}

.queue-list span {
  font-size: 0.78rem;
  color: var(--muted);
}

.btn-sm {
  appearance: none;
  border: none;
  background: var(--navy);
  color: #fff;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-sm:hover {
  background: var(--slate);
}

.btn-outline {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.78rem;
  cursor: pointer;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid #f1f5f9;
}

.data-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  background: #f8fafc;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table a {
  color: var(--accent);
  font-weight: 500;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.toolbar input,
.toolbar select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  background: var(--surface);
  font-size: 0.82rem;
}

.toolbar .spacer {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted);
}

.matrix-wrap {
  overflow-x: auto;
  padding: 0.5rem;
}

.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 520px;
}

.matrix th,
.matrix td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.5rem;
  text-align: center;
}

.matrix th {
  background: var(--navy);
  color: #e2e8f0;
  font-weight: 600;
}

.matrix th.row-head {
  text-align: left;
  background: #f8fafc;
  color: var(--text);
  font-weight: 600;
}

.matrix td.yes {
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
}

.matrix td.no {
  color: #cbd5e1;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.badge-pending {
  background: var(--amber-soft);
  color: var(--amber-text);
}

.badge-done {
  background: var(--green-soft);
  color: var(--green);
}

.badge-deny {
  background: #fee2e2;
  color: var(--red);
}

.profile-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
}

.profile-side {
  padding: 1rem;
}

.profile-side dl {
  margin: 0;
}

.profile-side dt {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.75rem;
}

.profile-side dd {
  margin: 0.15rem 0 0;
  font-weight: 500;
}

.settings-form {
  padding: 1rem;
  display: grid;
  gap: 1rem;
  max-width: 480px;
}

.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.toggle-ui {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  flex-shrink: 0;
}

.toggle-ui.on {
  background: var(--accent);
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-ui.on::after {
  left: 23px;
}

.breadcrumb {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.breadcrumb a {
  color: var(--accent);
}

@media (max-width: 1100px) {
  .stat-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .split,
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .rail {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    width: min(var(--rail-w), 88vw);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.2);
  }
  .shell.nav-open .rail {
    transform: translateX(0);
  }
  .menu-toggle {
    display: inline-block;
  }
  .top,
  main {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .stat-row {
    grid-template-columns: 1fr;
  }
}
