:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --ink: #323338;
  --muted: #676879;
  --border: rgba(50, 51, 56, 0.08);
  --border-strong: rgba(50, 51, 56, 0.16);
  --accent: #0073ea;
  --accent-soft: rgba(0, 115, 234, 0.10);
  --status-notstarted: #c4c4c4;
  --status-notstarted-ink: #323338;
  --status-notstarted-soft: rgba(196, 196, 196, 0.28);
  --status-inprogress: #fdab3d;
  --status-inprogress-soft: rgba(253, 171, 61, 0.16);
  --status-stuck: #e2445c;
  --status-stuck-soft: rgba(226, 68, 92, 0.12);
  --status-done: #00c875;
  --status-done-soft: rgba(0, 200, 117, 0.14);
  --shadow: 0 1px 2px rgba(50, 51, 56, 0.04), 0 6px 16px rgba(50, 51, 56, 0.06);
  --shadow-hover: 0 4px 10px rgba(50, 51, 56, 0.08), 0 14px 28px rgba(50, 51, 56, 0.12);
  --font-ui: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-data: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --avatar-1: #5b6ee1;
  --avatar-2: #0f9d9d;
  --avatar-3: #e2445c;
  --avatar-4: #fdab3d;
  --avatar-5: #a25ddc;
  --avatar-6: #00c875;
  --accent-glow: 0 2px 10px rgba(0, 115, 234, 0.32);
  --sidebar-bg: #292f4c;
  --sidebar-surface: #333966;
  --sidebar-ink: #ffffff;
  --sidebar-muted: rgba(255, 255, 255, 0.62);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(255, 255, 255, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161f;
    --surface: #1b1e2b;
    --surface-raised: #212437;
    --ink: #eceef5;
    --muted: #9799ad;
    --border: rgba(236, 238, 245, 0.08);
    --border-strong: rgba(236, 238, 245, 0.15);
    --accent: #4b9eff;
    --accent-soft: rgba(75, 158, 255, 0.16);
    --status-notstarted: #7c7f92;
    --status-notstarted-ink: #14161f;
    --status-notstarted-soft: rgba(124, 127, 146, 0.2);
    --status-inprogress: #ffb84d;
    --status-inprogress-soft: rgba(255, 184, 77, 0.16);
    --status-stuck: #ff6b83;
    --status-stuck-soft: rgba(255, 107, 131, 0.16);
    --status-done: #2ee089;
    --status-done-soft: rgba(46, 224, 137, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.24);
    --shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.34), 0 18px 36px rgba(0, 0, 0, 0.3);
    --accent-glow: 0 2px 10px rgba(75, 158, 255, 0.35);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Login screen ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 26px;
  box-shadow: var(--shadow-hover);
}
.login-card h1 { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
.login-card .sub { font-size: 0.82rem; color: var(--muted); margin: 0 0 20px; }
.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 0.78rem; font-weight: 700; margin-bottom: 6px; }
.login-field input {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.88rem;
}
.login-error {
  font-size: 0.78rem;
  color: var(--status-stuck);
  margin: -4px 0 14px;
  display: none;
}
.login-error.show { display: block; }
.login-card .btn.primary { width: 100%; justify-content: center; padding: 9px; margin-top: 4px; }
.login-hint { font-size: 0.72rem; color: var(--muted); margin-top: 16px; line-height: 1.5; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: "header header" "sidebar main";
  min-height: 100vh;
}
header.top {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand h1 { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.brand .tag {
  font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 700; border: 1px solid var(--border-strong); border-radius: 4px; padding: 2px 6px;
}
.top-actions { display: flex; gap: 8px; align-items: center; }
.whoami { font-size: 0.82rem; color: var(--muted); margin-right: 6px; }
.whoami strong { color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface-raised); color: var(--ink);
  font-size: 0.82rem; font-weight: 600; transition: border-color 0.12s, background 0.12s, transform 0.12s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); box-shadow: var(--accent-glow); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); border-color: var(--border-strong); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.small { padding: 5px 10px; font-size: 0.74rem; }
.btn.danger { background: transparent; border-color: var(--status-stuck); color: var(--status-stuck); }
.btn.danger:hover { background: var(--status-stuck-soft); }

