/* ───────── Màu & cỡ chữ (sáng / tối) ───────── */
:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --column: #eceef2;
  --border: #e3e6ec;
  --border-strong: #cfd4de;
  --text: #161b2a;
  --muted: #667085;
  --faint: #98a1b3;
  --primary: #3b5bdb;
  --primary-hover: #2f4bc0;
  --primary-soft: #e8edff;
  --primary-text: #2745b8;
  --on-primary: #ffffff;
  --danger: #c92a3a;
  --danger-soft: #fde8ea;
  --warn: #8a5a00;
  --warn-soft: #fff1d1;
  --ok: #0f7a56;
  --todo: #e0980b;
  --doing: #3b82f6;
  --done: #13a06f;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 6%);
  --shadow-md: 0 2px 8px rgb(16 24 40 / 8%), 0 1px 2px rgb(16 24 40 / 6%);
  --shadow-lg: 0 24px 64px rgb(16 24 40 / 22%);
  --ring: 0 0 0 3px rgb(59 91 219 / 28%);
  --radius: 10px;
  --radius-sm: 7px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Màu avatar: nền / chữ */
  --av-0-bg: #dbe6ff; --av-0-fg: #25479e;
  --av-1-bg: #e9defb; --av-1-fg: #61409c;
  --av-2-bg: #ffe6d1; --av-2-fg: #9a4f12;
  --av-3-bg: #d3efe9; --av-3-fg: #1f6f64;
  --av-4-bg: #fbdce6; --av-4-fg: #a32a57;
  --av-5-bg: #e4ecc9; --av-5-fg: #54661a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f121a;
    --surface: #181c27;
    --surface-2: #1f2432;
    --column: #141824;
    --border: #272d3d;
    --border-strong: #38405a;
    --text: #e8eaf1;
    --muted: #98a1b6;
    --faint: #6b7489;
    --primary: #6b86f5;
    --primary-hover: #8197f7;
    --primary-soft: #232c52;
    --primary-text: #a9b8fb;
    --on-primary: #0f121a;
    --danger: #ff6b78;
    --danger-soft: #3a1f26;
    --warn: #f5c15a;
    --warn-soft: #3a2f14;
    --ok: #4cd1a1;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-md: 0 2px 8px rgb(0 0 0 / 40%);
    --shadow-lg: 0 24px 64px rgb(0 0 0 / 60%);
    --ring: 0 0 0 3px rgb(107 134 245 / 40%);
    --av-0-bg: #263764; --av-0-fg: #b9ccff;
    --av-1-bg: #3a2c5e; --av-1-fg: #d8c8ff;
    --av-2-bg: #4a3220; --av-2-fg: #ffd3ac;
    --av-3-bg: #1f4540; --av-3-fg: #a6e8dc;
    --av-4-bg: #52283a; --av-4-fg: #ffc3d8;
    --av-5-bg: #3b4519; --av-5-fg: #d4e69a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f121a;
  --surface: #181c27;
  --surface-2: #1f2432;
  --column: #141824;
  --border: #272d3d;
  --border-strong: #38405a;
  --text: #e8eaf1;
  --muted: #98a1b6;
  --faint: #6b7489;
  --primary: #6b86f5;
  --primary-hover: #8197f7;
  --primary-soft: #232c52;
  --primary-text: #a9b8fb;
  --on-primary: #0f121a;
  --danger: #ff6b78;
  --danger-soft: #3a1f26;
  --warn: #f5c15a;
  --warn-soft: #3a2f14;
  --ok: #4cd1a1;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-md: 0 2px 8px rgb(0 0 0 / 40%);
  --shadow-lg: 0 24px 64px rgb(0 0 0 / 60%);
  --ring: 0 0 0 3px rgb(107 134 245 / 40%);
  --av-0-bg: #263764; --av-0-fg: #b9ccff;
  --av-1-bg: #3a2c5e; --av-1-fg: #d8c8ff;
  --av-2-bg: #4a3220; --av-2-fg: #ffd3ac;
  --av-3-bg: #1f4540; --av-3-fg: #a6e8dc;
  --av-4-bg: #52283a; --av-4-fg: #ffc3d8;
  --av-5-bg: #3b4519; --av-5-fg: #d4e69a;
}
:root[data-theme="light"] { color-scheme: light; }

