/* ── Reset & Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:   #185FA5;
  --red:    #D85A30;
  --green:  #3B6D11;
  --purple: #534AB7;
  /* theming */
  --bg:             #FFFDF7;
  --body-bg:        #f0ede6;
  --card-bg:        #ffffff;
  --input-bg:       #ffffff;
  --border:         #E8E4D8;
  --text:           #2C2C2A;
  --muted:          #888780;
  --radius:         10px;
  /* rows */
  --minus-row:      #FBF0EC;
  --plus-row:       #EDF5E3;
  --bonus-row:      #EEEDFE;
  --minus-count-bg: #f7dcd5;
  --plus-count-bg:  #d7edbe;
  --bonus-count-bg: #dddafb;
  /* components */
  --score-bg:          #E6F1FB;
  --reward-bg:         #FAEEDA;
  --reward-border:     #F0A500;
  --reward-title:      #854F0B;
  --reward-val-border: #FAC775;
  --numpad-key:        #eae7df;
  --numpad-active:     #d6d2c8;
  --hover-bg:          #f5f3ec;
  --dot-bg:            #ffffff;
  --dot-border:        #B5D4F4;
  --banner-bg:         #fff8dc;
  --banner-text:       #7a5c00;
  --error-bg:          #FAECE7;
}

[data-theme="dark"] {
  --blue:   #4A8FD5;
  --red:    #E07060;
  --green:  #5AAD3B;
  --purple: #7A74D0;
  --bg:             #1C1C2A;
  --body-bg:        #111120;
  --card-bg:        #252538;
  --input-bg:       #2A2A42;
  --border:         #3C3C58;
  --text:           #E0DED6;
  --muted:          #8A8878;
  --minus-row:      #2A1A18;
  --plus-row:       #182018;
  --bonus-row:      #1E1A38;
  --minus-count-bg: #3A2220;
  --plus-count-bg:  #1E3018;
  --bonus-count-bg: #2A255A;
  --score-bg:          #1A2840;
  --reward-bg:         #2A2010;
  --reward-border:     #C08800;
  --reward-title:      #D09040;
  --reward-val-border: #A07020;
  --numpad-key:        #2A2A42;
  --numpad-active:     #35354E;
  --hover-bg:          #2A2A42;
  --dot-bg:            #2A2A42;
  --dot-border:        #3A6090;
  --banner-bg:         #2A2510;
  --banner-text:       #C0A840;
  --error-bg:          #3A2020;
}

html { font-size: 16px; }
body {
  font-family: 'Nunito', sans-serif;
  background: var(--body-bg);
  color: var(--text);
  min-height: 100dvh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }

/* ── Nav ───────────────────────────────────────────────────────────── */
.app-nav {
  position: sticky; top: 0; z-index: 100;
  display: flex;
  background: var(--blue);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.nav-link {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  color: rgba(255,255,255,.75);
  font-size: 11px; font-weight: 700;
  transition: background .15s;
}
.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,.15);
  color: #fff;
}
.nav-icon { font-size: 20px; }

/* ── Main layout ───────────────────────────────────────────────────── */
.app-main { padding: 12px 8px 32px; }