/* ---------- Manage team modal ---------- */
.manage-team-modal { max-width: 720px; }
.manage-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 4px; border-bottom: 1px solid var(--border);
}
.manage-row:last-child { border-bottom: none; }
.manage-row .avatar { flex-shrink: 0; }
.manage-row .person-meta {
  flex: 1 1 140px; min-width: 140px; overflow: hidden;
}
.manage-row .person-meta .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-row .person-meta .email { font-size: 0.76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-row .role-pill {
  font-size: 0.7rem; font-weight: 700; color: var(--muted); background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 9px; white-space: nowrap; flex-shrink: 0;
}
.manage-row .account-status { font-size: 0.72rem; font-weight: 700; border-radius: 999px; padding: 3px 9px; white-space: nowrap; flex-shrink: 0; }
.manage-row .account-status.active { color: var(--status-done); background: var(--status-done-soft); }
.manage-row .account-status.blocked { color: var(--status-stuck); background: var(--status-stuck-soft); }
.manage-row .row-actions { display: flex; gap: 6px; margin-left: auto; flex-shrink: 0; flex-wrap: wrap; }

/* ---------- Sidebar ---------- */
/* Fixed dark sidebar regardless of light/dark theme — same pattern as Monday/Notion/Asana. */
nav.sidebar {
  grid-area: sidebar;
  background: var(--sidebar-bg);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.sidebar-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sidebar-muted); padding: 14px 10px 6px; }
