/* ═══════════════════════════════════════════════════════════════════════════
   pushpindo — style.css
   Aesthetic: physical card-index system
   Themes: sepia (warm paper), light (clean white), dark (elegant slate)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Theme: Sepia (default) ──────────────────────────────────────────────── */
[data-theme="sepia"] {
  --bg:           #e8dfd0;
  --paper:        #f2ece0;
  --paper-dark:   #e8dfd0;
  --paper-darker: #ddd3c0;
  --ink:          #2a2118;
  --ink-mid:      #5a4e3e;
  --ink-faint:    #9a8e7e;
  --ink-ghost:    #c4b8a8;
  --rule:         #d4c8b4;

  --accent-today:     #c0392b;
  --accent-cur-month: #2980b9;
  --accent-today-bg:  #fdf6f5;
  --accent-month-bg:  #f0f6fc;
  --accent-overlooked-bg: #fdf6e8;
  --accent-cal-hi-bg: #fff8f0;

  --pri-high:   #c0392b;
  --pri-medium: #d4820a;
  --pri-low:    #7a8c6e;

  --sidebar-bg:     #c8bfb0;
  --sidebar-text:   #2a2118;
  --sidebar-faint:  #7a6e5e;
  --sidebar-hover:  #bab0a0;
  --sidebar-border: #b0a690;
  --sidebar-accent: #c0392b;

  --titlebar-bg:     #f2ece0;
  --titlebar-border: #d4c8b4;
  --titlebar-text:   #2a2118;
  --titlebar-sub:    #9a8e7e;

  --shadow-card:  0 1px 3px rgba(42,33,24,0.12), 0 1px 1px rgba(42,33,24,0.08);
  --shadow-modal: 0 8px 32px rgba(42,33,24,0.28);
  --shadow-sidebar: 2px 0 12px rgba(42,33,24,0.15);
}

/* ── Theme: Light ────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:           #f0f0f0;
  --paper:        #ffffff;
  --paper-dark:   #f5f5f5;
  --paper-darker: #ebebeb;
  --ink:          #1a1a1a;
  --ink-mid:      #444444;
  --ink-faint:    #888888;
  --ink-ghost:    #bbbbbb;
  --rule:         #dddddd;

  --accent-today:     #d64040;
  --accent-cur-month: #2a7bc4;
  --accent-today-bg:  #fff5f5;
  --accent-month-bg:  #f0f6ff;
  --accent-overlooked-bg: #fffbf0;
  --accent-cal-hi-bg: #fff8f0;

  --pri-high:   #d64040;
  --pri-medium: #c47a10;
  --pri-low:    #5a8a50;

  --sidebar-bg:     #e0e0e0;
  --sidebar-text:   #1a1a1a;
  --sidebar-faint:  #666666;
  --sidebar-hover:  #d0d0d0;
  --sidebar-border: #c4c4c4;
  --sidebar-accent: #d64040;

  --titlebar-bg:     #ffffff;
  --titlebar-border: #dddddd;
  --titlebar-text:   #1a1a1a;
  --titlebar-sub:    #888888;

  --shadow-card:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-modal: 0 8px 32px rgba(0,0,0,0.18);
  --shadow-sidebar: 2px 0 12px rgba(0,0,0,0.1);
}

/* ── Theme: Dark ─────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:           #1e2027;
  --paper:        #272b35;
  --paper-dark:   #1e2027;
  --paper-darker: #181b22;
  --ink:          #e8eaf0;
  --ink-mid:      #b0b4c0;
  --ink-faint:    #6e7280;
  --ink-ghost:    #454855;
  --rule:         #363a46;

  --accent-today:     #e05c5c;
  --accent-cur-month: #5b9bd5;
  --accent-today-bg:  #2e2228;
  --accent-month-bg:  #1e2530;
  --accent-overlooked-bg: #2a2818;
  --accent-cal-hi-bg: #2e2a20;

  --pri-high:   #e05c5c;
  --pri-medium: #d49440;
  --pri-low:    #7aaa6a;

  --sidebar-bg:     #13151a;
  --sidebar-text:   #e8eaf0;
  --sidebar-faint:  #6e7280;
  --sidebar-hover:  #1e2027;
  --sidebar-border: #1e2027;
  --sidebar-accent: #e05c5c;

  --titlebar-bg:     #272b35;
  --titlebar-border: #363a46;
  --titlebar-text:   #e8eaf0;
  --titlebar-sub:    #6e7280;

  --shadow-card:  0 1px 3px rgba(0,0,0,0.35), 0 1px 1px rgba(0,0,0,0.25);
  --shadow-modal: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-sidebar: 2px 0 12px rgba(0,0,0,0.4);
}

/* ── Shared tokens ───────────────────────────────────────────────────────── */
:root {
  --font-body: 'Zilla Slab', Georgia, serif;
  --font-mono: 'Courier Prime', 'Courier New', monospace;

  --col-width:    260px;
  --titlebar-h:   54px;
  --sidebar-w:    200px;
  --sidebar-w-collapsed: 0px;
  --board-margin: 12px;   /* breathing room on right + bottom */

  --radius-sm: 3px;
  --radius:    5px;

  --sidebar-transition: width 0.2s ease, transform 0.2s ease;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      var(--rule) 27px,
      var(--rule) 28px
    );
}

