:root {
  --ink: #081121;
  --navy: #0b1527;
  --navy-soft: #101c30;
  --panel: #122033;
  --paper: #f7f6f2;
  --muted: #aab4c6;
  --amber: #f5a623;
  --amber-light: #ffc15f;
  --blue: #2d8cff;
  --line: rgba(231, 238, 249, 0.14);
  --line-strong: rgba(231, 238, 249, 0.28);
  --danger: #e15b64;
  --ok: #3dbe8b;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius: 16px;
  --font: "Manrope", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sidebar: 252px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(900px 380px at 0% -10%, rgba(245, 166, 35, 0.12), transparent 50%),
    var(--ink);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(245, 166, 35, 0.35); }

.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: rgba(11, 21, 39, 0.96);
  border-right: 1px solid var(--line);
  padding: 20px 14px 88px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.brand { display: flex; gap: 12px; align-items: center; margin: 0 6px 22px; }
.mark {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  background: linear-gradient(160deg, var(--amber-light), #c47b09);
  color: var(--ink); font-weight: 800; display: grid; place-items: center;
}
.brand h1 { font-size: 15px; margin: 0; letter-spacing: -0.03em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.nav-label {
  margin: 16px 10px 6px;
  color: #7f8ba0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}
.nav-btn {
  width: 100%; text-align: left; background: transparent; border: 1px solid transparent;
  color: var(--muted); padding: 9px 12px; border-radius: 10px; margin-bottom: 2px;
  font-size: 14px; font-weight: 650;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.nav-btn.active, .nav-btn:hover { background: rgba(247, 246, 242, 0.05); color: var(--paper); border-color: var(--line); }
.nav-btn.active { box-shadow: inset 3px 0 0 var(--amber); }
.side-foot { position: absolute; bottom: 16px; left: 14px; right: 14px; background: linear-gradient(180deg, transparent, #0b1527 30%); padding-top: 12px; }
.side-foot .ghost { width: 100%; }

.ghost, .primary, .danger {
  border: 0; border-radius: 11px; padding: 10px 14px; font-weight: 750;
  transition: transform 0.16s var(--ease), background 0.16s var(--ease), opacity 0.16s var(--ease);
}
.ghost:hover, .primary:hover, .danger:hover { transform: translateY(-1px); }
.primary { background: var(--amber); color: var(--ink); }
.primary:hover { background: var(--amber-light); }
.ghost { background: rgba(247, 246, 242, 0.03); color: var(--paper); border: 1px solid var(--line); }
.danger { background: rgba(225, 91, 100, 0.08); color: #ffb4ba; border: 1px solid rgba(225, 91, 100, 0.4); }
button:disabled { opacity: 0.55; cursor: wait; transform: none; }

.main { padding: 28px 32px 64px; min-width: 0; }
.menu-toggle { display: none; margin-bottom: 12px; }
main > section { animation: rise 0.35s var(--ease); }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.topbar > button, .toolbar button { flex: 0 0 auto; }
.kicker { font-family: var(--mono); color: var(--amber); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 6px; }
h2 { margin: 0; font-size: clamp(26px, 3vw, 32px); letter-spacing: -0.04em; line-height: 1.05; }
h3 { margin: 16px 0 10px; font-size: 15px; }
.detail h3:first-of-type, .panel > h3:first-child { margin-top: 0; }
.sub { color: var(--muted); margin: 6px 0 0; max-width: 62ch; line-height: 1.5; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.card, .panel, .detail {
  background: rgba(16, 28, 48, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card { padding: 16px 18px; }
.card span { color: var(--muted); font-size: 13px; }
.card strong { display: block; margin-top: 8px; font-size: clamp(24px, 2vw, 30px); letter-spacing: -0.04em; overflow-wrap: anywhere; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.72fr); gap: 14px; align-items: start; }
.panel, .detail { padding: 14px; min-width: 0; }
.detail { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.grid-2, .charts { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr); }
.charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart-box { height: 240px; position: relative; }
.chart-box canvas { width: 100% !important; height: 210px !important; }
.panel, .detail { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.mini, .detail table { min-width: 0; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td { overflow-wrap: anywhere; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
tbody tr { cursor: pointer; transition: background 0.15s var(--ease); }
tbody tr:hover, tr.selected { background: rgba(245, 166, 35, 0.07); }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
.search { width: min(280px, 100%); }
input, select, textarea {
  background: rgba(8, 17, 33, 0.8);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
input:focus, select:focus, textarea:focus { border-color: rgba(245, 166, 35, 0.75); box-shadow: 0 0 0 4px rgba(245, 166, 35, 0.12); }
textarea { min-height: 84px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid label, .stack label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 650; }
.span-2 { grid-column: span 2; }
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(45, 140, 255, 0.15); color: #9cc7ff; text-transform: capitalize; white-space: nowrap; }
.badge.completed { background: rgba(61, 190, 139, 0.16); color: #8ee0bc; }
.badge.cancelled, .badge.draft { background: rgba(170, 180, 198, 0.12); color: var(--muted); }
.badge.in_progress, .badge.released, .badge.planned { background: rgba(245, 166, 35, 0.16); color: var(--amber-light); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions button { padding: 6px 8px; font-size: 12px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.fact { background: rgba(8, 17, 33, 0.45); border-radius: 12px; padding: 10px 12px; }
.fact span { display: block; color: var(--muted); font-size: 12px; }
.fact strong { font-size: 14px; }
.detail ul { margin: 0 0 8px; padding-left: 18px; color: var(--muted); }
.hidden { display: none !important; }
.toast {
  position: fixed; right: 18px; bottom: 18px; background: var(--paper); color: var(--ink);
  padding: 12px 14px; border-radius: 12px; font-weight: 750; z-index: 40; max-width: min(320px, calc(100vw - 32px));
  animation: rise 0.25s var(--ease);
}
.toast.error { background: #ffd7db; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login {
  width: min(420px, 100%); background: var(--navy-soft); border: 1px solid var(--line);
  border-radius: 22px; padding: 28px; animation: rise 0.4s var(--ease);
}
.login .primary { width: 100%; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.drawer {
  position: fixed; inset: 0; background: rgba(5, 10, 20, 0.66); display: grid; justify-content: end; z-index: 25;
  animation: fade 0.2s var(--ease);
}
.drawer-card {
  width: min(560px, 100vw); height: 100%; background: #0d182b; border-left: 1px solid var(--line);
  padding: 22px; overflow: auto; animation: slide 0.28s var(--ease);
}
.check { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--paper) !important; }
.check input { width: auto; }
.metric { font-family: var(--mono); color: var(--amber-light); font-size: 13px; line-height: 1.6; }
.empty { color: var(--muted); padding: 16px 0; }
.mini { font-size: 13px; }

.loader {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 50;
  background: rgba(245, 166, 35, 0.18); overflow: hidden; pointer-events: none;
}
.loader::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 36%;
  background: linear-gradient(90deg, transparent, var(--amber), var(--amber-light));
  animation: load 0.9s var(--ease) infinite;
}
.loading .panel, .loading .detail, .loading .card { opacity: 0.72; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide { from { transform: translateX(18px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes load { from { transform: translateX(-120%); } to { transform: translateX(320%); } }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts, .workspace, .grid-2 { grid-template-columns: 1fr; }
  .detail { position: static; max-height: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 30; transform: translateX(-105%);
    transition: transform 0.24s var(--ease); width: min(280px, 86vw); height: 100vh;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .main { padding: 16px 16px 40px; }
  .form-grid, .facts, .stats { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .topbar { flex-direction: column; align-items: stretch; }
  .drawer { justify-content: stretch; }
  .drawer-card { width: 100%; border-left: 0; }
  .toast { left: 16px; right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}