/* ============================================================
   WeekDo — Themes + Mobile-First
   ============================================================ */

/* ---------- Reset & Variables ---------- */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Default: Dark */
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-hover: #1c1c1c;
  --surface-elevated: #222222;
  --text: #e8e8e8;
  --text-secondary: #888;
  --text-muted: #555;
  --accent: #c0392b;
  --accent-hover: #a93226;
  --danger: #e74c3c;
  --border: #2a2a2a;
  --radius: 4px;
  --radius-sm: 2px;

  --color-red: #e74c3c;
  --color-blue: #3498db;
  --color-green: #2ecc71;
  --color-yellow: #f1c40f;
  --color-purple: #9b59b6;
  --color-orange: #e67e22;
  --color-pink: #fd79a8;
  --color-gray: #636e72;

  --tab-height: 60px;
  --header-height: 48px;
  --header-sidebar-width: 120px;
}

/* Dim theme */
[data-theme="dim"] {
  --bg: #1c1e21;
  --surface: #242628;
  --surface-hover: #2c2f33;
  --surface-elevated: #313437;
  --text: #dde1e7;
  --text-secondary: #8b949e;
  --text-muted: #555e6b;
  --accent: #c0392b;
  --accent-hover: #a93226;
  --danger: #e74c3c;
  --border: #373b40;
}

/* Light theme */
[data-theme="light"] {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-hover: #f0f0f0;
  --surface-elevated: #e8e8e8;
  --text: #1a1a1a;
  --text-secondary: #555;
  --text-muted: #999;
  --accent: #c0392b;
  --accent-hover: #a93226;
  --danger: #e74c3c;
  --border: #d0d0d0;
}

/* Ocean theme */
[data-theme="ocean"] {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-hover: #1c2128;
  --surface-elevated: #21262d;
  --text: #c9d1d9;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --accent: #2980b9;
  --accent-hover: #1f618d;
  --danger: #e74c3c;
  --border: #30363d;
}

/* Forest theme */
[data-theme="forest"] {
  --bg: #0d1210;
  --surface: #131a14;
  --surface-hover: #1a231b;
  --surface-elevated: #1f2a20;
  --text: #cdd6c8;
  --text-secondary: #7f9e7a;
  --text-muted: #4a614a;
  --accent: #27ae60;
  --accent-hover: #1e8449;
  --danger: #e74c3c;
  --border: #2a3a2b;
}

/* Sunset theme */
[data-theme="sunset"] {
  --bg: #0f0a08;
  --surface: #1a1008;
  --surface-hover: #221510;
  --surface-elevated: #2a1c12;
  --text: #ede0d4;
  --text-secondary: #a08060;
  --text-muted: #5a3e2b;
  --accent: #d35400;
  --accent-hover: #b94600;
  --danger: #e74c3c;
  --border: #3a2516;
}

/* Violet theme */
[data-theme="violet"] {
  --bg: #0c0a14;
  --surface: #131020;
  --surface-hover: #1a1628;
  --surface-elevated: #201c30;
  --text: #e0dae8;
  --text-secondary: #8878a0;
  --text-muted: #504860;
  --accent: #8e44ad;
  --accent-hover: #7d3c98;
  --danger: #e74c3c;
  --border: #2c2840;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Utilities ---------- */

.hidden { display: none !important; }
.screen { min-height: 100vh; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Landing Screen ---------- */

.landing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}

.logo {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 8px;
}

.landing-subtitle {
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-size: 1rem;
}

#landing-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 300px;
}

#join-form {
  width: 100%;
  max-width: 300px;
  margin-top: 16px;
}

.join-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.join-actions .btn { flex: 1; }

#key-reveal {
  width: 100%;
  max-width: 360px;
  margin-top: 24px;
}

.key-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.key-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.key-display code {
  flex: 1;
  font-size: 1.1rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent);
  word-break: break-all;
}

.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 12px;
}

.loading {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 12px;
}

/* ---------- Buttons ---------- */

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:active { opacity: 0.85; }

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--surface-elevated); color: var(--text); }
.btn-secondary:hover { background: var(--surface-hover); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #a93226; }

.btn-small { padding: 7px 14px; font-size: 0.85rem; }

.btn-large { width: 100%; padding: 16px; font-size: 1rem; }

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover { color: var(--text); background: var(--surface-elevated); }

/* ---------- Inputs ---------- */

.input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-muted); }