.login-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--accent-today);
  border-radius: var(--radius);
  padding: 2.5rem 2.25rem;
  width: 300px;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.login-logo {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.login-sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: -0.4rem;
  margin-bottom: 0.5rem;
}

.login-error {
  background: var(--accent-today-bg);
  border: 1px solid var(--pri-high);
  border-radius: var(--radius-sm);
  color: var(--pri-high);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.4rem 0.6rem;
}

.login-input {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: var(--paper-dark);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: 0.5rem 0.65rem;
  outline: none;
  transition: border-color 0.15s;
}
.login-input:focus { border-color: var(--ink-mid); }

.login-btn {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  cursor: pointer;
  margin-top: 0.25rem;
  transition: background 0.15s;
}
.login-btn:hover { background: var(--ink-mid); }

/* ── App shell ───────────────────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Title bar ───────────────────────────────────────────────────────────── */
.titlebar {
  position: relative;
  z-index: 200;
  height: var(--titlebar-h);
  background: var(--titlebar-bg);
  border-bottom: 1px solid var(--titlebar-border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--paper-darker); }
.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--titlebar-text);
  border-radius: 1px;
  transition: background 0.12s;
}

.titlebar-logo {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--titlebar-text);
}

.titlebar-subtitle {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--titlebar-sub);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 2px;
}

/* ── App body (sidebar + board) ──────────────────────────────────────────── */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--sidebar-transition);
  box-shadow: var(--shadow-sidebar);
  flex-shrink: 0;
  z-index: 100;
}

/* Collapsed = slim icon rail, not zero-width */
:root { --sidebar-w-collapsed: 44px; }

.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
  min-width: var(--sidebar-w-collapsed);
}

/* Hide text labels when collapsed */
.sidebar.collapsed .sidebar-btn-label,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .sidebar-profile-info,
.sidebar.collapsed .theme-btn span:last-child,
.sidebar.collapsed .sidebar-profile-name,
.sidebar.collapsed .sidebar-profile-role {
  display: none;
}

/* Centre icons when collapsed */
.sidebar.collapsed .sidebar-btn {
  justify-content: center;
  padding: 0.55rem 0;
}

.sidebar.collapsed .sidebar-nav {
  padding: 1rem 0.35rem 0.5rem;
}

.sidebar.collapsed .sidebar-section {
  padding: 0.75rem 0.35rem 0;
}

.sidebar.collapsed .sidebar-profile {
  justify-content: center;
}

.sidebar.collapsed .theme-btn {
  justify-content: center;
  padding: 0.35rem 0;
}

/* Hide section borders that look odd when collapsed */
.sidebar.collapsed .sidebar-section {
  border-top-color: transparent;
}
.sidebar.collapsed .sidebar-section:first-of-type {
  border-top-color: var(--sidebar-border);
}

.sidebar-nav {
  padding: 1rem 0.75rem 0.5rem;
  flex-shrink: 0;
}

.sidebar-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-btn--primary {
  background: var(--sidebar-accent);
  color: #fff;
}
.sidebar-btn--primary:hover { filter: brightness(1.1); }

.sidebar-btn--ghost {
  background: transparent;
  color: var(--sidebar-faint);
  border: 1px solid var(--sidebar-border);
  margin-top: 0.35rem;
}
.sidebar-btn--ghost:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}
/* Primary button needs readable text on light sidebar backgrounds */
[data-theme="sepia"] .sidebar-btn--primary,
[data-theme="light"] .sidebar-btn--primary {
  color: #fff;
}

.sidebar-btn-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}
.sidebar-btn-label { overflow: hidden; }