/* ───────── Nền tảng ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--primary-text); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); font-size: .875rem; }
.icon { width: 18px; height: 18px; flex: none; }
kbd { font: 600 .6875rem/1 var(--font); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--border-strong); color: var(--muted); background: var(--surface); }
.stack { display: grid; gap: 14px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ───────── Nút, ô nhập ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 550; font-size: .875rem; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.primary kbd { background: transparent; border-color: rgb(255 255 255 / 45%); color: inherit; opacity: .85; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary kbd { border-color: rgb(15 18 26 / 40%); } }
:root[data-theme="dark"] .btn.primary kbd { border-color: rgb(15 18 26 / 40%); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn.danger-ghost { border-color: var(--border); background: transparent; color: var(--danger); }
.btn.danger-ghost:hover:not(:disabled) { background: var(--danger-soft); border-color: transparent; }
.btn.small { min-height: 32px; padding: 0 10px; font-weight: 500; }
.btn.block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.field { display: grid; gap: 6px; }
.field > span, .field-group > legend { font-size: .8125rem; font-weight: 600; color: var(--muted); }
input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select {
  width: 100%; min-width: 0; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); font-size: .9375rem; line-height: 1.4; }
textarea { resize: vertical; min-height: 84px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 7.5 10 12l4.5-4.5' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 18px; }
.error { color: var(--danger); font-size: .875rem; }
.error:empty { display: none; }
.empty-note { color: var(--muted); text-align: center; padding: 28px 0; }

/* ───────── Đăng nhập ───────── */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; box-shadow: var(--shadow-md); display: grid; gap: 10px; }
.login-card h1 { font-size: 1.5rem; letter-spacing: -.02em; margin-top: 14px; }
.login-card form { margin-top: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 1.0625rem; letter-spacing: -.02em; }
.brand b { font-weight: 500; color: var(--muted); }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: var(--on-primary); font-size: 1.5rem; font-weight: 750; line-height: 1; padding-bottom: 3px; }

/* ───────── Thanh trên ───────── */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 28px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.menu { position: relative; }
.menu summary { list-style: none; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px 0 6px; border-radius: 999px; cursor: pointer; user-select: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: var(--surface-2); }
.menu-name { font-size: .875rem; font-weight: 550; }
.chev { width: 16px; height: 16px; color: var(--muted); }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.menu-item { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-radius: 6px; background: none; font-size: .875rem; }
.menu-item:hover { background: var(--surface-2); }

/* ───────── Trang ───────── */
.page { max-width: 1560px; margin: 0 auto; padding: 28px 28px 56px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-head h1 { font-size: 1.625rem; letter-spacing: -.03em; line-height: 1.2; }
.page-head .muted { margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 20px; }

.avatar { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; font-size: .6875rem; font-weight: 700; letter-spacing: 0; background: var(--av-0-bg); color: var(--av-0-fg); user-select: none; }
.av-0 { background: var(--av-0-bg); color: var(--av-0-fg); } .av-1 { background: var(--av-1-bg); color: var(--av-1-fg); }
.av-2 { background: var(--av-2-bg); color: var(--av-2-fg); } .av-3 { background: var(--av-3-bg); color: var(--av-3-fg); }
.av-4 { background: var(--av-4-bg); color: var(--av-4-fg); } .av-5 { background: var(--av-5-bg); color: var(--av-5-fg); }
.avatars { display: flex; }
.avatars .avatar { width: 32px; height: 32px; font-size: .75rem; box-shadow: 0 0 0 2px var(--bg); margin-left: -8px; }
.avatars .avatar:first-child { margin-left: 0; }
.faces { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.face { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 12px 4px 4px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text); font-size: .8125rem; font-weight: 600; transition: background .12s, border-color .12s, opacity .12s, box-shadow .12s; }
.face .avatar { width: 30px; height: 30px; font-size: .75rem; }
.face:hover { border-color: var(--faint); box-shadow: var(--shadow-sm); }
.face[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); box-shadow: 0 0 0 1px var(--primary); }
.faces:has([aria-pressed="true"]) .face[aria-pressed="false"] { opacity: .6; }
.faces:has([aria-pressed="true"]) .face[aria-pressed="false"]:hover { opacity: 1; }
.face-count { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .6875rem; font-weight: 700; text-align: center; }
.face[aria-pressed="true"] .face-count { background: var(--primary); color: var(--on-primary); }
.unassigned-avatar { background: transparent; color: var(--faint); border: 1.5px dashed var(--border-strong); }

