:root {
  --bg: #0b0f16;
  --panel: #121925;
  --panel-2: #182233;
  --line: #27384e;
  --text: #ecf3fb;
  --muted: #95a8bf;
  --good: #36d399;
  --warn: #f6ad55;
  --bad: #f87171;
  --accent: #4fd1c5;
  --accent-strong: #22b8aa;
  --shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, #153352 0%, rgba(21, 51, 82, 0) 45%),
    radial-gradient(circle at 90% 20%, #103729 0%, rgba(16, 55, 41, 0) 40%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.2rem, 2.7vw, 1.8rem);
  letter-spacing: 0.02em;
}

h2 {
  margin-bottom: 0.9rem;
  font-size: 1.02rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

h3 {
  margin: 1rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

p {
  color: var(--muted);
}

label {
  font-size: 0.9rem;
  color: var(--muted);
}

input,
textarea,
button {
  font: inherit;
}

.screen {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.hidden {
  display: none;
}

.panel {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0.005));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.login-panel {
  max-width: 360px;
  margin: 12vh auto;
  display: grid;
  gap: 0.9rem;
}

.login-panel form {
  display: grid;
  gap: 0.65rem;
}

input,
textarea {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  width: 100%;
}

input:focus,
textarea:focus,
button:focus {
  outline: 2px solid rgba(79, 209, 197, 0.45);
  outline-offset: 1px;
}

button {
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: #09201d;
  font-weight: 700;
  padding: 0.65rem 0.95rem;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.04);
}

button.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

button.danger {
  background: #7f1d1d;
  color: #fee2e2;
}

button.danger.ghost {
  background: transparent;
  color: #fecaca;
  border-color: #7f1d1d;
}

.layout {
  display: grid;
  gap: 1rem;
  padding-bottom: 6rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem;
  background: rgba(255, 255, 255, 0.02);
}

.metric .label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric .value {
  font-size: 1.3rem;
  margin-top: 0.25rem;
  font-weight: 700;
}

.banner {
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font-weight: 700;
}

.banner.ok {
  border-color: #14532d;
  color: #86efac;
  background: rgba(20, 83, 45, 0.25);
}

.banner.bad {
  border-color: #7f1d1d;
  color: #fca5a5;
  background: rgba(127, 29, 29, 0.2);
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(14, minmax(16px, 1fr));
  gap: 0.35rem;
}

.heat-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.heat-empty {
  background: rgba(255, 255, 255, 0.03);
}

.heat-low {
  background: #7f1d1d;
}

.heat-mid {
  background: #9a6b21;
}

.heat-good {
  background: #0f766e;
}

.heat-perfect {
  background: #14532d;
}

.week-tabs,
.day-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
}

.week-tab,
.day-tab {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  white-space: nowrap;
  min-height: 42px;
}

.week-tab.active,
.day-tab.active {
  border-color: var(--accent-strong);
  color: #b9f7f1;
}

.selected-day-meta {
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.checklist-category {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 0.7rem;
  overflow: hidden;
}

.checklist-category h3 {
  margin: 0;
  padding: 0.65rem 0.8rem;
  background: rgba(255, 255, 255, 0.03);
  color: #c8d6e8;
}

.activity-row {
  padding: 0.65rem 0.8rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.5rem;
}

.activity-label {
  font-size: 0.95rem;
}

.activity-row.dim .activity-label {
  color: #68819f;
}

.status-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
}

.status-btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0.5rem 0.2rem;
  min-height: 40px;
}

.status-btn.active.completed {
  background: rgba(20, 83, 45, 0.45);
  border-color: #22c55e;
  color: #bbf7d0;
}

.status-btn.active.skipped {
  background: rgba(146, 64, 14, 0.4);
  border-color: #fb923c;
  color: #fed7aa;
}

.status-btn.active.wrong {
  background: rgba(127, 29, 29, 0.4);
  border-color: #f87171;
  color: #fecaca;
}

.status-btn.active.na {
  background: rgba(15, 23, 42, 0.9);
  border-color: #334155;
  color: #cbd5e1;
}

.wrong-list,
.damage-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.45rem;
}

.wrong-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
}

.checkbox-row {
  margin-top: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.checkbox-row input,
.wrong-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-strong);
}

.two-col {
  display: grid;
  gap: 1rem;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.6rem;
}

.score-chip {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem;
  background: rgba(255, 255, 255, 0.02);
}

.score-chip .k {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.score-chip .v {
  margin-top: 0.2rem;
  font-weight: 700;
}

.damage-list li {
  border: 1px solid #7f1d1d;
  border-radius: 8px;
  background: rgba(127, 29, 29, 0.15);
  padding: 0.45rem 0.55rem;
  color: #fecaca;
  font-size: 0.9rem;
}

.reset-controls {
  display: grid;
  gap: 0.6rem;
  max-width: 320px;
}

.sticky-save {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  gap: 0.9rem;
  align-items: center;
  padding: 0.7rem 1rem;
  backdrop-filter: blur(12px);
  background: rgba(9, 13, 20, 0.9);
  border-top: 1px solid var(--line);
}

.sticky-save .primary {
  min-width: 140px;
  min-height: 44px;
}

.save-status {
  font-size: 0.88rem;
}

.error {
  color: #fecaca;
  min-height: 1.2rem;
}

.muted {
  color: var(--muted);
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel:nth-child(1),
  .panel:nth-child(2),
  .panel:nth-child(3),
  .panel:nth-child(4),
  .panel:nth-child(5),
  .panel:nth-child(6),
  .panel:nth-child(7) {
    grid-column: span 2;
  }

  .two-col {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .screen {
    padding: 0.8rem;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .heatmap {
    grid-template-columns: repeat(10, minmax(16px, 1fr));
  }

  .sticky-save {
    justify-content: space-between;
  }

  .save-status {
    max-width: 50%;
    text-align: right;
  }
}