.sidebar-section {
  padding: 0.75rem 0.75rem 0;
  border-top: 1px solid var(--sidebar-border);
  margin-top: 0.5rem;
}

.sidebar-section--bottom {
  margin-top: auto;
  padding-bottom: 1rem;
}

.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--sidebar-faint);
  margin-bottom: 0.6rem;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--sidebar-accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.sidebar-profile-info {
  overflow: hidden;
  flex: 1;
}

.sidebar-profile-name {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-profile-role {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--sidebar-faint);
  text-transform: lowercase;
  letter-spacing: 0.05em;
}

/* ── Font size (controlled by JS via html style attribute) ───────────────── */
/* Base is html font-size; all rem values scale automatically.               */

/* ── Density: compact mode ───────────────────────────────────────────────── */
[data-density="compact"] .board {
  gap: 6px;
  padding: 6px;
}
[data-density="compact"] .task-card {
  padding: 0.32rem 0.55rem 0.32rem 0.5rem;
  margin-bottom: 0.25rem;
}
[data-density="compact"] .slot-header {
  padding: 0.28rem 1rem;
}
[data-density="compact"] .priority-label {
  padding: 0.28rem 1rem 0.18rem;
}
[data-density="compact"] .task-list {
  padding: 0 0.5rem 0.15rem;
}

/* ── Appearance modal ────────────────────────────────────────────────────── */
.modal--appearance {
  width: 380px;
}

.appear-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
.appear-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.appear-section-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.65rem;
}

/* Theme and density option grids */
.appear-theme-grid {
  display: flex;
  gap: 0.5rem;
}

.appear-theme-opt,
.appear-density-opt {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.5rem 0.55rem;
  background: var(--paper-dark);
  border: 2px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-mid);
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.appear-theme-opt:hover,
.appear-density-opt:hover {
  border-color: var(--ink-mid);
  background: var(--paper-darker);
}
.appear-theme-opt.active,
.appear-density-opt.active {
  border-color: var(--ink);
  background: var(--paper);
  color: var(--ink);
}

.appear-theme-label {
  font-size: 0.72rem;
}

/* Checkmark shown only when active */
.appear-check {
  font-size: 0.65rem;
  color: var(--ink);
  opacity: 0;
  position: absolute;
  top: 0.3rem;
  right: 0.4rem;
  transition: opacity 0.12s;
}
.appear-theme-opt.active .appear-check,
.appear-density-opt.active .appear-check {
  opacity: 1;
}

/* Theme swatches */
.appear-theme-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--rule);
  flex-shrink: 0;
}
.appear-theme-swatch--sepia { background: #f2ece0; border-color: #d4c8b4; }
.appear-theme-swatch--light { background: #ffffff; border-color: #cccccc; }
.appear-theme-swatch--dark  { background: #272b35; border-color: #363a46; }

/* Density icons */
.appear-density-icon {
  font-size: 1rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  font-family: var(--font-mono);
}
.appear-density-opt.active .appear-density-icon {
  color: var(--ink-mid);
}

/* Text size stepper */
.appear-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.appear-size-a {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink-faint);
  flex-shrink: 0;
  line-height: 1;
}
.appear-size-a--sm { font-size: 0.75rem; }
.appear-size-a--lg { font-size: 1.25rem; }

.appear-stepper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--paper-dark);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.appear-step-btn {
  background: none;
  border: none;
  color: var(--ink-mid);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
  line-height: 1;
}
.appear-step-btn:hover {
  background: var(--paper-darker);
  color: var(--ink);
}
.appear-step-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.appear-step-val {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink);
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  padding: 0.35rem 0.4rem;
  user-select: none;
}

/* ── Board wrap (adds right+bottom margin) ───────────────────────────────── */
.board-wrap {
  flex: 1;
  display: flex;
  overflow: hidden;
  padding: 0 var(--board-margin) var(--board-margin) 0;
  background: var(--bg);
  min-width: 0;
}

/* ── Board ───────────────────────────────────────────────────────────────── */
.board {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  min-width: 0;
  gap: 12px;
  padding: 12px;
}

/* ── Column ──────────────────────────────────────────────────────────────── */
.col {
  width: var(--col-width);
  min-width: var(--col-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  background: var(--paper);
  overflow: hidden;
}
.col:last-child { box-shadow: var(--shadow-card); }

/* Subtle tint on tickler columns to distinguish from Do Now */
#col-days, #col-months, #col-years {
  background: var(--paper-dark);
}

