:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --strip: #e2e5ea;
  --strip-hover: #d3d7de;
  --line: #e3e6eb;
  --line-strong: #cfd4dc;
  --text: #1c2230;
  --muted: #687082;
  --accent: #4338ca;
  --accent-soft: #eef0ff;
  --danger: #c2261d;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 36, 0.06), 0 1px 1px rgba(20, 24, 36, 0.03);
  --shadow-pop: 0 10px 30px rgba(20, 24, 36, 0.16), 0 2px 6px rgba(20, 24, 36, 0.08);
  --font: 'Be Vietnam Pro', 'Noto Sans JP', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

/* Bảng màu trạng thái: mỗi class c-* cấp 3 biến dùng chung */
.c-gray { --fg: #4b5262; --soft: #eef0f3; --solid: #9aa1ae; }
.c-blue { --fg: #1d4ed8; --soft: #e6efff; --solid: #3b82f6; }
.c-violet { --fg: #6d28d9; --soft: #f1eaff; --solid: #8b5cf6; }
.c-green { --fg: #047857; --soft: #e2f6ee; --solid: #10b981; }
.c-amber { --fg: #a35a00; --soft: #fff2dc; --solid: #f59e0b; }
.c-red { --fg: #b91c1c; --soft: #fde8e8; --solid: #ef4444; }
.c-sky { --fg: #0369a1; --soft: #e0f2fe; --solid: #38bdf8; }
.c-teal { --fg: #0f766e; --soft: #ddf6f2; --solid: #14b8a6; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 600; }
h2 small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.pad { padding: 8px 10px; }
body:not(.demo) .demo-only { display: none !important; }

/* ---------- Controls */
input, select, textarea {
  border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface);
  padding: 6px 9px; min-height: 32px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly] { background: var(--bg); color: var(--muted); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
label small { font-weight: 400; }
label > input, label > select, label > textarea { color: var(--text); font-size: 14px; font-weight: 400; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 7px;
  padding: 6px 14px; min-height: 32px; font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--bg); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #3730a3; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(20, 24, 36, .06); }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn.danger:hover { background: #fde8e8; }
.btn.sm { min-height: 28px; padding: 3px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.icon-btn { border: 0; background: transparent; cursor: pointer; color: var(--muted); border-radius: 6px; width: 26px; height: 26px; display: inline-grid; place-items: center; }
.icon-btn:hover { background: rgba(20, 24, 36, .07); color: var(--text); }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 13px; }
.link:hover { text-decoration: underline; }

.badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--fg); background: var(--soft); white-space: nowrap; }
.tag { display: inline-block; padding: 0 6px; border-radius: 5px; font-size: 11px; font-weight: 600; background: #eef0f3; color: #4b5262; letter-spacing: .02em; }
.tag.cust { background: #e6efff; color: #1d4ed8; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: #fff; }
.count.red { background: #ef4444; }
.count.blue { background: #3b82f6; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--solid); margin-right: 5px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 2px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; }

.avatar {
  --s: 22px; width: var(--s); height: var(--s); flex: none; border-radius: 50%; color: #fff;
  display: inline-grid; place-items: center; font-size: calc(var(--s) * .42); font-weight: 700; letter-spacing: -.02em;
}
.avatar.unassigned { background: #e7e9ee; color: #9aa1ae; }

.status-select {
  border-color: transparent; background-color: var(--soft); color: var(--fg); font-weight: 600; font-size: 12.5px;
  min-height: 28px; padding: 2px 6px; border-radius: 7px; cursor: pointer;
}
.status-select:hover { border-color: var(--solid); }

/* ---------- Login */
#login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, #e4e7ff, transparent), var(--bg); }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px 28px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 14px; }
.login-card > p { margin: 0; }
.error { color: var(--danger); font-size: 13px; min-height: 1em; margin: 0; }

.brand { display: flex; align-items: center; gap: 8px; font-size: 15px; white-space: nowrap; }
.brand.big { font-size: 20px; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: #fff; display: inline-grid; place-items: center; font-size: 15px; }
.brand.big .logo { width: 34px; height: 34px; font-size: 19px; }

/* ---------- Topbar & tab kiểu Chrome */
#app { height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: flex-end; gap: 6px; background: var(--strip); padding: 6px 10px 0; min-height: 44px; position: relative; z-index: 10; }
.topbar .brand { align-self: center; padding: 0 8px 6px 2px; }
.tabstrip { display: flex; align-items: flex-end; min-width: 0; flex: 0 1 auto; overflow-x: auto; scrollbar-width: none; }
.tabstrip::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: flex; align-items: center; gap: 8px; flex: 0 1 220px; min-width: 64px; height: 36px;
  padding: 0 8px 0 12px; border-radius: 9px 9px 0 0; cursor: default; user-select: none; color: #3d4352; font-size: 13px;
}
.tab:not(.active):hover { background: var(--strip-hover); }
.tab:not(.active) + .tab:not(.active)::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 1px; background: #b9bfc9; }
.tab.active { background: var(--bg); color: var(--text); font-weight: 500; }
.tab.active::before, .tab.active::after { content: ''; position: absolute; bottom: 0; width: 10px; height: 10px; background: transparent; }
.tab.active::before { left: -10px; border-bottom-right-radius: 9px; box-shadow: 4px 4px 0 4px var(--bg); }
.tab.active::after { right: -10px; border-bottom-left-radius: 9px; box-shadow: -4px 4px 0 4px var(--bg); }
.tab-icon { color: var(--muted); font-size: 13px; }
.tab.active .tab-icon { color: var(--accent); }
.tab-title { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tab-close { border: 0; background: transparent; width: 20px; height: 20px; border-radius: 50%; font-size: 10px; color: var(--muted); cursor: pointer; flex: none; display: grid; place-items: center; }
.tab-close:hover { background: rgba(0, 0, 0, .1); color: var(--text); }
.new-tab-wrap { position: relative; align-self: center; margin-bottom: 4px; }
.new-tab { width: 28px; height: 28px; border-radius: 50%; border: 0; background: transparent; font-size: 19px; line-height: 1; cursor: pointer; color: #3d4352; }
.new-tab:hover { background: var(--strip-hover); }
.demo-badge { align-self: center; margin: 0 0 6px auto; font-size: 11px; font-weight: 700; color: #a35a00; background: #fff2dc; padding: 2px 8px; border-radius: 999px; }
.user-wrap { position: relative; align-self: center; margin: 0 0 4px auto; }
.demo-badge + .user-wrap { margin-left: 8px; }
.user-btn { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 3px 8px 3px 3px; border-radius: 999px; cursor: pointer; }
.user-btn:hover { background: var(--strip-hover); }
.user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

.dropdown { position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 6px; z-index: 50; }
.dropdown.right { left: auto; right: 0; min-width: 200px; }
.dropdown button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown button:hover { background: var(--bg); }
.dropdown input { width: 100%; margin-bottom: 4px; }
#new-tab-menu { width: 360px; }
.dd-sep { height: 1px; background: var(--line); margin: 6px 0; }

#views { flex: 1; overflow: auto; }
.view { min-height: 100%; }
.loading { padding: 80px 16px; text-align: center; color: var(--muted); }

/* ---------- Layout trang */
.page { padding: 18px 20px 40px; max-width: 1600px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.page.narrow { max-width: 1100px; }
.page.full { max-width: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.note { background: #fffbeb; border: 1px solid #fde9b8; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 8px 0 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ---------- KPI */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.kpi { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.kpi:hover { border-color: var(--line-strong); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.kpi-value small { font-size: 14px; color: var(--muted); font-weight: 500; }
.kpi-sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi.warn .kpi-value { color: var(--danger); }
.bar { flex: 1; height: 6px; border-radius: 3px; background: #eef0f3; overflow: hidden; }
.bar i { display: block; height: 100%; background: #10b981; }

/* ---------- Overview */
.page.overview { padding-bottom: 18px; }
.overview-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 2.2fr); gap: 16px; align-items: stretch; }
.daily-card { display: flex; flex-direction: column; }
.daily-scroll { flex: 1; position: relative; min-height: 240px; }
.daily-scroll > div { position: absolute; inset: 0; overflow-y: auto; scrollbar-width: thin; margin-right: -8px; padding-right: 8px; }
.daily-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.daily-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); text-decoration: none; }
.daily-link:hover { border-color: var(--accent); background: #f7f8ff; }
.dl-date { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dl-url { grid-column: 1; font: 12px var(--mono, monospace); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-open { grid-column: 2; grid-row: 1 / 3; font-size: 16px; color: var(--muted); }
.daily-link:hover .dl-open, .daily-link.today .dl-open { color: var(--accent); }
.daily-link.today { border-color: var(--accent); background: #f5f6ff; box-shadow: inset 3px 0 0 var(--accent); padding: 12px 14px; }
.daily-link.today .dl-date { font-size: 14px; }
.daily-link.today .dl-url { color: var(--accent); }

.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-dow { font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fafbfc; }
.cal-day { height: 64px; padding: 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-day:hover { background: #fafbff; }
.cal-day.weekend { background: #fbfbfc; }
.cal-day.out .cal-num { color: #b5bac4; }
.cal-num { font-size: 12px; font-weight: 600; width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--accent); color: #fff; }
.cal-evs { display: flex; flex-direction: column; gap: 2px; min-height: 0; flex: 1; overflow-y: auto; scrollbar-width: thin; }
.cal-ev { display: block; font-size: 11px; padding: 1px 5px; border-radius: 4px; background: var(--soft); color: var(--fg); border-left: 3px solid var(--solid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-ev:hover { filter: brightness(.96); }
.cal-ev b { font-weight: 600; }

/* ---------- Screens */
.summary-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.status-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.status-chip { border: 1px solid transparent; background: var(--soft); color: var(--fg); border-radius: 999px; padding: 3px 12px; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.status-chip b { margin-left: 4px; }
.status-chip.on { border-color: var(--solid); box-shadow: 0 0 0 2px var(--soft); }
.stacked-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #eef0f3; margin: 12px 0; }
.stacked-bar i { background: var(--solid); }
.env-stats { display: flex; gap: 20px; flex-wrap: wrap; }
.env-stat { display: flex; gap: 6px; align-items: center; font-size: 12px; flex-wrap: wrap; }
.env-stat b { font-size: 12px; margin-right: 2px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { width: 220px; }
.filters select { max-width: 160px; }
.bulk { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--accent-soft); border: 1px solid #d7dbff; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
.bulk label { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; max-height: calc(100vh - 290px); }
.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th { position: sticky; top: 0; z-index: 1; background: #fafbfc; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
.grid th[data-sort] { cursor: pointer; }
.grid th[data-sort]:hover { color: var(--text); }
.grid th.sorted::after { content: ' ↑'; color: var(--accent); }
.grid th.sorted.desc::after { content: ' ↓'; }
.grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr[data-id] { cursor: pointer; }
.grid tbody tr[data-id]:hover { background: #fafbff; }
.grid tbody tr.selected { background: var(--accent-soft); }
.grid .name { min-width: 200px; }
.grid .name span { display: block; font-weight: 500; }
.grid .name small { display: block; color: var(--muted); font-size: 11.5px; }
.grid .w-check { width: 34px; text-align: center; }
.grid input[type=checkbox] { min-height: 0; width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.assignee { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.assignee select { border-color: transparent; background: transparent; min-height: 28px; padding: 2px 4px; max-width: 130px; cursor: pointer; }
.assignee select:hover { border-color: var(--line-strong); }
.env-pill { display: inline-block; min-width: 28px; padding: 1px 7px; border-radius: 5px; font-size: 11px; font-weight: 600; color: var(--fg); background: var(--soft); white-space: nowrap; }
.env-pill.c-gray { background: transparent; color: #b5bac4; }
.grid .env-col { text-align: center; min-width: 90px; padding-left: 4px; padding-right: 4px; }
.page.full .grid .name { min-width: 155px; }
.page.full .grid .assignee select { max-width: 100px; }
.grid td.env-col .env-pill { font-size: 12px; padding: 3px 8px; }
.grid .code-col { min-width: 165px; max-width: 190px; overflow-wrap: anywhere; font-size: 12px; }
.grid .code-col a { display: block; }
.grid .code-col .tag { margin-top: 3px; font-size: 10.5px; }
.status-chips .muted.small { align-self: center; margin-right: 2px; }
.dev-stat { padding-right: 20px; border-right: 1px solid var(--line); }
.dev-stat .status-chip { font-size: 12px; }
.table-foot { font-size: 12px; color: var(--muted); padding-top: 10px; }

/* ---------- Chi tiết màn hình */
.detail-head { display: flex; flex-direction: column; gap: 12px; }
.dh-main { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.dh-controls { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.dh-controls .assignee select { border-color: var(--line-strong); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0; }
.meta div { display: flex; flex-direction: column; }
.meta dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.meta dd { margin: 0; font-size: 13px; font-weight: 500; }
.detail-head .note { margin: 0; display: block; }

.env-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.env-card { border-top: 3px solid var(--solid); display: flex; flex-direction: column; gap: 10px; }
.env-top { display: flex; align-items: center; gap: 8px; }
.env-top b { font-size: 15px; }
.env-top .icon-btn { margin-left: auto; }
.env-card .status-select { align-self: flex-start; }
.env-info { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; }
.env-info dt { font-size: 11px; color: var(--muted); }
.env-info dd { margin: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.seg { display: inline-flex; background: var(--bg); border-radius: 8px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 4px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 500; }
.seg button b { margin-left: 3px; }

.issue { border: 1px solid var(--line); border-radius: 9px; margin-bottom: 8px; }
.issue.open { border-color: var(--line-strong); }
.issue-line { display: flex; align-items: center; gap: 8px; padding: 6px 8px; }
.issue-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; border: 0; background: transparent; text-align: left; cursor: pointer; padding: 2px; }
.issue-title .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.issue-body { padding: 4px 12px 12px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.issue-actions { display: flex; gap: 6px; }
.resolution { background: #ecfdf5; border-radius: 7px; padding: 6px 10px; font-size: 13px; }

.fb-form { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.fb-form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-form-row input:not([type=date]) { flex: 1; min-width: 140px; }
.fb { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.fb-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-content { font-size: 13.5px; }
.fb-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ---------- Cấu hình chung */
.settings-wrap { position: relative; align-self: center; margin: 0 0 4px auto; }
.demo-badge + .settings-wrap { margin-left: 8px; }
.settings-wrap + .user-wrap { margin-left: 4px; }
.settings-btn { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; font-size: 17px; cursor: pointer; color: #3d4352; }
.settings-btn:hover { background: var(--strip-hover); }
.dd-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px 4px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; font-weight: 400; }
label.check input { min-height: 0; width: 16px; height: 16px; accent-color: var(--accent); }
label.check.inline { white-space: nowrap; }
.account-box { border: 1px solid var(--line); background: #fafbfc; border-radius: 9px; padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.account-box p { margin: 0; }
.account-box label:not(.check) { width: 100%; }
input.compact, select.compact { min-height: 28px; padding: 2px 6px; font-size: 12.5px; }
.status-chips.left { margin-left: 0; }
.warn-text { color: var(--danger); font-weight: 500; }

/* ---------- Thành viên */
.role-summary { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.member-cell { display: flex; flex-direction: column; line-height: 1.3; }
.member-cell small { color: var(--muted); font-size: 11.5px; }
.grid tr.inactive td { opacity: .55; }

/* ---------- Sprint */
.sprint-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.sprint-list { position: sticky; top: 0; max-height: calc(100vh - 90px); overflow: auto; padding: 12px; }
.sprint-list .card-head { padding: 4px 4px 0; }
.sp-phase { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 6px 4px; }
.sp-phase:empty { border-top: 1px solid var(--line); margin-top: 8px; padding: 4px 0; }
.sp-item { width: 100%; text-align: left; border: 1px solid transparent; background: transparent; border-radius: 9px; padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.sp-item:hover { background: var(--bg); }
.sp-item.on { background: var(--accent-soft); border-color: #d7dbff; }
.sp-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sp-item-progress { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.sprint-panel { display: flex; flex-direction: column; gap: 12px; }
.sp-head-wrap { display: flex; flex-direction: column; gap: 12px; }
.sp-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sp-head .tools { display: flex; gap: 6px; align-items: flex-start; }
.sp-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; margin-top: 4px; }
.sprint-panel .stacked-bar { margin: 0; }
.sprint-panel .note { margin: 0; }
.sp-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.bulk-inline { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); border-radius: 8px; padding: 4px 8px; font-size: 13px; }
.bulk-inline select { min-height: 28px; padding: 2px 6px; max-width: 240px; }
.picker { border: 1px solid #d7dbff; background: #fafaff; border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.picker-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.picker-tools input { flex: 1; min-width: 200px; }
.picker-list { max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.pick-row { flex-direction: row; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 400; cursor: pointer; }
.pick-row:hover { background: var(--bg); }
.pick-row.head { position: sticky; top: 0; background: #fafbfc; font-weight: 500; z-index: 1; }
.pick-row input { min-height: 0; width: 15px; height: 15px; accent-color: var(--accent); }
.pick-row .mono { flex: none; width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.sprint-banner { display: grid; grid-template-columns: minmax(180px, auto) minmax(0, 1fr) auto; gap: 24px; align-items: center; text-align: left; cursor: pointer; width: 100%; border-left: 4px solid var(--accent); }
.sprint-banner:hover { border-color: var(--line-strong); border-left-color: var(--accent); }
.sb-title { display: flex; flex-direction: column; }
.sb-title b { font-size: 17px; }
.sb-progress { display: flex; flex-direction: column; gap: 8px; }
.sb-progress .stacked-bar { margin: 0; }
.sb-stat { margin-right: 14px; white-space: nowrap; color: var(--muted); }
.sb-stat b { color: var(--text); }
.sb-side { display: flex; flex-direction: column; gap: 4px; text-align: right; white-space: nowrap; }

/* ---------- Modal & toast */
dialog.modal { border: 0; padding: 0; border-radius: 14px; width: min(480px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); color: var(--text); }
dialog.modal.wide { width: min(680px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(20, 24, 36, .35); }
.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 64px); }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.modal-body { padding: 8px 18px 4px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.modal footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px 16px; }
.modal textarea.autosize { resize: vertical; min-height: 120px; max-height: 60vh; line-height: 1.6; }
.modal footer .left { margin-right: auto; }

#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; align-items: flex-end; pointer-events: none; }
.toast { background: #1c2230; color: #fff; padding: 9px 16px; border-radius: 9px; font-size: 13px; box-shadow: var(--shadow-pop); animation: toast-in .2s ease-out; }
.toast.err { background: var(--danger); }
.toast.info { background: #a35a00; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Responsive */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sprint-banner { grid-template-columns: 1fr; gap: 10px; }
  .sb-side { text-align: left; }
  .overview-grid { grid-template-columns: 1fr; }
  .daily-scroll { flex: none; min-height: 0; }
  .daily-scroll > div { position: static; max-height: 260px; }
  .sprint-layout { grid-template-columns: 1fr; }
  .sprint-list { position: static; max-height: 320px; }
}
@media (max-width: 760px) {
  .page { padding: 12px 12px 32px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .env-grid { grid-template-columns: 1fr; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .topbar .brand b, .user-name { display: none; }
  .tab { flex-basis: 140px; min-width: 44px; padding: 0 4px 0 8px; }
  .tab:not(.active) .tab-close { display: none; }
  .rp-sec { grid-template-columns: 1fr; gap: 0; }
  .filters input[type=search] { width: 100%; }
  #new-tab-menu { width: min(360px, calc(100vw - 24px)); }
}
.page.full .grid .status-select { max-width: 160px; }
.grid th.wrap { white-space: normal; }

/* Chuyển ngôn ngữ VI / 日本語 */
.lang-switch { display: inline-flex; align-self: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.lang-switch button { border: 0; background: transparent; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); padding: 3px 9px; cursor: pointer; }
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.topbar .lang-switch { margin: 0 4px 4px auto; }
.topbar .lang-switch + .settings-wrap { margin-left: 4px; }
.login-lang { position: absolute; top: 16px; right: 16px; }
:lang(ja) .grid th.wrap { word-break: keep-all; }
:lang(ja) .filters select { max-width: 200px; }