/* ---------- App Layout ---------- */

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

.header-logo {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
}

.tab-content {
  margin-top: var(--header-height);
  margin-bottom: var(--tab-height);
  padding: 16px;
  min-height: calc(100vh - var(--header-height) - var(--tab-height));
  overflow-y: auto;
}

/* ---------- Tab Bar ---------- */

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tab-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 16px;
  font-size: 0.7rem;
  font-weight: 500;
  transition: color 0.15s;
}

.tab.active { color: var(--accent); }
.tab:hover { color: var(--text-secondary); }
.tab svg { width: 22px; height: 22px; }

/* ---------- Task Card ---------- */

.task-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 6px;
  border-left: 8px solid var(--color-blue);
  transition: background 0.1s;
  cursor: default;
  position: relative;
}

.task-card:hover { background: var(--surface-hover); }
.task-card.completed .task-title { text-decoration: line-through; color: var(--text-muted); }

.task-card[data-color="red"]    { border-left-color: var(--color-red);    background: color-mix(in srgb, var(--color-red) 8%, transparent); }
.task-card[data-color="blue"]   { border-left-color: var(--color-blue);   background: color-mix(in srgb, var(--color-blue) 8%, transparent); }
.task-card[data-color="green"]  { border-left-color: var(--color-green);  background: color-mix(in srgb, var(--color-green) 8%, transparent); }
.task-card[data-color="yellow"] { border-left-color: var(--color-yellow); background: color-mix(in srgb, var(--color-yellow) 8%, transparent); }
.task-card[data-color="purple"] { border-left-color: var(--color-purple); background: color-mix(in srgb, var(--color-purple) 8%, transparent); }
.task-card[data-color="orange"] { border-left-color: var(--color-orange); background: color-mix(in srgb, var(--color-orange) 8%, transparent); }
.task-card[data-color="pink"]   { border-left-color: var(--color-pink);   background: color-mix(in srgb, var(--color-pink) 8%, transparent); }
.task-card[data-color="gray"]   { border-left-color: var(--color-gray);   background: color-mix(in srgb, var(--color-gray) 8%, transparent); }

.task-drag-handle {
  color: var(--text-muted);
  cursor: grab;
  font-size: 1rem;
  user-select: none;
  flex-shrink: 0;
}

.task-drag-handle:active { cursor: grabbing; }

.task-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.task-title {
  flex: 1;
  font-size: 0.9rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-title-input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  padding: 2px 0;
  min-width: 0;
}

.task-ribbon-click {
  position: absolute;
  left: -8px;
  top: 0;
  bottom: 0;
  width: 20px;
  cursor: pointer;
  z-index: 1;
}

.task-color-dot { display: none; }

.task-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 8px;
  flex-shrink: 0;
  line-height: 1;
}

.task-delete:hover { color: var(--danger); }

.task-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ---------- Today View ---------- */

.today-header {
  margin-bottom: 16px;
}

.today-date {
  font-size: 1.3rem;
  font-weight: 700;
}

.today-day {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.task-list {
  min-height: 40px;
}

.add-task-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.add-task-row .input { flex: 1; }

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- Planner View ---------- */

.planner-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.planner-nav-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 8px;
}

.planner-nav-btn:hover { opacity: 0.8; }

.planner-week-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.day-card {
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.day-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-elevated);
  font-weight: 600;
  font-size: 0.9rem;
}

.day-card-header.today {
  background: var(--accent);
  color: white;
}

.day-card-body {
  padding: 8px 10px;
  min-height: 20px;
}

.day-card-add {
  display: flex;
  gap: 6px;
  padding: 6px 10px 10px;
}

.day-card-add .input {
  flex: 1;
  padding: 8px 10px;
  font-size: 0.8rem;
}

.day-card-add .btn { font-size: 0.8rem; padding: 8px 12px; }

/* Planner task card — slightly smaller */
.planner-task {
  font-size: 0.85rem;
  padding: 8px 10px;
  margin-bottom: 4px;
}

.planner-task .task-title { font-size: 0.85rem; }

/* ---------- Inbox & Backlog Sections ---------- */

.section-collapsible {
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}

.section-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-header .count {
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 0.8rem;
}

.section-header .chevron {
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: transform 0.2s;
}

.section-header.open .chevron { transform: rotate(180deg); }

.section-body {
  padding: 0 10px 10px;
}

.section-body.collapsed { display: none; }