#col-now {
  flex: 1;
  width: auto;
  min-width: var(--col-width);
}

.col-header {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  flex-shrink: 0;
}

.col-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.col-body::-webkit-scrollbar { width: 4px; }
.col-body::-webkit-scrollbar-track { background: transparent; }
.col-body::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 2px; }

/* ── Do Now — priority sections ─────────────────────────────────────────── */
.priority-section { margin-bottom: 0.25rem; }

.priority-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0.65rem 1rem 0.35rem;
  color: var(--ink-faint);
  border-left: 3px solid transparent;
  margin-bottom: 0.1rem;
}
.priority-label--high   { border-left-color: var(--pri-high);   color: var(--pri-high); }
.priority-label--medium { border-left-color: var(--pri-medium); color: var(--pri-medium); }
.priority-label--low    { border-left-color: var(--pri-low);    color: var(--pri-low); }

.task-list {
  min-height: 4px;
  padding: 0 0.5rem 0.25rem;
}

/* ── Task card ───────────────────────────────────────────────────────────── */
.task-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem 0.55rem 0.6rem;
  margin-bottom: 0.45rem;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  transition: box-shadow 0.12s, transform 0.12s;
  position: relative;
}
.task-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transform: translateY(-1px);
}
.task-card[data-priority="high"]   { border-left-color: var(--pri-high); }
.task-card[data-priority="medium"] { border-left-color: var(--pri-medium); }
.task-card[data-priority="low"]    { border-left-color: var(--pri-low); }
#col-now .task-card { border-left-color: var(--rule); }

/* ── Task card checkbox (complete) and icon buttons ──────────────────────── */
.task-checkbox {
  width: 1rem;
  height: 1rem;
  border: 1.5px solid var(--ink-ghost);
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.task-checkbox:hover {
  border-color: var(--pri-low);
}
.task-checkbox--checking {
  border-color: var(--pri-low);
  background: var(--pri-low);
}
/* Checkmark drawn via pseudo-element on hover */
.task-checkbox:hover::after,
.task-checkbox--checking::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%) rotate(-45deg);
  width: 0.35rem;
  height: 0.2rem;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
}

.task-card-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.12s;
}
.task-card:hover .task-card-actions {
  opacity: 1;
}

.task-icon-btn {
  background: transparent;
  border: none;
  padding: 0.15rem 0.25rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--ink-mid);
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: color 0.12s, background 0.12s;
}
.task-icon-btn:hover {
  color: var(--ink);
  background: var(--rule);
}
.task-icon-btn--delete:hover {
  color: var(--pri-high);
  background: transparent;
}

/* btn-danger for delete-only confirm modal */
.btn-danger {
  background: var(--pri-high);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-danger:hover { opacity: 0.85; }
.btn-danger.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.75rem; }

.task-drag-handle {
  color: var(--ink-ghost);
  font-size: 0.75rem;
  line-height: 1.6;
  cursor: grab;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.1s;
  user-select: none;
  letter-spacing: -1px;
}
.task-card:hover .task-drag-handle { opacity: 1; }

.task-body { flex: 1; min-width: 0; }

.task-title {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
  word-break: break-word;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
  flex-wrap: wrap;
}

.task-category {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  background: var(--paper-dark);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0 0.35rem;
  color: var(--ink-mid);
  text-transform: lowercase;
}

.task-priority-pip {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 1px;
}
.task-priority-pip[data-priority="high"]   { background: var(--pri-high); }
.task-priority-pip[data-priority="medium"] { background: var(--pri-medium); }
.task-priority-pip[data-priority="low"]    { background: var(--pri-low); }

/* ── Slot rows (Days / Months / Years) ───────────────────────────────────── */
.slot { border-bottom: 1px solid var(--paper-darker); }

.slot-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.58rem 1rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-mid);
  user-select: none;
  transition: background 0.1s;
  position: relative;
}
.slot-header:hover { background: var(--paper-darker); }

.slot-chevron {
  font-size: 0.6rem;
  width: 0.9rem;
  flex-shrink: 0;
  color: var(--ink-ghost);
  transition: transform 0.18s;
}
.slot.open .slot-chevron { transform: rotate(90deg); }

.slot-label { flex: 1; }

