:root {
  color-scheme: light;
  --font-sans: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --bg: #f4f1ec;
  --bg-2: #f9f6f1;
  --card: rgba(16, 24, 46, 0.7);
  --text: #f5f7ff;
  --muted: rgba(226, 232, 255, 0.6);
  --accent: #235789;
  --accent-2: #f7b32b;
  --accent-3: #0f8b8d;
  --border: rgba(120, 140, 180, 0.25);
  --shadow: 0 16px 40px rgba(7, 12, 30, 0.35);
  --radius: 16px;
  --neon: #5ad0ff;
  --neon-2: #a15bff;
  --neon-3: #ff7ad9;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: #08122a;
  color: var(--text);
  line-height: 1.35;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 12, 30, 0.92) 0%, rgba(7, 12, 30, 0.72) 40%, rgba(7, 12, 30, 0.88) 100%),
    radial-gradient(800px 420px at 80% -10%, rgba(90, 208, 255, 0.25), transparent 60%),
    radial-gradient(700px 360px at -10% 10%, rgba(161, 91, 255, 0.2), transparent 60%),
    url("/static/bg.jpg");
  background-size: cover, cover, cover, cover;
  background-position: center, center, center, center;
  filter: saturate(1.1);
  z-index: -1;
}

.app::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 280px at 15% 0%, rgba(255, 122, 217, 0.18), transparent 60%);
  pointer-events: none;
  z-index: -1;
}

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: grid;
  gap: 16px;
  position: relative;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(226, 232, 255, 0.6);
  margin-bottom: 6px;
}

.title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
}

.subtitle {
  font-size: 12px;
  color: rgba(226, 232, 255, 0.6);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11px;
  color: rgba(245, 247, 255, 0.8);
  background: rgba(14, 22, 45, 0.75);
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
  backdrop-filter: blur(14px);
}

.hero {
  border: 1px solid rgba(90, 208, 255, 0.25);
  background: linear-gradient(135deg, rgba(25, 53, 90, 0.7), rgba(15, 139, 141, 0.35));
}

.card-title {
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 18, 40, 0.55);
  border-radius: 12px;
  padding: 12px;
  min-height: 72px;
  display: grid;
  gap: 6px;
}

.stat-label {
  color: rgba(226, 232, 255, 0.6);
  font-size: 12px;
}

.stat-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.filters {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
  margin-top: 10px;
}

.field span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(8, 16, 36, 0.7);
  font-family: var(--font-sans);
  color: var(--text);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.btn {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease, filter 0.2s ease;
}

.btn-primary {
  background: linear-gradient(120deg, rgba(90, 208, 255, 0.9), rgba(161, 91, 255, 0.85));
  color: #fff;
  box-shadow: 0 12px 24px rgba(55, 134, 255, 0.35);
}

.btn-primary:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.98); }

.btn-ghost {
  background: rgba(10, 18, 40, 0.6);
  color: rgba(245, 247, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-ghost:hover { background: rgba(10, 18, 40, 0.8); }

.btn::after {
  content: "";
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.35), transparent 45%);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: -1;
}

.btn:hover::after { opacity: 0.7; }

.btn-primary::before {
  content: "";
  position: absolute;
  inset: -100%;
  background: conic-gradient(from 180deg, rgba(90, 208, 255, 0.2), rgba(255, 122, 217, 0.4), rgba(161, 91, 255, 0.2));
  animation: spin 6s linear infinite;
  opacity: 0.6;
  z-index: -1;
}

.quick-range {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seg-btn {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 18, 40, 0.65);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: rgba(245, 247, 255, 0.8);
  transition: background 0.2s ease, color 0.2s ease, border 0.2s ease, transform 0.12s ease;
}