.person-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px;
  border: none; background: transparent; color: var(--sidebar-ink);
  text-align: left; font-size: 0.86rem; transition: background 0.15s ease, transform 0.1s ease;
}
.person-item:hover { background: var(--sidebar-surface); }
.person-item.active { background: var(--sidebar-active); font-weight: 700; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 800; color: #fff; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}
.person-meta { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.person-meta .role { font-size: 0.7rem; color: var(--sidebar-muted); }
.person-item .due-flag { margin-left: auto; font-family: var(--font-data); font-size: 0.68rem; color: #ffb84d; font-weight: 700; }
.sidebar-add-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  margin-top: 10px; padding: 9px 10px; border-radius: 8px; border: 1px dashed var(--sidebar-surface);
  background: transparent; color: var(--sidebar-muted); font-size: 0.8rem; font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sidebar-add-btn:hover { background: var(--sidebar-surface); color: var(--sidebar-ink); border-color: var(--sidebar-active); }

/* ---------- Main ---------- */
main.content { grid-area: main; padding: 28px 32px 60px; overflow-y: auto; min-width: 0; }
.view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.view-header h2 { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 2px; text-wrap: balance; }
.view-header .sub { color: var(--muted); font-size: 0.85rem; }
.view-tabs { display: flex; gap: 6px; background: var(--surface); border: 1px solid var(--border); padding: 3px; border-radius: 10px; }
.view-tabs button { padding: 6px 12px; border-radius: 8px; border: none; background: transparent; color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.view-tabs button.active { background: var(--surface-raised); color: var(--ink); box-shadow: var(--shadow); }

.banner {
  display: flex; align-items: flex-start; gap: 10px; background: var(--accent-soft); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 14px; font-size: 0.82rem; color: var(--ink); margin-bottom: 18px;
}
.banner p { margin: 0; line-height: 1.5; }
.banner strong { color: var(--accent); }
.banner .close { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 1rem; line-height: 1; padding: 2px; }

/* ---------- Kanban board ---------- */
.board { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 16px; align-items: start; }
.column {
  background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--status);
  border-radius: 14px; padding: 14px; min-height: 120px;
}
.column.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 0 2px 12px; margin-bottom: 12px; }
.column-head .status-pill {
  display: inline-flex; align-items: center; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
  font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--status); color: var(--status-ink, #fff);
}
.column-head .count { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.cards { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }

.card {
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px;
  cursor: grab; box-shadow: var(--shadow); transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  animation: pop-in 220ms ease-out;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-hover); transform: translateY(-2px) rotate(-0.4deg); }
.card:active { cursor: grabbing; }
.card.overdue { border-left: 2px solid var(--status-stuck); }
.card.due-soon { border-left: 2px solid var(--accent); }
.card-top { display: flex; align-items: flex-start; gap: 8px; }
.card-title { font-size: 0.9rem; font-weight: 600; line-height: 1.35; flex: 1; text-wrap: balance; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 0.62rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}
.chip.critical { background: var(--status-stuck); color: #fff; }
.chip.normal { background: var(--border); color: var(--muted); }
.chip.assignee { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.card-dates { font-variant-numeric: tabular-nums; font-size: 0.78rem; color: var(--muted); margin-top: 8px; }
.card-badge { display: inline-block; margin-top: 8px; font-size: 0.68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.card-badge.overdue { background: var(--status-stuck); color: #fff; }
.card-badge.soon { background: var(--accent); color: #fff; }
.card-attach { margin-top: 8px; font-size: 0.78rem; display: flex; align-items: center; gap: 5px; }
.card-attach a { color: var(--accent); text-decoration: none; }
.card-attach a:hover { text-decoration: underline; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.status-select { font-size: 0.76rem; padding: 5px 7px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); flex: 1; }
.icon-btn { background: none; border: none; color: var(--muted); font-size: 0.9rem; padding: 3px 6px; border-radius: 5px; }
.icon-btn:hover { color: var(--status-stuck); background: var(--status-stuck-soft); }

/* ---------- Notifications ---------- */
.notif-wrap { position: relative; }
.notif-bell { position: relative; font-size: 1.05rem; padding: 6px 8px; border-radius: 8px; }
.notif-bell:hover { background: var(--border); color: var(--ink); }
.notif-badge {
  position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px;
  background: var(--status-stuck); color: #fff; font-size: 0.62rem; font-weight: 800; line-height: 15px; text-align: center;
}
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0; width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-hover);
  z-index: 40;
}
.notif-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-panel-head h4 { margin: 0; font-size: 0.86rem; font-weight: 800; }
.notif-panel-head button { font-size: 0.72rem; color: var(--accent); background: none; border: none; font-weight: 700; }
.notif-item { display: block; width: 100%; text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); background: transparent; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--accent-soft); }
.notif-item .msg { font-size: 0.8rem; color: var(--ink); display: block; }
.notif-item .when { font-size: 0.68rem; color: var(--muted); display: block; margin-top: 3px; }
.notif-empty { padding: 24px 14px; text-align: center; color: var(--muted); font-size: 0.8rem; }

/* ---------- Task thread (comments) ---------- */
.thread-modal { max-width: 520px; }
.thread-recap { font-size: 0.8rem; color: var(--muted); margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.thread-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.thread-empty { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 18px 0; }
.thread-comment { display: flex; gap: 10px; }
.thread-comment .avatar { width: 26px; height: 26px; font-size: 0.62rem; flex-shrink: 0; }
.thread-comment-body { flex: 1; min-width: 0; }
.thread-comment-head { display: flex; align-items: baseline; gap: 8px; }
.thread-comment-head .author { font-weight: 700; font-size: 0.8rem; }
.thread-comment-head .when { font-size: 0.68rem; color: var(--muted); }
.thread-comment-text { font-size: 0.84rem; color: var(--ink); margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.thread-comment .response-tag {
  display: inline-block; margin-top: 4px; font-size: 0.66rem; font-weight: 700; color: var(--status-inprogress);
  background: var(--status-inprogress-soft); padding: 2px 8px; border-radius: 999px;
}
.thread-input-row { display: flex; flex-direction: column; gap: 8px; }
.thread-input-row textarea { width: 100%; min-height: 60px; resize: vertical; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); }
.thread-input-actions { display: flex; align-items: center; justify-content: space-between; }
.thread-request-toggle { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted); }

/* ---------- Chat (Team Chat + DMs) ---------- */
.chat-view { display: flex; flex-direction: column; height: calc(100vh - 180px); max-width: 640px; }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 4px 4px 14px; }
.chat-empty { text-align: center; color: var(--muted); font-size: 0.84rem; margin: auto; }
.chat-message { display: flex; gap: 10px; }
.chat-message.mine { flex-direction: row-reverse; }
.chat-message .avatar { width: 28px; height: 28px; font-size: 0.64rem; flex-shrink: 0; }
.chat-bubble { max-width: 72%; }
.chat-message.mine .chat-bubble { display: flex; flex-direction: column; align-items: flex-end; }
.chat-bubble-head { display: flex; align-items: baseline; gap: 8px; font-size: 0.72rem; color: var(--muted); margin-bottom: 3px; }
.chat-message.mine .chat-bubble-head { flex-direction: row-reverse; }
.chat-bubble-head .author { font-weight: 700; color: var(--ink); }
.chat-bubble-text {
  display: inline-block; padding: 8px 12px; border-radius: 14px; background: var(--surface-raised);
  border: 1px solid var(--border); font-size: 0.86rem; color: var(--ink); white-space: pre-wrap; word-break: break-word;
}
.chat-message.mine .chat-bubble-text { background: var(--accent); border-color: var(--accent); color: #fff; }
.chat-input-row { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.chat-input-row textarea {
  flex: 1; resize: none; min-height: 44px; max-height: 120px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font-family: var(--font-ui);
}
.dm-picker { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.dm-picker-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid transparent;
  background: var(--surface-raised); text-align: left;
}
.dm-picker-item:hover { border-color: var(--border-strong); }
.dm-picker-item .name { font-weight: 700; font-size: 0.86rem; }
.empty-col { color: var(--muted); font-size: 0.8rem; text-align: center; padding: 22px 6px; }

/* ---------- Person cell (All Boards table) ---------- */
.person-cell { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.person-cell .avatar { width: 24px; height: 24px; font-size: 0.6rem; }

/* ---------- Completed / productivity ---------- */
.filters-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.filters-row label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-right: 6px; }
select.filter, input.filter {
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-raised); color: var(--ink); font-size: 0.82rem;
}
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.segmented button { padding: 6px 12px; border: none; background: var(--surface-raised); color: var(--muted); font-size: 0.78rem; font-weight: 600; border-right: 1px solid var(--border); }
.segmented button:last-child { border-right: none; }
.segmented button.active { background: var(--accent-soft); color: var(--accent); }

.chart-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; margin-bottom: 20px; overflow-x: auto; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 42px; align-items: center; gap: 10px; padding: 5px 0; }
.bar-row .label { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--status-done-soft); border-radius: 3px; height: 8px; position: relative; }
.bar-fill { background: var(--status-done); border-radius: 3px; height: 100%; min-width: 3px; }
.bar-row .val { font-family: var(--font-data); font-variant-numeric: tabular-nums; font-size: 0.78rem; text-align: right; }

table.completed-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
table.completed-table th, table.completed-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.completed-table th { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
table.completed-table td.dates { font-family: var(--font-data); font-variant-numeric: tabular-nums; color: var(--muted); }
table.completed-table tr:last-child td { border-bottom: none; }

/* ---------- Table view (Monday-style spreadsheet) ---------- */
table.task-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.task-table thead th {
  text-align: left; padding: 10px 16px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--border-strong); background: var(--surface);
}
.task-row { background: var(--surface-raised); transition: background 0.12s ease; }
.task-row:hover { background: var(--accent-soft); }
.task-row td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.task-row:last-child td { border-bottom: none; }
.task-row.overdue { box-shadow: inset 3px 0 0 var(--status-stuck); }
.task-row.due-soon { box-shadow: inset 3px 0 0 var(--accent); }
.task-title-cell { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.row-attach { text-decoration: none; font-size: 0.9rem; }
.task-row td.dates { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.status-pill-select {
  appearance: none; -webkit-appearance: none; border: none; cursor: pointer;
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700;
  padding: 6px 26px 6px 12px; border-radius: 999px; background-color: var(--status); color: var(--status-ink, #fff);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

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

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 12, 0.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: var(--surface-raised); border-radius: 16px; border: 1px solid var(--border); width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto; padding: 26px 28px 28px; box-shadow: var(--shadow-hover); }
.modal.wide { max-width: 560px; }
.modal h3 { margin: 0 0 18px; font-size: 1.1rem; font-weight: 800; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.78rem; font-weight: 700; margin-bottom: 6px; }
.field .req { color: var(--status-stuck); }
.field input[type="text"], .field input[type="date"], .field input[type="email"], .field input[type="password"], .field textarea, .field input[type="file"], .field select {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
}
.field textarea { resize: vertical; min-height: 60px; }
.field .err { color: var(--status-stuck); font-size: 0.72rem; margin-top: 4px; display: none; }
.field.invalid .err { display: block; }
.field.invalid input, .field.invalid textarea { border-color: var(--status-stuck); }
.priority-toggle { display: flex; gap: 8px; }
.priority-toggle button { flex: 1; padding: 8px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.priority-toggle button.active.normal { background: var(--status-notstarted-soft); color: var(--status-notstarted); border-color: var(--status-notstarted); }
.priority-toggle button.active.critical { background: var(--status-stuck-soft); color: var(--status-stuck); border-color: var(--status-stuck); }
.password-row { display: flex; gap: 8px; }
.password-row input { flex: 1; }
.password-row .btn { padding: 9px 12px; white-space: nowrap; border: 1px solid var(--border-strong); }
.attach-preview { font-size: 0.76rem; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 80; max-width: min(340px, calc(100vw - 40px)); }
.toast { background: var(--surface-raised); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); border-radius: 12px; padding: 10px 12px; font-size: 0.8rem; color: var(--ink); box-shadow: var(--shadow-hover); display: flex; align-items: flex-start; gap: 8px; }
.toast.warn { border-left-color: var(--status-stuck); }
.toast p { margin: 0; line-height: 1.4; }
.toast .close { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 0.9rem; line-height: 1; padding: 0; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "header" "sidebar" "main"; }
  nav.sidebar { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .board { grid-template-columns: 1fr; }
}

/* ---------- Fun bits: confetti + bouncy feedback ---------- */
.confetti-piece {
  position: fixed;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 200;
  animation: confetti-burst 900ms cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
}

@keyframes confetti-burst {
  0% { transform: translate(var(--x0), var(--y0)) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--x1), var(--y1)) rotate(var(--spin)) scale(0.6); opacity: 0; }
}

@keyframes pop-in {
  0% { transform: scale(0.85); }
  55% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.person-item:active { transform: scale(0.98); }
.btn.primary:active { transform: scale(0.95); }

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