.slot-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  border-radius: 10px;
  padding: 0.05rem 0.4rem;
  background: var(--paper-darker);
  color: var(--ink-ghost);
  min-width: 1.5rem;
  text-align: center;
  border: 1px solid var(--rule);
}
.slot-count.has-tasks {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.slot--today .slot-header {
  background: var(--accent-today-bg);
  border-left: 3px solid var(--accent-today);
  padding-left: calc(1rem - 3px);
}
.slot--today .slot-label { color: var(--accent-today); font-weight: 700; }

.slot--cur-month .slot-header {
  background: var(--accent-month-bg);
  border-left: 3px solid var(--accent-cur-month);
  padding-left: calc(1rem - 3px);
}
.slot--cur-month .slot-label { color: var(--accent-cur-month); font-weight: 700; }

.slot--cur-year .slot-header {
  border-left: 3px solid var(--ink-mid);
  padding-left: calc(1rem - 3px);
}
.slot--cur-year .slot-label { font-weight: 700; color: var(--ink); }

.slot-tasks {
  display: none;
  padding: 0.3rem 0.5rem 0.4rem;
}
.slot.open .slot-tasks { display: block; }

/* ── Calendar ────────────────────────────────────────────────────────────── */
.calendar-wrap {
  flex-shrink: 0;
  border-top: 2px solid var(--rule);
  padding: 0.75rem 0.9rem 0.9rem;
  background: var(--paper-dark);
  font-family: var(--font-mono);
}

.cal-month { margin-bottom: 0.9rem; }
.cal-month:last-child { margin-bottom: 0; }

.cal-month-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mid);
  margin-bottom: 0.4rem;
}

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

.cal-dow {
  font-size: 0.6rem;
  text-align: center;
  color: var(--ink-ghost);
  padding-bottom: 0.2rem;
}

.cal-day {
  font-size: 0.72rem;
  text-align: center;
  padding: 0.2rem 0.1rem;
  border-radius: 2px;
  cursor: pointer;
  color: var(--ink-mid);
  transition: background 0.1s;
}
.cal-day:hover { background: var(--paper-darker); }
.cal-day.cal-day--today {
  background: var(--accent-today);
  color: #fff;
  font-weight: 700;
  border-radius: 3px;
}
.cal-day.cal-day--highlighted {
  outline: 2px solid var(--accent-today);
  outline-offset: -1px;
}
.cal-day--empty { cursor: default; }
.cal-day--empty:hover { background: transparent; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.modal {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--ink);
  border-radius: var(--radius);
  width: 480px;
  max-width: 94vw;
  box-shadow: var(--shadow-modal);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  gap: 1rem;
}

.modal-title {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.modal-close {
  background: none;
  border: none;
  color: var(--ink-ghost);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.1rem;
  flex-shrink: 0;
  transition: color 0.1s;
}
.modal-close:hover { color: var(--ink); }

.modal-body { padding: 0.85rem 1.1rem 1.1rem; }

.modal-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.modal-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  border: 1px solid var(--rule);
  background: var(--paper-dark);
  color: var(--ink-mid);
}

.modal-notes {
  font-size: 0.9rem;
  color: var(--ink-mid);
  line-height: 1.6;
  white-space: pre-wrap;
  min-height: 1.5rem;
  font-style: italic;
}
.modal-notes:empty::before { content: 'no notes'; color: var(--ink-ghost); }

.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
}

.modal--sm { width: 340px; }

/* ── Loading state ───────────────────────────────────────────────────────── */
.loading-msg {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-ghost);
  padding: 1.5rem 1rem;
  text-align: center;
}

/* ── Drag & drop ─────────────────────────────────────────────────────────── */
.task-card.dragging {
  opacity: 0.4;
  box-shadow: none;
  transform: none;
}
.task-card.drag-over-above {
  border-top: 2px solid var(--ink-mid);
  margin-top: -1px;
}
.task-card.drag-over-below {
  border-bottom: 2px solid var(--ink-mid);
}
.task-list.drag-target-empty {
  min-height: 32px;
  border: 1px dashed var(--rule);
  border-radius: var(--radius-sm);
  background: var(--paper-darker);
}
.slot-tasks.drag-over {
  background: var(--paper-darker);
  border-radius: var(--radius-sm);
}

/* ── Panel (new task slide-in) ───────────────────────────────────────────── */
.panel-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  z-index: 400;
}

.panel {
  background: var(--paper);
  border-left: 1px solid var(--rule);
  width: 360px;
  max-width: 94vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.18);
  animation: slideIn 0.18s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem 0.85rem;
  border-bottom: 2px solid var(--rule);
  flex-shrink: 0;
}

