:root {
  --bg: #131a2a;
  --bg-elev: #171f32;
  --surface: #1d263c;
  --surface-2: #242f4a;
  --surface-3: #2c3857;
  --border: #2a3550;
  --border-strong: #3a4769;
  --text: #e7eaf3;
  --text-2: #b4bccf;
  --muted: #7f8aa6;
  --accent: #6d8cff;
  --accent-hover: #8099ff;
  --accent-soft: rgba(109, 140, 255, 0.14);
  --danger: #f2716b;
  --danger-soft: rgba(242, 113, 107, 0.12);
  --warn: #f2b45a;

  --s-planned: #6d8cff;
  --s-in_progress: #f2b45a;
  --s-blocked: #ef5f7a;
  --s-testing: #b18cff;
  --s-done: #4ccf9c;
  --s-backlog: #8e98b3;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 10px 30px -12px rgba(5, 9, 20, 0.6);
  --shadow-lg: 0 30px 80px -20px rgba(5, 9, 20, 0.75);

  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- brand ---------- */

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(135deg, #7b97ff, #5a6ff0);
  box-shadow: 0 6px 16px -6px rgba(109, 140, 255, 0.7);
  position: relative;
}
.brand-mark::after {
  content: ''; position: absolute; inset: 8px 7px;
  background:
    linear-gradient(#fff, #fff) left top / 3px 100% no-repeat,
    linear-gradient(#fff, #fff) center top / 3px 65% no-repeat,
    linear-gradient(#fff, #fff) right top / 3px 80% no-repeat;
  border-radius: 2px; opacity: 0.95;
}
.brand-lg { font-size: 20px; justify-content: center; }
.brand-link {
  align-self: flex-start; border-radius: 12px;
  color: inherit; text-decoration: none; transition: background .15s;
}
.brand-link:hover { background: var(--surface); }
.brand-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.brand-lg .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
.brand-lg .brand-mark::after { inset: 10px 9px; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid transparent; background: var(--surface-2);
  font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #0d1430; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-block { width: 100%; height: 42px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border-radius: var(--radius-sm); border: 0; background: transparent;
  color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- forms ---------- */

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: .01em; }

input:not([type=checkbox]), select, textarea {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 96px; }
input::placeholder, textarea::placeholder { color: #5f6a86; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237f8aa6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.form-error {
  background: var(--danger-soft); color: var(--danger);
  padding: 10px 12px; border-radius: var(--radius); font-size: 13px;
}

/* ---------- auth ---------- */

.auth {
  min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(109, 140, 255, .16), transparent 60%),
    radial-gradient(700px 400px at 110% 110%, rgba(76, 207, 156, .08), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px; padding: 32px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; box-shadow: var(--shadow-lg);
}
.auth-sub { text-align: center; margin: 8px 0 24px; }

.segmented {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  background: var(--bg-elev); border-radius: var(--radius); margin-bottom: 20px;
}
.seg {
  height: 34px; border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font-weight: 600; cursor: pointer; transition: background .15s, color .15s;
}
.seg.active { background: var(--surface-3); color: var(--text); }

/* ---------- layout ---------- */

.layout { display: grid; grid-template-columns: 248px 1fr; height: 100%; }

.sidebar {
  display: flex; flex-direction: column; gap: 24px;
  padding: 20px 14px; background: var(--bg-elev); border-right: 1px solid var(--border);
  min-height: 0;
}
.sidebar > .brand { padding: 4px 8px; }

.nav { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.nav-top { flex: none; overflow: visible; margin-bottom: 18px; }
.nav-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px 6px 10px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.project-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.project-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 10px; background: transparent;
  color: var(--text-2); cursor: pointer; text-align: left; transition: background .15s, color .15s;
}
.project-item:hover { background: var(--surface); color: var(--text); }
.project-item.active { background: var(--surface-2); color: var(--text); }
.project-item .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.project-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.project-item .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.project-item .all-icon { width: 16px; height: 16px; color: var(--muted); }
.project-row { position: relative; }
.project-row .row-actions {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 2px; opacity: 0;
}
.project-row .row-actions .icon-btn { width: 26px; height: 26px; }
.project-row .row-actions .icon-btn svg { width: 15px; height: 15px; }
.project-row .row-actions .danger:hover { color: var(--danger); background: var(--danger-soft); }
.project-row:hover .row-actions, .project-row .row-actions:focus-within { opacity: 1; }
.project-row:hover .project-item:has(+ .row-actions) { padding-right: 92px; }
.project-row:hover .count { visibility: hidden; }
.project-empty { padding: 8px 10px; font-size: 13px; color: var(--muted); }

.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.user-meta strong, .user-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta strong { font-size: 13px; font-weight: 600; }
.user-meta span { font-size: 12px; }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 12px; font-weight: 700; color: #0d1430; letter-spacing: .02em;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.empty { background: var(--surface-3); color: var(--muted); border: 1px dashed var(--border-strong); }
.avatar.emoji { background: var(--surface-3); font-size: 17px; line-height: 1; }
.avatar.sm.emoji { font-size: 13px; }
.avatar.lg.emoji { font-size: 34px; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }

.profile-btn {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 2px; margin: -2px; border: 0; border-radius: 10px; background: transparent;
  text-align: left; cursor: pointer;
}
.profile-btn:hover .user-meta strong { color: var(--accent-hover); }
#me-avatar { display: contents; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 28px 32px 20px;
}
.topbar h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.topbar p { font-size: 13px; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search input { width: 220px; height: 38px; padding-left: 36px; background: var(--surface); }
.select-pill { width: auto; height: 38px; min-width: 140px; background-color: var(--surface); }

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

.board {
  flex: 1; min-height: 0;
  /* One column per status, however many there are; scrolls sideways if the screen is too narrow. */
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(176px, 1fr); gap: 10px;
  padding: 0 32px 28px; overflow-x: auto;
}

.column {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: border-color .15s, background .15s;
}
.column.drag-over { border-color: var(--accent); background: #1a2338; }

.column-head { display: flex; align-items: center; gap: 8px; padding: 14px 8px 10px 14px; min-width: 0; }
.column-head .status-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent); background: currentColor; }
.column-head h3 { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.column-head .count {
  font-size: 12px; color: var(--muted); background: var(--surface); padding: 1px 8px; border-radius: 99px;
  font-variant-numeric: tabular-nums;
}
.column-head .icon-btn { margin-left: auto; width: 24px; height: 24px; flex: none; }
.column-head .status-dot, .column-head .count { flex: none; }

.column-body {
  flex: 1; min-height: 80px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px; padding: 4px 10px 12px;
}
.column-empty {
  border: 1.5px dashed var(--border); border-radius: var(--radius); padding: 18px 12px;
  text-align: center; font-size: 13px; color: var(--muted);
}

.card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px; border-radius: 14px; cursor: grab;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255,255,255,.02) inset;
  transition: border-color .15s, transform .15s, box-shadow .15s, opacity .15s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card.dragging { opacity: .4; }
.card.done .card-title { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--muted); }

.tag {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%; padding: 2px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 80%, white);
}
.tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card-title { font-size: 14px; font-weight: 600; line-height: 1.4; word-break: break-word; }
.card-desc {
  font-size: 13px; color: var(--muted); word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-meta { display: flex; align-items: center; gap: 10px; }
.comment-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.comment-badge svg { width: 14px; height: 14px; }

.due {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px;
  border-radius: 8px; font-size: 12px; font-weight: 500;
  background: var(--surface-2); color: var(--text-2);
}
.due svg { width: 13px; height: 13px; }
.due.soon { background: rgba(242, 180, 90, .14); color: var(--warn); }
.due.overdue { background: var(--danger-soft); color: var(--danger); }
.due.none { background: transparent; padding: 0; color: var(--muted); }

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

.modal {
  width: min(560px, calc(100% - 32px)); padding: 0; border: 1px solid var(--border);
  border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.modal-sm { width: min(420px, calc(100% - 32px)); }
.modal::backdrop { background: rgba(8, 12, 24, .6); backdrop-filter: blur(4px); }
.modal[open] { animation: pop .18s ease-out; }
.modal .form { padding: 22px 24px 20px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.modal-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.modal-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.spacer { flex: 1; }

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

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 30px; height: 30px; border-radius: 10px; border: 2px solid transparent;
  cursor: pointer; background: var(--c); transition: transform .1s;
}
.swatch:hover { transform: scale(1.08); }
.swatch[aria-checked=true] { border-color: var(--text); box-shadow: 0 0 0 3px var(--bg); }
.swatch.custom {
  position: relative; display: inline-grid; place-items: center; color: #fff;
  background: conic-gradient(from 90deg, #f2716b, #f2b45a, #4ccf9c, #38bdf8, #6d8cff, #a78bfa, #f472b6, #f2716b);
}
.swatch.custom.picked { background: var(--c); }
.swatch.custom svg { width: 14px; height: 14px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; border: 0; }

/* ---------- task dialog with comments ---------- */

.modal.with-comments { width: min(980px, calc(100% - 32px)); }
.task-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.modal.with-comments .task-layout { grid-template-columns: minmax(0, 1fr) 360px; }

/* height: 0 + min-height: 100% = the panel never sets the dialog's height, it just fills whatever
   height the task form has (including when the description is resized); the list scrolls inside. */
.comments {
  display: flex; flex-direction: column; height: 0; min-height: 100%;
  background: var(--bg-elev); border-left: 1px solid var(--border);
}
.comments-head { display: flex; align-items: center; gap: 8px; padding: 22px 20px 12px; }
.comments-head h3 { font-size: 14px; font-weight: 700; }
.comments-head .count { font-size: 12px; color: var(--muted); background: var(--surface); padding: 1px 8px; border-radius: 99px; }

.comment-list {
  list-style: none; margin: 0; padding: 4px 20px 12px; flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}
.comment { display: grid; grid-template-columns: 24px 1fr; gap: 10px; }
.comment-main { min-width: 0; }
.comment-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); }
.comment-meta strong { color: var(--text); font-weight: 600; font-size: 13px; }
.comment-meta .icon-btn { width: 22px; height: 22px; margin-left: auto; opacity: 0; }
.comment:hover .comment-meta .icon-btn, .comment-meta .icon-btn:focus-visible { opacity: 1; }
.comment-meta .icon-btn svg { width: 13px; height: 13px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 0 7px; height: 18px; border-radius: 99px;
  font-size: 11px; font-weight: 600; color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.comment-body {
  margin-top: 4px; padding: 8px 12px; border-radius: 4px 12px 12px 12px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2); white-space: pre-wrap; word-break: break-word;
}
.comment.mine .comment-body { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 25%, var(--border)); }
.comment.deleted .avatar { opacity: .5; }
.comment.deleted .comment-meta strong { color: var(--muted); }
.comment-body.deleted-note {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border-style: dashed; color: var(--muted); font-style: italic;
}
.comment.mine .comment-body.deleted-note { background: transparent; border-color: var(--border-strong); }
.deleted-note svg { width: 13px; height: 13px; }
.activity-tabs {
  display: flex; gap: 2px; padding: 3px; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
}
.activity-tabs button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .12s, color .12s;
}
.activity-tabs button:hover { color: var(--text-2); }
.activity-tabs button[aria-selected=true] { background: var(--surface-3); color: var(--text); }
.activity-tabs .count { font-size: 11px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.activity-tabs [aria-selected=true] .count { color: var(--text-2); }

.event {
  display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px;
  font-size: 12px; color: var(--muted);
}
.event b { color: var(--text-2); font-weight: 600; }
.event q { color: var(--text-2); quotes: '“' '”'; }
.event .priority-pill { height: 18px; vertical-align: 1px; padding: 0 6px 0 4px; }
.event .priority-pill.normal { padding: 0; }
.event .mono { font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace; font-size: 11.5px; color: var(--text-2); }

/* History tab: one entry per save, every change on its own line. */
.event.detailed { align-items: start; }
.event.detailed .event-dot { margin-top: 7px; }
.event-changes { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.event-changes li { position: relative; padding-left: 12px; }
.event-changes li::before { content: ''; position: absolute; left: 2px; top: 10px; width: 4px; height: 1px; background: var(--border-strong); }
.event-dot {
  justify-self: center; width: 8px; height: 8px; border-radius: 50%; background: var(--c);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent);
}
.event-text { min-width: 0; line-height: 1.9; }
.event-text strong { color: var(--text-2); font-weight: 600; }
.event-text .status-pill { vertical-align: 1px; }
.event .arrow { color: var(--muted); margin: 0 1px; }
.event time { white-space: nowrap; }
.comments-empty { margin: auto 0; padding: 24px 8px; text-align: center; font-size: 13px; color: var(--muted); }

.comment-form { padding: 12px 20px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.comment-form textarea { min-height: 64px; max-height: 200px; background: var(--surface); }
.comment-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hint { font-size: 11px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }

/* ---------- profile dialog ---------- */

.profile-preview { display: flex; align-items: center; gap: 14px; padding: 4px 0 2px; }
.profile-preview > div { display: flex; flex-direction: column; min-width: 0; }
.profile-preview strong { font-size: 15px; }
.profile-preview .muted { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }

.field .segmented { margin: 2px 0 6px; }
.emoji-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px;
  max-height: 176px; overflow-y: auto; padding: 2px;
}
.emoji-btn {
  height: 38px; border-radius: 10px; border: 1px solid transparent; background: var(--bg-elev);
  font-size: 20px; line-height: 1; cursor: pointer; transition: background .12s, transform .08s;
}
.emoji-btn:hover { background: var(--surface-3); transform: scale(1.06); }
.emoji-btn[aria-checked=true] { border-color: var(--accent); background: var(--accent-soft); }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 24px 16px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--bg-elev);
  text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 22px; height: 22px; color: var(--accent); margin-bottom: 4px; }
