:root {
  --primary: #9601cd;
  --primary-strong: #7a00a7;
  --navy: #051b4b;
  --accent: #eb408c;
  --surface: #ffffff;
  --bg: #f4f7fb;
  --line: rgba(6, 24, 63, 0.09);
  --text: #172034;
  --muted: #66748f;
  --success: #0f9f6e;
  --danger: #d13f5a;
  --warning: #f59e0b;
  --shadow: 0 14px 40px rgba(10, 18, 35, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea, select { font: inherit; }
body { min-height: 100vh; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .78rem; }

.app-shell { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 18px; background: linear-gradient(180deg, #0a1847 0%, #06132d 100%);
  color: #fff; border-right: 1px solid rgba(255,255,255,.08); z-index: 20;
}
.brand-card {
  display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(150,1,205,.30), rgba(235,64,140,.14)); border: 1px solid rgba(255,255,255,.1);
}
.brand-mark {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: inset 0 1px 0 rgba(255,255,255,.24);
}
.brand-title { font-size: 1rem; font-weight: 700; }
.brand-subtitle { color: rgba(255,255,255,.7); font-size: .86rem; }
.nav-list { display: grid; gap: 8px; margin-top: 18px; }
.nav-item {
  border: 0; border-radius: 14px; text-align: left; padding: 14px 16px; background: rgba(255,255,255,.04);
  color: #fff; cursor: pointer; transition: .2s ease; font-weight: 600;
}
.nav-item:hover, .nav-item.active { background: linear-gradient(135deg, rgba(150,1,205,.85), rgba(235,64,140,.65)); }
.sidebar-footer { display: grid; gap: 10px; margin-top: auto; padding-top: 18px; }

.main-content { padding: 22px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px;
}
.topbar h1 { margin: 0 0 4px; font-size: clamp(1.5rem, 2vw, 2.1rem); }
.menu-btn {
  display: none; border: 0; background: var(--surface); box-shadow: var(--shadow); width: 48px; height: 48px; border-radius: 14px;
}
.status-pills { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px; border-radius: 999px; background: rgba(150,1,205,.1); color: var(--primary); font-weight: 700;
}
.pill.accent { background: rgba(235,64,140,.13); color: #b6125f; }
.pill.danger { background: rgba(209,63,90,.12); color: var(--danger); }
.pill.ghost { background: var(--surface); color: var(--navy); border: 1px solid var(--line); }
.pill.small { padding: 6px 10px; font-size: .76rem; }

.hero-card {
  display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 24px; margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(150,1,205,.96), rgba(5,27,75,.97)); color: #fff; border-radius: var(--radius-xl); box-shadow: var(--shadow);
}
.eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .78; }
.hero-card h2 { margin: 10px 0 10px; font-size: clamp(1.5rem, 2.3vw, 2.4rem); }
.hero-card p { margin: 0 0 14px; max-width: 760px; color: rgba(255,255,255,.88); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-meta span { padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,.12); font-size: .88rem; }
.hero-actions { display: grid; gap: 10px; min-width: 160px; }

.view { display: none; }
.view.active { display: block; }
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.one-up { grid-template-columns: minmax(0, 1fr); }
.card {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px; border: 1px solid rgba(255,255,255,.74);
}
.card-title-row { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card h3 { margin: 0; font-size: 1.1rem; }

.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: linear-gradient(180deg, #fff, #fbfbff); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow);
}
.stat-label { font-size: .84rem; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-size: 1.7rem; font-weight: 800; color: var(--navy); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid.compact { grid-template-columns: 1fr; }
.form-grid label { display: grid; gap: 6px; }
.form-grid label span { font-size: .84rem; color: var(--muted); font-weight: 600; }
.form-grid .full { grid-column: 1 / -1; }
input, textarea, select {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; background: #fff; color: var(--text); width: 100%;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(150,1,205,.16); border-color: rgba(150,1,205,.42); }
.form-actions { display: flex; gap: 10px; justify-content: flex-start; }
.primary-btn, .ghost-btn, .icon-btn {
  border: 0; border-radius: 14px; cursor: pointer; transition: .2s ease; font-weight: 700;
}
.primary-btn { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; padding: 12px 16px; box-shadow: 0 10px 24px rgba(150,1,205,.22); }
.primary-btn:hover { transform: translateY(-1px); }
.ghost-btn { background: #fff; color: var(--navy); border: 1px solid var(--line); padding: 12px 15px; }
.ghost-btn.small { padding: 8px 11px; border-radius: 12px; }
.icon-btn { background: #fff; padding: 10px 12px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
thead th {
  position: sticky; top: 0; background: #f8f8ff; color: var(--navy); font-size: .84rem; text-align: left; padding: 12px; border-bottom: 1px solid var(--line);
}
tbody td { padding: 12px; border-bottom: 1px solid rgba(6,24,63,.06); vertical-align: top; font-size: .92rem; }
.empty-cell { padding: 18px; color: var(--muted); }

.stack-list, .mini-list { display: grid; gap: 10px; }
.list-row, .mini-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fcfcff;
}
.bullet-list { margin: 0; padding-left: 18px; display: grid; gap: 10px; }
.empty-copy { color: var(--muted); }

.dialog-card {
  width: min(420px, calc(100vw - 28px)); border: 0; border-radius: 20px; padding: 18px; box-shadow: var(--shadow); background: #fff;
}
.dialog-card::backdrop { background: rgba(3, 11, 26, .56); }
.dialog-actions.top { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.backdrop {
  display: none; position: fixed; inset: 0; background: rgba(3, 11, 26, .56); z-index: 15;
}
.backdrop.show { display: block; }
.toast-host { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 10px; z-index: 60; }
.toast {
  background: rgba(5, 27, 75, .96); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); min-width: 220px;
}

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.two-up { grid-template-columns: 1fr; }
}

@media (max-width: 940px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: min(320px, 86vw); transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-grid; place-items: center; }
  .topbar { align-items: flex-start; }
}

@media (max-width: 760px) {
  .main-content { padding: 14px; }
  .hero-card { flex-direction: column; align-items: flex-start; padding: 20px; }
  .status-pills { justify-content: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .hero-actions { width: 100%; }
  .topbar { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

.section-line { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