.panel-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* ── Form elements ───────────────────────────────────────────────────────── */
.field-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: block;
  margin-bottom: 0.2rem;
}
.field-required { color: var(--pri-high); }

.field-input, .field-textarea, .field-select {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  background: var(--paper-dark);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: 0.45rem 0.6rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.field-input:focus,
.field-textarea:focus,
.field-select:focus { border-color: var(--ink-mid); }

.field-textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.field-select { cursor: pointer; }
.field-select--full { width: 100%; }

.field-row { display: flex; gap: 0.65rem; }
.field-group { flex: 1; min-width: 0; }

.form-error {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--pri-high);
  background: var(--accent-today-bg);
  border: 1px solid var(--pri-high);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-primary {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--ink-mid); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: transparent;
  color: var(--ink-faint);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-ghost:hover { background: var(--paper-darker); color: var(--ink-mid); }

.btn-danger {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  background: transparent;
  color: var(--pri-high);
  border: 1px solid var(--pri-high);
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-danger:hover { background: var(--pri-high); color: #fff; }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.75rem; }

/* ── Slot overlooked + calendar highlight ────────────────────────────────── */
.slot--highlighted-cal .slot-header { background: var(--accent-cal-hi-bg); }

.slot--overlooked .slot-header {
  background: var(--accent-overlooked-bg);
  border-left: 3px solid var(--pri-medium);
  padding-left: calc(1rem - 3px);
}
.slot--overlooked .slot-label { color: var(--pri-medium); font-weight: 700; }
.slot--overlooked .slot-count.has-tasks {
  background: var(--pri-medium);
  border-color: var(--pri-medium);
}

.confirm-msg {
  font-size: 0.88rem;
  color: var(--ink-mid);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
.board::-webkit-scrollbar { height: 4px; }
.board::-webkit-scrollbar-track { background: var(--paper-dark); }
.board::-webkit-scrollbar-thumb { background: var(--rule); }

/* ── Days-in variables (added to each theme) ─────────────────────────────── */
[data-theme="sepia"] {
  --days-green: #4a7c3f;
  --days-amber: #c47a10;
  --days-red:   #c0392b;
}
[data-theme="light"] {
  --days-green: #3a7d30;
  --days-amber: #b86e00;
  --days-red:   #c0392b;
}
[data-theme="dark"] {
  --days-green: #7aaa6a;
  --days-amber: #d49440;
  --days-red:   #e05c5c;
}

/* ── Category colour bars (left edge of task card) ───────────────────────── */
.task-cat-bars {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 4px;
  flex-shrink: 0;
  align-self: stretch;
  border-radius: 2px 0 0 2px;
  overflow: hidden;
  margin-left: -3px;  /* tuck under card's left border */
  margin-right: 4px;
}

.task-cat-bar {
  flex: 1;
  min-height: 6px;
  border-radius: 1px;
}

/* ── Days-in pill ────────────────────────────────────────────────────────── */
.task-days-in {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
  min-width: 1.4rem;
  text-align: right;
  opacity: 0.85;
  letter-spacing: -0.01em;
}

/* ── Category editor (in new-task panel + edit modal) ────────────────────── */
.cat-editor {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.cat-tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--paper-dark);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.4rem 0.25rem 0.35rem;
}

.cat-tag-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.15);
  transition: transform 0.1s;
}
.cat-tag-swatch:hover { transform: scale(1.2); }

.cat-tag-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-mid);
  flex: 1;
}

.cat-tag-remove {
  background: none;
  border: none;
  color: var(--ink-ghost);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0 0.1rem;
  transition: color 0.1s;
  flex-shrink: 0;
}
.cat-tag-remove:hover { color: var(--pri-high); }

.cat-add-row {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.cat-add-input {
  flex: 1;
  font-size: 0.78rem !important;
  padding: 0.3rem 0.5rem !important;
}

.cat-add-btn {
  flex-shrink: 0;
  padding: 0.3rem 0.6rem !important;
  font-size: 1rem !important;
  line-height: 1;
}

.cat-add-wrapper {
  position: relative;
}

.cat-dropdown {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px var(--shadow-md);
  z-index: 200;
  display: flex;
  flex-direction: column;
  max-height: 180px;
  overflow-y: auto;
}

.cat-dropdown.hidden {
  display: none;
}

.cat-dropdown-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  background: none;
  border: none;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-mid);
  transition: background 0.1s;
}

.cat-dropdown-chip:hover {
  background: var(--paper-dark);
  color: var(--ink);
}

