/* ===== Design tokens ===== */
:root{
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-50: #eff6ff;
  --accent: #10b981;
  --warn: #ef4444;
  --radius: 14px;
  --shadow: 0 12px 30px rgba(0,0,0,.08);
  --shadow-sm: 0 6px 18px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark){
  :root{
    --bg: #0f172a;
    --card: #111827;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: #1f2937;
    --primary: #60a5fa;
    --primary-600: #3b82f6;
    --primary-50: #0b1220;
    --accent: #34d399;
    --shadow: 0 12px 30px rgba(0,0,0,.35);
    --shadow-sm: 0 6px 18px rgba(0,0,0,.3);
  }
}
*, *::before, *::after { box-sizing: border-box; }
html,body{height:100%}
body{
  margin:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, sans-serif;
  color:var(--text); background:
    radial-gradient(1200px 1200px at 10% -10%, rgba(37,99,235,.08), transparent 40%),
    radial-gradient(1200px 1200px at 110% 10%, rgba(16,185,129,.06), transparent 40%),
    var(--bg);
}
.container{ max-width: 1100px; margin: 28px auto; padding: 0 16px; }
.header{ display:flex; align-items: center; gap:14px; margin-bottom: 18px; }
.logo{
  width:40px; height:40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  box-shadow: var(--shadow-sm);
  display:flex; align-items:center; justify-content:center; color:white; font-weight:700;
}
.title h1{margin:0; font-size: clamp(20px, 3vw, 28px);}
.title p{margin:2px 0 0; color:var(--muted); font-size: 14px}

.grid{ display:grid; gap:16px; grid-template-columns: 1fr; }
@media (min-width: 980px){
  .grid{
    grid-template-columns: minmax(340px, 420px) minmax(520px, 640px);
    justify-content: center; max-width: 1080px; margin-inline: auto;
  }
}

.card{
  background: var(--card); border:1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding:18px;
}
.section-title{ display:flex; align-items:center; justify-content: space-between; gap:10px; margin-bottom:12px; }
.section-title h2{margin:0; font-size:18px}
.row{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
label{font-size:14px; color:var(--muted)}
input[type="text"], input[type="number"]{
  border:1px solid var(--border); background:transparent; color:var(--text);
  padding:10px 12px; border-radius:10px; outline:none; min-width: 0;
}
input::placeholder{color:var(--muted)}

.btn{
  border:1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding:10px 14px; border-radius: 10px;
  cursor:pointer; transition: transform .04s ease, background .2s ease, border-color .2s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover{ transform: translateY(-1px); }
.btn:active{ transform: translateY(0); }
.btn-primary{
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  border-color: transparent; color: white;
}
.btn-ghost{ background: transparent; }
.btn-warn{
  border-color: color-mix(in oklab, var(--warn), black 10%);
  color: var(--warn);
  background: color-mix(in oklab, var(--warn), transparent 92%);
}
.badge{
  font-size:12px; padding:4px 10px; border-radius:999px; border:1px solid var(--border); color:var(--muted);
  background: color-mix(in oklab, var(--primary-50), transparent 60%);
}
.badge.on{ color:#059669; border-color: #10b98144; background: #10b98111; }
.badge.off{ color:#b91c1c; border-color: #ef444444; background: #ef444411; }

.countdown{
  font-size: clamp(32px, 6vw, 48px);
  font-weight: 800; letter-spacing: 1px;
  padding: 10px 14px; border-radius: 12px;
  background: linear-gradient(to right, var(--primary-50), transparent);
  border:1px solid var(--border);
  display:inline-block; margin-top: 6px;
}
.hint{ color:var(--muted); font-size:12px; margin-top:4px }

table{ width:100%; border-collapse: collapse; }
thead th{
  text-align:left; font-size:12px; color:var(--muted); font-weight:600;
  border-bottom:1px solid var(--border); padding:10px 8px;
  position: sticky; top:0; background: var(--card);
}
tbody td{ border-bottom:1px solid var(--border); padding: 10px 8px; vertical-align: top; }
tbody tr:hover{ background: color-mix(in oklab, var(--primary-50), transparent 85%); }

#chartWrap{ display:none; margin-top:12px; }
#barChart{
  width:100%; height:auto; border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(99,102,241,0.04), transparent);
  border-radius: 12px; box-shadow: var(--shadow-sm);
}
.chart-note{ font-size:12px; color:var(--muted); margin-top:6px }

.modal-backdrop{ position:fixed; inset:0; display:none; place-items:center; background: rgba(0,0,0,.45); z-index: 50;}
.modal{
  width:min(520px, 92vw); background: var(--card); color:var(--text);
  border:1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  padding:18px; animation: pop .14s ease-out;
}
@keyframes pop{ from{transform: scale(.98); opacity:.8} to{transform: scale(1); opacity:1} }
.modal h3{ margin:0 0 10px }
.modal .row{ display:grid; grid-template-columns: 140px 1fr; gap:10px; align-items:center }
.modal .actions{ display:flex; gap:10px; justify-content: end; margin-top:12px }

code{ background: color-mix(in oklab, var(--primary-50), transparent 70%); padding:2px 6px; border-radius:6px; }
.spacer{ height:8px }
.nowrap{ white-space: nowrap }
.actions-col{ white-space: nowrap }