.dropzone strong { font-size: 13px; }
.dropzone .muted { font-size: 12px; }

.link-btn {
  align-self: flex-start; margin-top: 4px; padding: 0; border: 0; background: none;
  font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.link-btn:hover { color: var(--danger); }

/* ---------- date picker ---------- */

.datepicker { position: relative; }
.date-trigger {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 40px; padding: 0 8px 0 12px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s;
}
.date-trigger:hover { border-color: var(--border-strong); }
.date-trigger:focus-visible, .datepicker.open .date-trigger { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.date-trigger > svg { width: 16px; height: 16px; color: var(--muted); }
.date-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date-label.placeholder { color: #5f6a86; }
.date-label .rel { color: var(--muted); margin-left: 6px; font-size: 12px; }
.date-trigger { padding-right: 38px; }
.date-clear { position: absolute; right: 8px; top: 8px; width: 24px; height: 24px; }
.date-clear svg { width: 14px; height: 14px; }

.date-pop {
  position: fixed; z-index: 20; width: 296px; padding: 14px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: var(--shadow-lg); animation: pop .14s ease-out;
}
.date-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.date-pop-head strong { font-size: 14px; font-weight: 600; }
.date-pop-head .nav-btns { display: flex; gap: 2px; }
.date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-grid .dow { height: 28px; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.day {
  height: 36px; border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text); position: relative;
  transition: background .1s;
}
.day:hover { background: var(--surface-3); }
.day.outside { color: #56607a; }
.day.today { color: var(--accent-hover); font-weight: 700; }
.day.today::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.day.selected { background: var(--accent); color: #0d1430; font-weight: 700; }
.day:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.date-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.chip-btn {
  height: 28px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.chip-btn:hover { background: var(--surface-3); color: var(--text); }
.chip-btn.subtle { margin-left: auto; border-color: transparent; color: var(--muted); }
.chip-btn.subtle:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- screenshots ---------- */

.tray { display: flex; flex-wrap: wrap; gap: 8px; }
.tray:empty { display: none; }
.thumb {
  position: relative; width: 88px; height: 66px; padding: 0; overflow: hidden; flex: none;
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elev); cursor: zoom-in;
}
.tray-sm .thumb { width: 64px; height: 48px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .remove {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; padding: 0;
  display: grid; place-items: center; border: 0; border-radius: 50%;
  background: rgba(10, 14, 26, .75); color: #fff; cursor: pointer; opacity: 0; transition: opacity .12s;
}
.thumb:hover .remove, .thumb .remove:focus-visible { opacity: 1; }
.thumb .remove svg { width: 12px; height: 12px; }
.thumb.uploading { display: grid; place-items: center; cursor: progress; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.attach-row { display: flex; align-items: center; gap: 10px; }
.attach-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-2); cursor: pointer;
  transition: background .12s, color .12s;
}
.attach-btn:hover { background: var(--surface-3); color: var(--text); }
.attach-btn svg { width: 14px; height: 14px; }

.drop-target { border-radius: var(--radius); transition: box-shadow .12s, background .12s; }
.drop-target.drag-over { box-shadow: 0 0 0 2px var(--accent); background: var(--accent-soft); }
#desc-field.drag-over { box-shadow: 0 0 0 6px var(--accent-soft), 0 0 0 7px var(--accent); background: transparent; }

.comment-images { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.comment-images .thumb { width: 120px; height: 84px; }

.card-cover {
  display: block; width: calc(100% + 28px); height: 120px; margin: -14px -14px 0; object-fit: cover;
  border-radius: 13px 13px 0 0; border-bottom: 1px solid var(--border); background: var(--bg-elev);
  pointer-events: none;
}

.lightbox {
  max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; margin: 0; padding: 24px;
  border: 0; background: transparent; display: none; place-items: center; cursor: zoom-out;
}
.lightbox[open] { display: grid; }
.lightbox::backdrop { background: rgba(6, 9, 18, .88); backdrop-filter: blur(6px); }
.lightbox img { max-width: 100%; max-height: calc(100vh - 48px); border-radius: 12px; box-shadow: var(--shadow-lg); animation: pop .16s ease-out; }

/* ---------- priority ---------- */

.priority-picker {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
}
.priority-option { position: relative; }
.priority-option input { position: absolute; opacity: 0; pointer-events: none; }
.priority-option span {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border-radius: 9px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background .12s, color .12s;
}
.priority-option span:hover { background: var(--surface); color: var(--text-2); }
.priority-option svg { width: 15px; height: 15px; color: var(--c); stroke-width: 2.4; }
.priority-option input:checked + span {
  color: var(--text); background: color-mix(in srgb, var(--c) 18%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent);
}
.priority-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.card-top .tag { min-width: 0; }
.priority-pill {
  display: inline-flex; align-items: center; gap: 4px; flex: none; margin-left: auto;
  height: 22px; padding: 0 8px 0 6px; border-radius: 99px; font-size: 11px; font-weight: 600;
  color: color-mix(in srgb, var(--c) 85%, white); background: color-mix(in srgb, var(--c) 14%, transparent);
}
.priority-pill svg { width: 13px; height: 13px; stroke-width: 2.6; }
.priority-pill.normal { background: transparent; color: var(--muted); padding: 0; }
.priority-pill.normal svg { color: var(--c); }
.priority-pill.extreme { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent); }

/* ---------- cover toggle on screenshot thumbs ---------- */

.thumb .cover-toggle {
  position: absolute; left: 4px; bottom: 4px; display: inline-flex; align-items: center; gap: 3px;
  height: 18px; padding: 0 6px; border: 0; border-radius: 99px; cursor: pointer;
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  background: rgba(10, 14, 26, .78); color: #dfe4f2; opacity: 0; transition: opacity .12s, background .12s;
}
.thumb .cover-toggle svg { width: 10px; height: 10px; stroke-width: 2.6; }
.thumb:hover .cover-toggle, .thumb .cover-toggle:focus-visible { opacity: 1; }
.thumb .cover-toggle.on { opacity: 1; background: var(--accent); color: #0d1430; }
.thumb .cover-toggle.on:hover { background: var(--danger); color: #fff; }
.thumb .cover-toggle .on-hover, .thumb .cover-toggle.on:hover .idle { display: none; }
.thumb .cover-toggle.on:hover .on-hover { display: inline; }
.thumb.is-cover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* Touch screens have no hover: keep thumbnail actions visible. */
@media (hover: none) {
  .thumb .remove, .thumb .cover-toggle { opacity: 1; }
}

/* ---------- task IDs ---------- */

.task-key {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; margin-right: 10px; vertical-align: 2px;
  border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border);
  font: 600 12px/1 ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace; letter-spacing: .02em; color: var(--text-2);
}
.card-key {
  margin-right: 7px; font: 600 11.5px/1 ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
  color: var(--muted); letter-spacing: .01em; vertical-align: 1px;
}
.card.done .card-key { text-decoration: none; display: inline-block; }
.task-key.copyable { gap: 5px; cursor: pointer; transition: background .12s, border-color .12s, color .12s; }
.task-key.copyable svg { width: 12px; height: 12px; display: none; }
.task-key.copyable:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--text); }
.task-key.copyable:hover svg { display: block; }
.task-key.copyable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.task-key.copied, .task-key.copied:hover { background: color-mix(in srgb, var(--s-done) 16%, transparent); border-color: color-mix(in srgb, var(--s-done) 45%, transparent); color: var(--s-done); }
.task-key.copied svg { display: block; }
.head-actions { display: flex; align-items: center; gap: 2px; }
.prev-keys {
  margin-left: 10px; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0;
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
}

/* ---------- archived projects ---------- */

.archived-toggle button {
  display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px; padding: 8px 10px;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 12px; font-weight: 600; text-align: left; transition: background .15s, color .15s;
}
.archived-toggle button:hover { background: var(--surface); color: var(--text-2); }
.archived-toggle svg { width: 15px; height: 15px; }
.archived-toggle span:first-of-type { flex: 1; }
.archived-toggle .count { font-weight: 500; }
.archived-toggle svg:last-child { transition: transform .15s; }
.archived-toggle [aria-expanded=true] svg:last-child { transform: rotate(180deg); }
.project-row.archived .project-item { color: var(--muted); }
.project-row.archived .dot { opacity: .5; }
.archived-badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; margin-left: 8px; vertical-align: 4px;
  border-radius: 99px; border: 1px dashed var(--border-strong);
  font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--muted);
}

.key-input { text-transform: uppercase; font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace; letter-spacing: .04em; }
.key-input:disabled { opacity: .7; cursor: not-allowed; }
.field-hint { font-size: 12px; color: var(--muted); }
.field-hint b { color: var(--text-2); font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace; font-weight: 600; }

/* ---------- full-screen task page ---------- */

.app-page-mode .topbar, .app-page-mode .board { display: none; }
.task-page { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 20px 32px 28px; gap: 16px; }
.task-page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.back-link {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px 0 6px; border-radius: 10px;
  color: var(--text-2); text-decoration: none; font-weight: 600; transition: background .12s, color .12s;
}
.back-link:hover { background: var(--surface); color: var(--text); }
.back-link svg { width: 16px; height: 16px; }
.crumbs { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; min-width: 0; }
.crumbs .sep { opacity: .6; }
.crumbs .dot { width: 8px; height: 8px; border-radius: 3px; }
.crumbs strong { color: var(--text-2); font-weight: 600; font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace; }

.task-page-body {
  flex: 1; min-height: 0; display: flex;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; overflow: hidden;
}
.task-page-body .task-layout { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) 420px; }
.task-page-body #task-form { overflow-y: auto; padding: 28px 32px; gap: 16px; }
.task-page-body #task-form > * { max-width: 920px; width: 100%; }
.task-page-body #expand-task-btn { display: none; }
.task-page-body .modal-head h2 { font-size: 15px; color: var(--muted); font-weight: 600; }
.task-page-body [name=title] { height: 52px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.task-page-body [name=description] { min-height: 220px; }
.task-page-body .thumb { width: 132px; height: 96px; }
.task-page-body .comments { height: auto; min-height: 0; }

.task-page-missing {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center;
}
.task-page-missing h2 { font-size: 20px; }
.task-page-missing .btn { margin-top: 8px; text-decoration: none; }

@media (max-width: 900px) {
  .task-page { padding: 16px; }
  .task-page-body { overflow: visible; }
  .task-page-body .task-layout { grid-template-columns: minmax(0, 1fr); }
  .task-page-body #task-form { padding: 20px 16px; overflow: visible; }
  .task-page-body .comment-list { max-height: none; }
}

/* ---------- calendar page ---------- */

.app-calendar-mode .topbar, .app-calendar-mode .board { display: none; }
.calendar-page { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 24px 32px 28px; }
.cal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cal-title h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.cal-title p { font-size: 13px; margin-top: 2px; min-height: 1em; }
.cal-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-controls[hidden] { display: none !important; }
.cal-nav { display: flex; gap: 2px; }
.cal-nav .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
.cal-views { margin: 0; grid-template-columns: repeat(3, auto); }
.cal-views .seg { padding: 0 14px; height: 30px; }
.cal-controls .btn-sm svg, .cal-menu-wrap .btn svg { width: 15px; height: 15px; }
.small { font-size: 12px; }
.danger-text { color: var(--danger); }
.danger-text:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

.cal-menu-wrap { position: relative; }
.cal-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 15; width: 280px; max-height: 60vh; overflow-y: auto;
  padding: 8px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: pop .14s ease-out;
}
.cal-menu-section { padding: 8px 8px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cal-menu-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 10px 8px 4px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); overflow: hidden; }
.cal-menu-foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-logo { width: 16px; height: 16px; flex: none; }

