:root {
  --bg: #0f1115;
  --panel: #171923;
  --muted: #a0a7b5;
  --text: #e6e8ee;
  --brand: #5b9cff;
  --brand-strong: #2f7dff;
  --danger: #ff6b6b;
  --ok: #4bd096;
  --border: #2a2f3a;
}

/* Light theme overrides */
:root[data-theme="light"] {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --muted: #6b7280;
  --text: #0f1115;
  --brand: #2f7dff;
  --brand-strong: #1f5ed8;
  --danger: #d04444;
  --ok: #138a57;
  --border: #e5e7eb;
}

:root[data-theme="skylight"] {
  --bg: #fbfcfe;
  --panel: #ffffff;
  --muted: #6b768a;
  --text: #0f1115;

  /* Brand (aqua sky) */
  --brand: #6cc9e3;
  --brand-strong: #3eb1d3;

  /* Status */
  --danger: #f7b6ba;
  --ok: #a6e4c8;
  --border: #e9eef5;

  /* Pastel accents (for tags/cards) */
  --accent-sky: #bfe3ff;
  --accent-aqua: #bfe7ea;
  --accent-lilac: #d8cbf1;
  --accent-lavender: #d5d6ff;
  --accent-pink: #f8c9cc;
  --accent-peach: #f9d2b8;
  --accent-lemon: #f9eeb0;
  --accent-mint: #cfead9;
  --accent-sage: #d3edd6;
}
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0));
}
.header-main h1 {
  margin: 0;
  font-size: 20px;
}
.subtitle {
  margin: 4px 0 0 0;
  color: var(--muted);
  font-size: 13px;
}
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.header-actions button,
.file-btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.header-actions button:hover, .file-btn:hover {
  border-color: var(--brand);
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.theme-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.theme-switch .theme-slider {
  position: absolute;
  inset: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.theme-switch .theme-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 50%;
  transform: translate(0, -50%);
  background: var(--text);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  transition: transform 160ms ease;
}
.theme-switch input:checked + .theme-slider {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand) inset;
}
.theme-switch input:checked + .theme-slider::before {
  transform: translate(20px, -50%);
}
.theme-switch input:focus-visible + .theme-slider {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.file-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.source-note {
  padding: 8px 20px;
  color: var(--muted);
  font-size: 12px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  padding: 20px;
}

.controls {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  height: fit-content;
}
.control-row {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}
.control-row label {
  font-size: 12px;
  color: var(--muted);
}
.control-row select,
.control-row button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}
.control-row button:hover {
  border-color: var(--brand);
}
.control-row .primary {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.days, .readings {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.days h2, .readings h2 {
  margin: 0 0 12px 0;
  font-size: 16px;
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.day-btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 0;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  user-select: none;
}
.day-btn[aria-selected="true"],
.day-btn.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand) inset;
}
.day-btn.done {
  border-color: rgba(75, 208, 150, 0.4);
  background: rgba(75, 208, 150, 0.06);
}

.reading-list {
  display: grid;
  gap: 10px;
}
.reading-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}
.reading-item.completed {
  border-color: rgba(75, 208, 150, 0.4);
  background: rgba(75, 208, 150, 0.06);
}
.reading-item .track {
  font-size: 12px;
  color: var(--muted);
}
.reading-item .ref a {
  color: var(--text);
  font-weight: 600;
}
.reading-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.reading-actions button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.reading-actions .primary {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.progress-card {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  padding: 10px;
}
.progress-card.small {
  margin-top: 16px;
}
.progress-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.progress-bar {
  height: 8px;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--brand-strong));
  transition: width 160ms ease;
}
.progress-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.app-footer {
  gap: 16px;
  display: flex;
  align-items: center;
  padding: 20px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  justify-content: space-between;
}

.app-footer .danger {
  border-color: #3b2020;
  color: var(--danger);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  padding: 8px 12px;
  background: var(--danger-hover);
  border: 1px solid var(--border);
}

.app-footer .danger:hover {
  background: var(--danger);
  color: #fff;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
}