.cat-dropdown-chip--new {
  color: var(--ink-faint);
  border-top: 1px solid var(--rule);
  font-style: italic;
}

.cat-dropdown-chip--new:hover {
  color: var(--ink-mid);
}

.cat-chip-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.12);
}
/* ── Category badges in modal view ──────────────────────────────────────── */
.modal-cat-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem 0.15rem 0.35rem;
  border-radius: 2px;
  border: 1px solid var(--rule);
  background: var(--paper-dark);
  color: var(--ink-mid);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.modal-cat-badge::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cat-color, var(--ink-ghost));
  flex-shrink: 0;
}

/* ── Logo ────────────────────────────────────────────────────────────────── */
.titlebar-logo-img {
  width: 36px;
  height: 36px;
  display: block;
  flex-shrink: 0;
  /* Tint the logo to match the titlebar ink colour across themes */
  filter: brightness(0) saturate(100%);
  opacity: 0.75;
}

[data-theme="dark"] .titlebar-logo-img {
  filter: brightness(0) saturate(100%) invert(1);
  opacity: 0.8;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.login-logo-img {
  width: 72px;
  height: 72px;
  display: block;
  flex-shrink: 0;
  filter: brightness(0) saturate(100%);
  opacity: 0.85;
}

[data-theme="dark"] .login-logo-img {
  filter: brightness(0) saturate(100%) invert(1);
  opacity: 0.85;
}

/* ── Login link (switch to register) ────────────────────────────────────── */
.login-link {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  cursor: pointer;
  text-align: center;
  padding: 0.15rem 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}
.login-link:hover { color: var(--ink-mid); }

/* ── Sidebar avatar as button ────────────────────────────────────────────── */
button.sidebar-avatar {
  cursor: pointer;
  border: none;
  transition: filter 0.12s;
}
button.sidebar-avatar:hover { filter: brightness(1.15); }

/* ── Sidebar profile role as link ────────────────────────────────────────── */
.sidebar-profile-role--link {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--sidebar-faint);
  text-transform: lowercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.12s;
}
.sidebar-profile-role--link:hover { color: var(--sidebar-text); }

/* ── Profile modal ───────────────────────────────────────────────────────── */
.modal--profile {
  width: 420px;
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--sidebar-accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.profile-meta {
  flex: 1;
  min-width: 0;
}

.profile-username {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.profile-joined {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
  margin-top: 0.15rem;
}

.profile-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.profile-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.profile-section-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.3rem;
}

.profile-msg {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--pri-high);
}
.profile-msg[data-ok="true"] {
  color: var(--pri-low);
}

/* ── Titlebar toggle stays readable against any sidebar colour ───────────── */
/* The toggle is in the titlebar (not sidebar) so no change needed there.    */

/* ── Sidebar shadow only when expanded ──────────────────────────────────── */
.sidebar.collapsed {
  box-shadow: none;
}
/* ═══════════════════════════════════════════════════════════════════════════
   Mobile layout  (≤ 700px)
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 700px) {

  .sidebar { display: none !important; }
  .sidebar-toggle { display: none; }

  .titlebar {
    justify-content: center;
    padding: 0 1rem;
    height: 40px;
  }
  .titlebar-subtitle { display: none; }

  .app-body {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 56px;
  }

  .board-wrap {
    padding: 0;
    overflow: visible;
    flex: none;
  }

  .board {
    flex-direction: column;
    overflow: visible;
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
  }

  .col,
  #col-now {
    width: 100%;
    min-width: 0;
    flex-shrink: 0;
    border-right: none;
    border-bottom: 2px solid var(--rule);
    overflow: visible;
    height: auto;
  }
  .col:last-child { border-bottom: none; }

  .col-body {
    overflow: visible;
    height: auto;
    max-height: none;
  }

  .calendar-wrap { width: 100%; }

  .panel-backdrop {
    align-items: flex-end;
    justify-content: stretch;
  }
  .panel {
    width: 100%;
    max-width: 100%;
    height: 85vh;
    border-left: none;
    border-top: 2px solid var(--rule);
    border-radius: var(--radius) var(--radius) 0 0;
    animation: slideUp 0.2s ease-out;
  }
  @keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  .modal {
    width: 96vw;
    max-width: 96vw;
  }

  .mobile-nav {
    display: flex !important;
  }
}

/* Hidden on desktop, shown on mobile via the media query above */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: var(--sidebar-bg);
  border-top: 1px solid var(--sidebar-border);
  z-index: 300;
  align-items: stretch;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
}