.seg-btn.active {
  background: linear-gradient(120deg, rgba(255, 122, 217, 0.9), rgba(90, 208, 255, 0.9));
  border-color: transparent;
  color: #0b1020;
}
.seg-btn:active { transform: translateY(1px) scale(0.98); }

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.list-block {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.hint { color: var(--muted); font-size: 12px; }

.series {
  display: grid;
  gap: 10px;
}

.series-item {
  display: grid;
  grid-template-columns: 84px 1fr 86px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.bar {
  height: 10px;
  background: #efe7de;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

.bar > span {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  width: var(--w, 0%);
  transform-origin: left;
  animation: bar-fill 0.7s ease;
}

.bar-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.bar-name {
  font-weight: 600;
}

.bar-value {
  color: var(--muted);
  font-size: 12px;
}

.bar-track {
  height: 10px;
  background: rgba(8, 16, 36, 0.7);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 122, 217, 0.9), rgba(90, 208, 255, 0.9));
  width: var(--w, 0%);
  transform-origin: left;
  animation: bar-fill 0.7s ease;
}

.chart {
  position: relative;
  min-height: 140px;
  background: rgba(10, 18, 40, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  overflow: hidden;
}

.chart svg {
  width: 100%;
  height: 140px;
  display: block;
}

.chart-small svg {
  height: 120px;
}

.chart .area {
  fill: rgba(90, 208, 255, 0.22);
  animation: fade-in 0.6s ease;
}

.chart .line {
  fill: none;
  stroke: rgba(90, 208, 255, 0.95);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart .dot {
  fill: rgba(255, 122, 217, 0.95);
  stroke: rgba(255, 255, 255, 0.8);
  stroke-width: 1.5;
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(226, 232, 255, 0.6);
  margin-top: 8px;
  padding: 0 4px;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(8, 16, 36, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
  pointer-events: none;
  transform: translate(-50%, -110%);
  white-space: nowrap;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

.story {
  display: grid;
  gap: 12px;
}

.story-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.story-range {
  font-size: 12px;
  color: rgba(226, 232, 255, 0.6);
}

.story-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.story-chip {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 18, 40, 0.55);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.story-chip.accent {
  border-color: rgba(90, 208, 255, 0.4);
  background: rgba(10, 18, 40, 0.8);
}

.story-chip.dim {
  color: rgba(226, 232, 255, 0.6);
}

.story-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.story-kpi {
  background: rgba(10, 18, 40, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.story-label {
  font-size: 12px;
  color: rgba(226, 232, 255, 0.6);
}

.story-value {
  font-size: 18px;
  font-weight: 800;
}

.story-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.story-missing {
  font-size: 12px;
  color: rgba(226, 232, 255, 0.7);
}

.story-insight {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(10, 18, 40, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.story-insight-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(120deg, rgba(255, 122, 217, 0.6), rgba(90, 208, 255, 0.7));
  box-shadow: 0 8px 20px rgba(90, 208, 255, 0.25);
  font-size: 16px;
}

.story-insight-text {
  line-height: 1.4;
}

.command {
  display: grid;
  gap: 12px;
}

.command-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.progress-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: conic-gradient(var(--neon) var(--p, 0%), rgba(255, 255, 255, 0.08) 0);
  padding: 6px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
}

.progress-center {
  height: 100%;
  width: 100%;
  border-radius: 50%;
  background: rgba(10, 18, 40, 0.75);
  display: grid;
  place-items: center;
  text-align: center;
}

.progress-value {
  font-weight: 800;
  font-size: 18px;
}

.progress-label {
  font-size: 10px;
  color: rgba(226, 232, 255, 0.6);
}

.command-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.command-stat {
  background: rgba(10, 18, 40, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.command-stat-label {
  font-size: 12px;
  color: rgba(226, 232, 255, 0.6);
}

.command-stat-value {
  font-weight: 800;
  font-size: 16px;
}

.command-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.command-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.command-card {
  background: rgba(10, 18, 40, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.command-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(7, 12, 30, 0.3);
}

.command-card.flash {
  animation: status-flash 1.2s ease;
}

.command-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.command-name {
  font-weight: 700;
}

.command-state {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.status-submitted .command-state {
  background: rgba(90, 208, 255, 0.2);
  color: #e6f7ff;
}

.status-missing .command-state {
  background: rgba(255, 122, 217, 0.2);
  color: #ffe8f6;
}

.command-amount {
  font-size: 16px;
  font-weight: 800;
}

.command-meta {
  font-size: 12px;
  color: rgba(226, 232, 255, 0.65);
}

.command-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.btn.btn-xs {
  padding: 6px 10px;
  font-size: 11px;
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(7, minmax(36px, 1fr));
  gap: 8px;
}

.heat-cell {
  border-radius: 12px;
  padding: 8px;
  display: grid;
  gap: 6px;
  min-height: 64px;
  background: rgba(10, 18, 40, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.heat-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(7, 12, 30, 0.25);
}

.heat-day {
  font-size: 11px;
  color: rgba(226, 232, 255, 0.7);
}

.heat-value {
  font-weight: 700;
  font-size: 12px;
}
}

.line-draw {
  stroke-dasharray: var(--len, 0);
  stroke-dashoffset: var(--len, 0);
  animation: line-draw 0.8s ease forwards;
}

.empty {
  color: rgba(226, 232, 255, 0.6);
  font-size: 13px;
  padding: 8px 0;
}

.warning {
  border-color: #f2b5b5;
  background: #fff2f2;
}

.stagger > * {
  opacity: 0;
  transform: translateY(8px);
  animation: stagger-in 0.45s ease forwards;
}

.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.05s; }
.stagger > *:nth-child(3) { animation-delay: 0.08s; }
.stagger > *:nth-child(4) { animation-delay: 0.11s; }
.stagger > *:nth-child(5) { animation-delay: 0.14s; }
.stagger > *:nth-child(6) { animation-delay: 0.17s; }
.stagger > *:nth-child(7) { animation-delay: 0.2s; }
.stagger > *:nth-child(8) { animation-delay: 0.23s; }

.pulse {
  animation: pulse 0.35s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes stagger-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bar-fill {
  from { transform: scaleX(0.2); }
  to { transform: scaleX(1); }
}

@keyframes line-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes status-flash {
  0% { box-shadow: 0 0 0 rgba(90, 208, 255, 0); }
  30% { box-shadow: 0 0 24px rgba(90, 208, 255, 0.45); }
  100% { box-shadow: 0 0 0 rgba(90, 208, 255, 0); }
}

@media (max-width: 720px) {
  .title { font-size: 24px; }
  .header { flex-direction: column; align-items: flex-start; }
  .stat-value { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