.cal-check { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; cursor: pointer; }
.cal-check:hover { background: var(--surface-3); }
.cal-check input { position: absolute; opacity: 0; pointer-events: none; }
.cal-check-box {
  width: 16px; height: 16px; flex: none; border-radius: 5px; border: 2px solid var(--c);
  display: grid; place-items: center; transition: background .12s;
}
.cal-check input:checked + .cal-check-box { background: var(--c); }
.cal-check input:checked + .cal-check-box::after { content: ''; width: 4px; height: 8px; border: solid #0d1430; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.cal-check input:focus-visible + .cal-check-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-check-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cal-banner { padding: 10px 14px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.cal-body {
  position: relative; flex: 1; min-height: 0; display: flex;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
}
.cal-grid { flex: 1; min-width: 0; padding: 4px 0 0; }
.cal-grid[hidden] { display: none; }
/* Thin bar along the top of the calendar while anything loads from Google. */
.cal-progress { position: absolute; left: 0; right: 0; top: 0; height: 2px; z-index: 6; overflow: hidden; pointer-events: none; }
.cal-progress::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 35%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: cal-progress 1.1s ease-in-out infinite;
}
@keyframes cal-progress { from { left: -35%; } to { left: 100%; } }

/* Placeholder blocks while a range loads for the first time. */
.cal-grid .fc-event.ev-skeleton {
  background: var(--surface-2); border-left-color: var(--surface-3); pointer-events: none;
  animation: cal-skeleton 1s ease-in-out infinite alternate;
}
@keyframes cal-skeleton { from { opacity: .35; } to { opacity: .8; } }

