:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1f2630;
  --border: #2a323d;
  --text: #e6edf3;
  --text-dim: #9aa6b2;
  --accent: #58a6ff;
  --ok: #57c98a;
  --warn: #d29922;
  --bad: #f85149;
  --code: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Yu Gothic UI", system-ui, sans-serif;
}

main { max-width: 980px; margin: 0 auto; padding: 32px 20px 80px; }
header { margin-bottom: 18px; }
h1 { font-size: 28px; margin: 0 0 8px; letter-spacing: -0.01em; }
.lede { margin: 0; color: var(--text-dim); max-width: 760px; }
.lede strong { color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--code); font-size: 12.5px;
  background: var(--surface-2); padding: 1px 5px; border-radius: 3px;
  border: 1px solid var(--border);
}

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

/* ────────── month nav ────────── */

.month-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.month-nav h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.01em;
  flex: 1;
  text-align: center;
}

button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--code);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover { border-color: var(--accent); color: var(--accent); }
button.danger:hover { border-color: var(--bad); color: var(--bad); }
button.today-btn { font-size: 12px; padding: 4px 10px; }

.month-nav > button:first-child,
.month-nav > button:nth-child(3) {
  font-size: 18px;
  padding: 4px 12px;
  line-height: 1;
}

/* ────────── calendar ────────── */

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-align: center;
  font-family: var(--code);
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.day {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 6px 18px;
  font-family: var(--code);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  min-height: 56px;
  transition: border-color 0.1s, transform 0.06s;
}

.day:hover { border-color: var(--accent); }
.day:active { transform: translateY(1px); }
.day.adjacent-month { color: var(--text-dim); background: transparent; border-color: transparent; }
.day.today { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.day.selected { background: rgba(88, 166, 255, 0.15); border-color: var(--accent); }
.day.has-entry::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  transform: translateX(-50%);
}

/* ────────── entry editor ────────── */

.entry-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}

.entry-head h2 {
  font-size: 16px; font-weight: 600; margin: 0; font-family: var(--code);
}

.entry-stats {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--code);
}

#entry-text {
  width: 100%;
  min-height: 200px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--code);
  font-size: 14px;
  line-height: 1.7;
  padding: 12px 14px;
  border-radius: 6px;
  resize: vertical;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}

#entry-text:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.18);
}

/* ────────── stats ────────── */

.stats-section {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px;
}

@media (min-width: 600px) {
  .stats-section { grid-template-columns: repeat(4, 1fr); }
}

.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}

.stat-label {
  font-size: 10.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.stat-value {
  font-family: var(--code);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ────────── actions ────────── */

.actions-section {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.storage-status {
  margin-left: auto;
  font-size: 11.5px;
  font-family: var(--code);
  color: var(--text-dim);
}

.storage-status.ok { color: var(--ok); }
.storage-status.bad { color: var(--bad); }

/* ────────── footer ────────── */

footer { margin-top: 24px; font-size: 12.5px; color: var(--text-dim); }
footer p { margin: 4px 0; }