.inbox-header h3 { color: var(--accent); }
.backlog-header h3 { color: var(--color-orange); }

/* ---------- History View ---------- */

.history-week {
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.history-week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}

.history-week-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
}

.history-week-body {
  padding: 0 10px 10px;
}

.history-day {
  margin-bottom: 8px;
}

.history-day-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 4px;
  padding-left: 4px;
}

.history-task {
  font-size: 0.8rem;
  padding: 6px 10px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-task .status-icon {
  flex-shrink: 0;
  font-size: 0.75rem;
}

.history-task .move-to-backlog {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 6px;
}

.history-task .move-to-backlog:hover { color: var(--accent); }

/* ---------- Settings Overlay ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.overlay-content {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
}

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

.overlay-header h2 { font-size: 1.2rem; font-weight: 700; }

.settings-section {
  margin-bottom: 24px;
}

.settings-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.keys-list {
  margin-bottom: 12px;
}

.key-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 6px;
}

.key-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.key-item-label { font-size: 0.85rem; font-weight: 500; }
.key-item-meta { font-size: 0.75rem; color: var(--text-secondary); }

.key-item-revoke {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px 8px;
}

.key-item-revoke:hover { color: var(--danger); }

.generate-key-form {
  display: flex;
  gap: 8px;
}

.generate-key-form .input { flex: 1; }

/* ---------- Color Picker ---------- */

.color-picker {
  position: fixed;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  display: flex;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 300;
}

.color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.1s, transform 0.1s;
}

.color-dot:hover { transform: scale(1.15); }
.color-dot.selected { border-color: white; }

/* ---------- Auto-rollover icon button ---------- */

.task-rollover-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 3px;
  flex-shrink: 0;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  line-height: 1;
}

.task-rollover-btn svg { width: 13px; height: 13px; }
.task-rollover-btn.active { color: var(--accent); }
.task-rollover-btn:hover { color: var(--text-secondary); }
.task-rollover-btn.active:hover { color: var(--accent-hover); }

/* ---------- SortableJS ghost styles ---------- */

.sortable-ghost {
  opacity: 0.4;
}

.sortable-chosen {
  background: var(--surface-elevated) !important;
}

/* ---------- Move-to-day popup ---------- */

.move-to-day-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  flex-shrink: 0;
  line-height: 1;
}

.move-to-day-btn:hover { color: var(--accent); }

.move-to-day-popup {
  position: fixed;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 0;
  z-index: 400;
  min-width: 140px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.move-to-day-popup button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.8rem;
  padding: 6px 12px;
  cursor: pointer;
}

.move-to-day-popup button:hover { background: var(--surface-hover); }

/* ---------- Desktop (>768px) ---------- */

@media (min-width: 768px) {
  .tab-bar {
    position: fixed;
    top: 0;
    bottom: auto;
    left: 0;
    right: 0;
    height: var(--header-height);
    border-top: none;
    border-bottom: 1px solid var(--border);
    justify-content: center;
    gap: 0;
    padding-left: var(--header-sidebar-width);
  }

  .app-header {
    z-index: 101;
    width: var(--header-sidebar-width);
    border-bottom: none;
  }

  .tab {
    flex-direction: row;
    gap: 6px;
    font-size: 0.85rem;
    padding: 8px 20px;
  }

  .tab-content {
    margin-top: var(--header-height);
    margin-bottom: 0;
    padding: 0;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
  }

  #view-today,
  #view-history,
  #view-habits {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    padding: 24px;
    height: 100%;
    overflow-y: auto;
  }

  #view-planner {
    width: 100%;
    height: 100%;
    padding: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .overlay-content {
    border-radius: var(--radius);
    margin-bottom: 10vh;
  }

  .overlay { align-items: center; }
}

