/* =========================================================================
   Themes. Every component below reads only these semantic tokens, so a theme
   is just a block of variables. A theme can also be applied to any element
   (data-theme="…") — the settings page uses that for live previews.
   ========================================================================= */

/* «Бумага» — warm paper notebook (DESIGN_new.md). Default. */
:root,
[data-theme="paper"] {
  color-scheme: light;
  --success: #1a8a4a;
  --backdrop: rgba(15, 15, 15, 0.36);
  --pill-text: #6b4a00;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-features: "lnum" on, "locl" 0;
  --text-size: 14px;

  --bg: #f6f5f4;
  --surface: #ffffff;
  --surface-hover: #fbfaf9;
  --surface-muted: rgba(0, 0, 0, 0.035);
  --input-bg: rgba(0, 0, 0, 0.04);
  --text: rgba(0, 0, 0, 0.95);
  --text-muted: #615d59;
  --text-faint: #757575;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);
  --dashed: rgba(0, 0, 0, 0.18);

  --primary: #0075de;
  --primary-hover: #005bab;
  --primary-text: #ffffff;
  --secondary-bg: #e6f3fe;
  --secondary-hover: #d4eafd;
  --secondary-text: #0075de;
  --ghost-hover: rgba(0, 0, 0, 0.05);
  --danger: #e32d14;
  --danger-bg: #fdecea;
  --focus: #0075de;

  --brand-bg: #000000;
  --brand-text: #ffffff;
  --badge-bg: rgba(0, 0, 0, 0.06);
  --badge-text: rgba(0, 0, 0, 0.7);
  --notice-bg: #e6f3fe;
  --notice-border: transparent;
  --notice-icon-bg: #ffffff;
  --topbar-bg: rgba(246, 245, 244, 0.85);
  --topbar-border: transparent;
  --topbar-shadow: 0 0.7px 1.462px rgba(0, 0, 0, 0.015), 0 3px 9px rgba(0, 0, 0, 0.03);
  --column-bg: rgba(0, 0, 0, 0.03);
  --column-border: transparent;
  --column-shadow: none;
  --toast-bg: #02093a;

  --radius-btn: 8px;
  --radius-input: 8px;
  --radius-card: 12px;
  --radius-task: 8px;
  --radius-badge: 9999px;
  --radius-menu-item: 6px;

  --shadow-card: none;
  --shadow-task: none;
  --shadow-task-hover: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lifted: 0 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.06);
  --shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.06);

  --title-weight: 700;
  --display-size: 40px;
  --display-tracking: -1.4px;
  --heading-size: 22px;
  --heading-tracking: -0.242px;
  --board-title-size: 32px;
  --board-title-tracking: -1px;

  /* Rotating accent cast for board covers and column pills */
  --accent-1: #ffb110;
  --accent-2: #f64932;
  --accent-3: #62aef0;
  --accent-4: #02093a;
  --accent-5: #097fe8;
  --accent-6: #b18164;
  --pill-1: #fdecc8;
  --pill-2: #fdddd8;
  --pill-3: #dbeafb;
  --pill-4: #e3e2f0;
  --pill-5: #d3e5ef;
  --pill-6: #eee0d6;
  --cover-bars: rgba(255, 255, 255, 0.9);
  --cover-bars-border: transparent;
  --column-pills: 1;

  --theme-color: #f6f5f4;
}