/* ───────── Thanh lọc ───────── */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.toolbar .push { margin-left: auto; }
.search { position: relative; display: flex; align-items: center; width: 280px; max-width: 100%; }
.search .icon { position: absolute; left: 11px; color: var(--faint); pointer-events: none; }
.toolbar .search input[type="search"] { padding-left: 36px; padding-right: 34px; }
.search kbd { position: absolute; right: 9px; pointer-events: none; }
.search input:focus ~ kbd { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 13px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); font-size: .8125rem; font-weight: 550; color: var(--muted); transition: background .12s, border-color .12s, color .12s; }
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); }
.chip-count { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--surface-2); font-size: .6875rem; font-weight: 700; text-align: center; color: var(--muted); }
.chip-count:empty { display: none; }
.chip[aria-pressed="true"] .chip-count { background: var(--primary); color: var(--on-primary); }
#chip-late:not([aria-pressed="true"]) .chip-count:not(:empty) { background: var(--danger-soft); color: var(--danger); }
.select { width: auto; min-width: 170px; min-height: 36px; border-radius: 999px; padding-left: 14px; font-size: .8125rem; font-weight: 550; }

/* ───────── Cột & card ───────── */
.tabs { display: none; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.column { background: var(--column); border: 1px solid var(--border); border-radius: 14px; padding: 12px; min-height: 220px; transition: background .12s, border-color .12s; }
.column.drag-over { background: var(--primary-soft); border-color: var(--primary); }
.column-head { display: flex; align-items: center; gap: 9px; padding: 4px 6px 12px; }
.column-head h2 { font-size: .9375rem; font-weight: 650; letter-spacing: -.01em; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--todo); }
.column[data-status="backlog"] .dot { background: var(--faint); }
.column[data-status="doing"] .dot { background: var(--doing); }
.column[data-status="done"] .dot { background: var(--done); }
.count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .75rem; font-weight: 650; color: var(--muted); text-align: center; }
.column-head .icon-btn { margin-left: auto; width: 30px; height: 30px; }
.cards { display: grid; gap: 10px; }
.empty-column { display: grid; place-items: center; gap: 4px; padding: 30px 12px; color: var(--faint); font-size: .8125rem; text-align: center; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); }
.add-inline { width: 100%; margin-top: 10px; justify-content: flex-start; color: var(--muted); }

