/* =====================================================================
   VINUT GIAO VIỆC — UI KIT  (vinut-ui.css)
   Bộ giao diện cho hệ thống giao việc kiểu Redmine, nhận diện Vinut.
   Layout: thanh trên trắng + thanh bên xanh đậm thương hiệu, nội dung
   dạng bảng dữ liệu dày; đỏ Vinut chỉ dùng điểm nhấn (quá hạn, khẩn,
   đường cong logo dưới tiêu đề).
   Quy ước: mọi màu lấy từ token; class tiền tố ngắn, không phụ thuộc
   Bootstrap (có thể dùng song song Bootstrap JS cho modal/dropdown).
   ===================================================================== */

:root {
  /* Thương hiệu (lấy mẫu từ logo) */
  --brand-green: #177e3e;
  --brand-green-strong: #0f5e2d;
  --brand-red: #ed1c24;

  /* Nền & chữ — trung tính ngả xanh lá */
  --bg: #f4f7f4;
  --surface: #ffffff;
  --surface-2: #f8faf8;
  --surface-sunken: #eef3ef;
  --line: #dde6df;
  --line-strong: #c6d3c9;
  --fg: #15241a;
  --fg-2: #33463a;
  --muted: #5d7064;
  --faint: #8a9b90;

  /* Vai trò */
  --accent: var(--brand-green);
  --accent-hover: var(--brand-green-strong);
  --accent-soft: #e4f2e8;
  --accent-ink: #ffffff;
  --mark: var(--brand-red);
  --mark-soft: #fde8e9;

  /* Thanh bên */
  --side-bg: #0f4a26;
  --side-fg: #d8eadd;
  --side-muted: #8fb79b;
  --side-hover: #165c31;
  --side-active: #ffffff;
  --side-active-fg: #0f4a26;

  /* Ngữ nghĩa */
  --ok: #1d8a4a;      --ok-soft: #e3f4e9;
  --warn: #b26a00;    --warn-soft: #fff2dc;
  --danger: #d0161e;  --danger-soft: #fde7e8;
  --info: #1f6aa5;    --info-soft: #e5f0f9;
  --violet: #6a4bb0;  --violet-soft: #eee9f8;
  --slate: #5d6b78;   --slate-soft: #eceff2;

  /* Chữ */
  --font-sans: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;
  --fs-xs: 0.75rem;   /* 12 */
  --fs-sm: 0.8125rem; /* 13 */
  --fs-md: 0.875rem;  /* 14 */
  --fs-lg: 1rem;      /* 16 */
  --fs-xl: 1.25rem;   /* 20 */
  --fs-2xl: 1.625rem; /* 26 */

  /* Hình khối */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(15, 50, 28, .06), 0 1px 1px rgba(15, 50, 28, .04);
  --shadow-2: 0 10px 30px -12px rgba(15, 50, 28, .28), 0 2px 6px rgba(15, 50, 28, .08);
  --focus: 0 0 0 3px rgba(23, 126, 62, .28);

  --topbar-h: 56px;
  --side-w: 248px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-green: #3fb46b; --brand-green-strong: #5cc884; --brand-red: #ff5c61;
    --bg: #0e1511; --surface: #151f18; --surface-2: #19251d; --surface-sunken: #111a14;
    --line: #26362b; --line-strong: #34493a;
    --fg: #e4ece6; --fg-2: #c5d3c9; --muted: #95a99b; --faint: #6f8475;
    --accent-soft: #183823; --accent-ink: #07150c; --mark-soft: #3a1618;
    --side-bg: #0a120d; --side-fg: #c9dccf; --side-muted: #789b83; --side-hover: #142019;
    --side-active: #1c3324; --side-active-fg: #8fe0ab;
    --ok: #4cc27a; --ok-soft: #173622; --warn: #f0a63a; --warn-soft: #3a2a10;
    --danger: #ff5c61; --danger-soft: #3d1618; --info: #6aafe6; --info-soft: #132a3c;
    --violet: #b29cf0; --violet-soft: #271f3d; --slate: #a3b0bc; --slate-soft: #222a31;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 14px 34px -12px rgba(0,0,0,.6);
    --focus: 0 0 0 3px rgba(63, 180, 107, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand-green: #3fb46b; --brand-green-strong: #5cc884; --brand-red: #ff5c61;
  --bg: #0e1511; --surface: #151f18; --surface-2: #19251d; --surface-sunken: #111a14;
  --line: #26362b; --line-strong: #34493a;
  --fg: #e4ece6; --fg-2: #c5d3c9; --muted: #95a99b; --faint: #6f8475;
  --accent-soft: #183823; --accent-ink: #07150c; --mark-soft: #3a1618;
  --side-bg: #0a120d; --side-fg: #c9dccf; --side-muted: #789b83; --side-hover: #142019;
  --side-active: #1c3324; --side-active-fg: #8fe0ab;
  --ok: #4cc27a; --ok-soft: #173622; --warn: #f0a63a; --warn-soft: #3a2a10;
  --danger: #ff5c61; --danger-soft: #3d1618; --info: #6aafe6; --info-soft: #132a3c;
  --violet: #b29cf0; --violet-soft: #271f3d; --slate: #a3b0bc; --slate-soft: #222a31;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 14px 34px -12px rgba(0,0,0,.6);
  --focus: 0 0 0 3px rgba(63, 180, 107, .35);
  color-scheme: dark;
}

/* ---------- Nền tảng ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; text-wrap: balance; color: var(--fg); }
h1 { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-xl); font-weight: 650; }
h3 { font-size: var(--fs-lg); font-weight: 600; }
h4 { font-size: var(--fs-md); font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.mono, code, kbd { font-family: var(--font-mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.eyebrow { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Khung ứng dụng ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-rows: var(--topbar-h) 1fr; min-height: 100%; }
.topbar {
  grid-column: 1 / -1; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 40; background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 34px; width: auto; display: block; }
:root[data-theme="dark"] .brand-logo-wrap { background: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-logo-wrap { background: #fff; } }
.brand-logo-wrap { border-radius: 8px; padding: 2px 6px; display: inline-flex; }
.brand-name { display: flex; flex-direction: column; line-height: 1.1; border-left: 1px solid var(--line); padding-left: 10px; }
.brand-name b { font-size: var(--fs-md); font-weight: 700; }
.brand-name span { font-size: var(--fs-xs); color: var(--muted); }
.topbar-search { flex: 1; max-width: 460px; margin-left: 12px; position: relative; }
.topbar-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.topbar-search input[type="search"] { padding-left: 34px; background: var(--surface-sunken); border-color: transparent; }
.topbar-search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--mark); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; font: inherit; }
.user-chip .who { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-chip .who b { font-size: var(--fs-sm); font-weight: 600; }
.user-chip .who span { font-size: var(--fs-xs); color: var(--muted); }

.side { background: var(--side-bg); color: var(--side-fg); padding: 14px 10px 24px; overflow-y: auto; position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); }
.side-section { display: grid; gap: 2px; margin-bottom: 18px; }
.side-title { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--side-muted); padding: 6px 10px; font-weight: 600; }
.side a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-fg); font-weight: 500; }
.side a:hover { background: var(--side-hover); text-decoration: none; }
.side a.active { background: var(--side-active); color: var(--side-active-fg); font-weight: 650; }
.side a .count { margin-left: auto; font-size: 11px; font-weight: 600; background: rgba(255,255,255,.12); padding: 1px 7px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.side a.active .count { background: var(--accent-soft); color: var(--accent); }
.side a .count.hot { background: var(--brand-red); color: #fff; }
.side-project { margin: 0 4px 16px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.side-project .eyebrow { color: var(--side-muted); }
.side-project b { display: block; color: #fff; margin-top: 2px; }
.side-project .scope { margin-top: 6px; }

.main { min-width: 0; padding-block: 22px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.main-inner { max-width: 1280px; margin: 0 auto; display: grid; gap: 18px; }
.btn.nav-toggle { display: none; }
.scrim { display: none; }
.side { grid-column: 1; grid-row: 2; }
.main { grid-column: 2; grid-row: 2; }

@media (min-width: 1100px) { .main { padding-left: 28px; padding-right: 28px; } }
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .main { grid-column: 1; }
  .side { position: fixed; left: 0; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); bottom: 0; width: min(300px, 86vw); height: auto; z-index: 25; transform: translateX(-102%); transition: transform .2s ease; padding-left: max(10px, env(safe-area-inset-left, 0px)); box-shadow: var(--shadow-2); }
  .app.nav-open .side { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(5, 20, 10, .4); z-index: 20; }
  .btn.nav-toggle { display: inline-flex; }
  .brand-name { display: none; }
  .topbar-search { display: none; }
  .user-chip .who { display: none; }
}

/* ---------- Tiêu đề trang ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.page-head .titles { display: grid; gap: 4px; min-width: 0; flex: 1 1 320px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--faint); }
/* Đường cong lấy từ logo Vinut, đặt dưới tiêu đề trang */
.swoosh { display: block; width: 72px; height: 8px; margin-top: 4px; }
.swoosh path { fill: none; stroke: var(--brand-green); stroke-width: 3; stroke-linecap: round; }
.swoosh path + path { stroke: var(--brand-red); }

/* ---------- Thanh module dự án ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 12px; color: var(--muted); font-weight: 550; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--fg); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Nút ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg); font: inherit; font-weight: 600; font-size: var(--fs-md); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); border-color: var(--faint); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn-ghost:hover { background: var(--surface-sunken); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); }
.btn-lg { height: 44px; padding: 0 20px; font-size: var(--fs-lg); }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn.is-loading::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.btn-group .btn.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); z-index: 1; }

/* ---------- Biểu mẫu ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 600; color: var(--fg-2); }
.req::after { content: " *"; color: var(--mark); }
.input, .select, .textarea, input[type="text"], input:not([type]), input[type="password"], input[type="search"], input[type="email"], input[type="date"], input[type="number"], input[type="url"], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg); font: inherit; font-size: var(--fs-md);
}
textarea, .textarea { height: auto; min-height: 120px; padding: 10px 12px; line-height: 1.55; resize: vertical; }
select, .select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[readonly], .is-readonly { background: var(--surface-sunken); color: var(--fg-2); }
.hint { font-size: var(--fs-xs); color: var(--muted); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field-error { font-size: var(--fs-xs); color: var(--danger); font-weight: 500; display: flex; gap: 5px; align-items: center; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 680px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: var(--fs-md); }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.input-group { display: flex; }
.input-group input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group .btn { border-radius: 0 var(--r-sm) var(--r-sm) 0; margin-left: -1px; height: 38px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding-top: 16px; border-top: 1px solid var(--line); }

/* Lựa chọn dạng thẻ (chế độ hiển thị, cấp phạm vi) */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.choice { position: relative; display: grid; gap: 4px; padding: 12px 14px 12px 40px; border: 1px solid var(--line-strong); border-radius: var(--r-md); cursor: pointer; background: var(--surface); }
.choice input { position: absolute; left: 14px; top: 15px; accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.choice b { font-size: var(--fs-md); }
.choice span { font-size: var(--fs-xs); color: var(--muted); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }

/* ---------- Khối nội dung ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h3 { flex: 1; min-width: 0; }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.with-aside { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .with-aside { grid-template-columns: minmax(0, 1fr); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* Ô số liệu (chỉ dùng ở Trang của tôi / dashboard) */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 14px 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 2px; color: var(--fg); }
.kpi:hover { text-decoration: none; border-color: var(--line-strong); }
.kpi .val { font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi .lbl { font-size: var(--fs-sm); color: var(--muted); }
.kpi.is-alert { border-color: color-mix(in srgb, var(--mark) 35%, var(--line)); background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box; }
.kpi.is-alert .val { color: var(--mark); }

/* ---------- Nhãn trạng thái ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; background: var(--slate-soft); color: var(--slate); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.st-new { background: var(--info-soft); color: var(--info); }
.st-progress { background: var(--warn-soft); color: var(--warn); }
.st-resolved { background: var(--ok-soft); color: var(--ok); }
.st-feedback { background: var(--violet-soft); color: var(--violet); }
.st-closed { background: var(--slate-soft); color: var(--slate); }
.st-rejected { background: var(--slate-soft); color: var(--slate); text-decoration: line-through; }

/* Mức ưu tiên: vạch đứng đặt đầu dòng */
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 550; white-space: nowrap; }
.prio i { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.prio i b { width: 3px; border-radius: 1px; background: var(--line-strong); }
.prio i b:nth-child(1) { height: 5px; } .prio i b:nth-child(2) { height: 8px; } .prio i b:nth-child(3) { height: 12px; }
.pr-low i b:nth-child(1) { background: var(--slate); }
.pr-normal i b:nth-child(-n+2) { background: var(--accent); }
.pr-high i b { background: var(--warn); }
.pr-urgent i b, .pr-immediate i b { background: var(--mark); }
.pr-urgent, .pr-immediate { color: var(--mark); }

.tracker { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: .02em; border: 1px solid var(--line-strong); color: var(--fg-2); background: var(--surface-2); white-space: nowrap; }
.tracker.bug { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.tracker.feature { color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, var(--line)); }
.tracker.task { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }

/* Phạm vi tổ chức: ký hiệu cấp + tên */
.scope { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 24px; padding: 0 8px 0 3px; border-radius: 6px; background: var(--accent-soft); color: var(--fg); font-size: var(--fs-xs); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope .lv { display: inline-grid; place-items: center; height: 18px; min-width: 24px; padding: 0 4px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: .03em; background: var(--accent); color: var(--accent-ink); }
.scope.lv-sys .lv { background: var(--brand-red); color: #fff; }
.scope.lv-sys { background: var(--mark-soft); }
.scope.lv-kv .lv { background: color-mix(in srgb, var(--accent) 80%, #1f6aa5); }
.scope.is-inactive { opacity: .6; text-decoration: line-through; }
.side .scope { background: rgba(255,255,255,.1); color: var(--side-fg); }
.vis { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--muted); font-weight: 550; white-space: nowrap; }
.vis .icon { width: 14px; height: 14px; }

.orgpath { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: var(--fs-sm); color: var(--fg-2); }
.orgpath span { white-space: nowrap; }
.orgpath .sep { color: var(--faint); }
.orgpath .missing { color: var(--warn); font-style: italic; }

/* Ảnh đại diện chữ cái */
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.avatar.unit { border-radius: 7px; background: var(--surface-sunken); color: var(--fg-2); border-color: var(--line-strong); }
.avatar.gone { background: var(--slate-soft); color: var(--slate); border-style: dashed; }
.person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.person .nm { display: grid; line-height: 1.2; min-width: 0; }
.person .nm b { font-weight: 600; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .nm span { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Thanh tiến độ */
.progress { position: relative; height: 6px; border-radius: 99px; background: var(--surface-sunken); overflow: hidden; min-width: 60px; }
.progress > i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: inherit; }
.progress-row { display: flex; align-items: center; gap: 8px; }
.progress-row .num { font-size: var(--fs-xs); color: var(--muted); width: 34px; text-align: right; }

/* Ngày: quá hạn / sắp đến hạn */
.due { font-variant-numeric: tabular-nums; white-space: nowrap; }
.due.over { color: var(--mark); font-weight: 650; }
.due.soon { color: var(--warn); font-weight: 600; }

/* ---------- Bảng dữ liệu ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
.tbl th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.sortable { cursor: pointer; }
.tbl th.sorted { color: var(--accent); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tbody tr.is-selected td { background: var(--accent-soft); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .c-check { width: 36px; }
.tbl .c-id { width: 72px; font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--muted); }
.tbl .c-num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .subject { font-weight: 550; color: var(--fg); }
.tbl .subject:hover { color: var(--accent); }
.tbl .sub { display: block; font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.tbl tr.group td { background: var(--surface-sunken); font-weight: 650; font-size: var(--fs-sm); color: var(--fg-2); padding: 7px 12px; }
.tbl tr.group td .muted { font-weight: 500; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line-strong); border-bottom: 0; }
.tbl .child td:nth-child(3) { padding-left: 28px; }
.tbl .child .subject::before { content: "↳ "; color: var(--faint); }

/* Bảng thành thẻ trên điện thoại: thêm class .tbl-cards và data-label cho td */
@media (max-width: 720px) {
  .tbl-cards thead { display: none; }
  .tbl-cards, .tbl-cards tbody, .tbl-cards tr, .tbl-cards td { display: block; width: 100%; }
  .tbl-cards tbody tr { border: 1px solid var(--line); border-radius: var(--r-md); margin: 10px; width: auto; background: var(--surface); padding: 6px 0; }
  .tbl-cards tbody tr:hover td { background: transparent; }
  .tbl-cards td { border: 0; padding: 5px 14px; display: flex; gap: 12px; justify-content: space-between; align-items: center; text-align: right; }
  .tbl-cards td[data-label]::before { content: attr(data-label); font-size: var(--fs-xs); color: var(--muted); font-weight: 600; text-align: left; flex: none; }
  .tbl-cards td.c-main { display: block; text-align: left; padding-top: 8px; }
  .tbl-cards td.c-main::before { display: none; }
  .tbl-cards td.c-check { display: none; }
  .tbl-cards tr.group { border: 0; background: transparent; margin: 14px 10px 0; padding: 0; }
  .tbl-cards tr.group td { background: transparent; padding: 0 4px; }
  .tbl-cards tfoot { display: block; }
  .tbl-cards tfoot tr { display: flex; justify-content: space-between; padding: 0 10px; }
  .tbl-cards .child td:nth-child(3) { padding-left: 14px; }
}

/* Bảng ma trận báo cáo giờ công */
.matrix td, .matrix th { text-align: right; font-variant-numeric: tabular-nums; }
.matrix td:first-child, .matrix th:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.matrix th:first-child { background: var(--surface-2); z-index: 2; }
.matrix .lvl-1 td:first-child { font-weight: 700; }
.matrix .lvl-2 td:first-child { padding-left: 26px; }
.matrix .lvl-3 td:first-child { padding-left: 42px; color: var(--fg-2); }
.heat { position: relative; }
.heat span { position: relative; z-index: 1; }
.heat::before { content: ""; position: absolute; inset: 4px 3px; border-radius: 4px; background: var(--accent); opacity: var(--h, 0); }

/* ---------- Bộ lọc ---------- */
.filters { display: grid; gap: 12px; }
.filter-row { display: grid; grid-template-columns: 180px 150px minmax(0, 1fr) 32px; gap: 8px; align-items: center; }
.filter-row .k { font-weight: 600; font-size: var(--fs-sm); display: flex; gap: 8px; align-items: center; }
@media (max-width: 720px) { .filter-row { grid-template-columns: minmax(0, 1fr) 32px; } .filter-row .k { grid-column: 1 / -1; } .filter-row select.op { grid-column: 1 / -1; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 10px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); font-size: var(--fs-sm); color: var(--fg-2); }
.chip b { color: var(--fg); font-weight: 600; }
.chip button { border: 0; background: transparent; color: var(--faint); cursor: pointer; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.chip button:hover { background: var(--surface-sunken); color: var(--fg); }
.chip.org { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--accent-soft); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .spacer { flex: 1; }

/* ---------- Cây tổ chức / OrgPicker ---------- */
.tree { list-style: none; margin: 0; padding: 0; font-size: var(--fs-md); }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 20px; border-left: 1px dashed var(--line-strong); margin-left: 13px; }
.tree li { margin: 0; }
.tree .node { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; min-width: 0; }
.tree .node:hover { background: var(--surface-2); }
.tree .node .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .node .code { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--faint); }
.tree .node .meta { margin-left: auto; display: flex; gap: 6px; align-items: center; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.tree .node.is-selected { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.tree .node.is-inactive .name { color: var(--faint); text-decoration: line-through; }
.tree .node.is-disabled { opacity: .5; pointer-events: none; }
.tree .twisty { width: 18px; height: 18px; display: grid; place-items: center; color: var(--muted); flex: none; border: 0; background: none; padding: 0; cursor: pointer; }
.tree .lvtag { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: var(--surface-sunken); color: var(--fg-2); flex: none; letter-spacing: .03em; }
.tree .lvtag.ct { background: var(--accent); color: var(--accent-ink); }
.tree .lvtag.kv { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--accent); }
.tree .lvtag.other { background: var(--warn-soft); color: var(--warn); }

.picker { position: relative; }
.picker-trigger { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 38px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.picker-trigger .orgpath { flex: 1; min-width: 0; }
.picker-pop { margin-top: 6px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-2); overflow: hidden; }
.picker-pop .search { padding: 10px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.picker-pop .tree { max-height: 290px; overflow: auto; padding: 8px; }
.picker-pop .foot { display: flex; align-items: center; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }

/* ---------- Thông báo ---------- */
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid; font-size: var(--fs-md); align-items: flex-start; }
.alert .icon { margin-top: 1px; }
.alert b { font-weight: 650; }
.alert-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--fg); }
.alert-info .icon { color: var(--info); }
.alert-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--fg); }
.alert-warn .icon { color: var(--warn); }
.alert-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--fg); }
.alert-danger .icon { color: var(--danger); }
.alert-success { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--fg); }
.alert-success .icon { color: var(--ok); }