/* «Классика» — clinical blueprint, monochrome (DESIGN.md). */
[data-theme="classic"] {
  color-scheme: light;
  --success: #1a8a4a;
  --backdrop: rgba(10, 10, 10, 0.32);
  --font: 'Geist', 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: var(--font);
  --font-features: "ss01" on, "cv11" on;
  --text-size: 14px;

  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-hover: #fafafa;
  --surface-muted: #fafafa;
  --input-bg: #f5f5f5;
  --text: #0a0a0a;
  --text-muted: #737373;
  --text-faint: #737373;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --dashed: #d4d4d4;

  --primary: #0a0a0a;
  --primary-hover: #262626;
  --primary-text: #fafafa;
  --secondary-bg: #f5f5f5;
  --secondary-hover: #ebebeb;
  --secondary-text: #0a0a0a;
  --ghost-hover: #f5f5f5;
  --danger: #e7000b;
  --danger-bg: #fef2f2;
  --focus: #0a0a0a;

  --brand-bg: #0a0a0a;
  --brand-text: #fafafa;
  --badge-bg: #f5f5f5;
  --badge-text: #171717;
  --notice-bg: #ffffff;
  --notice-border: #e5e5e5;
  --notice-icon-bg: #f5f5f5;
  --topbar-bg: rgba(245, 245, 245, 0.85);
  --topbar-border: #e5e5e5;
  --topbar-shadow: none;
  --column-bg: #ffffff;
  --column-border: #e5e5e5;
  --column-shadow: 0 0 0 1px rgba(23, 23, 23, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --toast-bg: #0a0a0a;

  --radius-btn: 18px;
  --radius-input: 18px;
  --radius-card: 24px;
  --radius-task: 18px;
  --radius-badge: 18px;
  --radius-menu-item: 12px;

  --shadow-card: 0 0 0 1px rgba(23, 23, 23, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-task: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-task-hover: var(--shadow-card);
  --shadow-lifted: 0 0 0 1px rgba(23, 23, 23, 0.05), 0 12px 32px -8px rgba(0, 0, 0, 0.18), 0 4px 8px -4px rgba(0, 0, 0, 0.1);
  --shadow-modal: var(--shadow-lifted);

  --title-weight: 600;
  --display-size: 30px;
  --display-tracking: -0.75px;
  --heading-size: 18px;
  --heading-tracking: -0.2px;
  --board-title-size: 24px;
  --board-title-tracking: -0.6px;

  --accent-1: #fafafa; --accent-2: #fafafa; --accent-3: #fafafa;
  --accent-4: #fafafa; --accent-5: #fafafa; --accent-6: #fafafa;
  --pill-1: transparent; --pill-2: transparent; --pill-3: transparent;
  --pill-4: transparent; --pill-5: transparent; --pill-6: transparent;
  --cover-bars: #ffffff;
  --cover-bars-border: #e5e5e5;
  --column-pills: 0;

  --theme-color: #f5f5f5;
}

/* «Бумага», тёмный режим */
[data-mode="dark"][data-theme="paper"],
[data-mode="dark"] [data-theme="paper"] {
  color-scheme: dark;
  --bg: #191919;
  --surface: #202020;
  --surface-hover: #262626;
  --surface-muted: rgba(255, 255, 255, 0.04);
  --input-bg: rgba(255, 255, 255, 0.06);
  --text: rgba(255, 255, 255, 0.92);
  --text-muted: #a3a09c;
  --text-faint: #858585;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);
  --dashed: rgba(255, 255, 255, 0.2);

  --primary: #2383e2;
  --primary-hover: #3b92e8;
  --primary-text: #ffffff;
  --secondary-bg: rgba(35, 131, 226, 0.16);
  --secondary-hover: rgba(35, 131, 226, 0.24);
  --secondary-text: #6cb0f5;
  --ghost-hover: rgba(255, 255, 255, 0.06);
  --danger: #ff7262;
  --danger-bg: rgba(255, 98, 80, 0.12);
  --success: #4cc38a;
  --focus: #2383e2;

  --brand-bg: #ffffff;
  --brand-text: #000000;
  --badge-bg: rgba(255, 255, 255, 0.08);
  --badge-text: rgba(255, 255, 255, 0.75);
  --notice-bg: rgba(35, 131, 226, 0.14);
  --notice-icon-bg: #202020;
  --topbar-bg: rgba(25, 25, 25, 0.85);
  --topbar-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
  --column-bg: rgba(255, 255, 255, 0.035);
  --toast-bg: #2f2f2f;
  --backdrop: rgba(0, 0, 0, 0.6);

  --shadow-task-hover: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lifted: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-modal: 0 20px 56px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);

  --pill-1: #4a3a17; --pill-2: #4d2620; --pill-3: #1f3a52;
  --pill-4: #2d2e4a; --pill-5: #1d3c49; --pill-6: #3d3029;
  --cover-bars: rgba(255, 255, 255, 0.86);

  --theme-color: #191919;
}

/* «Классика», тёмный режим */
[data-mode="dark"][data-theme="classic"],
[data-mode="dark"] [data-theme="classic"] {
  color-scheme: dark;
  --bg: #0a0a0a;
  --surface: #171717;
  --surface-hover: #1f1f1f;
  --surface-muted: #1c1c1c;
  --input-bg: #262626;
  --text: #fafafa;
  --text-muted: #a1a1a1;
  --text-faint: #8a8a8a;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --dashed: rgba(255, 255, 255, 0.22);

  --primary: #fafafa;
  --primary-hover: #e5e5e5;
  --primary-text: #0a0a0a;
  --secondary-bg: #262626;
  --secondary-hover: #303030;
  --secondary-text: #fafafa;
  --ghost-hover: #262626;
  --danger: #ff5c5f;
  --danger-bg: rgba(231, 0, 11, 0.16);
  --success: #4cc38a;
  --focus: #fafafa;

  --brand-bg: #fafafa;
  --brand-text: #0a0a0a;
  --badge-bg: #262626;
  --badge-text: #e5e5e5;
  --notice-bg: #171717;
  --notice-border: rgba(255, 255, 255, 0.1);
  --notice-icon-bg: #262626;
  --topbar-bg: rgba(10, 10, 10, 0.85);
  --topbar-border: rgba(255, 255, 255, 0.1);
  --column-bg: #171717;
  --column-border: rgba(255, 255, 255, 0.1);
  --column-shadow: none;
  --toast-bg: #262626;
  --backdrop: rgba(0, 0, 0, 0.65);

  --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-task: none;
  --shadow-task-hover: 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-lifted: 0 12px 32px -8px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --shadow-modal: var(--shadow-lifted);

  --accent-1: #1c1c1c; --accent-2: #1c1c1c; --accent-3: #1c1c1c;
  --accent-4: #1c1c1c; --accent-5: #1c1c1c; --accent-6: #1c1c1c;
  --cover-bars: #262626;
  --cover-bars-border: rgba(255, 255, 255, 0.08);

  --theme-color: #0a0a0a;
}

:root { --page-max-width: 1280px; --column-width: 288px; }

/* Board colors are the same in every theme: the user picked them explicitly. */
:root {
  --board-1: #ffb110; --board-2: #f64932; --board-3: #62aef0; --board-4: #02093a;
  --board-5: #097fe8; --board-6: #b18164; --board-7: #3fa36b; --board-8: #9b9a97;
}

/* ========================================================================= */

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-size);
  line-height: 1.43;
  font-feature-settings: var(--font-features);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#app { min-height: 100%; display: flex; flex-direction: column; }

button, input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
svg.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

h1, h2, h3 { margin: 0; font-weight: var(--title-weight); }
.display { font-size: var(--display-size); line-height: 1.15; letter-spacing: var(--display-tracking); }
.heading-sm { font-size: 24px; line-height: 1.27; letter-spacing: -0.5px; }
.subheading { font-size: var(--heading-size); line-height: 1.3; letter-spacing: var(--heading-tracking); }
.muted { color: var(--text-muted); }
.lede { font-family: var(--font-serif); font-size: 18px; line-height: 1.56; color: var(--text-muted); }
[data-theme="classic"] .lede { font-size: 14px; line-height: 1.43; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 15px;
  border: none; border-radius: var(--radius-btn);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background-color .2s ease, opacity .2s ease, box-shadow .2s ease, color .2s ease;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .icon-btn:focus-visible, .board-tile:focus-visible, .task:focus-visible, .theme-option:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--secondary-bg); color: var(--secondary-text); }