.page {
  max-width: 860px;
  margin: 0 auto;
  background: var(--bg);
  border-radius: 14px;
  padding: 20px 16px 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

/* ── Login ─────────────────────────────────────────────────────────── */
.login-body {
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh;
}
.login-card {
  background: var(--bg);
  border-radius: 20px;
  padding: 32px 24px;
  width: 100%; max-width: 320px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.login-emoji { font-size: 48px; }
.login-title {
  font-family: 'Baloo 2', sans-serif;
  font-size: 28px; font-weight: 800;
  color: var(--blue);
  margin-top: 4px;
}
.login-subtitle { color: var(--muted); font-size: 14px; margin-top: 4px; margin-bottom: 20px; }
.login-error {
  background: var(--error-bg); color: var(--red);
  border-radius: 8px; padding: 8px 12px;
  font-size: 13px; font-weight: 700;
  margin-bottom: 12px;
}

.pin-dots { display: flex; gap: 12px; justify-content: center; margin-bottom: 20px; }
.pin-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2.5px solid var(--blue);
  background: transparent;
  transition: background .1s;
}
.pin-dot.filled { background: var(--blue); }

.numpad { display: flex; flex-direction: column; gap: 10px; }
.numpad-row { display: flex; gap: 10px; justify-content: center; }
.numpad-key {
  width: 72px; height: 56px;
  border-radius: 12px;
  background: var(--numpad-key);
  font-size: 22px; font-weight: 700;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: background .1s, transform .07s;
  border: none;
}
.numpad-key:active { background: var(--numpad-active); transform: scale(.95); }
.numpad-key.delete { font-size: 20px; color: var(--muted); }
.numpad-key.empty { background: transparent; pointer-events: none; }

/* ── Page header ────────────────────────────────────────────────────── */
.page-title {
  font-family: 'Baloo 2', sans-serif;
  font-size: 22px; font-weight: 800;
  color: var(--blue);
  text-align: center;
  margin-bottom: 2px;
}
.week-line {
  text-align: center;
  font-size: 12px; font-weight: 700;
  color: var(--muted);
  letter-spacing: .05em;
  margin-bottom: 14px;
}
.readonly-banner {
  background: var(--banner-bg); color: var(--banner-text);
  border-radius: 8px; padding: 8px 12px;
  font-size: 13px; font-weight: 700;
  margin-bottom: 12px; text-align: center;
}
.readonly-banner a { color: var(--blue); text-decoration: underline; }

/* ── Table ─────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; min-width: 440px; }

th {
  font-size: 11px; font-weight: 700;
  color: #fff; padding: 7px 3px;
  text-align: center;
  background: var(--blue);
}
th.rule-head {
  text-align: left; padding-left: 10px;
  font-size: 12px;
  border-radius: 8px 0 0 0;
}
th.day-head { width: 44px; }
th.day-head:last-child { border-radius: 0 8px 0 0; }

.section-cell {
  font-family: 'Baloo 2', sans-serif;
  font-size: 12px; font-weight: 700;
  color: #fff;
  padding: 5px 10px;
}
.minus-section { background: var(--red); }
.plus-section  { background: var(--green); }
.bonus-section { background: var(--purple); }

.rule-row { border-bottom: 1px solid var(--border); }
.rule-row:last-of-type { border-bottom: none; }

.minus-row { background: var(--minus-row); }
.plus-row  { background: var(--plus-row); }
.bonus-row { background: var(--bonus-row); }

.rule-td { min-width: 120px; }
.rule-cell {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 10px;
}
.emoji { font-size: 22px; flex-shrink: 0; }
.rule-desc {
  font-size: 12px; font-weight: 700;
  color: var(--text); line-height: 1.3;
}

/* ── Day cells ─────────────────────────────────────────────────────── */
.day-cell {
  width: 44px;
  min-height: 44px;
  border-left: 1px solid var(--border);
  text-align: center;
  vertical-align: middle;
  padding: 3px;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}
.day-cell.tappable {
  cursor: pointer;
  transition: background .12s;
}
.day-cell.tappable:not(.has-count)::after {
  content: '';
  display: block;
  width: 26px; height: 26px;
  margin: 5px auto;
  border: 1.5px dashed #ccc;
  border-radius: 5px;
}
[data-theme="dark"] .day-cell.tappable:not(.has-count)::after {
  border-color: #555;
}
.day-cell.tappable:active { filter: brightness(.92); }

.minus-count { background: var(--minus-count-bg); }
.plus-count  { background: var(--plus-count-bg); }
.bonus-count { background: var(--bonus-count-bg); }

.count {
  font-family: 'Baloo 2', sans-serif;
  font-size: 18px; font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.sub-btn {
  position: absolute; bottom: 1px; right: 2px;
  font-size: 14px; font-weight: 800;
  color: var(--muted);
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  padding: 0;
  transition: background .1s, color .1s;
}
.sub-btn:hover { background: rgba(0,0,0,.1); color: var(--text); }

/* ── Score footer ──────────────────────────────────────────────────── */
.score-footer {
  margin-top: 14px;
  background: var(--score-bg);
  border-radius: 12px;
  padding: 12px 14px;
}
.score-label {
  font-family: 'Baloo 2', sans-serif;
  font-size: 14px; font-weight: 700;
  color: var(--blue);
  margin-bottom: 4px;
}
.score-row { display: flex; align-items: baseline; gap: 4px; margin-bottom: 8px; }
.score-number {
  font-family: 'Baloo 2', sans-serif;
  font-size: 28px; font-weight: 800;
  color: var(--blue);
}
.score-goal { font-size: 14px; font-weight: 700; color: var(--muted); }
.dots { display: flex; flex-wrap: wrap; gap: 5px; }
.dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--dot-border);
  background: var(--dot-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--blue);
  transition: background .2s, border-color .2s;
}
.dot-filled { background: var(--blue); border-color: var(--blue); color: white; }
.dot-bonus  { background: #F0A500; border-color: #F0A500; color: white; font-size: 14px; }
.goal-reached {
  margin-top: 8px;
  font-family: 'Baloo 2', sans-serif;
  font-size: 15px; font-weight: 800;
  color: var(--green);
}

/* ── Reward box ────────────────────────────────────────────────────── */
.reward-box {
  margin-top: 10px;
  border: 2px dashed var(--reward-border);
  border-radius: 12px;
  background: var(--reward-bg);
  padding: 10px 14px;
  display: flex; align-items: flex-start; gap: 12px;
}
.reward-icon { font-size: 28px; flex-shrink: 0; margin-top: 2px; }
.reward-title {
  font-family: 'Baloo 2', sans-serif;
  font-size: 14px; font-weight: 800;
  color: var(--reward-title);
  margin-bottom: 4px;
}
.reward-value {
  font-size: 15px; font-weight: 600;
  color: var(--text);
  min-height: 22px;
  border-bottom: 2px solid var(--reward-val-border);
  padding-bottom: 2px;
  cursor: pointer;
  min-width: 160px;
}
.reward-value:hover { background: rgba(240,165,0,.1); border-radius: 4px 4px 0 0; }
.reward-form { display: flex; gap: 6px; align-items: center; }
.reward-input {
  font-family: 'Nunito', sans-serif;
  font-size: 15px; font-weight: 600;
  border: none; border-bottom: 2px solid var(--reward-border);
  background: transparent;
  padding: 2px 4px;
  outline: none;
  color: var(--text);
  width: 160px;
}

/* ── Config page ───────────────────────────────────────────────────── */
.config-page { padding: 16px 14px 28px; }
.config-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.card-title {
  font-family: 'Baloo 2', sans-serif;
  font-size: 16px; font-weight: 800;
  color: var(--blue);
  margin-bottom: 10px;
}
.card-hint { font-size: 12px; color: var(--muted); margin-bottom: 10px; }

.form-inline { display: flex; flex-direction: column; gap: 10px; }
.form-row {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.form-row label { font-size: 13px; font-weight: 700; min-width: 140px; color: var(--muted); }
.form-row small { font-size: 11px; color: var(--muted); }

.input-text {
  flex: 1; min-width: 160px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  outline: none;
  color: var(--text);
  background: var(--input-bg);
}
.input-text:focus { border-color: var(--blue); }
.input-short {
  width: 64px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 7px 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  outline: none;
  color: var(--text);
  background: var(--input-bg);
  text-align: center;
}
.input-short:focus { border-color: var(--blue); }
.input-date {
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  outline: none;
  color: var(--text);
  background: var(--input-bg);
}
.input-date:focus { border-color: var(--blue); }
.input-pin {
  width: 100px;
  letter-spacing: .2em;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 18px; font-weight: 800;
  text-align: center;
  outline: none;
  background: var(--input-bg);
  color: var(--text);
}
.input-pin:focus { border-color: var(--blue); }
.input-emoji {
  width: 60px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 7px 6px;
  font-size: 18px;
  text-align: center;
  outline: none;
  background: var(--input-bg);
  color: var(--text);
}
.input-emoji:focus { border-color: var(--blue); }

.btn-primary {
  background: var(--blue); color: white;
  border-radius: 9px; padding: 9px 18px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px; font-weight: 700;
  border: none; cursor: pointer;
  align-self: flex-start;
  transition: background .15s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-danger-outline {
  background: var(--card-bg); color: var(--red);
  border: 2px solid var(--red);
}
.btn-danger-outline:hover { background: var(--error-bg); }

.btn-save {
  background: var(--green); color: white;
  border-radius: 7px; padding: 5px 10px;
  font-size: 14px; font-weight: 700;
}
.btn-cancel {
  background: var(--border); color: var(--muted);
  border-radius: 7px; padding: 5px 10px;
  font-size: 14px; font-weight: 700;
}
.btn-add {
  background: var(--plus-row); color: var(--green);
  border: 1.5px solid var(--plus-count-bg);
  border-radius: 7px; padding: 6px 12px;
  font-size: 13px; font-weight: 700;
  white-space: nowrap;
}
.btn-icon {
  background: none; border: none;
  font-size: 16px; padding: 2px 4px;
  cursor: pointer; line-height: 1;
  border-radius: 5px;
  transition: background .1s;
}
.btn-icon:hover { background: var(--border); }
.btn-icon.danger:hover { background: var(--error-bg); }

/* ── Rule list in config ───────────────────────────────────────────── */
.rule-list { list-style: none; margin-bottom: 10px; }
.rule-list-item {
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
}
.rule-list-item:last-child { border-bottom: none; }
.rule-list-display {
  display: flex; align-items: center; gap: 8px;
}
.rule-emoji-sm { font-size: 20px; flex-shrink: 0; }
.rule-desc-sm  { flex: 1; font-size: 13px; font-weight: 700; color: var(--text); }
.rule-actions  { display: flex; gap: 2px; flex-shrink: 0; }
.rule-edit-form {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; flex-wrap: wrap;
}
.empty-hint { font-size: 13px; color: var(--muted); font-style: italic; margin-bottom: 8px; }

.add-rule-form {
  display: flex; gap: 6px; align-items: center;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* ── Theme toggle ──────────────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.theme-btn {
  flex: 1;
  padding: 7px 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px; font-weight: 700;
  color: var(--muted);
  background: var(--input-bg);
  border: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.theme-btn + .theme-btn { border-left: 1.5px solid var(--border); }
.theme-btn.active { background: var(--blue); color: #fff; }

/* ── Version info ──────────────────────────────────────────────────── */
.version-info {
  display: flex; align-items: center; justify-content: space-between;
}
.version-name {
  font-size: 14px; font-weight: 700;
  color: var(--text);
}
.version-badge {
  font-size: 12px; font-weight: 700;
  color: var(--muted);
  background: var(--body-bg);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  font-family: 'Baloo 2', sans-serif;
}

/* ── History ───────────────────────────────────────────────────────── */
.history-list { list-style: none; }
.history-item { border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: none; }
.history-link {
  display: block; padding: 10px 4px;
  transition: background .12s; border-radius: 6px;
}
.history-link:hover { background: var(--hover-bg); }
.history-week { font-size: 14px; font-weight: 700; color: var(--text); }
.history-meta { display: flex; gap: 12px; align-items: center; margin-top: 3px; flex-wrap: wrap; }
.history-score { font-size: 13px; font-weight: 700; color: var(--muted); }
.score-good { color: var(--green); }
.score-bad  { color: var(--red); }
.history-reward { font-size: 12px; color: var(--muted); }

/* ── Archive ───────────────────────────────────────────────────────── */
.archive-page { display: flex; flex-direction: column; gap: 12px; }

.archive-year {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.archive-year-summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--hover-bg);
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  user-select: none;
}
.archive-year-summary::-webkit-details-marker { display: none; }
.archive-year-summary::before {
  content: '▶';
  font-size: 10px;
  margin-right: 8px;
  transition: transform .2s;
  color: var(--muted);
}
details[open] .archive-year-summary::before { transform: rotate(90deg); }
.archive-year-label { font-size: 17px; color: var(--text); }
.archive-year-count { font-size: 12px; color: var(--muted); font-weight: 600; }

.archive-list { list-style: none; }
.archive-list li { border-top: 1px solid var(--border); }

.archive-card {
  display: block;
  padding: 12px 16px;
  background: var(--bg);
  transition: background .15s;
}
.archive-card:hover { background: var(--hover-bg); }

.archive-card-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.archive-card-label { font-size: 14px; font-weight: 700; color: var(--text); }

.archive-badge {
  font-size: 11px; font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-good { background: var(--plus-row); color: var(--green); }
.badge-bad  { background: var(--minus-row); color: var(--red); }

.archive-card-bottom {
  display: flex; align-items: center; gap: 10px;
}
.archive-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.archive-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--blue);
  transition: width .3s;
}
.bar-good { background: var(--green); }
.bar-bad  { background: var(--red); width: 0 !important; }

.archive-score { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.archive-reward { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ── Utilities ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Mobile tweaks ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .app-main { padding: 8px 4px 28px; }
  .page { padding: 16px 10px 20px; border-radius: 10px; }
  .page-title { font-size: 18px; }
  th.rule-head { font-size: 11px; }
  .rule-desc { font-size: 11px; }
  .emoji { font-size: 18px; }
}

/* ── Minus-Modus Toggle & Hint ─────────────────────────────────────── */
.subtract-toggle-form {
  display: flex;
  align-items: center;
  margin: 10px 0 0;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.subtract-hint {
  margin: 10px 0 0;
  padding: 8px 12px;
  background: var(--minus-row);
  border-radius: 8px;
  font-size: 13px;
  color: var(--red);
}
.switch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.switch-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
  cursor: pointer;
}
.switch-hint {
  font-size: 13px;
  color: var(--muted);
}

/* ── Reward laps (completed rounds on main page) ───────────────────── */
.reward-laps { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }

.reward-box-compact {
  padding: 8px 12px;
  opacity: .85;
}
.reward-box-compact .reward-icon { font-size: 20px; }
.reward-box-compact .reward-title { font-size: 12px; }
.reward-box-compact .reward-value { font-size: 13px; min-height: auto; }

.reward-box-fulfilled {
  border-color: var(--green);
  background: var(--plus-row);
}
.reward-box-fulfilled .reward-title { color: var(--green); }

.reward-fulfilled-hint {
  font-size: 11px;
  color: var(--green);
  margin-top: 2px;
}

/* ── Rewards page ───────────────────────────────────────────────────── */
.rewards-page { display: flex; flex-direction: column; gap: 14px; }

/* Section containers */
.rwd-section {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.rwd-section-current { border-color: var(--reward-border); border-width: 2px; }

.rwd-section-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--reward-bg);
  border-bottom: 1px solid var(--reward-border);
}
.rwd-section-title {
  font-family: 'Baloo 2', sans-serif;
  font-size: 14px; font-weight: 800;
  color: var(--reward-title);
}
.rwd-section-sub { font-size: 12px; color: var(--muted); }

/* Cards grid */
.rwd-cards {
  display: flex; flex-direction: column; gap: 0;
}
.rwd-cards-past { padding: 8px 12px; gap: 8px; }

/* Individual reward card */
.rwd-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  transition: background .15s;
}
.rwd-card:last-child { border-bottom: none; }
.rwd-cards-past .rwd-card {
  border: 1px solid var(--border);
  border-radius: 8px;
}
.rwd-card-done {
  background: var(--plus-row);
}
[data-theme="dark"] .rwd-card-done { background: var(--plus-row); }

/* Card top row: badge + lap tag */
.rwd-card-top {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.rwd-badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 800;
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: .02em;
}
.rwd-badge-open {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}
[data-theme="dark"] .rwd-badge-open {
  background: #3A2A08;
  color: #FBD080;
  border-color: #6B4C10;
}
.rwd-badge-done {
  background: var(--plus-count-bg);
  color: var(--green);
  border: 1px solid var(--plus-count-bg);
}
.rwd-lap-tag {
  font-size: 11px; font-weight: 700;
  color: var(--muted);
}

/* Description – the hero */
.rwd-desc {
  font-family: 'Baloo 2', sans-serif;
  font-size: 17px; font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

/* Card footer: timestamp + button */
.rwd-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
  margin-top: 2px;
}
.rwd-timestamp {
  font-size: 11px; font-weight: 600;
  color: var(--muted);
  min-height: 16px;
}
.rwd-card-done .rwd-timestamp { color: var(--green); }

.btn-rwd-toggle {
  font-family: 'Nunito', sans-serif;
  font-size: 12px; font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn-rwd-toggle:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-rwd-toggle:disabled { opacity: .45; cursor: default; }

/* Past weeks */
.rwd-past-header {
  font-family: 'Baloo 2', sans-serif;
  font-size: 14px; font-weight: 800;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 0 2px;
}
.rwd-week-group { padding: 10px 14px; border-top: 1px solid var(--border); }
.rwd-week-label {
  font-size: 12px; font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.rwd-empty {
  padding: 16px 14px;
  font-size: 13px; color: var(--muted); font-style: italic;
  text-align: center;
}
.rwd-empty a { color: var(--blue); text-decoration: underline; }

/* ── Carry-over hint ───────────────────────────────────────────────── */
.carry-hint {
  margin: 10px 0 0;
  padding: 8px 12px;
  background: var(--bonus-row, #fffbe6);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--yellow, #b45309);
  text-align: center;
}