/* ── Desktop Planner Grid ── */
@media (min-width: 768px) {
  .planner-grid-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .planner-grid-nav {
    flex-shrink: 0;
    padding-bottom: 8px;
  }

  .planner-grid-body {
    display: flex;
    flex: 1;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
  }

  .planner-sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--surface);
    position: relative;
  }

  .sidebar-merge-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    background: var(--surface-elevated);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .sidebar-merge-btn button {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .sidebar-merge-btn button:hover {
    color: var(--accent);
    border-color: var(--accent);
  }

  .planner-sidebar-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  .planner-sidebar-section + .planner-sidebar-section {
    border-top: 1px solid var(--border);
  }

  .planner-sidebar-header {
    padding: 8px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: var(--surface-elevated);
    flex-shrink: 0;
  }

  .planner-sidebar-header.inbox-label { color: var(--accent); }

  .planner-sidebar-tasks {
    flex: 1;
    overflow-y: auto;
    padding: 4px 6px;
    min-height: 0;
  }

  .planner-sidebar-add {
    flex-shrink: 0;
    padding: 4px 6px 6px;
    display: flex;
    gap: 4px;
    border-top: 1px solid var(--border);
  }

  .planner-sidebar-add .input {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.75rem;
  }

  .planner-sidebar-add .btn {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .planner-days {
    display: flex;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
  }

  .planner-day-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    position: relative;
    overflow-x: hidden;
  }

  .col-resize-handle {
    position: absolute;
    right: -3px;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: col-resize;
    z-index: 20;
    background: transparent;
  }

  .col-resize-handle:hover,
  .col-resize-handle.dragging {
    background: var(--accent);
    opacity: 0.4;
  }

  .planner-day-col:last-child { border-right: none; }

  .planner-day-col-header {
    padding: 6px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    background: var(--surface-elevated);
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
  }

  .planner-day-col-header.today {
    background: var(--accent);
    color: white;
  }

  .planner-day-col-tasks {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px;
    min-height: 0;
  }

  .planner-day-col-add {
    flex-shrink: 0;
    padding: 4px;
    display: flex;
    gap: 4px;
    border-top: 1px solid var(--border);
  }

  .planner-day-col-add .input {
    flex: 1;
    padding: 5px 6px;
    font-size: 0.72rem;
  }

  .planner-day-col-add .btn {
    padding: 5px 8px;
    font-size: 0.72rem;
  }
}

/* ── Join form standalone (key-only landing) ── */
.join-form-standalone {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

/* ============================================================
   MULTI-BOARD SETTINGS
   ============================================================ */

.settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.settings-section-header h3 { margin: 0; }

.boards-list { display: flex; flex-direction: column; gap: 6px; }

.board-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.board-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-elevated);
}

.board-item-name { flex: 1; font-size: 0.9rem; font-weight: 500; }

.board-item-current {
  font-size: 0.7rem;
  color: var(--accent);
  padding: 1px 6px;
  border: 1px solid var(--accent);
  border-radius: 10px;
}

.board-item-expand {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 6px;
  line-height: 1;
}

.board-item-body {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: none;
}
.board-item-body.expanded { display: block; }

.board-item-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  align-items: center;
}

/* ============================================================
   HABITS
   ============================================================ */

.habits-divider {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 8px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.habit-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  border-left: 4px solid var(--color-gray);
  margin-bottom: 4px;
}

.habit-card.completed .habit-title {
  text-decoration: line-through;
  opacity: 0.5;
}

.habit-checkbox { flex-shrink: 0; cursor: pointer; }
.habit-title { flex: 1; font-size: 0.85rem; }

.habit-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 2px;
  opacity: 0;
  line-height: 1;
}
.habit-card:hover .habit-delete { opacity: 1; }

/* Habits tab — habit list items */
.habit-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  background: var(--surface-elevated);
}

.habit-list-item-info { flex: 1; min-width: 0; }
.habit-list-name { font-size: 0.9rem; font-weight: 500; }
.habit-list-recurrence { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.habit-list-stats { text-align: right; font-size: 0.75rem; color: var(--text-secondary); flex-shrink: 0; }
.habit-stat-streak { font-weight: 600; color: var(--accent); }

/* Habit create form */
.habit-create-form {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.habit-day-picker {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.day-btn { cursor: pointer; }
.day-btn input { display: none; }
.day-btn span {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  background: var(--surface-elevated);
  transition: background 0.1s, border-color 0.1s;
}
.day-btn input:checked + span {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.input-sm { padding: 4px 8px !important; font-size: 0.85rem !important; }

.inbox-list { display: flex; flex-direction: column; gap: 4px; }

.inbox-schedule-today {
  flex-shrink: 0;
  margin-left: auto;
}

/* ---------- Theme Picker ---------- */

.theme-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  transition: border-color 0.15s, color 0.15s;
}

.theme-btn:hover { border-color: var(--accent); color: var(--text); }
.theme-btn.active { border-color: var(--accent); color: var(--text); }

.theme-swatch {
  width: 32px;
  height: 20px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.2);
}