.btn-secondary:hover:not(:disabled) { background: var(--secondary-hover); }
.btn-outline { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.btn-outline:hover:not(:disabled) { background: var(--ghost-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--ghost-hover); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px var(--border); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-block { width: 100%; height: 40px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: none;
  border: none; border-radius: var(--radius-btn);
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.icon-btn:hover { background: var(--ghost-hover); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }

/* ---------- inputs ---------- */

.input, .textarea {
  width: 100%;
  background: var(--input-bg);
  border: none; border-radius: var(--radius-input);
  padding: 8px 12px; min-height: 40px;
  font-size: 14px; outline: none;
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow .2s ease, background-color .2s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .textarea:focus { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-strong), 0 0 0 3px color-mix(in srgb, var(--focus) 14%, transparent); }
.textarea { resize: none; line-height: 1.43; padding-top: 10px; display: block; }
.input-plain { background: transparent; padding-left: 10px; padding-right: 10px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; }

/* ---------- surfaces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: var(--radius-badge);
  font-size: 12px; font-weight: 500; line-height: 1.33;
  background: var(--badge-bg); color: var(--badge-text);
}

/* ---------- login ---------- */

.auth-page { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; padding: 32px 28px 28px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: calc(var(--radius-card) / 1.6);
  background: var(--brand-bg); color: var(--brand-text);
  display: grid; place-items: center; margin-bottom: 20px;
}
.brand-mark svg.icon { width: 20px; height: 20px; stroke-width: 2.25; }
.auth-head { margin-bottom: 24px; }
.auth-head p { margin: 6px 0 0; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-faint); font-size: 12px; margin: 4px 0; }
.divider::before, .divider::after { content: ''; height: 1px; flex: 1; background: var(--border); }
.form-error { color: var(--danger); font-size: 13px; margin: -4px 0 0; }
.form-error:empty { display: none; }

/* ---------- app shell ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--topbar-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--topbar-border);
  box-shadow: var(--topbar-shadow);
}
.topbar-inner { height: 56px; padding: 0 16px; display: flex; align-items: center; gap: 12px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; font-weight: 600; flex: none; }
.topbar .brand .brand-mark { width: 28px; height: 28px; border-radius: calc(var(--radius-card) / 2.4); margin: 0; }
.topbar .brand .brand-mark svg.icon { width: 15px; height: 15px; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; color: var(--text-faint); }
.crumbs a { color: var(--text-faint); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .current { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs svg.icon { width: 14px; height: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 4px; flex: none; }

.page { width: 100%; max-width: var(--page-max-width); margin: 0 auto; padding: 40px 16px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.page-head p { margin: 6px 0 0; }

/* ---------- boards grid ---------- */

.boards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

.board-tile {
  display: flex; flex-direction: column;
  min-height: 176px; padding: 0; overflow: hidden;
  text-align: left; cursor: pointer; text-decoration: none; color: inherit;
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.board-tile:hover { box-shadow: var(--shadow-lifted); transform: translateY(-2px); border-color: transparent; }
.board-tile .tile-cover { height: 104px; background: var(--surface-muted) center / cover no-repeat; border-bottom: 1px solid var(--border); }
.board-tile .tile-cover.empty { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 18px 18px 0; align-items: start; }
.board-tile .tile-cover.empty span { height: 100%; background: var(--cover-bars); border: 1px solid var(--cover-bars-border); border-bottom: none; border-radius: calc(var(--radius-task) + 2px) calc(var(--radius-task) + 2px) 0 0; }
.board-tile .tile-cover.empty span:nth-child(2) { height: 70%; }
.board-tile .tile-cover.empty span:nth-child(3) { height: 45%; }
[data-color="1"] { --c: var(--board-1); }
[data-color="2"] { --c: var(--board-2); }
[data-color="3"] { --c: var(--board-3); }
[data-color="4"] { --c: var(--board-4); }
[data-color="5"] { --c: var(--board-5); }
[data-color="6"] { --c: var(--board-6); }
[data-color="7"] { --c: var(--board-7); }
[data-color="8"] { --c: var(--board-8); }
[data-accent="1"] { --c: var(--accent-1); }
[data-accent="2"] { --c: var(--accent-2); }
[data-accent="3"] { --c: var(--accent-3); }
[data-accent="4"] { --c: var(--accent-4); }
[data-accent="5"] { --c: var(--accent-5); }
[data-accent="6"] { --c: var(--accent-6); }
.board-tile .tile-cover.empty[data-color], .board-tile .tile-cover.empty[data-accent] { background-color: var(--c); }
.board-tile .tile-cover.empty[data-color] { border-bottom-color: transparent; }
[data-theme="classic"] .board-tile .tile-cover.empty[data-color] span { border-color: transparent; }

.tile-wrap { position: relative; display: flex; flex-direction: column; }
.tile-wrap > .board-tile { flex: 1; }
.tile-color-btn {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border: none; border-radius: var(--radius-btn);
  display: grid; place-items: center; cursor: pointer;
  background: rgba(255, 255, 255, 0.92); color: #000; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  opacity: 0; transition: opacity .2s ease, background-color .2s ease;
}
.tile-wrap:hover .tile-color-btn, .tile-color-btn:focus-visible, .tile-color-btn[aria-expanded="true"] { opacity: 1; }
.tile-color-btn:hover { background: #fff; }
.tile-color-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (hover: none) { .tile-color-btn { opacity: 1; } }

.board-color-dot {
  width: 18px; height: 18px; flex: none; border-radius: 50%; border: none; cursor: pointer; padding: 0;
  background: var(--c, var(--border-strong)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: transform .2s ease;
}
.board-color-dot:hover { transform: scale(1.15); }
.board-color-dot:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[data-theme="classic"] .board-color-dot[data-accent] { background: var(--border-strong); }

.color-picker { min-width: 0; width: 212px; padding: 12px; }
.color-picker-title { font-size: 13px; font-weight: 600; margin: 0 2px 10px; }
.color-picker .swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.color-picker .swatch {
  width: 100%; aspect-ratio: 1; height: auto; padding: 0; border-radius: 50%;
  background: var(--c); color: #fff; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); transition: transform .2s ease;
}
.color-picker .swatch:hover { background: var(--c); transform: scale(1.08); }
.color-picker .swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.color-picker .swatch[data-color="1"] svg.icon, .color-picker .swatch[data-color="3"] svg.icon, .color-picker .swatch[data-color="8"] svg.icon { color: #000; }
.color-picker .swatch svg.icon { stroke-width: 3; }
.color-picker .color-auto { margin-top: 6px; gap: 8px; }
.color-picker { width: 232px; }
.custom-color { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.custom-color-label { font-size: 12px; font-weight: 500; color: var(--text-muted); margin: 0 2px 6px; }
.custom-color-row { display: flex; align-items: center; gap: 6px; }
.custom-swatch {
  position: relative; width: 32px; height: 32px; flex: none; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: conic-gradient(#f64932, #ffb110, #3fa36b, #62aef0, #097fe8, #8e6cd8, #f64932);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.custom-swatch svg.icon { width: 14px; height: 14px; stroke-width: 3; filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.4)); }
.custom-swatch.filled { background: var(--c); }
.custom-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.custom-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: none; padding: 0; }
.custom-hex { min-height: 32px; height: 32px; padding: 4px 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; flex: 1; min-width: 0; }
.custom-hex.invalid { box-shadow: inset 0 0 0 1px var(--danger); }
.color-picker .custom-apply { width: auto; height: 32px; padding: 0 10px; justify-content: center; background: var(--secondary-bg); color: var(--secondary-text); border-radius: var(--radius-btn); font-weight: 500; }
.color-picker .custom-apply:hover { background: var(--secondary-hover); }
.color-picker .color-auto[aria-pressed="true"] { font-weight: 600; }
.swatch-mini { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); flex: none; }
[data-theme="classic"] .swatch-mini[data-accent] { background: var(--border-strong); }
[data-theme="paper"] .board-tile .tile-cover.empty, :root:not([data-theme]) .board-tile .tile-cover.empty { border-bottom-color: transparent; }
.board-tile .tile-body { padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 4px; }
.board-tile .tile-name { font-weight: 600; font-size: 16px; line-height: 1.4; letter-spacing: -0.2px; overflow-wrap: anywhere; }
.board-tile .tile-meta { color: var(--text-muted); font-size: 13px; }

.board-new {
  min-height: 176px; border: 1px dashed var(--dashed); border-radius: var(--radius-card);
  background: transparent; color: var(--text-muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  font-size: 14px; font-weight: 500;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.board-new:hover { background: var(--surface-muted); color: var(--text); border-color: var(--border-strong); }
.board-new .plus { width: 40px; height: 40px; border-radius: var(--radius-btn); background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text); }
.board-new .plus svg.icon { width: 18px; height: 18px; }
.board-form { min-height: 176px; padding: 20px; display: flex; flex-direction: column; gap: 12px; justify-content: space-between; }
.board-form .row { display: flex; gap: 8px; justify-content: flex-end; }

.notice {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px; margin-bottom: 28px;
  background: var(--notice-bg); border-color: var(--notice-border);
}
.notice .notice-icon { width: 40px; height: 40px; border-radius: var(--radius-btn); background: var(--notice-icon-bg); display: grid; place-items: center; flex: none; }
.notice .notice-icon svg.icon { width: 18px; height: 18px; }
.notice .notice-text { flex: 1; min-width: 0; }
.notice .notice-text strong { display: block; font-weight: 600; }
.notice .notice-text span { color: var(--text-muted); }
.notice .notice-actions { display: flex; gap: 8px; flex: none; }
.notice .btn-secondary { background: var(--surface); }

/* ---------- board view ---------- */

.board-page { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.board-head { padding: 28px 16px 16px; display: flex; align-items: center; gap: 8px; }
.board-title {
  font-size: var(--board-title-size); line-height: 1.25; letter-spacing: var(--board-title-tracking); font-weight: var(--title-weight);
  border-radius: var(--radius-btn); padding: 0 6px; margin-left: -6px; cursor: text; min-width: 0;
  overflow-wrap: anywhere;
}
.board-title:hover { background: var(--ghost-hover); }
.board-title-input { font-size: var(--board-title-size); letter-spacing: var(--board-title-tracking); font-weight: var(--title-weight); max-width: 560px; }

.columns {
  flex: 1; display: flex; align-items: flex-start; gap: 12px;
  padding: 4px 16px 32px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scroll-padding-inline: 16px;
}
.column {
  width: var(--column-width); flex: none; scroll-snap-align: start;
  display: flex; flex-direction: column; max-height: calc(100dvh - 170px);
  padding: 0;
  background: var(--column-bg); border-color: var(--column-border); box-shadow: var(--column-shadow);
}
.column-head { display: flex; align-items: center; gap: 8px; padding: 12px 8px 8px 14px; }
.column-title-wrap { flex: 1; min-width: 0; display: flex; }
.column-title {
  min-width: 0; font-weight: 600; font-size: 14px; cursor: text; overflow-wrap: anywhere;
  padding: 3px 10px; margin-left: -10px; border-radius: var(--radius-badge);
}
[data-theme="paper"] .column-title, :root:not([data-theme]) .column-title { margin-left: 0; font-weight: 500; }
.column-title[data-accent="1"] { background: var(--pill-1); }
.column-title[data-accent="2"] { background: var(--pill-2); }
.column-title[data-accent="3"] { background: var(--pill-3); }
.column-title[data-accent="4"] { background: var(--pill-4); }
.column-title[data-accent="5"] { background: var(--pill-5); }
.column-title[data-accent="6"] { background: var(--pill-6); }
.column-title-input { flex: 1; min-height: 32px; padding: 4px 10px; }
.column-head .badge { background: transparent; color: var(--text-faint); padding: 0 4px; }
[data-theme="classic"] .column-head .badge { background: var(--badge-bg); color: var(--badge-text); padding: 2px 8px; }
.column-cards { display: flex; flex-direction: column; gap: 8px; padding: 4px 8px; overflow-y: auto; min-height: 8px; }
.column-foot { padding: 6px 8px 8px; }
.column-foot .btn { width: 100%; justify-content: flex-start; padding: 0 10px; }

.task {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-task);
  box-shadow: var(--shadow-task);
  cursor: pointer; overflow: hidden; touch-action: manipulation;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: box-shadow .2s ease, border-color .2s ease, background-color .2s ease;
}
.task:hover { border-color: var(--border-strong); box-shadow: var(--shadow-task-hover); }
.task-cover { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--surface-muted); pointer-events: none; }
.task-body { padding: 9px 12px 10px; }
.task-title { overflow-wrap: anywhere; white-space: pre-wrap; font-weight: 500; }
[data-theme="classic"] .task-title { font-weight: 400; }
[data-theme="classic"] .task-body { padding: 10px 14px 12px; }
.task-meta { display: flex; gap: 6px; margin-top: 6px; color: var(--text-faint); }
.task-meta svg.icon { width: 14px; height: 14px; }

.task.placeholder { background: var(--surface-muted); border: 1px dashed var(--dashed); box-shadow: none; }
.task.placeholder > * { visibility: hidden; }
.drag-ghost { position: fixed; z-index: 100; pointer-events: none; margin: 0; box-shadow: var(--shadow-lifted); transform: rotate(2deg); cursor: grabbing; }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none !important; }

.composer { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 2px; }
.composer .textarea { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); min-height: 64px; border-radius: var(--radius-task); }
.composer .textarea:focus { box-shadow: inset 0 0 0 1px var(--border-strong), 0 0 0 3px color-mix(in srgb, var(--focus) 14%, transparent); }
.composer-row { display: flex; align-items: center; gap: 6px; }
.composer-row .spacer { flex: 1; }
.composer-preview { position: relative; border-radius: var(--radius-task); overflow: hidden; border: 1px solid var(--border); }
.composer-preview img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.composer-preview .icon-btn { position: absolute; top: 6px; right: 6px; background: rgba(255, 255, 255, 0.92); color: #000; }

.column-new { width: var(--column-width); flex: none; }
.column-new > .btn { width: 100%; height: 44px; justify-content: flex-start; padding: 0 16px; background: var(--column-bg); color: var(--text-muted); border-radius: var(--radius-card); }
[data-theme="classic"] .column-new > .btn { background: var(--ghost-hover); color: var(--text); }
.column-new > .btn:hover { background: var(--ghost-hover); color: var(--text); }
.column-new form { padding: 12px; display: flex; flex-direction: column; gap: 8px; }

/* labels */
[data-label="green"] { --lb: #4bce97; --lb-fg: #164b35; }
[data-label="yellow"] { --lb: #f5cd47; --lb-fg: #533f04; }
[data-label="orange"] { --lb: #fea362; --lb-fg: #702e00; }
[data-label="red"] { --lb: #f87168; --lb-fg: #5d1f1a; }
[data-label="purple"] { --lb: #9f8fef; --lb-fg: #352c63; }
[data-label="blue"] { --lb: #579dff; --lb-fg: #09326c; }
[data-label="sky"] { --lb: #6cc3e0; --lb-fg: #164555; }
[data-label="lime"] { --lb: #94c748; --lb-fg: #37471f; }
[data-label="pink"] { --lb: #e774bb; --lb-fg: #50253f; }
[data-label="gray"] { --lb: #8590a2; --lb-fg: #091e42; }
[data-mode="dark"] [data-label="green"] { --lb: #216e4e; --lb-fg: #baf3db; }
[data-mode="dark"] [data-label="yellow"] { --lb: #7f5f01; --lb-fg: #fff7d6; }
[data-mode="dark"] [data-label="orange"] { --lb: #a54800; --lb-fg: #fedec8; }
[data-mode="dark"] [data-label="red"] { --lb: #ae2e24; --lb-fg: #ffd5d2; }
[data-mode="dark"] [data-label="purple"] { --lb: #5e4db2; --lb-fg: #dfd8fd; }
[data-mode="dark"] [data-label="blue"] { --lb: #0055cc; --lb-fg: #cce0ff; }
[data-mode="dark"] [data-label="sky"] { --lb: #206a83; --lb-fg: #c6edfb; }
[data-mode="dark"] [data-label="lime"] { --lb: #4c6b1f; --lb-fg: #d3f1a7; }
[data-mode="dark"] [data-label="pink"] { --lb: #943d73; --lb-fg: #fdd0ec; }
[data-mode="dark"] [data-label="gray"] { --lb: #5d6b82; --lb-fg: #dcdfe4; }

.task-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; cursor: pointer; }
.task-labels .label-chip {
  display: inline-flex; align-items: center; min-width: 40px; max-width: 100%; height: 8px; padding: 0;
  border-radius: 4px; background: var(--lb); color: var(--lb-fg);
  font-size: 0; font-weight: 600; overflow: hidden; white-space: nowrap;
  transition: height .15s ease, padding .15s ease, font-size .15s ease, filter .15s ease;
}
.task-labels:hover .label-chip { filter: brightness(0.95); }
[data-mode="dark"] .task-labels:hover .label-chip { filter: brightness(1.15); }
.labels-expanded .task-labels .label-chip { height: 20px; padding: 0 8px; font-size: 12px; }
.label-text { overflow: hidden; text-overflow: ellipsis; }

.card-labels-section { display: flex; flex-direction: column; gap: 6px; }
.card-labels-section > label { font-size: 13px; font-weight: 500; }
.card-labels { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.label-chip.big {
  display: inline-flex; align-items: center; min-width: 48px; height: 30px; padding: 0 12px; max-width: 240px;
  border: none; border-radius: 6px; background: var(--lb); color: var(--lb-fg);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; overflow: hidden;
}
.label-chip.big:hover { filter: brightness(0.95); }
[data-mode="dark"] .label-chip.big:hover { filter: brightness(1.15); }
.label-add {
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border-strong); background: transparent;
  color: var(--text-muted); display: grid; place-items: center; cursor: pointer; transition: background-color .2s ease, color .2s ease;
}
.label-add:hover { background: var(--ghost-hover); color: var(--text); }

.menu.labels-pop { width: 304px; padding: 12px; max-height: calc(100vh - 16px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.labels-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px -4px 0; }
.labels-pop-head strong { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.labels-pop-head .pop-spacer { width: 32px; }
.labels-pop .menu-reset, .labels-pop button.icon-btn { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: var(--radius-btn); }
.labels-caption { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: -4px; }
.label-rows { display: flex; flex-direction: column; gap: 6px; }
.label-row { display: flex; align-items: center; gap: 8px; }
.label-check { width: 16px; height: 16px; margin: 0 4px; accent-color: var(--primary); cursor: pointer; flex: none; }
.labels-pop button.label-bar, .label-bar {
  flex: 1; min-width: 0; height: 32px; padding: 0 12px; border: none; border-radius: 6px;
  background: var(--lb); color: var(--lb-fg); font-size: 14px; font-weight: 600; text-align: left;
  display: flex; align-items: center; justify-content: flex-start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.labels-pop button.label-bar:hover { background: var(--lb); filter: brightness(0.95); }
[data-mode="dark"] .labels-pop button.label-bar:hover { filter: brightness(1.15); }
.label-bar.static { cursor: default; width: 100%; }
.label-preview { padding: 14px; border-radius: var(--radius-task); background: var(--surface-muted); display: flex; }
.labels-empty { margin: 4px 0; font-size: 13px; }
.labels-pop .labels-create { height: 36px; justify-content: center; background: var(--secondary-bg); color: var(--secondary-text); border-radius: var(--radius-btn); }
.labels-pop .labels-create:hover { background: var(--secondary-hover); }
.label-swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.labels-pop button.label-swatch {
  height: 30px; padding: 0; border-radius: 6px; background: var(--lb); color: var(--lb-fg);
  display: grid; place-items: center; justify-content: center;
}
.labels-pop button.label-swatch:hover { background: var(--lb); filter: brightness(0.95); }
.labels-pop button.label-swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--lb); }
.label-swatch svg.icon { stroke-width: 3; }
.labels-edit-actions { display: flex; justify-content: space-between; gap: 8px; }
.labels-pop .labels-edit-actions .btn { width: auto; height: 32px; justify-content: center; padding: 0 14px; font-weight: 500; }
.labels-pop .labels-edit-actions .btn-primary { background: var(--primary); color: var(--primary-text); border-radius: var(--radius-btn); }
.labels-pop .labels-edit-actions .btn-primary:hover { background: var(--primary-hover); }
.labels-pop .labels-edit-actions .btn-danger { color: var(--danger); box-shadow: inset 0 0 0 1px var(--border); border-radius: var(--radius-btn); }
.labels-pop .labels-edit-actions .btn-danger:hover { background: var(--danger-bg); }
.labels-pop .field label { font-size: 12px; font-weight: 600; color: var(--text-muted); }

/* archive */
.archive-modal { gap: 14px; }
.archive-title { display: flex; align-items: center; gap: 8px; }
.archive-title svg.icon { width: 18px; height: 18px; color: var(--text-muted); }
.archive-title .badge { font-size: 12px; letter-spacing: 0; }
.archive-list { display: flex; flex-direction: column; gap: 8px; max-height: min(60vh, 520px); overflow-y: auto; }
.archive-item { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-task); background: var(--surface); }
.archive-thumb { width: 56px; height: 40px; flex: none; border-radius: calc(var(--radius-task) - 2px); object-fit: cover; background: var(--surface-muted); }
.archive-thumb.empty { display: grid; place-items: center; color: var(--text-faint); }
.archive-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.archive-text strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-text span { color: var(--text-faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.archive-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; text-align: center; color: var(--text-muted); }
.archive-empty strong { color: var(--text); font-weight: 600; }
.archive-empty span { max-width: 360px; font-size: 13px; }
.archive-empty-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-muted); margin-bottom: 4px; }
.archive-empty-icon svg.icon { width: 20px; height: 20px; }
.archive-foot { display: flex; justify-content: flex-end; }
.archive-foot:has(> [hidden]) { display: none; }
@media (max-width: 520px) {
  .archive-actions .btn { padding: 0 10px; }
  .archive-actions .btn svg.icon { display: none; }
}

/* dates */
.task-date { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 6px 1px 4px; border-radius: 4px; margin-left: -4px; }
.task-date.overdue { background: var(--danger-bg); color: var(--danger); }
.task-date.soon { background: color-mix(in srgb, #f5cd47 30%, transparent); color: var(--text); }
.card-dates-section { display: flex; flex-direction: column; gap: 6px; }
.card-dates-head { display: flex; align-items: center; justify-content: space-between; min-height: 28px; }
.card-dates-head label { font-size: 13px; font-weight: 500; }
.card-dates-head .btn { height: 26px; padding: 0 8px; font-size: 12px; }
.card-dates { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.card-dates .field { gap: 4px; flex: 1; min-width: 150px; }
.date-caption { font-size: 12px; color: var(--text-muted); }
.date-input { min-height: 36px; height: 36px; padding: 0 10px; font-variant-numeric: tabular-nums; }
.date-dash { color: var(--text-faint); padding-bottom: 8px; }
@media (max-width: 420px) { .date-dash { display: none; } }

/* board view switch */
.board-head .spacer { flex: 1; }
.board-view-switch .segment svg.icon { width: 14px; height: 14px; }

/* gantt */
.gantt-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 0 16px 16px; gap: 10px; }
.gantt-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gantt {
  flex: 1; min-height: 0; max-height: calc(100dvh - 190px); overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card);
  --row: 40px; --weekend: color-mix(in srgb, var(--text) 4%, transparent); --line: color-mix(in srgb, var(--text) 6%, transparent);
}
.gantt-grid { position: relative; min-width: 100%; }
.gantt-head { position: sticky; top: 0; z-index: 4; display: flex; background: var(--surface); border-bottom: 1px solid var(--border); }
.gantt-corner {
  position: sticky; left: 0; z-index: 5; width: var(--left); flex: none; display: flex; align-items: flex-end;
  padding: 0 14px 8px; font-size: 12px; font-weight: 600; color: var(--text-muted); background: var(--surface); border-right: 1px solid var(--border);
}
.gantt-scale { position: relative; height: 52px; flex: none; }
.gantt-months { position: relative; height: 26px; }
.gantt-month { position: absolute; top: 0; height: 26px; font-size: 12px; font-weight: 600; white-space: nowrap; border-left: 1px solid var(--border); text-transform: capitalize; overflow: clip; }
.gantt-month span { position: sticky; left: var(--left); display: inline-block; padding: 6px 8px 0; }
.gantt-days { position: relative; height: 26px; }
.gantt-days.hidden { display: none; }
.gantt-day { position: absolute; top: 0; height: 26px; display: grid; place-items: center; font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.gantt-day.weekend { color: var(--text-faint); background: var(--weekend); }
.gantt-day.today { color: var(--primary-text); }
.gantt-day.today::before { content: ''; position: absolute; inset: 3px 50% 3px 50%; transform: translateX(-50%); width: 24px; border-radius: 999px; background: var(--primary); z-index: -1; }
.gantt-days .gantt-day.today { z-index: 0; }

.gantt-row { display: flex; height: var(--row); border-bottom: 1px solid var(--line); }
.gantt-row.group { height: 36px; background: var(--surface-muted); }
.gantt-label {
  position: sticky; left: 0; z-index: 3; width: var(--left); flex: none; display: flex; align-items: center; gap: 8px;
  padding: 0 14px; background: var(--surface); border: none; border-right: 1px solid var(--border); text-align: left; min-width: 0;
}
.gantt-row.group .gantt-label { background: color-mix(in srgb, var(--surface-muted) 100%, var(--surface)); background: var(--surface); box-shadow: inset 0 0 0 999px var(--surface-muted); }
.gantt-label.task-link { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; cursor: pointer; font: inherit; color: inherit; }
.gantt-label.task-link:hover .gantt-title { text-decoration: underline; text-underline-offset: 2px; }
.gantt-title { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 13px; }
.gantt-dates { font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.gantt-dates.overdue { color: var(--danger); }
.gantt-label .column-title { margin-left: 0; cursor: default; font-size: 12px; padding: 2px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-count { color: var(--text-faint); font-size: 12px; }
.gantt-undated-title { font-weight: 600; font-size: 12px; color: var(--text-muted); }
.gantt-hint { position: sticky; left: calc(var(--left) + 12px); display: inline-block; padding: 9px 0 0 12px; font-size: 12px; color: var(--text-faint); white-space: nowrap; }

.gantt-track {
  position: relative; flex: none; height: 100%;
  background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(var(--w) * 5), var(--weekend) calc(var(--w) * 5), var(--weekend) calc(var(--w) * 7));
  background-position-x: var(--weekend-offset);
}
.gantt-track.zoom-day {
  background-image:
    repeating-linear-gradient(90deg, transparent 0, transparent calc(var(--w) - 1px), var(--line) calc(var(--w) - 1px), var(--line) var(--w)),
    repeating-linear-gradient(90deg, transparent 0, transparent calc(var(--w) * 5), var(--weekend) calc(var(--w) * 5), var(--weekend) calc(var(--w) * 7));
  background-position-x: 0, var(--weekend-offset);
}
.gantt-track.zoom-month { background-image: none; }
.gantt-track.placeable { cursor: copy; }
.gantt-track.placeable:hover { background-color: color-mix(in srgb, var(--primary) 6%, transparent); }

.gantt-bar {
  position: absolute; top: 7px; height: calc(var(--row) - 14px); z-index: 1;
  display: flex; align-items: center; min-width: 6px; padding: 0 8px; box-sizing: border-box;
  border-radius: 6px; cursor: grab; touch-action: none; user-select: none;
  background: var(--lb, var(--primary)); color: var(--lb-fg, var(--primary-text));
  font-size: 12px; font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: box-shadow .15s ease, filter .15s ease;
}
.gantt-bar:not([data-label]) { background: color-mix(in srgb, var(--primary) 85%, transparent); }
.gantt-bar:hover { filter: brightness(0.96); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18); }
[data-mode="dark"] .gantt-bar:hover { filter: brightness(1.12); }
.gantt-bar.overdue { box-shadow: inset 0 0 0 2px var(--danger); }
.gantt-bar.dragging { cursor: grabbing; filter: brightness(0.92); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); z-index: 2; }
.gantt-bar:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.gantt-bar-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.gantt-handle { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.gantt-handle.start { left: -2px; }
.gantt-handle.end { right: -2px; }
.gantt-bar[data-range]::after {
  content: attr(data-range); position: absolute; left: 0; bottom: calc(100% + 6px); white-space: nowrap;
  padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 500; background: var(--toast-bg); color: #fff; pointer-events: none;
}
.gantt-today { position: absolute; top: 26px; bottom: 0; width: 2px; margin-left: -1px; background: var(--primary); z-index: 2; pointer-events: none; opacity: .7; }
@media (max-width: 640px) {
  .gantt-wrap { padding: 0 8px 8px; }
  .gantt-corner, .gantt-label { padding: 0 10px; }
  .board-view-switch .segment { padding: 0 9px; }
}

/* ---------- menus ---------- */

.menu {
  position: fixed; z-index: 60; min-width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(var(--radius-btn) + 4px); box-shadow: var(--shadow-lifted);
  animation: pop .15s ease-out;
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 34px; padding: 0 10px; border: none; background: none;
  border-radius: var(--radius-menu-item); cursor: pointer; text-align: left; font-size: 14px;
}
.menu button:hover { background: var(--ghost-hover); }
.menu button.danger { color: var(--danger); }
.menu .menu-label { flex: 1; }
.menu .menu-check { display: inline-flex; color: var(--primary); }
[data-theme="classic"] .menu .menu-check { color: var(--text); }
.menu button.active { font-weight: 500; }

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: var(--backdrop);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 64px 16px 32px; overflow-y: auto;
  animation: fade .2s ease-out;
}
.modal { width: 100%; max-width: 580px; overflow: hidden; animation: pop .2s ease-out; box-shadow: var(--shadow-modal); }
.modal.narrow { max-width: 400px; }
.modal-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; }
.modal-head > :first-child { flex: 1; min-width: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 24px 20px; }
.modal-cover { position: relative; background: var(--surface-muted); }
.modal-cover img { width: 100%; max-height: 320px; object-fit: cover; }
.modal-cover-actions { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px; }
.modal-cover-actions .btn { background: rgba(255, 255, 255, 0.92); color: #000; backdrop-filter: blur(8px); }
.modal-cover-actions .btn:hover { background: #fff; }
.card-title-input { font-size: 22px; font-weight: var(--title-weight); letter-spacing: -0.3px; padding-left: 10px; margin-left: -10px; width: calc(100% + 10px); }
.card-desc { min-height: 120px; }
.modal-actions-row { display: flex; flex-wrap: wrap; gap: 8px; }

.dropzone {
  border: 1px dashed var(--dashed); border-radius: var(--radius-task);
  padding: 20px; display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-muted); cursor: pointer; background: var(--surface-muted);
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.dropzone:hover, .dropzone.over { background: var(--ghost-hover); color: var(--text); border-color: var(--border-strong); }

/* description / markdown */
.desc { display: flex; flex-direction: column; gap: 8px; }
.desc-head { display: flex; align-items: center; justify-content: space-between; min-height: 32px; }
.desc-head label { font-size: 13px; font-weight: 500; }
.desc-head .btn { height: 28px; padding: 0 10px; }
.desc-empty {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  min-height: 72px; padding: 12px 14px; border: none; border-radius: var(--radius-input);
  background: var(--input-bg); color: var(--text-faint); cursor: text; text-align: left;
  transition: background-color .2s ease;
}
.desc-empty:hover { background: var(--ghost-hover); }
.desc-empty span { font-size: 12px; opacity: .8; }
.desc .markdown { cursor: text; border-radius: var(--radius-input); padding: 4px 8px; margin: 0 -8px; transition: background-color .2s ease; }
.desc .markdown:hover { background: var(--surface-muted); }
.desc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.desc-hint { margin-left: auto; color: var(--text-faint); font-size: 12px; }

.md-editor { border-radius: var(--radius-input); box-shadow: inset 0 0 0 1px var(--border-strong); background: var(--surface); overflow: hidden; }
.md-editor:focus-within { box-shadow: inset 0 0 0 1px var(--border-strong), 0 0 0 3px color-mix(in srgb, var(--focus) 14%, transparent); }
.md-editor .card-desc { background: transparent; box-shadow: none; border-radius: 0; min-height: 160px; font-family: var(--font); }
.md-editor .card-desc:focus { box-shadow: none; background: transparent; }
.md-toolbar { display: flex; align-items: center; gap: 2px; padding: 4px; border-bottom: 1px solid var(--border); background: var(--surface-muted); flex-wrap: wrap; }
.md-toolbar .spacer { flex: 1; }
.md-toolbar.previewing .md-tool:not(.md-preview-toggle) { opacity: .35; pointer-events: none; }
.md-tool { width: 30px; height: 30px; border: none; border-radius: calc(var(--radius-btn) - 2px); background: transparent; color: var(--text-muted); display: grid; place-items: center; cursor: pointer; transition: background-color .2s ease, color .2s ease; }
[data-theme="classic"] .md-tool { border-radius: 12px; }
.md-tool:hover, .md-tool[aria-pressed="true"] { background: var(--ghost-hover); color: var(--text); }
.md-tool svg.icon { width: 15px; height: 15px; }
.md-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.desc-preview { padding: 10px 12px; min-height: 160px; }

.markdown { overflow-wrap: anywhere; line-height: 1.55; }
.markdown.plain { white-space: pre-wrap; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p, .markdown ul, .markdown ol, .markdown blockquote, .markdown pre, .markdown table { margin: 0 0 10px; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 16px 0 8px; line-height: 1.3; font-weight: var(--title-weight); letter-spacing: -0.2px; }
.markdown h1 { font-size: 20px; } .markdown h2 { font-size: 18px; } .markdown h3 { font-size: 16px; } .markdown h4 { font-size: 14px; }
.markdown ul, .markdown ol { padding-left: 22px; }
.markdown li { margin: 2px 0; }
.markdown li > p { margin: 0; }
.markdown li:has(> input[type="checkbox"]) { list-style: none; margin-left: -20px; }
.markdown input[type="checkbox"] { width: 15px; height: 15px; margin: 0 8px 0 0; vertical-align: -2px; accent-color: var(--primary); cursor: pointer; }
.markdown li:has(> input:checked) { color: var(--text-faint); text-decoration: line-through; }
.markdown a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
[data-theme="classic"] .markdown a { color: var(--text); }
.markdown blockquote { padding: 2px 0 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-muted); }
.markdown code { font-size: 12.5px; }
.markdown pre { padding: 10px 12px; background: var(--input-bg); border-radius: var(--radius-task); overflow-x: auto; }
.markdown pre code { background: none; padding: 0; font-size: 12.5px; }
.markdown hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.markdown table { border-collapse: collapse; display: block; overflow-x: auto; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 4px 10px; text-align: left; }
.markdown img { border-radius: var(--radius-task); }

.task-meta span { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.task-progress.done { color: var(--success); }

/* ---------- settings ---------- */

.settings { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.settings-layout { display: grid; grid-template-columns: minmax(0, 680px) minmax(300px, 380px); gap: 16px; align-items: start; }
.settings-side { position: sticky; top: 72px; }
.settings-side .section-head { flex-wrap: wrap; }
@media (max-width: 960px) {
  .settings-layout { grid-template-columns: minmax(0, 680px); }
  .settings-side { position: static; }
}
.section-head { padding: 20px 24px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-head p { margin: 4px 0 0; color: var(--text-muted); }
.section-body { padding: 16px 24px 24px; display: flex; flex-direction: column; gap: 12px; }
.passkey-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.passkey-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.passkey-list li:first-child { border-top: none; padding-top: 0; }
.passkey-list .pk-icon { width: 36px; height: 36px; border-radius: var(--radius-btn); background: var(--input-bg); display: grid; place-items: center; flex: none; }
.passkey-list .pk-text { flex: 1; min-width: 0; }
.passkey-list .pk-text strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.passkey-list .pk-text span { color: var(--text-muted); font-size: 13px; }
.form-grid { display: flex; flex-direction: column; gap: 12px; }
.form-grid .actions { display: flex; justify-content: flex-end; }

/* light / dark / system switch */
.mode-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mode-label { font-size: 13px; font-weight: 500; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: calc(var(--radius-btn) + 3px); background: var(--input-bg); }
.segment {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border: none; border-radius: var(--radius-btn); background: transparent; color: var(--text-muted);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.segment svg.icon { width: 14px; height: 14px; }
.segment:hover { color: var(--text); }
.segment[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--border); }
.segment:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
@media (max-width: 420px) { .segment { padding: 0 9px; } .segment svg.icon { display: none; } }

/* theme picker: each option renders a live mini-board in its own theme */
.theme-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.theme-option {
  display: flex; flex-direction: column; gap: 10px; padding: 8px 8px 12px;
  border: none; border-radius: 14px; background: transparent; cursor: pointer; text-align: left;
  box-shadow: inset 0 0 0 1px var(--border);
  transition: box-shadow .2s ease, background-color .2s ease;
}
.theme-option:hover { background: var(--surface-muted); }
.theme-option[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--focus); }
.theme-option .theme-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.theme-option .theme-label strong { font-weight: 600; }
.theme-option .theme-label span { color: var(--text-muted); font-size: 13px; display: block; }
.theme-option .theme-check { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--primary-text); flex: none; }
.theme-option[aria-checked="false"] .theme-check { visibility: hidden; }
.theme-option .theme-check svg.icon { width: 12px; height: 12px; stroke-width: 3; }

.theme-preview {
  height: 132px; border-radius: 8px; overflow: hidden; pointer-events: none;
  background: var(--bg); color: var(--text); font-family: var(--font); font-feature-settings: var(--font-features);
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.theme-preview .pv-title { font-size: 15px; font-weight: var(--title-weight); letter-spacing: -0.3px; display: flex; align-items: center; gap: 6px; }
.theme-preview .pv-title i { display: block; width: 14px; height: 14px; border-radius: 4px; background: var(--brand-bg); }
.theme-preview .pv-cols { display: flex; gap: 6px; flex: 1; }
.theme-preview .pv-col {
  flex: 1; padding: 6px; display: flex; flex-direction: column; gap: 5px;
  background: var(--column-bg); border: 1px solid var(--column-border); border-radius: calc(var(--radius-card) / 2);
}
.theme-preview .pv-col b { font-size: 9px; font-weight: 600; padding: 1px 6px; border-radius: var(--radius-badge); align-self: flex-start; }
.theme-preview .pv-col:nth-child(1) b { background: var(--pill-1); }
.theme-preview .pv-col:nth-child(2) b { background: var(--pill-3); }
.theme-preview .pv-task { height: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius-task) / 2); }
.theme-preview .pv-task.cover { height: 30px; background: var(--accent-1); border: none; }
.theme-preview[data-theme="classic"] .pv-task.cover { background: #e5e5e5; }
.theme-preview .pv-btn { align-self: flex-start; font-size: 9px; font-weight: 500; padding: 3px 9px; border-radius: var(--radius-btn); background: var(--primary); color: var(--primary-text); }

/* updates */
.update-status { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.update-status.ok svg.icon { color: var(--success); }
.update-status.available svg.icon { color: var(--primary); }
[data-theme="classic"] .update-status.available svg.icon { color: var(--text); }
.update-status.error { color: var(--danger); }
.update-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.commit-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-task); max-height: 240px; overflow-y: auto; }
.commit-list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-top: 1px solid var(--border); }
.commit-list li:first-child { border-top: none; }
.commit-msg { overflow-wrap: anywhere; }
.commit-meta { color: var(--text-faint); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.update-log {
  margin: 0; padding: 12px; max-height: 220px; overflow: auto;
  background: var(--input-bg); border-radius: var(--radius-task);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
}
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--input-bg); padding: 1px 6px; border-radius: 4px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--primary); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* backups */
.backup-auto { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--radius-task); background: var(--surface-muted); }
.switch-row { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.keep-row { display: flex; align-items: center; gap: 8px; }
.keep-select { width: auto; min-height: 32px; height: 32px; padding: 0 28px 0 10px; appearance: none; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  box-shadow: inset 0 0 0 1px var(--border); }
.keep-select:disabled { opacity: .5; cursor: default; }
.switch { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; margin: 0; flex: none; transition: background-color .2s ease; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform .2s ease; }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(16px); }
.switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.backup-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-task); max-height: 360px; overflow-y: auto; }
.backup-list li { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-top: 1px solid var(--border); }
.backup-list li:first-child { border-top: none; }
.backup-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.backup-text strong { font-weight: 500; font-size: 13px; }
.backup-text > span { display: flex; align-items: center; gap: 6px; color: var(--text-faint); font-size: 12px; }
.backup-type { padding: 1px 7px; font-size: 11px; }
.backup-type.manual { background: var(--secondary-bg); color: var(--secondary-text); }
.backup-type.pre-restore { background: var(--pill-1); color: var(--pill-text, var(--text)); }
[data-mode="dark"] .backup-type.pre-restore { color: #f5d38a; }
.backup-type.upload { background: var(--pill-4); }
[data-theme="classic"] .backup-type.pre-restore, [data-theme="classic"] .backup-type.upload { background: var(--badge-bg); color: var(--badge-text); }
.backup-actions { display: flex; gap: 2px; flex: none; }
.busy-overlay { align-items: center; z-index: 300; }
.busy-card { display: flex; align-items: center; gap: 12px; padding: 18px 22px; font-weight: 500; }

/* ---------- toasts ---------- */

#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
.toast {
  background: var(--toast-bg); color: #fff; padding: 10px 16px; border: 1px solid transparent;
  border-radius: var(--radius-btn); font-size: 14px; box-shadow: var(--shadow-lifted);
  animation: pop .2s ease-out; pointer-events: auto; text-align: center;
}
.toast.error { background: var(--surface); color: var(--danger); border: 1px solid var(--border); }

.loading { flex: 1; display: grid; place-items: center; color: var(--text-muted); padding: 48px; }

@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 640px) {
  :root { --column-width: min(84vw, 320px); }
  .page { padding-top: 28px; }
  .display { font-size: min(var(--display-size), 30px); }
  .notice { flex-wrap: wrap; }
  .notice .notice-actions { width: 100%; }
  .notice .notice-actions .btn { flex: 1; }
  .modal-backdrop { padding: 16px 8px; align-items: flex-end; }
  .topbar .brand span { display: none; }
  .column { max-height: calc(100dvh - 160px); }
  .board-title { font-size: min(var(--board-title-size), 24px); }
}

/* Dark mode: keep very dark color swatches visible against the dark background */
[data-mode="dark"] .board-color-dot,
[data-mode="dark"] .swatch-mini,
[data-mode="dark"] .color-picker .swatch,
[data-mode="dark"] .custom-swatch { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); }
[data-mode="dark"] .color-picker .swatch[aria-pressed="true"],
[data-mode="dark"] .custom-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c), inset 0 0 0 1px rgba(255, 255, 255, 0.22); }