.card { position: relative; display: grid; gap: 8px; padding: 12px 14px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); cursor: pointer; transition: box-shadow .12s, border-color .12s, transform .12s; }
.card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card.dragging { opacity: .45; }
.card::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.card.is-high::before { background: var(--danger); }
.card.is-late { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.card.is-done .card-title { color: var(--muted); }
.card.is-done { background: color-mix(in srgb, var(--surface) 70%, var(--column)); box-shadow: none; }
.card-cover { display: block; width: 100%; height: 118px; object-fit: cover; border-radius: 7px; background: var(--surface-2); margin-bottom: 2px; }
.card-title { font-size: .9375rem; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.card-open { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-open:focus-visible { outline-offset: 4px; border-radius: 4px; }
.card-desc { color: var(--muted); font-size: .8125rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.tag .icon { width: 13px; height: 13px; }
.tag.late { background: var(--danger-soft); color: var(--danger); }
.tag.soon { background: var(--warn-soft); color: var(--warn); }
.tag.high { background: var(--danger-soft); color: var(--danger); }
.tag.low { color: var(--faint); }
.tag.plain { background: transparent; padding-left: 0; padding-right: 2px; font-weight: 550; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.stack-avatars { display: flex; align-items: center; min-width: 0; }
.stack-avatars .avatar { box-shadow: 0 0 0 2px var(--surface); margin-left: -7px; }
.stack-avatars .avatar:first-child { margin-left: 0; }
.stack-avatars .more { background: var(--surface-2); color: var(--muted); }
.unassigned { color: var(--faint); font-size: .75rem; }
.status-select { width: auto; min-height: 28px; padding: 2px 26px 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; color: var(--muted); border-color: var(--border); background-color: var(--surface-2); background-position: right 5px center; background-size: 16px; }
.status-select:hover { border-color: var(--border-strong); color: var(--text); }

/* ───────── Hộp thoại ───────── */
dialog { color: var(--text); padding: 0; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgb(10 14 24 / 55%); backdrop-filter: blur(3px); }
.sheet { width: min(920px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); border-radius: 16px; overflow: hidden; }
.sheet.narrow { width: min(460px, calc(100vw - 32px)); }
.sheet[open] { display: flex; flex-direction: column; }
.sheet form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 14px 24px; border-bottom: 1px solid var(--border); flex: none; }
.sheet-head h2 { font-size: 1rem; font-weight: 650; }
.sheet-body { display: grid; grid-template-columns: minmax(0, 1fr) 290px; min-height: 0; overflow-y: auto; flex: 1; }
.sheet-title { padding: 18px 24px 6px; flex: none; }
.sheet-main { padding: 14px 24px 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; min-width: 0; }
.sheet-side { padding: 18px 20px 24px; background: var(--surface-2); border-left: 1px solid var(--border); display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; min-width: 0; }
.sheet-single { padding: 18px 24px 24px; overflow-y: auto; }
.sheet-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 24px; border-top: 1px solid var(--border); background: var(--surface); flex: none; }
.sheet-foot .error { margin-right: auto; }
.title-input { border: 0 !important; box-shadow: none !important; padding: 4px 0 !important; min-height: 0 !important; font-size: 1.375rem !important; font-weight: 650; letter-spacing: -.02em; background: transparent !important; border-bottom: 2px solid transparent !important; border-radius: 0 !important; }
.title-input:focus { border-bottom-color: var(--primary) !important; }
.block { display: grid; gap: 10px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.block-head h3 { font-size: .875rem; font-weight: 650; }
.block-head .count { margin-left: 4px; }
.field-group { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.field-group > legend { padding: 0; margin-bottom: 8px; float: left; width: 100%; }
.field-group > :not(legend) { clear: both; }
.timeline { margin: 0; display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid var(--border); font-size: .75rem; }
.timeline > div { display: flex; justify-content: space-between; gap: 12px; }
.timeline dt { color: var(--muted); }
.timeline dd { margin: 0; font-weight: 600; text-align: right; }
.card-dates { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--faint); font-size: .6875rem; line-height: 1.5; }
.card-dates span { white-space: nowrap; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; gap: 2px; background: var(--column); border: 1px solid var(--border); border-radius: 9px; }
.segmented label { position: relative; display: block; }
.segmented input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.segmented span { display: grid; place-items: center; min-height: 32px; padding: 0 6px; border-radius: 6px; font-size: .8125rem; font-weight: 600; color: var(--muted); text-align: center; transition: background .12s, color .12s; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { box-shadow: var(--ring); }
.segmented.prio label[data-p="high"] input:checked + span { background: var(--danger-soft); color: var(--danger); }
.people { display: flex; flex-wrap: wrap; gap: 7px; }
.person { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 4px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); font-size: .8125rem; font-weight: 550; cursor: pointer; transition: background .12s, border-color .12s; }
.person input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.person:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); }
.person:has(input:focus-visible) { box-shadow: var(--ring); }
.person .avatar { width: 24px; height: 24px; }
.due-row { display: flex; gap: 6px; min-width: 0; }
.due-row input { flex: 1; min-width: 0; }

.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.files:empty { display: none; }
.file { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 6px 6px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.file.pending { border-style: dashed; }
.file-thumb { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 6px; overflow: hidden; background: var(--surface-2); color: var(--muted); border: 0; padding: 0; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
button.file-thumb { cursor: zoom-in; }
.file-info { min-width: 0; flex: 1; }
.file-info a, .file-info span { display: block; font-size: .8125rem; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; color: inherit; }
.file-info a:hover { text-decoration: underline; color: var(--primary-text); }
.file-info small { display: block; font-size: .6875rem; color: var(--muted); }
.file .icon-btn { width: 28px; height: 28px; flex: none; }
.dropzone { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); font-size: .8125rem; cursor: pointer; transition: background .12s, border-color .12s; }
.dropzone:hover, .dropzone.drag-over { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-input:focus-visible + * { outline: 2px solid var(--primary); }

.comments { display: grid; gap: 12px; }
.comments:empty { display: none; }
.comment { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
.comment-body { background: var(--surface-2); border-radius: 4px 12px 12px 12px; padding: 8px 12px; }
.comment-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.comment-head b { font-size: .8125rem; }
.comment-head small { color: var(--muted); font-size: .6875rem; }
.comment-text { margin-top: 2px; font-size: .875rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 44px; }

.archive-list { display: grid; gap: 8px; }
.archive-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.archive-item > div { flex: 1; min-width: 0; }
.archive-item b { display: block; font-size: .875rem; overflow-wrap: anywhere; }
.archive-item small { color: var(--muted); font-size: .75rem; }

.lightbox { width: min(1000px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border: 0; border-radius: 12px; background: #0b0e16; color: #e8eaf1; padding: 12px; text-align: center; }
.lightbox[open] { display: block; }
.lightbox img { max-width: 100%; max-height: calc(100dvh - 120px); border-radius: 6px; }
.lightbox p { margin-top: 8px; font-size: .8125rem; color: #98a1b6; }
.icon-btn.light { position: absolute; right: 10px; top: 10px; background: rgb(255 255 255 / 12%); color: #fff; }
.icon-btn.light:hover { background: rgb(255 255 255 / 22%); color: #fff; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; max-width: min(92vw, 520px); padding: 11px 18px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: .875rem; font-weight: 500; box-shadow: var(--shadow-lg); animation: toast-in .18s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ───────── Màn hình nhỏ ───────── */
@media (max-width: 1100px) {
  .board { gap: 12px; }
}
@media (max-width: 860px) {
  .topbar { padding: 0 16px; }
  .page { padding: 18px 16px 40px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .page-actions { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .faces { justify-content: flex-start; }
  .faces { gap: 6px; }
  .face { min-height: 36px; padding: 3px 9px 3px 3px; gap: 6px; }
  .face .avatar { width: 28px; height: 28px; }
  .face-name { display: none; }
  .face[aria-pressed="true"] .face-name { display: inline; }
  .toolbar { gap: 8px; }
  .page-head h1 { font-size: 1.375rem; }
  .menu-name { display: none; }
  .btn kbd { display: none; }
  .search { width: 100%; }
  .select { flex: 1; min-width: 0; }
  .toolbar .push { margin-left: 0; }
  .search kbd { display: none; }

  /* Mỗi lần chỉ hiện một cột, đổi bằng thanh tab */
  .tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--column); border: 1px solid var(--border); border-radius: 12px; position: sticky; top: 60px; z-index: 10; }
  .tab { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: .8125rem; font-weight: 600; }
  .tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
  .tab .count { border: 0; background: var(--surface-2); }
  .board { grid-template-columns: 1fr; }
  .board .column { display: none; background: transparent; border: 0; padding: 0; min-height: 0; }
  .board[data-tab="backlog"] .column[data-status="backlog"],
  .board[data-tab="todo"] .column[data-status="todo"],
  .board[data-tab="doing"] .column[data-status="doing"],
  .board[data-tab="done"] .column[data-status="done"] { display: block; }
  .column-head { display: none; }

  /* Hộp thoại chiếm gần hết màn hình, 1 cột */
  .sheet { width: 100vw; max-width: none; height: 100dvh; max-height: none; border-radius: 0; border: 0; }
  .sheet.narrow { width: min(460px, calc(100vw - 24px)); height: auto; max-height: calc(100dvh - 24px); border-radius: 16px; border: 1px solid var(--border); }
  .sheet-body { grid-template-columns: 1fr; }
  .sheet-side { border-left: 0; border-top: 1px solid var(--border); order: -1; padding: 16px; }
  .sheet-title { padding: 14px 16px 4px; }
  .sheet-main { padding: 16px; }
  .sheet-head { padding: 10px 8px 10px 16px; }
  .sheet-foot { padding: 10px 16px; }
  .files { grid-template-columns: 1fr; }
}
@media (hover: none) { .card:hover { box-shadow: var(--shadow-sm); border-color: var(--border); } }

/* ───────── Loại task (icon) ───────── */
:root { --t-task: #3b5bdb; --t-bug: #d6293a; --t-meeting: #8b5cf6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --t-task: #8aa0ff; --t-bug: #ff7d88; --t-meeting: #b69cff; } }
:root[data-theme="dark"] { --t-task: #8aa0ff; --t-bug: #ff7d88; --t-meeting: #b69cff; }
.type-icon { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 6px; background: color-mix(in srgb, currentColor 14%, transparent); }
.type-icon .icon { width: 15px; height: 15px; }
.type-task { color: var(--t-task); } .type-bug { color: var(--t-bug); } .type-meeting { color: var(--t-meeting); }
.card-title-row { display: flex; align-items: flex-start; gap: 8px; }
.card-title-row .type-icon { margin-top: 1px; }
.card-title-row .card-title { flex: 1; min-width: 0; }
.card.is-backlog { background: color-mix(in srgb, var(--surface) 82%, var(--column)); border-style: dashed; }
.ti { display: inline-grid; place-items: center; width: 18px; height: 18px; font-style: normal; }
.ti .icon { width: 16px; height: 16px; }
.segmented.types span { gap: 6px; display: flex; align-items: center; justify-content: center; }
.segmented.types label[data-t="task"] input:checked + span { color: var(--t-task); }
.segmented.types label[data-t="bug"] input:checked + span { color: var(--t-bug); background: var(--danger-soft); }
.segmented.types label[data-t="meeting"] input:checked + span { color: var(--t-meeting); }
.segmented.wrap { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); }

/* ───────── Kiểu xem, thanh sprint ───────── */
.view-switch { display: inline-flex; padding: 3px; gap: 2px; background: var(--column); border: 1px solid var(--border); border-radius: 10px; }
.view-switch button { min-height: 30px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: .8125rem; font-weight: 600; }
.view-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.sprint-bar { display: grid; gap: 10px; padding: 14px 16px; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.sprint-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.sprint-top h2 { font-size: .9375rem; font-weight: 650; }
.sprint-dates { color: var(--muted); font-size: .8125rem; }
.sprint-top .push { margin-left: auto; }
.pill { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-text); font-size: .6875rem; font-weight: 700; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.muted { background: var(--surface-2); color: var(--muted); }
.progress { position: relative; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--done); transition: width .3s; }
.sprint-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8125rem; color: var(--muted); }
.sprint-stats b { color: var(--text); font-weight: 650; }
.sprint-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--muted); font-size: .875rem; }

/* ───────── Hộp thoại phụ ───────── */
.head-actions { display: flex; align-items: center; gap: 4px; }
.sheet.wide { width: min(560px, calc(100vw - 32px)); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.sprint-list { display: grid; gap: 10px; margin-bottom: 18px; }
.sprint-item { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.sprint-item.is-current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.sprint-item-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sprint-item-top b { font-size: .9375rem; }
.sprint-item small { color: var(--muted); font-size: .75rem; }
.sprint-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sprint-close { display: grid; gap: 10px; padding: 14px; margin-bottom: 16px; border: 1px solid var(--warn); background: var(--warn-soft); border-radius: var(--radius-sm); }
.sprint-form { display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.sprint-form h3 { font-size: .9375rem; }
.lightbox .btn { margin-top: 10px; background: rgb(255 255 255 / 10%); color: #fff; border-color: rgb(255 255 255 / 25%); }

/* ───────── Lịch tuần / tháng ───────── */
.calendar { display: grid; gap: 14px; }
.cal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-head h2 { font-size: 1.0625rem; font-weight: 650; letter-spacing: -.01em; margin-right: auto; }
.cal-nav { display: inline-flex; gap: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.cal-dow { padding: 8px 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cal-day { min-width: 0; min-height: 120px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: grid; align-content: start; gap: 4px; }
.cal-grid > :nth-child(7n) { border-right: 0; }
.cal-month .cal-day { min-height: 108px; }
.cal-week .cal-day { min-height: 320px; }
.cal-day.is-other { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.cal-day.is-other .cal-num { color: var(--faint); }
.cal-day.is-today { background: var(--primary-soft); }
.cal-num { display: flex; align-items: center; justify-content: space-between; font-size: .75rem; font-weight: 650; color: var(--muted); padding: 0 2px; }
.cal-day.is-today .cal-num span:first-child { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 999px; background: var(--primary); color: var(--on-primary); }
.cal-add { opacity: 0; border: 0; background: none; color: var(--muted); width: 20px; height: 20px; border-radius: 5px; padding: 0; line-height: 1; }
.cal-day:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-add:hover { background: var(--surface-2); color: var(--text); }
.cal-item { display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0; padding: 3px 6px; border: 0; border-left: 3px solid var(--border-strong); border-radius: 5px; background: var(--surface-2); color: var(--text); font-size: .75rem; font-weight: 550; text-align: left; line-height: 1.35; }
.cal-item:hover { background: color-mix(in srgb, var(--surface-2) 70%, var(--border-strong)); }
.cal-item .icon { width: 13px; height: 13px; flex: none; }
.cal-item .cal-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-week .cal-item .cal-title { white-space: normal; overflow-wrap: anywhere; }
.cal-item time { color: var(--muted); font-weight: 500; flex: none; }
.cal-item.is-high { border-left-color: var(--danger); }
.cal-item.is-low { border-left-color: var(--faint); }
.cal-item.is-late { background: var(--danger-soft); }
.cal-item.is-done { opacity: .6; text-decoration: line-through; }
.cal-item.is-backlog { border-left-style: dashed; }
.cal-item.is-start { background: transparent; border: 1px dashed var(--border-strong); border-left-width: 1px; color: var(--muted); }
.cal-more { border: 0; background: none; padding: 1px 4px; color: var(--primary-text); font-size: .75rem; font-weight: 600; text-align: left; }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; padding: 0 2px; }
.cal-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.cal-dots i.is-high { background: var(--danger); } .cal-dots i.is-done { background: var(--done); }
.cal-nodue { display: grid; gap: 8px; }
.cal-nodue h3 { font-size: .875rem; font-weight: 650; }
.cal-nodue .list { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-nodue .cal-item { width: auto; max-width: 280px; }
@media (max-width: 860px) {
  .view-switch { width: 100%; } .view-switch button { flex: 1; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-week .cal-dow { display: none; }
  .cal-week .cal-day { min-height: 0; border-right: 0; }
  .cal-week .cal-day::before { content: attr(data-label); font-size: .75rem; font-weight: 700; color: var(--muted); }
  .cal-month .cal-day { min-height: 62px; padding: 4px; cursor: pointer; }
  .cal-month .cal-item, .cal-month .cal-more, .cal-month .cal-add { display: none; }
  .cal-month .cal-dots { display: flex; }
  .cal-dow { padding: 6px 2px; text-align: center; font-size: .625rem; }
  .form-row { grid-template-columns: 1fr; }
}

/* ───────── Nút đổi giao diện ───────── */
.topbar-right { display: flex; align-items: center; gap: 6px; }
.theme-btn { width: 38px; height: 38px; border-radius: 999px; }
.theme-btn .icon { width: 19px; height: 19px; }
.theme-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; margin: 4px 2px 8px; background: var(--column); border: 1px solid var(--border); border-radius: 9px; }
.theme-group button { min-height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: .75rem; font-weight: 650; }
.theme-group button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.menu-label { padding: 6px 12px 0; color: var(--faint); font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.count:empty { display: none; }
@media (max-width: 860px) {
  .tab { padding: 0 2px; font-size: .75rem; white-space: nowrap; gap: 5px; }
  .tab .count { min-width: 18px; padding: 0 5px; }
}

/* ───────── API key ───────── */
.key-list { display: grid; gap: 8px; margin: 14px 0; }
.key-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.key-item > div { flex: 1; min-width: 0; }
.key-item b { display: block; font-size: .875rem; overflow-wrap: anywhere; }
.key-item small { color: var(--muted); font-size: .75rem; }
.key-item code, .how-to code { font: 500 .75rem ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.secret-box { display: grid; gap: 8px; margin: 14px 0; padding: 12px 14px; border: 1px solid var(--warn); background: var(--warn-soft); border-radius: var(--radius-sm); }
.secret-box code { display: block; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; font: 600 .8125rem ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; user-select: all; }
.secret-box p { font-size: .8125rem; color: var(--warn); font-weight: 550; }
.how-to { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.how-to summary { cursor: pointer; font-weight: 650; font-size: .875rem; }
.how-to pre { margin: 10px 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow-x: auto; font: 500 .75rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; }
