:root {
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe4ee;
  --sidebar: #0b1220;
  --sidebar-line: #1e293b;
  --accent: #0ea5e9;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }

body {
  font-size: 13px;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.7), transparent 70%);
}

th, td {
  padding: 8px 10px !important;
  font-size: 12px;
  vertical-align: middle;
}

th {
  color: #475569;
  font-weight: 700;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  border-color: #edf2f7 !important;
}

tr:hover td {
  background: #f8fbff;
}

button, input, select, textarea {
  letter-spacing: 0;
}

input, select, textarea {
  border-color: #cbd5e1 !important;
  background: #fff;
}

input:focus, select:focus, textarea:focus {
  outline: none !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, .16) !important;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
  white-space: nowrap;
}

.btn-sm:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

.btn-sm:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
  box-shadow: none;
}

.input-sm, .select-sm {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.filter-bar label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.login-bg {
  background-color: #07111f;
  background-image:
    linear-gradient(135deg, rgba(14, 165, 233, .22), rgba(34, 197, 94, .12)),
    linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: auto, 36px 36px, 36px 36px;
}

.login-card {
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.app-shell {
  position: relative;
  z-index: 1;
}

.app-sidebar {
  background: var(--sidebar) !important;
  color: #cbd5e1;
  border-right-color: var(--sidebar-line) !important;
  box-shadow: 12px 0 28px rgba(15, 23, 42, .12);
}

.app-sidebar h1 {
  color: #fff;
}

.app-sidebar .nav-btn {
  color: #cbd5e1;
  border: 1px solid transparent;
  border-radius: 8px;
}

.app-sidebar .nav-btn:hover {
  background: rgba(148, 163, 184, .12) !important;
  color: #fff;
}

.app-sidebar .nav-btn.bg-blue-100 {
  background: rgba(14, 165, 233, .18) !important;
  color: #f8fafc !important;
  border-color: rgba(14, 165, 233, .34);
}

.app-sidebar #userBadge {
  background: rgba(255,255,255,.06) !important;
  border: 1px solid rgba(255,255,255,.1);
  color: #dbeafe;
}

.app-sidebar #userBadge span {
  color: inherit !important;
}

.app-main {
  background: transparent;
}

.app-main h2 {
  color: #0f172a;
}

.bg-white.rounded-xl,
.metric-card,
.panel-card {
  border-radius: 8px !important;
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .05);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

.tag {
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.admin-col { display: none; }
body.is-admin .admin-col { display: table-cell; }

.submitter-tag {
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
}

.metric-card {
  background: var(--surface);
  padding: 16px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 24px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: 0;
}

.panel-card {
  background: var(--surface);
  padding: 16px;
}

.panel-title {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.trend-grid {
  display: grid;
  grid-template-columns: repeat(14, minmax(24px, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 180px;
}

.trend-bar-wrap {
  min-width: 0;
  text-align: center;
  color: #94a3b8;
  font-size: 10px;
}

.trend-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 8px 8px 2px 2px;
  background: linear-gradient(180deg, var(--accent), #2563eb);
  transition: height .2s ease;
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.rank-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #334155;
  font-size: 12px;
}

.progress-track {
  height: 8px;
  border-radius: 9999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: var(--accent);
}

.scenario-result {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .05);
}

.check-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fafc;
}

.check-item span {
  font-size: 11px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
}

.check-item strong {
  font-size: 12px;
  color: #0f172a;
}

.check-item em {
  grid-column: 2;
  font-size: 11px;
  color: var(--muted);
  font-style: normal;
}

.check-item.is-pass span {
  color: #047857;
  background: #d1fae5;
}

.check-item.is-fail span {
  color: #b91c1c;
  background: #fee2e2;
}

@media (max-width: 820px) {
  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100% !important;
    min-height: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
  }

  .app-sidebar .space-y-1 {
    display: flex;
    gap: 6px;
  }

  .app-main {
    padding: 12px !important;
  }

  .trend-grid {
    grid-template-columns: repeat(7, minmax(26px, 1fr));
  }
}