.toast-stack { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; z-index: 60; width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--fg); color: var(--bg); box-shadow: var(--shadow-2); font-size: var(--fs-md); animation: toast-in .2s ease; }
.toast .icon { color: var(--brand-green); }
:root[data-theme="dark"] .toast .icon { color: #1a7a3c; }
.toast.err .icon { color: var(--brand-red); }
@keyframes toast-in { from { transform: translateY(8px); opacity: .4; } }

/* Trạng thái rỗng / đang tải / lỗi */
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 40px 20px; color: var(--muted); }
.empty .ill { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty .ill .icon { width: 26px; height: 26px; }
.empty h4 { color: var(--fg); }
.empty p { max-width: 42ch; }
.empty.is-error .ill { background: var(--danger-soft); color: var(--danger); }
.skel { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--line) 50%, var(--surface-sunken) 75%); background-size: 200% 100%; animation: skel 1.3s ease infinite; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Chi tiết công việc ---------- */
.issue-head { display: grid; gap: 10px; }
.issue-head .ids { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.attrs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.attrs .a { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.attrs .a dt { color: var(--muted); font-size: var(--fs-sm); }
.attrs .a dd { margin: 0; min-width: 0; }
@media (max-width: 720px) { .attrs { grid-template-columns: minmax(0, 1fr); } .attrs .a { grid-template-columns: 120px minmax(0, 1fr); } }
.prose { max-width: 72ch; color: var(--fg); line-height: 1.65; }
.prose p + p, .prose ul, .prose p + ul { margin-top: 10px; }
.prose ul { padding-left: 20px; }
.prose code { background: var(--surface-sunken); padding: 1px 5px; border-radius: 4px; }
.prose a.ref { font-family: var(--font-mono); font-size: .92em; }
.timeline { display: grid; gap: 0; }
.entry { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }
.entry:first-child { border-top: 0; }
.entry .who { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.entry .who b { font-weight: 650; }
.entry .when { font-size: var(--fs-xs); color: var(--muted); }
.entry .no { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--faint); }
.changes { list-style: none; margin: 8px 0 0; padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 4px; font-size: var(--fs-sm); color: var(--fg-2); }
.changes .old { text-decoration: line-through; color: var(--faint); }
.changes .arrow { color: var(--faint); margin: 0 4px; }
.entry.private { background: repeating-linear-gradient(-45deg, transparent 0 8px, var(--surface-2) 8px 16px); }
.note-body { margin-top: 8px; }
.files { display: grid; gap: 6px; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); min-width: 0; }
.file .fn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.file .sz { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); padding: 18px; text-align: center; color: var(--muted); background: var(--surface-2); }
.dropzone b { color: var(--accent); }
.kv-list { display: grid; gap: 8px; font-size: var(--fs-sm); }
.kv-list > div { display: flex; justify-content: space-between; gap: 10px; }
.kv-list dt { color: var(--muted); }
.kv-list dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.source-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.source { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--surface-sunken); color: var(--fg-2); border: 1px solid var(--line); white-space: nowrap; }

