:root {
  color-scheme: light;
  --page-plane:      #f9f9f7;
  --surface-1:       #fcfcfb;
  --text-primary:    #0b0b0b;
  --text-secondary:  #52514e;
  --text-muted:      #898781;
  --gridline:        #e1e0d9;
  --border:          rgba(11, 11, 11, 0.10);
  --accent:          #2a78d6;
  --accent-wash:     #cde2fb;
  --status-good:     #0ca30c;
  --status-good-text:#006300;
  --status-warning:  #fab219;
  --status-critical: #d03b3b;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page-plane:      #0d0d0d;
    --surface-1:       #1a1a19;
    --text-primary:    #ffffff;
    --text-secondary:  #c3c2b7;
    --text-muted:      #898781;
    --gridline:        #2c2c2a;
    --border:          rgba(255, 255, 255, 0.10);
    --accent:          #3987e5;
    --accent-wash:     #18314f;
    --status-good:     #0ca30c;
    --status-good-text:#0ca30c;
    --status-warning:  #fab219;
    --status-critical: #e66767;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-plane:      #0d0d0d;
  --surface-1:       #1a1a19;
  --text-primary:    #ffffff;
  --text-secondary:  #c3c2b7;
  --text-muted:      #898781;
  --gridline:        #2c2c2a;
  --border:          rgba(255, 255, 255, 0.10);
  --accent:          #3987e5;
  --accent-wash:     #18314f;
  --status-good:     #0ca30c;
  --status-good-text:#0ca30c;
  --status-warning:  #fab219;
  --status-critical: #e66767;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page-plane);
  color: var(--text-primary);
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.app-header h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
}
.ghost-btn:hover { background: var(--surface-1); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: proportional-nums;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--gridline);
  margin-bottom: 20px;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.panel { display: none; }
.panel.active { display: block; }

.add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.note-form { flex-direction: column; }

.add-form input[type="text"],
.add-form textarea {
  flex: 1;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
}

.add-form textarea { resize: vertical; }

.add-form button {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.note-form button { align-self: flex-start; }

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.item-row .title {
  flex: 1;
  font-size: 14px;
}

.item-row.done .title {
  color: var(--text-muted);
  text-decoration: line-through;
}

.checkbox {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--text-muted);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--status-good-text);
  white-space: nowrap;
}

.checkin-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.checkin-btn.checked {
  background: var(--accent);
  color: #ffffff;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--status-critical); }

.note-item {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.note-item .note-title {
  font-size: 14px;
  font-weight: 600;
}
.note-item .note-body {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: pre-wrap;
}
.note-item .note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}
.note-item .note-date {
  font-size: 11px;
  color: var(--text-muted);
}

.empty-state {
  color: var(--text-muted);
  font-size: 13px;
  padding: 12px 4px;
}