.cal-state { flex: 1; display: grid; place-items: center; padding: 32px 16px; overflow-y: auto; }
.cal-state[hidden] { display: none; }
.cal-state-card { max-width: 440px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.cal-state-card h2 { font-size: 20px; letter-spacing: -0.01em; }
.cal-state-card p { line-height: 1.6; }
.cal-state-card code { font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.cal-state-icon { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); }
.cal-state-icon .g-logo { width: 30px; height: 30px; }
.cal-state-card .btn { text-decoration: none; margin-top: 4px; }
.cal-state-card .btn .g-logo { background: #fff; border-radius: 50%; padding: 2px; width: 20px; height: 20px; }
.cal-perks { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; color: var(--text-2); font-size: 13px; }
.cal-perks li { position: relative; padding-left: 26px; }
.cal-perks li::before {
  content: ''; position: absolute; left: 4px; top: 4px; width: 5px; height: 9px;
  border: solid var(--s-done); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* FullCalendar, themed with the planner's colours */
.cal-grid {
  --fc-border-color: var(--border);
  --fc-page-bg-color: var(--bg-elev);
  --fc-neutral-bg-color: var(--surface);
  --fc-neutral-text-color: var(--muted);
  --fc-today-bg-color: rgba(109, 140, 255, .05);
  --fc-now-indicator-color: var(--accent);
  --fc-highlight-color: var(--accent-soft);
  --fc-event-bg-color: var(--surface-3);
  --fc-event-border-color: transparent;
  --fc-event-text-color: var(--text);
  --fc-event-selected-overlay-color: rgba(255, 255, 255, .06);
  --fc-more-link-bg-color: transparent;
  --fc-more-link-text-color: var(--text-2);
  --fc-non-business-color: transparent;
  --fc-small-font-size: 12px;
  font-size: 13px;
}
.cal-grid .fc-theme-standard .fc-scrollgrid { border: 0; }
.cal-grid .fc-theme-standard td, .cal-grid .fc-theme-standard th { border-color: var(--border); }
.cal-grid .fc-col-header-cell { padding: 10px 0 8px; background: var(--bg-elev); }
.cal-grid .fc-col-header-cell-cushion { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; text-decoration: none; }
.cal-grid .fc-day-today .fc-col-header-cell-cushion { color: var(--accent-hover); }
.cal-grid a { color: inherit; text-decoration: none; }
.cal-grid .fc-timegrid-slot { height: 46px; }
.cal-grid .fc-timegrid-slot-minor { border-top-style: dashed; border-top-color: rgba(42, 53, 80, .55); }
.cal-grid .fc-timegrid-slot-label-cushion, .cal-grid .fc-timegrid-axis-cushion { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.cal-grid .fc-timegrid-axis-cushion { text-transform: none; }
.cal-grid .fc-timegrid-now-indicator-line { border-width: 2px 0 0; }
.cal-grid .fc-timegrid-now-indicator-arrow { border-width: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: -4px; left: auto; right: -4px; }
.cal-grid .fc-daygrid-day-number { margin: 6px 6px 0 0; min-width: 26px; height: 26px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.cal-grid .fc-day-today .fc-daygrid-day-number { background: var(--accent); color: #0d1430; }
.cal-grid .fc-day-other .fc-daygrid-day-number { color: #56607a; }
.cal-grid .fc-daygrid-day.fc-day-today { background: rgba(109, 140, 255, .05); }
.cal-grid .fc-daygrid-more-link { font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 6px; }
.cal-grid .fc-daygrid-more-link:hover { background: var(--surface-2); }
.cal-grid .fc-popover { background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.cal-grid .fc-popover-header { background: transparent; padding: 10px 12px 4px; color: var(--text-2); font-weight: 600; }
.cal-grid .fc-highlight { border-radius: 6px; }
.cal-grid .fc-scroller::-webkit-scrollbar { width: 10px; }

/* Events: a soft tint of the calendar's colour with a solid strip on the left */
.cal-grid .fc-event {
  --ev: var(--accent);
  background: color-mix(in srgb, var(--ev) 22%, var(--surface));
  border: 0; border-left: 3px solid var(--ev); border-radius: 7px;
  box-shadow: none; cursor: pointer; transition: background .12s;
}
.cal-grid .fc-event:hover { background: color-mix(in srgb, var(--ev) 34%, var(--surface)); }
.cal-grid .fc-timegrid-event-harness-inset .fc-timegrid-event { box-shadow: 0 0 0 1px var(--bg-elev); }
.cal-grid .fc-daygrid-event { margin: 1px 4px 2px; }
.cal-grid .fc-event.fc-event-mirror, .cal-grid .fc-event.fc-event-dragging { box-shadow: var(--shadow); }
.cal-grid .fc-event-main { padding: 0; color: var(--text); }
.ev-inner { display: flex; flex-direction: column; gap: 1px; padding: 3px 7px; min-width: 0; overflow: hidden; line-height: 1.3; }
.ev-title { font-weight: 600; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.ev-time { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ev-meet { position: absolute; right: 5px; top: 4px; color: var(--text-2); }
.ev-meet svg { width: 12px; height: 12px; }
.fc-daygrid-event .ev-inner { flex-direction: row; align-items: center; gap: 6px; white-space: nowrap; }
.fc-daygrid-event .ev-time { order: -1; }
.fc-daygrid-event .ev-meet { position: static; }
.fc-timegrid-event.fc-event-short .ev-inner { flex-direction: row; gap: 6px; }

/* Planner tasks on the calendar: project colour, dashed strip, task ID */
.cal-grid .fc-event.ev-task { background: color-mix(in srgb, var(--ev) 12%, var(--surface)); border-left-style: dashed; }
.ev-task .ev-inner { flex-direction: row; align-items: center; gap: 6px; white-space: nowrap; }
.ev-key { font: 600 10.5px/1 ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace; color: var(--text-2); flex: none; }
.ev-task.is-done .ev-title { text-decoration: line-through; color: var(--muted); }

/* ---------- event dialogs ---------- */

.event-view { --ev: var(--accent); }
.event-view .modal-head h2 { position: relative; padding-left: 16px; font-size: 18px; line-height: 1.35; word-break: break-word; }
.event-view .modal-head h2::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 5px; border-radius: 4px; background: var(--ev); }
.event-view .modal-head { align-items: flex-start; gap: 10px; }
.ev-view-body { display: flex; flex-direction: column; gap: 14px; }
.ev-row { display: grid; grid-template-columns: 18px 1fr; gap: 12px; align-items: start; color: var(--text-2); font-size: 13.5px; }
.ev-row > svg { width: 17px; height: 17px; color: var(--muted); margin-top: 1px; }
.ev-row .small svg { width: 12px; height: 12px; vertical-align: -2px; }
.ev-row a { color: var(--accent-hover); word-break: break-all; }
.ev-cal-dot { width: 12px; height: 12px; margin: 3px 0 0 3px; border-radius: 4px; background: var(--ev); }
.ev-join { align-self: flex-start; text-decoration: none; margin-left: 30px; }
.ev-meet-url { margin: -8px 0 0 30px; }
.ev-guests { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.ev-guests li { display: flex; align-items: center; gap: 8px; }
.ev-guests em { color: var(--muted); font-style: normal; font-size: 12px; }
.guest-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.guest-dot.yes { background: var(--s-done); }
.guest-dot.no { background: var(--danger); }
.guest-dot.maybe { background: var(--warn); }
.ev-desc { white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow-y: auto; color: var(--text-2); }
.ev-open-google { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; }
.ev-open-google:hover { color: var(--text); }
.ev-open-google svg { width: 13px; height: 13px; }

.ev-when { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.ev-when .switch { grid-column: 1 / -1; }
.ev-datetime { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 8px; }
.is-all-day .ev-datetime { grid-template-columns: minmax(0, 1fr); }
.is-all-day .ev-time { display: none; }
.ev-datetime .date-trigger { padding-right: 10px; }
.ev-datetime .date-label .rel { display: none; }

.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; width: 34px; height: 20px; flex: none; border-radius: 99px; background: var(--surface-3); transition: background .15s; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); transition: transform .15s, background .15s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); background: #fff; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-box { height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }

.chips-input {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 5px 8px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); cursor: text;
}
.chips-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chips-input input { flex: 1; min-width: 160px; height: 28px; padding: 0 4px; border: 0; background: transparent; box-shadow: none !important; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 10px; border-radius: 99px;
  background: var(--surface-3); font-size: 12.5px; color: var(--text);
}
.chip button { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.chip button:hover { background: var(--border-strong); color: var(--text); }
.chip svg { width: 11px; height: 11px; }

/* ---------- profile: connected accounts ---------- */

.connected-account { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.ca-row { display: flex; align-items: center; gap: 12px; }
.ca-row .g-logo { width: 22px; height: 22px; }
.ca-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.ca-text strong { font-size: 13px; }
.ca-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-actions .btn { text-decoration: none; }
.ca-calendars { display: flex; flex-direction: column; gap: 2px; padding-top: 8px; border-top: 1px solid var(--border); max-height: 200px; overflow-y: auto; }
.ca-calendars > .small { padding: 0 8px 4px; }

@media (max-width: 900px) {
  .calendar-page { padding: 16px; }
  .cal-controls { width: 100%; }
  .cal-controls #new-event-btn { margin-left: auto; }
  .cal-body { min-height: 70vh; }
  .ev-when { grid-template-columns: 1fr; }
}

/* ---------- booking page settings (in the planner) ---------- */

.booking-modal { width: min(680px, calc(100% - 32px)); }
.booking-tabs { margin: 0; }
.booking-tabs .count { margin-left: 6px; padding: 0 7px; border-radius: 99px; background: var(--accent); color: #0d1430; font-size: 11px; }
.booking-tabs .count:empty { display: none; }
.bk-loading, .bk-empty { padding: 40px 0; text-align: center; }
.bk-loading { display: grid; place-items: center; }

.bk-status { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-elev); }
.bk-status.on { border-color: color-mix(in srgb, var(--s-done) 45%, transparent); background: color-mix(in srgb, var(--s-done) 8%, var(--bg-elev)); }
.bk-status .switch { align-items: flex-start; }
.bk-status .switch-track { margin-top: 2px; }
.bk-status b { color: var(--text); }

.bk-link { display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 4px 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.bk-link:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bk-link-prefix { color: var(--muted); font-size: 13px; white-space: nowrap; }
.bk-link input { flex: 1; min-width: 60px; height: 32px; padding: 0 2px; border: 0; background: transparent; box-shadow: none !important; font-weight: 600; }
.bk-link .icon-btn { width: 32px; height: 32px; }

.bk-picture { display: flex; align-items: center; gap: 16px; }
.bk-picture-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.bk-picture-tabs { margin: 0; grid-template-columns: repeat(3, 1fr); }
.bk-picture-tabs .seg { height: 30px; font-size: 12.5px; }
.bk-emoji { margin-top: 10px; max-height: 132px; }
.dropzone[data-pic-pane] { margin-top: 10px; padding: 18px 16px; }

.bk-durations { display: flex; flex-wrap: wrap; gap: 6px; }
.bk-chip input { position: absolute; opacity: 0; pointer-events: none; }
.bk-chip span {
  display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--border-strong); color: var(--text-2); font-size: 13px; font-weight: 600; transition: background .12s, color .12s, border-color .12s;
}
.bk-chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.bk-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.bk-hours { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.bk-day { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 12px; padding: 8px 12px; min-height: 52px; }
.bk-day + .bk-day { border-top: 1px solid var(--border); }
.bk-day b { font-weight: 600; color: var(--text); width: 32px; }
.bk-day.off b { color: var(--muted); }
.bk-windows { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.bk-window { display: inline-flex; align-items: center; gap: 6px; }
.bk-window select { width: 112px; height: 34px; padding-left: 10px; font-size: 13px; }
.bk-window .icon-btn { width: 26px; height: 26px; }
.bk-add { margin: 0; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--muted); }
.bk-add:hover { color: var(--accent-hover); background: var(--surface-2); }
.bk-add svg { width: 15px; height: 15px; }
.bk-busy { display: flex; flex-direction: column; gap: 2px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); max-height: 180px; overflow-y: auto; }

.bk-bookings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bk-booking { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.bk-booking.cancelled { opacity: .6; }
.bk-booking-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.bk-booking-main .muted { word-break: break-all; }
.bk-when { font-size: 12px; font-weight: 600; color: var(--accent-hover); }
.bk-tag { margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: var(--danger-soft); color: var(--danger); font-size: 11px; }
.bk-note { margin-top: 2px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.bk-booking-actions { display: flex; align-items: center; gap: 4px; }
.bk-section { margin: 18px 0 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

@media (max-width: 520px) {
  .bk-day { grid-template-columns: 1fr; gap: 6px; }
  .bk-link-prefix { display: none; }
}

/* ---------- public booking page (/book/<name>) ---------- */

.book-body {
  min-height: 100%;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(109, 140, 255, .14), transparent 60%),
    radial-gradient(700px 400px at 110% 110%, rgba(76, 207, 156, .07), transparent 60%),
    var(--bg);
}
.book { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 32px 16px; }
.book-card {
  width: 100%; max-width: 1000px; min-height: 540px; display: grid; grid-template-columns: 300px 1fr;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.book-card.narrow { max-width: 480px; min-height: 0; grid-template-columns: 1fr; }
.book-info { display: flex; flex-direction: column; gap: 10px; padding: 32px 28px; border-right: 1px solid var(--border); background: var(--bg-elev); }
.book-info[hidden] { display: none; }
.book-info .avatar.lg { margin-bottom: 4px; }
.book-info h1 { font-size: 22px; line-height: 1.3; letter-spacing: -0.02em; margin-bottom: 6px; }
.book-meta { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; font-weight: 500; }
.book-meta svg { width: 17px; height: 17px; color: var(--muted); }
.book-durations { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.book-durations .chip-btn.active { background: var(--accent); border-color: var(--accent); color: #0d1430; }
.book-desc { margin-top: 8px; color: var(--text-2); font-size: 14px; line-height: 1.6; white-space: pre-wrap; }

.book-main { padding: 32px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.book-main h2 { font-size: 18px; letter-spacing: -0.01em; }
.book-loading { flex: 1; display: grid; place-items: center; }
.book-pick { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 28px; }
.book-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.book-cal-head strong { font-size: 15px; }
.book-cal-head .icon-btn:disabled { opacity: .3; cursor: default; background: transparent; }
.book-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.book-dow { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding-bottom: 6px; }
.book-day {
  aspect-ratio: 1; max-height: 52px; border: 0; border-radius: 12px; background: transparent; color: #56607a;
  font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; position: relative; cursor: default;
}
.book-day.free { background: var(--accent-soft); color: var(--accent-hover); font-weight: 700; cursor: pointer; transition: background .12s; }
.book-day.free:hover { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.book-day.selected { background: var(--accent); color: #0d1430; }
.book-day.today::after { content: ''; position: absolute; left: 50%; bottom: 6px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.book-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.book-cal.is-loading .book-grid { opacity: .5; }

.book-slots { display: flex; flex-direction: column; min-height: 0; }
.book-slots-day { font-weight: 600; margin: 4px 0 12px; }
.book-slot-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; padding-right: 4px; }
.book-slot {
  height: 44px; flex: none; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 12px;
  background: transparent; color: var(--accent-hover); font-weight: 600; font-size: 14px; cursor: pointer; transition: background .12s, color .12s;
}
.book-slot:hover { background: var(--accent); color: #0d1430; }
.book-slots-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.8; padding: 24px 0; }
.book-slots-empty .link-btn { color: var(--accent-hover); font-size: 13px; }

.book-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px 4px 4px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 600; cursor: pointer; }
.book-back:hover { background: var(--surface-2); color: var(--text); }
.book-back svg { width: 16px; height: 16px; }
.book-summary { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--border); font-size: 14px; color: var(--text-2); }
.book-summary div { display: flex; align-items: center; gap: 10px; }
.book-summary svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.book-summary b { color: var(--text); }
.book-form { max-width: 460px; }
.book-form em { font-style: normal; font-weight: 500; }
.book-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.book-fine { text-align: center; }

.book-done { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; max-width: 460px; margin: 0 auto; }
.book-done .book-summary { align-self: stretch; text-align: left; }
.book-done .btn { text-decoration: none; }
.book-done a:not(.btn) { color: var(--accent-hover); word-break: break-all; }
.book-done-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--s-done) 18%, transparent); color: var(--s-done); }
.book-done-icon svg { width: 28px; height: 28px; stroke-width: 2.5; }
.book-done-icon.muted-icon { background: var(--surface-2); color: var(--muted); }
.book-main > .btn { align-self: flex-start; text-decoration: none; }
.book-status { align-self: flex-start; padding: 4px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--text-2); }
.book-status.ok { background: color-mix(in srgb, var(--s-done) 16%, transparent); color: var(--s-done); }
.book-status.cancelled { background: var(--danger-soft); color: var(--danger); }
.book-foot { font-size: 12px; color: var(--muted); }
.book-foot a { color: var(--text-2); text-decoration: none; font-weight: 600; }

@media (max-width: 860px) {
  .book { justify-content: flex-start; padding: 16px; }
  .book-card { grid-template-columns: 1fr; min-height: 0; }
  .book-info { border-right: 0; border-bottom: 1px solid var(--border); padding: 24px; }
  .book-main { padding: 24px 20px; }
  .book-pick { grid-template-columns: 1fr; }
  .book-slot-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); max-height: none; }
}

/* ---------- time zone picker ---------- */

.tz-picker { position: relative; min-width: 0; flex: 1; }
.tz-trigger {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 40px; padding: 0 10px 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev);
  color: var(--text); font-size: 13.5px; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.tz-trigger:hover { border-color: var(--border-strong); }
.tz-trigger:focus-visible, .tz-trigger[aria-expanded=true] { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tz-trigger-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tz-trigger-region { font-weight: 400; color: var(--muted); }
.tz-trigger-offset { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tz-trigger svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.book-tz .tz-trigger { height: 36px; background: transparent; }

.tz-pop {
  position: fixed; z-index: 30; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: pop .14s ease-out;
}
.tz-search-wrap { position: relative; display: block; padding: 8px; border-bottom: 1px solid var(--border); }
.tz-search { height: 36px; padding: 0 38px 0 12px; background: var(--bg-elev); font-size: 13px; }
.tz-search::-webkit-search-cancel-button { display: none; }
.tz-search-icon, .tz-search-close {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 26px; height: 26px; color: var(--muted);
}
.tz-search-icon { pointer-events: none; }
.tz-search-icon[hidden], .tz-search-close[hidden] { display: none; }
.tz-search-close { padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: pointer; transition: background .12s, color .12s; }
.tz-search-close:hover { background: var(--surface-3); color: var(--text); }
.tz-search-icon svg, .tz-search-close svg { width: 15px; height: 15px; }
.tz-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; min-height: 0; }
.tz-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.tz-item.active { background: var(--surface-3); }
.tz-item.selected { box-shadow: inset 3px 0 0 var(--accent); }
.tz-item.selected b { color: var(--accent-hover); }
.tz-item.divider { margin-bottom: 7px; position: relative; }
.tz-item.divider::after { content: ''; position: absolute; left: 4px; right: 4px; bottom: -4px; height: 1px; background: var(--border); }
.tz-item-main { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.tz-item-main b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tz-item-main span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tz-item-main em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--s-done); }
.tz-item-side { display: flex; flex-direction: column; align-items: flex-end; flex: none; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; line-height: 1.3; }
.tz-item-offset { font-size: 11px; color: var(--muted); }
.tz-empty { padding: 20px 10px; text-align: center; font-size: 13px; color: var(--muted); }

/* ---------- toast ---------- */

.toast {
  /* inset/margin/overflow reset the browser's default popover box */
  position: fixed; inset: auto; margin: 0; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px); overflow: visible;
  padding: 10px 16px; border-radius: var(--radius);
  background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text);
  box-shadow: var(--shadow); font-weight: 500; z-index: 10;
  animation: pop .18s ease-out;
}
.toast[hidden] { display: none; }
.toast-action {
  margin-left: 6px; padding: 4px 10px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--accent-soft); color: var(--accent-hover); font-weight: 700; font-size: 13px;
}
.toast-action:hover { background: var(--accent); color: #0d1430; }

/* Bin shown while dragging a task card */
.trash-zone {
  position: fixed; left: 50%; bottom: 28px; z-index: 20; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 14px 26px; border-radius: 18px;
  background: color-mix(in srgb, var(--danger) 12%, var(--surface-2)); border: 2px dashed color-mix(in srgb, var(--danger) 55%, transparent);
  color: var(--danger); font-weight: 600; box-shadow: var(--shadow-lg);
  animation: trash-in .18s ease-out; transition: transform .12s, background .12s, border-color .12s;
}
.trash-zone[hidden] { display: none; }
.trash-zone svg { width: 22px; height: 22px; pointer-events: none; }
.trash-zone span { pointer-events: none; }
.trash-zone.over { transform: translateX(-50%) scale(1.08); background: color-mix(in srgb, var(--danger) 28%, var(--surface-2)); border-style: solid; border-color: var(--danger); }
@keyframes trash-in { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translateX(-50%); } }
.toast svg { width: 16px; height: 16px; flex: none; stroke-width: 2.6; }
.toast.success { background: #1c3a33; border-color: #2b5a4b; color: #a7f3d0; }
.toast.success svg { color: var(--s-done); }
.toast.error { background: #3a2230; border-color: #5a2e3c; color: #ffb3ae; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; height: auto; min-height: 100%; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--border); min-width: 0; }
  .nav { order: 3; flex-basis: 100%; min-width: 0; }
  .nav-top { margin-bottom: 8px; }
  .nav-label { padding-left: 2px; }
  .project-list { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .project-item { white-space: nowrap; background: var(--surface); }
  .project-row { display: flex; align-items: center; gap: 2px; }
  .project-row .row-actions { display: none; position: static; transform: none; opacity: 1; }
  .project-row:has(.project-item.active) .row-actions { display: flex; }
  .project-row:hover .project-item:has(+ .row-actions) { padding-right: 10px; }
  .project-row:hover .count { visibility: visible; }
  .user-chip { margin-left: auto; padding: 6px; border-radius: 12px; }
  .user-meta { display: none; }
  .topbar { padding: 20px 16px 16px; }
  .topbar-actions { width: 100%; }
  .search { flex: 1 1 100%; }
  .search input { width: 100%; }
  .select-pill { flex: 1; }
  .modal.with-comments .task-layout { grid-template-columns: minmax(0, 1fr); }
  .comments { border-left: 0; border-top: 1px solid var(--border); height: auto; min-height: 0; }
  .comment-list { min-height: 120px; max-height: 50vh; }
  .comment-meta .icon-btn { opacity: 1; }
  .board { grid-auto-columns: minmax(270px, 85vw); padding: 0 16px 20px; scroll-snap-type: x mandatory; }
  .column { scroll-snap-align: start; max-height: 75vh; }
}

@media (max-width: 520px) {
  .grid-2 { grid-template-columns: 1fr; }
  .auth-card { padding: 24px 20px; }
  .select-pill { flex: 1; }
}