.mobile-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--sidebar-faint);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-btn:active { background: var(--sidebar-hover); }
.mobile-nav-btn--primary { color: var(--sidebar-accent); }

.mobile-nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}


/* ── Inline card expand ──────────────────────────────────────────────────── */
.task-card.expanded {
  border-left-width: 4px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.18);
}

.task-card-detail {
  width: 100%;
  padding-top: 0.5rem;
  margin-top: 0.4rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  /* detail lives inside the flex row — force it to full width */
  flex-basis: 100%;
}

/* The card needs to allow wrapping so detail can sit below */
.task-card {
  flex-wrap: wrap;
  align-items: flex-start;
}

.task-card-detail-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.task-card-detail-notes {
  font-size: 0.82rem;
  color: var(--ink-mid);
  line-height: 1.5;
  white-space: pre-wrap;
  font-style: italic;
}

.task-card-detail-actions {
  display: flex;
  gap: 0.4rem;
  padding-top: 0.2rem;
}

.btn-complete {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: transparent;
  color: var(--pri-low);
  border: 1px solid var(--pri-low);
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-complete:hover { background: var(--pri-low); color: #fff; }
.btn-complete.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.75rem; }

/* ── Confirm dialog: Complete vs Delete layout ───────────────────────────── */
.confirm-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
/* Push Delete to left, Complete to right */
.confirm-actions .btn-ghost:first-child { margin-right: auto; }

/* ── Sidebar archive nav button active state ─────────────────────────────── */
.sidebar-btn--nav.active {
  background: var(--paper-darker);
  color: var(--sidebar-text);
  border-color: var(--sidebar-border);
}

/* ── Archive screen ──────────────────────────────────────────────────────── */
.archive-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin: 0 var(--board-margin) var(--board-margin) 0;
  box-shadow: var(--shadow-card);
}

.archive-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  flex-shrink: 0;
}

.archive-back {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink-mid);
  cursor: pointer;
  padding: 0.25rem 0.65rem;
  transition: background 0.12s, color 0.12s;
}
.archive-back:hover { background: var(--paper-darker); color: var(--ink); }

.archive-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.archive-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-ghost);
  margin-left: auto;
}

.archive-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

.archive-week {
  margin-bottom: 1.25rem;
}

.archive-week-heading {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0.4rem;
}

.archive-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--paper-darker);
  position: relative;
}
.archive-row:last-child { border-bottom: none; }

.archive-cat-bars {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 3px;
  flex-shrink: 0;
  align-self: stretch;
  border-radius: 2px;
  overflow: hidden;
}

.archive-row-left {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.archive-check {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--pri-low);
  flex-shrink: 0;
  margin-top: 1px;
}

.archive-row-info {
  flex: 1;
  min-width: 0;
}

.archive-row-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-mid);
  text-decoration: line-through;
  text-decoration-color: var(--ink-ghost);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.archive-row-meta {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--ink-ghost);
  margin-top: 0.1rem;
}

.archive-row-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.12s;
}
.archive-row:hover .archive-row-actions { opacity: 1; }

/* ── Completion notes — modal view ───────────────────────────────────────── */
.modal-completion-notes-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.3rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
}

.modal-completion-notes-text {
  color: var(--pri-low);
  font-style: normal;
}
.modal-completion-notes-text:empty::before {
  content: none;
}

/* ── Completion notes — archive rows ─────────────────────────────────────── */
.archive-completion-notes {
  font-size: 0.75rem;
  color: var(--ink-faint);
  font-style: italic;
  margin-top: 0.2rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Profile — desktop access / token section ────────────────────────────── */
.profile-token-desc {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin-bottom: 0.65rem;
  line-height: 1.5;
}

.profile-token-none {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-ghost);
  margin-bottom: 0.5rem;
}

.profile-token-wrap {
  background: var(--paper-darker);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.5rem;
}

.profile-token-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.profile-token-val {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-mid);
  word-break: break-all;
  letter-spacing: 0.03em;
  user-select: all;
}

.profile-token-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--ink-faint);
  padding: 0.15rem 0.25rem;
  border-radius: var(--radius-sm);
  transition: color 0.12s, background 0.12s;
  flex-shrink: 0;
  line-height: 1;
}
.profile-token-icon-btn:hover {
  color: var(--ink);
  background: var(--paper-dark);
}

.profile-token-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}
