:root {
  --ink: #172033;
  --muted: #637089;
  --line: #d8e0eb;
  --surface: #f4f6fa;
  --panel: #ffffff;
  --nav: #111827;
  --blue: #1d4ed8;
  --green: #0f766e;
  --amber: #a16207;
  --red: #b42318;
}

* { box-sizing: border-box; }

body {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  min-height: 100vh;
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  background: var(--nav);
  color: #eef4ff;
}

.brand {
  display: grid;
  gap: 8px;
  margin-bottom: 28px;
}

.brand span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: var(--nav);
  font-weight: 900;
}

.nav {
  display: block;
  width: 100%;
  margin: 7px 0;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #dce7f6;
  text-align: left;
  font-weight: 750;
}

.nav.is-active {
  background: #ffffff;
  color: var(--nav);
}

main {
  min-width: 0;
  padding: 24px;
}

.topbar, .hero, .section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar { margin-bottom: 18px; }

p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1, h2 { margin: 0; }

.user-card, .notice, article, .hero, .list-row, .setup-panel, .table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(24, 33, 47, 0.07);
}

.user-card {
  min-width: 260px;
  padding: 12px 14px;
  font-weight: 750;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #fff8e8;
  color: #5d4510;
}

.notice[data-tone="success"] {
  background: #e9f8f4;
  color: #0b5f55;
}

.notice[data-tone="warn"] {
  background: #fdecec;
  color: #8a2a2a;
}

.view { display: none; }
.view.is-active { display: block; }

.hero { padding: 22px; }

#timer {
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 0.95;
}

#timerState {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 800;
}

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

.actions button, .section-head button, .rate-form button {
  min-height: 40px;
  padding: 9px 13px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 850;
}

.actions .secondary {
  background: #e8eefb;
  color: var(--ink);
}

.actions .danger { background: var(--red); }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

article, .list-row { padding: 16px; }

article span, .list-row span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

article strong, .list-row strong {
  display: block;
  margin-top: 6px;
  font-size: 1.15rem;
}

article small, .list-row small, td small, .setup-panel small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.4;
}

.section-head { margin-bottom: 14px; }

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

td { font-size: 0.9rem; }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
}

.pill.good {
  background: #e8f7f2;
  color: var(--green);
}

.pill.warn {
  background: #fff3d6;
  color: var(--amber);
}

.rate-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rate-form input {
  width: 90px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.rate-form button {
  min-height: 38px;
  padding: 8px 10px;
}

.setup-panel {
  display: grid;
  gap: 12px;
  max-width: 980px;
  padding: 16px;
}

.setup-panel label {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.check-row {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}

.list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

@media (max-width: 860px) {
  body { grid-template-columns: 1fr; }
  .rail {
    position: static;
    height: auto;
  }
  .topbar, .hero, .section-head {
    align-items: stretch;
    flex-direction: column;
  }
  .metric-grid { grid-template-columns: 1fr; }
}
