:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-muted: #f7f9fc;
  --ink: #111827;
  --muted: #667085;
  --line: #d0d7e2;
  --line-strong: #98a2b3;
  --completed: #127a44;
  --missed: #b9382c;
  --neutral: #475467;
  --empty: #e7ecf3;
  --accent: #2563eb;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Times New Roman", Times, serif;
  line-height: 1.25;
}

button,
textarea,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

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

.eyebrow,
.panel-label,
.date-label,
.month-totals,
.save-message,
.legend,
.stat-label,
.stat-foot {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-header h1,
h2,
h3,
legend {
  margin: 0;
  font-weight: 700;
}

.site-header h1 {
  font-size: 1.6rem;
}

.icon-btn,
.nav-btn,
.action-btn,
.day-cell {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 0;
}

.icon-btn,
.nav-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.nav-btn {
  width: auto;
  min-width: 88px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.icon-btn.is-active,
.nav-btn.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.about-panel {
  height: auto;
  margin-bottom: 14px;
  padding: 0 14px;
  overflow: hidden;
  transition: height 220ms ease, opacity 220ms ease, margin-bottom 220ms ease;
  opacity: 1;
}

.about-panel.is-collapsed {
  opacity: 0;
  margin-bottom: 14px;
  pointer-events: none;
}

.about-grid {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transform: translateY(0);
  transition: transform 220ms ease;
}

.about-panel.is-collapsed .about-grid {
  transform: translateY(-10px);
}

.about-grid h2 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.about-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.app-shell {
  display: grid;
  gap: 12px;
  max-width: 750px;
  margin: 0 auto;
  padding: 0 14px 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.panel-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-top h2 {
  font-size: 1.25rem;
}

.mode-badge {
  display: inline-block;
  margin: 0 0 12px;
  padding: 5px 8px;
  border: 1px solid rgba(18, 122, 68, 0.28);
  background: rgba(18, 122, 68, 0.08);
  color: var(--completed);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.stat-card {
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--panel-muted);
}

.stat-card strong {
  display: block;
  margin: 4px 0;
  font-size: 1.5rem;
  line-height: 1;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 180px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}

textarea:disabled {
  background: var(--panel-muted);
  color: var(--muted);
}

.action-row {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.action-btn {
  padding: 10px 14px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.action-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.action-btn-completed {
  border-color: rgba(18, 122, 68, 0.35);
  background: rgba(18, 122, 68, 0.08);
}

.action-btn-missed {
  border-color: rgba(185, 56, 44, 0.35);
  background: rgba(185, 56, 44, 0.08);
}

.action-btn-neutral {
  border-color: var(--line-strong);
  background: var(--panel-muted);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.day-preview {
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--panel-muted);
}

.day-preview-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.day-preview-date,
.day-preview-status {
  margin: 0;
}

.day-preview-date {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.day-preview-status {
  font-size: 0.76rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.day-preview-text {
  margin: 0;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 4px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  vertical-align: middle;
}

.swatch.completed {
  background: var(--completed);
}

.swatch.missed {
  background: var(--missed);
}

.swatch.neutral {
  background: var(--neutral);
}

.swatch.empty {
  background: var(--empty);
}

.months-grid {
  display: grid;
  gap: 10px;
}

.month-card {
  padding: 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.month-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.month-title {
  font-size: 1rem;
}

.weekday-row,
.day-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.weekday-row {
  margin-bottom: 4px;
}

.weekday-cell {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
}

.day-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0;
  background: var(--empty);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease;
}

.day-cell.placeholder {
  border-color: transparent;
  background: transparent;
  cursor: default;
}

.day-cell.completed {
  background: var(--completed);
  color: #fff;
}

.day-cell.missed {
  background: var(--missed);
  color: #fff;
}

.day-cell.neutral {
  background: var(--neutral);
  color: #fff;
}

.day-cell.today {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.icon-btn:hover,
.nav-btn:hover,
.action-btn:hover,
.day-cell:hover {
  border-color: var(--line-strong);
}

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

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

@media (min-width: 780px) {
  .site-header,
  .about-panel {
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 14px;
    padding-right: 14px;
  }
}