/* ---------- Phân trang ---------- */
.pager { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0 8px; border-radius: var(--r-sm); color: var(--fg-2); font-weight: 550; font-variant-numeric: tabular-nums; }
.pager a:hover { background: var(--surface-sunken); text-decoration: none; }
.pager .cur { background: var(--accent); color: var(--accent-ink); }

/* ---------- Hộp thoại ---------- */
.modal-demo { position: relative; border-radius: var(--r-lg); background: color-mix(in srgb, var(--fg) 35%, transparent); padding: 28px 16px; display: grid; place-items: center; }
.modal { width: min(520px, 100%); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); border: 1px solid var(--line); overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { flex: 1; }
.modal-body { padding: 18px; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; background: var(--surface-2); border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- Đăng nhập ---------- */
.auth { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-art { position: relative; background: var(--side-bg); color: #e6f2ea; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.auth-art .arc { position: absolute; left: -10%; right: -10%; bottom: -36%; height: 70%; border-radius: 50% 50% 0 0 / 60% 60% 0 0; border-top: 10px solid var(--brand-green); opacity: .9; }
.auth-art .arc.r { bottom: -40%; border-top-color: var(--brand-red); border-top-width: 4px; opacity: .8; }
.auth-art h2 { color: #fff; font-size: 2rem; max-width: 16ch; line-height: 1.2; }
.auth-art p { color: #b9d5c2; max-width: 44ch; margin-top: 12px; }
.auth-art .levels { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 28px; position: relative; z-index: 1; }
.auth-art .levels span { padding: 6px 10px; border-radius: 99px; border: 1px solid rgba(255,255,255,.2); font-size: var(--fs-sm); color: #dcebe1; }
.auth-art .levels span b { color: #fff; }
.auth-form { display: grid; place-items: center; padding-block: 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); background: var(--bg); }
.auth-card { width: min(400px, 100%); display: grid; gap: 18px; }
.auth-card .logo { height: 64px; width: auto; justify-self: start; }
@media (max-width: 860px) { .auth { grid-template-columns: minmax(0, 1fr); } .auth-art { display: none; } }

/* ---------- Tiện ích ---------- */
.mt-0 { margin-top: 0; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.hide-sm { }
@media (max-width: 720px) { .hide-sm { display: none !important; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--fs-xs); color: var(--muted); }
.swatch { display: grid; gap: 6px; }
.swatch i { display: block; height: 44px; border-radius: 8px; border: 1px solid var(--line); }
.swatch b { font-size: var(--fs-sm); }
.swatch code { font-size: var(--fs-xs); color: var(--muted); }

/* =====================================================================
   v3 — QUẢN TRỊ & CÁC MÀN HÌNH BỔ SUNG
   ===================================================================== */

/* Công tắc bật/tắt (dùng cho bool trong cài đặt) */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-md); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 38px; height: 22px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }

/* Khung cài đặt: menu tab dọc + nội dung */
.settings { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.settings-nav { display: grid; gap: 2px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--fg-2); font-weight: 550; }
.settings-nav a:hover { background: var(--surface-sunken); text-decoration: none; }
.settings-nav a.active { background: var(--accent-soft); color: var(--accent); }
.settings-nav a .mark { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--warn); }
@media (max-width: 900px) {
  .settings { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .settings-nav a { white-space: nowrap; }
}
/* Một dòng cài đặt: nhãn + mô tả bên trái, điều khiển bên phải */
.setting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 8px 24px; padding: 14px 18px; border-bottom: 1px solid var(--line); align-items: center; }
.setting:last-child { border-bottom: 0; }
.setting .s-label { display: grid; gap: 3px; min-width: 0; }
.setting .s-label b { font-weight: 600; }
.setting .s-label .key { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.setting .s-label p { font-size: var(--fs-sm); color: var(--muted); max-width: 60ch; }
.setting .s-ctrl { display: flex; align-items: center; gap: 8px; justify-content: flex-end; min-width: 0; }
.setting .s-ctrl > input, .setting .s-ctrl > select { max-width: 100%; }
.setting.is-changed { box-shadow: inset 3px 0 0 var(--warn); }
.changed-tag { font-size: 11px; font-weight: 650; color: var(--warn); background: var(--warn-soft); padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.secret { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); color: var(--muted); }
@media (max-width: 680px) { .setting { grid-template-columns: minmax(0, 1fr); } .setting .s-ctrl { justify-content: flex-start; } }
.sticky-save { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--r-md); background: var(--fg); color: var(--bg); box-shadow: var(--shadow-2); }
.sticky-save .btn { border-color: transparent; }
.sticky-save .btn-ghost { color: var(--bg); }
.sticky-save .btn-ghost:hover { background: rgba(255,255,255,.12); }

/* Lưới lối vào quản trị */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.admin-tile { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 4px 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--fg); align-items: start; }
.admin-tile:hover { border-color: var(--accent); text-decoration: none; }
.admin-tile .ti { grid-row: span 2; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.admin-tile b { font-weight: 650; }
.admin-tile span { font-size: var(--fs-xs); color: var(--muted); }
.admin-tile.warn .ti { background: var(--warn-soft); color: var(--warn); }
.attention { display: grid; gap: 0; }
.attention > div { display: flex; gap: 10px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: var(--fs-md); flex-wrap: wrap; }
.attention > div:last-child { border-bottom: 0; }
.attention .sev { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.attention .sev.hi { background: var(--danger); }
.attention a { margin-left: auto; font-size: var(--fs-sm); }

/* Ma trận checkbox (quyền × vai trò, workflow) */
.mx { border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); min-width: 100%; }
.mx th, .mx td { border-bottom: 1px solid var(--line); padding: 7px 10px; text-align: center; white-space: nowrap; }
.mx thead th { background: var(--surface-2); font-size: var(--fs-xs); font-weight: 650; color: var(--fg-2); position: sticky; top: 0; z-index: 2; }
.mx th:first-child, .mx td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.mx thead th:first-child { background: var(--surface-2); z-index: 3; }
.mx tbody tr:hover td { background: var(--surface-2); }
.mx tr.grp td { background: var(--surface-sunken); font-weight: 700; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.mx input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.mx .code { display: block; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.mx td.diag { background: repeating-linear-gradient(-45deg, var(--surface-sunken) 0 4px, transparent 4px 8px); }
.mx .col-all { font-size: 10px; display: block; color: var(--accent); font-weight: 600; cursor: pointer; }
/* Ô workflow 3 lớp: A = mọi lúc, T = khi là tác giả, G = khi là người được giao */
.wf { display: inline-flex; gap: 3px; }
.wf label { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line-strong); font-size: 10px; font-weight: 700; color: var(--faint); cursor: pointer; background: var(--surface); }
.wf input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wf label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.wf label.t:has(input:checked) { background: var(--info); border-color: var(--info); color: #fff; }
.wf label.g:has(input:checked) { background: var(--violet); border-color: var(--violet); color: #fff; }
.wf label:has(input:focus-visible) { box-shadow: var(--focus); }
.rule { font-size: 11px; font-weight: 650; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.rule.ro { background: var(--slate-soft); color: var(--slate); border-color: transparent; }
.rule.rq { background: var(--mark-soft); color: var(--mark); border-color: transparent; }

/* Danh sách kéo thả (enumeration, vai trò, giá trị custom field) */
.sortable-list { list-style: none; margin: 0; padding: 0; }
.sortable-list li { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sortable-list li:last-child { border-bottom: 0; }
.sortable-list .grip { cursor: grab; color: var(--faint); letter-spacing: -2px; font-weight: 700; user-select: none; }
.sortable-list .nm { font-weight: 600; flex: 1 1 160px; min-width: 0; }
.sortable-list .tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.sortable-list li.is-off .nm { color: var(--faint); text-decoration: line-through; }

/* Lộ trình (Roadmap) */
.version { display: grid; gap: 10px; padding: 18px; border-bottom: 1px solid var(--line); }
.version:last-child { border-bottom: 0; }
.version .vh { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; }
.version .vh h3 { font-size: var(--fs-lg); }
.version .bar { height: 10px; border-radius: 99px; background: var(--surface-sunken); overflow: hidden; display: flex; }
.version .bar i { display: block; height: 100%; }
.version .bar i.done { background: var(--accent); }
.version .bar i.prog { background: color-mix(in srgb, var(--accent) 40%, var(--surface)); }

/* Gantt */
.gantt { --day: 30px; display: grid; grid-template-columns: 280px minmax(0, 1fr); border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.gantt .g-left { border-right: 1px solid var(--line); min-width: 0; }
.gantt .g-right { overflow-x: auto; }
.gantt .g-row { height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.gantt .g-row.lvl2 { padding-left: 28px; }
.gantt .g-row.head { height: 46px; background: var(--surface-2); font-weight: 650; font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.gantt .g-canvas { position: relative; width: calc(var(--day) * 21); }
.gantt .g-days { display: grid; grid-template-columns: repeat(21, var(--day)); height: 46px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.gantt .g-days span { display: grid; place-items: center; font-size: 11px; color: var(--muted); border-right: 1px solid var(--line); line-height: 1.1; text-align: center; font-variant-numeric: tabular-nums; }
.gantt .g-days span.off { background: var(--surface-sunken); color: var(--faint); }
.gantt .g-days span.today { color: var(--mark); font-weight: 700; }
.gantt .g-lane { position: relative; height: 34px; border-bottom: 1px solid var(--line); background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-size: var(--day) 100%; }
.gantt .g-off { position: absolute; top: 0; bottom: 0; width: var(--day); background: var(--surface-sunken); opacity: .7; }
.gantt .g-bar { position: absolute; top: 9px; height: 16px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 30%, var(--surface)); border: 1px solid var(--accent); overflow: hidden; }
.gantt .g-bar i { display: block; height: 100%; background: var(--accent); }
.gantt .g-bar.late { border-color: var(--mark); background: var(--mark-soft); }
.gantt .g-bar.late i { background: var(--mark); }
.gantt .g-bar.parent { top: 13px; height: 8px; background: var(--fg-2); border-color: var(--fg-2); border-radius: 2px; }
.gantt .g-ms { position: absolute; top: 10px; width: 14px; height: 14px; transform: rotate(45deg); background: var(--brand-red); }
.gantt .g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--mark); z-index: 2; }
@media (max-width: 720px) { .gantt { grid-template-columns: 150px minmax(0, 1fr); } }

/* Lịch tháng */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal .dow { padding: 8px; font-size: var(--fs-xs); font-weight: 650; color: var(--muted); background: var(--surface-2); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .05em; }
.cal .day { min-height: 104px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; align-content: start; gap: 4px; min-width: 0; }
.cal .day .d { font-size: var(--fs-xs); font-weight: 650; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.cal .day.out .d { color: var(--faint); }
.cal .day.off { background: var(--surface-sunken); }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--mark); }
.cal .ev { display: block; font-size: 11.5px; padding: 2px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--accent); }
.cal .ev.start { border-left-color: var(--info); background: var(--info-soft); }
.cal .ev.over { border-left-color: var(--mark); background: var(--mark-soft); }
.cal .ev.hol { border-left-color: var(--warn); background: var(--warn-soft); }
.cal .ev.ms { border-left-color: var(--brand-red); font-weight: 650; }
@media (max-width: 720px) { .cal .day { min-height: 64px; } .cal .ev { font-size: 10px; padding: 1px 3px; } }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.kcol { background: var(--surface-sunken); border-radius: var(--r-md); padding: 10px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.kcol .kh { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; }
.kcol .kh .wip { margin-left: auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kcol .kh .wip.over { color: var(--mark); font-weight: 700; }
.kcol.no-drop { opacity: .5; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; display: grid; gap: 8px; box-shadow: var(--shadow-1); cursor: grab; }
.kcard .kt { font-weight: 550; line-height: 1.35; }
.kcard .kf { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--muted); }
.kcard .kf .avatar { width: 22px; height: 22px; font-size: 9px; margin-left: auto; }
.kcard.dragging { transform: rotate(2deg); box-shadow: var(--shadow-2); border-color: var(--accent); }

/* Hoạt động */
.feed-day { padding: 8px 18px; background: var(--surface-2); font-weight: 650; font-size: var(--fs-sm); color: var(--fg-2); border-bottom: 1px solid var(--line); }
.feed-item { display: grid; grid-template-columns: 56px 26px minmax(0, 1fr); gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line); align-items: start; font-size: var(--fs-md); }
.feed-item .t { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 3px; }
.feed-item .k { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-sunken); color: var(--fg-2); }
.feed-item .k.is-issue { background: var(--accent-soft); color: var(--accent); }
.feed-item .k.is-time { background: var(--info-soft); color: var(--info); }
.feed-item .k.is-wiki { background: var(--violet-soft); color: var(--violet); }
.feed-item p { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }

/* Kết quả tìm kiếm */
.result { display: grid; gap: 4px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.result:last-child { border-bottom: 0; }
.result .rt { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.result p { color: var(--fg-2); font-size: var(--fs-sm); max-width: 80ch; }
.result mark { background: color-mix(in srgb, var(--warn) 28%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.result .rm { font-size: var(--fs-xs); color: var(--muted); }

/* Bảng chấm giờ theo tuần */
.timesheet input { height: 32px; text-align: right; padding: 0 8px; width: 64px; font-variant-numeric: tabular-nums; }
.timesheet td.off { background: var(--surface-sunken); }
.timesheet td.short { box-shadow: inset 0 -2px 0 var(--warn); }

/* Bảng thông báo (chuông) */
.notif-panel { width: min(380px, 100%); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-2); overflow: hidden; }
.notif-panel .nh { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-panel .nh h4 { flex: 1; }
.notif { display: grid; grid-template-columns: 28px minmax(0, 1fr) 8px; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.notif .when { font-size: var(--fs-xs); color: var(--muted); }
.notif.unread { background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); }
.notif.unread::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; }

/* Banner toàn hệ thống */
.sys-banner { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: var(--r-md); font-size: var(--fs-sm); background: var(--warn-soft); color: var(--fg); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.sys-banner .icon { color: var(--warn); }
.sys-banner button { margin-left: auto; }

/* Wiki */
.wiki { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; align-items: start; }
.wiki .toc { display: grid; gap: 4px; font-size: var(--fs-sm); }
.wiki .toc a { color: var(--fg-2); }
.wiki .prose h2 { font-size: var(--fs-xl); margin: 22px 0 8px; }
.wiki .prose h3 { margin: 16px 0 6px; }
.wiki .prose table { border-collapse: collapse; margin: 10px 0; font-size: var(--fs-sm); }
.wiki .prose th, .wiki .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.wiki .prose th { background: var(--surface-2); }
@media (max-width: 900px) { .wiki { grid-template-columns: minmax(0, 1fr); } }
.md-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border: 1px solid var(--line-strong); border-bottom: 0; border-radius: var(--r-sm) var(--r-sm) 0 0; background: var(--surface-2); }
.md-toolbar + textarea { border-radius: 0 0 var(--r-sm) var(--r-sm); }
.md-toolbar button { height: 28px; min-width: 28px; padding: 0 6px; border: 0; background: transparent; border-radius: 4px; font: inherit; font-weight: 700; font-size: var(--fs-sm); color: var(--fg-2); cursor: pointer; }
.md-toolbar button:hover { background: var(--surface-sunken); }
.md-toolbar .sep { width: 1px; background: var(--line); margin: 4px 4px; }

/* Nhãn mục menu bên theo nhóm thu gọn */
.side details summary { list-style: none; cursor: pointer; }
.side details summary::-webkit-details-marker { display: none; }
/* v3 sửa: lưới một cột không bị nội dung nowrap đẩy rộng */
.stack { grid-template-columns: minmax(0, 1fr); }
.picker { min-width: 0; }
.row .vis { white-space: normal; }
.wf label { position: relative; }
.switch { position: relative; }
.gantt .g-bar.parent.late { background: var(--mark); border-color: var(--mark); }

/* =====================================================================
   v3.1 — VÙNG LÀM VIỆC TRÀN RỘNG, MENU THU GỌN, THANH CUỘN, ĐIỆN THOẠI
   ===================================================================== */

/* Vùng làm việc tràn hết bề rộng (bỏ giới hạn 1280px) */
.main-inner { max-width: none; }
@media (min-width: 1100px) { .main { padding-left: 24px; padding-right: 24px; } }
@media (min-width: 1600px) { .main { padding-left: 32px; padding-right: 32px; } }

/* Thanh cuộn chung: mảnh, theo màu chủ đề */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
::-webkit-scrollbar-corner { background: transparent; }

/* Menu bên: thanh cuộn ẩn, chỉ hiện mảnh khi rê chuột */
.side { display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color .2s; padding-bottom: 0; }
.side:hover, .side:focus-within { scrollbar-color: rgba(255, 255, 255, .28) transparent; }
.side::-webkit-scrollbar { width: 6px; }
.side::-webkit-scrollbar-thumb { background: transparent; border: 0; border-radius: 99px; }
.side:hover::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .28); }
.side::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .45); }
.side a { position: relative; white-space: nowrap; }
.side a .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Nút thu gọn ở đáy menu */
.side-collapse { position: sticky; bottom: 0; margin: auto -10px 0; display: flex; align-items: center; gap: 10px; width: calc(100% + 20px); padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); border: 0; border-top: 1px solid rgba(255, 255, 255, .1); background: var(--side-bg); color: var(--side-muted); font: inherit; font-weight: 550; cursor: pointer; text-align: left; }
.side-collapse:hover { color: #fff; background: var(--side-hover); }
.side-collapse .icon { transition: transform .2s; }

/* Topbar: nút menu luôn hiện; nút tìm kiếm chỉ ở điện thoại */
.btn.nav-toggle { display: inline-flex; }
.search-mobile { display: none; }

/* ---- Máy tính: menu thu gọn thành dải icon ---- */
@media (min-width: 961px) {
  .app { transition: grid-template-columns .2s ease; }
  .app.side-collapsed { grid-template-columns: 68px minmax(0, 1fr); }
  .side-collapsed .side { padding-left: 10px; padding-right: 10px; }
  .side-collapsed .side a { justify-content: center; padding: 10px 0; }
  .side-collapsed .side a .lbl { display: none; }
  .side-collapsed .side a .count { position: absolute; top: 3px; right: 6px; margin: 0; min-width: 16px; height: 16px; padding: 0 4px; font-size: 9px; line-height: 16px; text-align: center; }
  .side-collapsed .side-project { display: none; }
  .side-collapsed .side-title { font-size: 0; height: 1px; padding: 0; margin: 6px 8px; background: rgba(255, 255, 255, .14); }
  .side-collapsed .side-section { margin-bottom: 10px; }
  .side-collapsed .side-collapse { justify-content: center; padding-left: 0; padding-right: 0; }
  .side-collapsed .side-collapse .lbl { display: none; }
  .side-collapsed .side-collapse .icon { transform: rotate(180deg); }
  /* Nhãn nổi khi rê chuột vào icon */
  .side-collapsed .side a:hover::after { content: attr(data-label); position: fixed; left: 74px; transform: translateY(2px); padding: 5px 10px; border-radius: 6px; background: var(--fg); color: var(--bg); font-size: var(--fs-sm); font-weight: 550; white-space: nowrap; box-shadow: var(--shadow-2); z-index: 50; pointer-events: none; }
}

/* ---- Điện thoại & máy tính bảng ---- */
@media (max-width: 960px) {
  :root { --topbar-h: 52px; }
  .side-collapse { display: none; }
  .search-mobile { display: inline-flex; }
  .topbar { gap: 4px; }
  .brand-logo { height: 30px; }
  .side { width: min(300px, 86vw); padding-bottom: 24px; }
  body.nav-lock { overflow: hidden; }
  .main { padding-block: 14px 40px; }
  .main-inner { gap: 14px; }
  .page-head { align-items: stretch; }
  .page-head .actions { width: 100%; }
  .panel-head { padding: 12px 14px; }
  .panel-body { padding: 14px; }
  .panel-foot { padding: 10px 14px; }
  .setting { padding: 12px 14px; }
}
@media (max-width: 600px) {
  h1 { font-size: 1.375rem; }
  .user-chip { padding: 2px; border: 0; }
  .topbar-actions { gap: 0; }
  /* Nút hành động đầu trang: chia đều, dễ bấm */
  .page-head .actions > .btn, .page-head .actions > a.btn { flex: 1 1 auto; }
  .page-head .actions > select { flex: 1 1 100%; }
  .btn { height: 40px; }
  .btn-sm { height: 34px; }
  .btn-icon { width: 40px; }
  .btn-icon.btn-sm { width: 34px; }
  input[type="text"], input[type="password"], input[type="search"], input[type="email"], input[type="date"], input[type="number"], select { height: 42px; font-size: 16px; } /* 16px: iOS không tự phóng to khi nhập */
  textarea { font-size: 16px; }
  .kpis { gap: 8px; }
  .kpi { padding: 12px; }
  .kpi .val { font-size: 1.5rem; }
  .toolbar > .chip { max-width: 100%; }
  .chip { height: auto; min-height: 28px; flex-wrap: wrap; padding-block: 3px; }
  .tabs a { padding: 10px 10px; }
  .filters .toolbar .spacer { display: none; }
  .tbl-cards tbody tr { margin: 8px; }
  .attrs .a { grid-template-columns: 110px minmax(0, 1fr); }
  .issue-head .ids .btn { flex: 1 1 auto; }
  .kanban { grid-auto-columns: 82vw; scroll-snap-type: x mandatory; }
  .kcol { scroll-snap-align: start; }
  .gantt { grid-template-columns: 130px minmax(0, 1fr); --day: 26px; }
  .gantt .g-row { padding: 0 8px; font-size: var(--fs-xs); }
  .gantt .g-row.lvl2 { padding-left: 16px; }
  .cal .dow { padding: 6px 2px; text-align: center; font-size: 10px; }
  .cal .day { min-height: 56px; padding: 3px; }
  .cal .ev { font-size: 0; height: 6px; padding: 0; border-left-width: 0; border-radius: 3px; }
  .cal .ev.over { background: var(--mark); } .cal .ev.start { background: var(--info); } .cal .ev { background: var(--accent); } .cal .ev.ms { background: var(--brand-red); }
  .feed-item { grid-template-columns: 26px minmax(0, 1fr); padding: 10px 14px; }
  .feed-item .t { grid-column: 2; order: 2; padding: 0; }
  .feed-day { padding: 8px 14px; }
  .sticky-save { border-radius: var(--r-md); }
  .modal-demo { padding: 12px 8px; }
  .auth-form { place-items: start center; padding-top: 28px; }
}
/* Hiện/ẩn theo bề rộng */
.show-sm { display: none !important; }
@media (max-width: 600px) { .show-sm { display: revert !important; } .panel.show-sm { display: block !important; } }
/* Bộ lọc thu gọn trên điện thoại */
.filter-toggle { display: none; }
.filter-toggle .icon { transition: transform .15s; }
@media (max-width: 600px) {
  .filter-toggle { display: inline-flex; }
  .filter-panel .panel-head select { order: 5; flex: 1 1 100%; }
  .filter-panel:not(.is-open) .filters { display: none; }
  .filter-panel:not(.is-open) .panel-head { border-bottom: 0; }
  .filter-panel.is-open .filter-toggle .icon { transform: rotate(180deg); }
}
.panel-head select, .toolbar select { min-width: 0; max-width: 100%; }
