/* ============ font: Be Vietnam Pro (made for Vietnamese diacritics; OFL, assets/fonts/OFL.txt) — served locally, no CDN ============ */
@font-face { font-family: "Be Vietnam Pro"; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/be-vietnam-pro-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/be-vietnam-pro-vietnamese-400.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 500; font-style: normal; font-display: swap;
  src: url(fonts/be-vietnam-pro-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 500; font-style: normal; font-display: swap;
  src: url(fonts/be-vietnam-pro-vietnamese-500.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 600; font-style: normal; font-display: swap;
  src: url(fonts/be-vietnam-pro-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 600; font-style: normal; font-display: swap;
  src: url(fonts/be-vietnam-pro-vietnamese-600.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 700; font-style: normal; font-display: swap;
  src: url(fonts/be-vietnam-pro-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 700; font-style: normal; font-display: swap;
  src: url(fonts/be-vietnam-pro-vietnamese-700.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }

/* ============ tokens ============ */
:root {
  --bg: #f3f5f8; --panel: #fff; --panel-2: #f8f9fb; --text: #172033; --muted: #5f6b7d; --line: #e2e6ec; --line-2: #eef1f5;
  --accent: #0b63c9; --accent-soft: #e7f0fb; --on-accent: #fff;
  --red: #c62828; --red-soft: #fdecea; --amber: #a35f00; --amber-soft: #fff3df;
  --green: #2e7d32; --green-soft: #e8f5e9; --gray-soft: #eef0f3;
  /* role identity: categorical slots 1-3 */
  --s-chu_tri: #2a78d6; --s-phoi_hop: #eb6834; --s-mail: #1baf7a; --s-other: #9aa3b1;
  /* deadline state — never reused as series colors */
  --st-overdue: #d03b3b; --st-today: #ec835a; --st-soon: #fab219; --st-later: #b7c0cc; --st-none: #e3e6ec;
  --grid: #e8eaee; --axis: #c3c7cf;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 10px 30px rgba(16,24,40,.12);
  --r: 12px;
  /* type scale — use these sizes only: 12 · 13 · 14 · 15 · 18 · 24 (display numbers 30/36) */
  --font: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151a; --panel: #1b1f26; --panel-2: #20252d; --text: #e6e8ec; --muted: #9aa3b1; --line: #2c323c; --line-2: #252a32;
    --accent: #5aa2f0; --accent-soft: #1c2b3e; --on-accent: #0b1320;
    --red: #ff8a80; --red-soft: #3a1f1f; --amber: #f0b45a; --amber-soft: #3a2e1a;
    --green: #7ccf83; --green-soft: #1d3320; --gray-soft: #262b33;
    --s-chu_tri: #3987e5; --s-phoi_hop: #e0652f; --s-mail: #1fa875; --s-other: #6b7482;
    --st-later: #5b6472; --st-none: #343a44;
    --grid: #2a2f37; --axis: #3a404a;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 30px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151a; --panel: #1b1f26; --panel-2: #20252d; --text: #e6e8ec; --muted: #9aa3b1; --line: #2c323c; --line-2: #252a32;
  --accent: #5aa2f0; --accent-soft: #1c2b3e; --on-accent: #0b1320;
  --red: #ff8a80; --red-soft: #3a1f1f; --amber: #f0b45a; --amber-soft: #3a2e1a;
  --green: #7ccf83; --green-soft: #1d3320; --gray-soft: #262b33;
  --s-chu_tri: #3987e5; --s-phoi_hop: #e0652f; --s-mail: #1fa875; --s-other: #6b7482;
  --st-later: #5b6472; --st-none: #343a44;
  --grid: #2a2f37; --axis: #3a404a;
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 30px rgba(0,0,0,.45);
  color-scheme: dark;
}

/* ============ base ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.25; margin: 0; letter-spacing: -.015em; font-weight: 700; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 14px; }
code { background: var(--gray-soft); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.mt { margin-top: 18px; }
.mt-s { margin-top: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* line icons from the sprite in index.php */
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn .ico { width: 16px; height: 16px; }
/* document number ("7659/D01-B4"): set apart from the subject, figures aligned */
.docno { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: .01em; }
/* skeleton placeholders (first load of a page) */
.sk { border-radius: var(--r); background: linear-gradient(90deg, var(--gray-soft) 0%, var(--line-2) 50%, var(--gray-soft) 100%);
  background-size: 200% 100%; animation: sk 1.3s ease-in-out infinite; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.sk-tile { flex: 1 1 150px; height: 136px; }
.sk-card { height: 260px; }
.sk-row { height: 84px; border-radius: 10px; }
.sk-line { height: 34px; margin: 6px 0; border-radius: 8px; }
.list.loading > * { opacity: .5; transition: opacity .15s; }

/* ============ layout ============ */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px;
  display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand b { display: block; font-size: 15px; }
.brand small { display: block; font-size: 12px; color: var(--muted); line-height: 1.3; }
.logo { width: 36px; height: 36px; border-radius: 10px; flex: none; display: block; }
nav { display: grid; gap: 2px; }
nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); }
nav a:hover { background: var(--gray-soft); text-decoration: none; }
nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
nav .ni { width: 18px; height: 18px; display: grid; place-items: center; color: var(--muted); }
nav a.active .ni { color: var(--accent); }
nav .nl { flex: 1; }
.pill { background: var(--accent); color: var(--on-accent); border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 600; }
.pill:empty { display: none; }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.run-info { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--muted); line-height: 1.4; }
.run-info:empty { display: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-later); flex: none; transform: translateY(-1px); }
.dot.green { background: var(--green); } .dot.amber { background: var(--st-soon); } .dot.red { background: var(--st-overdue); }
.theme-btn { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; text-align: left; padding: 4px 2px; cursor: pointer; }
.theme-btn:hover { color: var(--text); }

/* fills the window up to ~1900px of content; on wider screens it stays centred instead of leaving a gap on the right */
.main { padding: 26px 32px 40px; min-width: 0; width: 100%; max-width: 1900px; margin-inline: auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; }
.intro { margin: 0 0 14px; max-width: 80ch; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }

/* ============ controls ============ */
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 7px 13px;
  border-radius: 8px; cursor: pointer; font: inherit; line-height: 1.3; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; justify-content: center; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.sel { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .6; cursor: wait; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--gray-soft); color: var(--text); }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; max-width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { width: 100%; min-height: 70px; resize: vertical; }
.num-in { width: 90px; }
/* filter bar: [search][sort][Bộ lọc] / role + status chips / fold-out panel / removable "in effect" chips */
.filters { display: grid; gap: 10px; margin-bottom: 16px; }
.f-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.f-search { flex: 1 1 260px; position: relative; display: flex; align-items: center; min-width: 0; }
.f-search .ico { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.f-search input { width: 100%; padding-left: 36px; }
.f-sort { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.f-more { white-space: nowrap; }
.f-count { background: var(--accent); color: var(--on-accent); border-radius: 9px; font-size: 12px; font-weight: 700; padding: 0 6px; line-height: 18px; }
.f-count:empty { display: none; }
.f-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-row + .chip-row { padding-left: 18px; border-left: 1px solid var(--line); }
.fchip { --c: var(--s-other); border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px;
  padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.fchip:hover { border-color: var(--accent); }
.fchip.r-chu_tri { --c: var(--s-chu_tri); } .fchip.r-phoi_hop { --c: var(--s-phoi_hop); } .fchip.r-mail { --c: var(--s-mail); }
.fchip[class*="r-"]::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--c); }
.fchip.on { background: var(--text); border-color: var(--text); color: var(--panel); font-weight: 600; }
.f-panel { display: flex; flex-wrap: wrap; gap: 12px 16px; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.f-panel[hidden] { display: none; }
.ff { flex: 1 1 180px; display: grid; gap: 5px; align-content: start; min-width: 0; }
.ff > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.ff select, .ff input { width: 100%; }
.ff-dates { flex: 3 1 480px; }
.f-dates { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(145px, 1fr) auto minmax(145px, 1fr); gap: 8px; align-items: center; }
.f-active { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.f-active[hidden] { display: none; }
.f-act { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 500;
  border-radius: 999px; padding: 3px 4px 3px 12px; max-width: 100%; }
.f-act button { border: 0; background: none; color: inherit; cursor: pointer; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.f-act button:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.f-act .ico { width: 14px; height: 14px; stroke-width: 2.2; }
.f-clear { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; padding: 3px 6px; }
.f-clear:hover { color: var(--text); }
.list-more { display: flex; justify-content: center; padding: 12px 0 4px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row input[type=text] { flex: 1 1 220px; }
.seg { display: inline-flex; gap: 0; flex-wrap: wrap; }
.seg .btn { border-radius: 0; margin-left: -1px; }
.seg .btn:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.seg .btn:last-child { border-radius: 0 8px 8px 0; }
.seg .btn.sel { position: relative; z-index: 1; }

/* ============ tags, role chips, deadline badges ============ */
.tag { display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; padding: 1px 7px; font-size: 12px; line-height: 1.6;
  background: var(--gray-soft); color: var(--muted); white-space: nowrap; }
.tag.mail { background: var(--accent-soft); color: var(--accent); }
.tag.eoffice_doc, .tag.eoffice_task { background: var(--green-soft); color: var(--green); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.ai { background: var(--accent-soft); color: var(--accent); }

.role { --c: var(--s-other); display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  color: var(--text); white-space: nowrap; }
.role::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.r-chu_tri { --c: var(--s-chu_tri); } .r-phoi_hop { --c: var(--s-phoi_hop); } .r-mail { --c: var(--s-mail); } .r-other { --c: var(--s-other); }

.due { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600;
  white-space: nowrap; background: var(--gray-soft); color: var(--muted); }
.due::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.due.over { background: var(--red-soft); color: var(--red); }
.due.today { background: var(--amber-soft); color: var(--amber); }
.due.soon { background: var(--amber-soft); color: var(--amber); }
.due.later { background: var(--gray-soft); color: var(--text); font-weight: 500; }
.due.later::before { background: var(--st-later); }
.due.none { background: none; color: var(--muted); font-weight: 400; padding-left: 0; }
.due.none::before { display: none; }
.due.done { background: var(--green-soft); color: var(--green); }

.alert { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; background: var(--red-soft); color: var(--red); border: 1px solid var(--st-overdue); }
.alert code { background: rgba(0,0,0,.06); }
.empty { color: var(--muted); font-size: 13px; padding: 6px 0; }
.empty-box { color: var(--muted); text-align: center; padding: 28px 16px; border: 1px dashed var(--line); border-radius: var(--r);
  display: grid; gap: 6px; justify-items: center; }
.empty-box b { color: var(--text); font-weight: 600; }
.empty-box .btn { margin-top: 6px; }

/* ============ overview ============ */
.alarms { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.alarm-break { display: none; }
/* tiles that need action take two shares of the row; zero tiles one share, flat and grey */
.alarm { flex: 2 1 0; min-width: 170px; min-height: 136px; display: flex; flex-direction: column; gap: 3px; padding: 14px 15px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--panel); color: var(--text); min-width: 0; box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s; }
a.alarm:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.alarm .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; margin-bottom: auto; }
.alarm .ic .ico { width: 18px; height: 18px; stroke-width: 2.2; }
.alarm .num { font-size: 36px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.alarm .lbl { font-weight: 600; font-size: 14px; line-height: 1.3; }
.alarm .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alarm .go { color: var(--muted); font-size: 12px; }
.alarm.crit { background: var(--red-soft); border-color: var(--st-overdue); }
.alarm.crit .ic { background: var(--st-overdue); }
.alarm.crit .num { color: var(--red); }
.alarm.warn { background: var(--amber-soft); border-color: var(--st-soon); }
.alarm.warn .ic { background: var(--st-today); }
.alarm.warn .num { color: var(--amber); }
.alarm.ok .ic { background: var(--green); }
.alarm.ok .num { color: var(--green); }
.alarm.info .ic { background: var(--accent-soft); color: var(--accent); }
.alarm.zero { flex: 1 1 0; min-width: 120px; background: var(--panel-2); box-shadow: none; }
.alarm.zero .ic { background: var(--gray-soft); color: var(--muted); }
.alarm.zero .num { color: var(--muted); font-size: 30px; }
.alarm.zero .lbl { font-weight: 500; color: var(--muted); }
a.alarm.zero:hover { transform: none; box-shadow: none; border-color: var(--accent); }

.groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grp { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: var(--r);
  padding: 16px 18px; display: flex; flex-direction: column; min-width: 0; box-shadow: var(--shadow); }
.grp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grp-head h2 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.grp-head h2::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.grp-total { font-size: 30px; font-weight: 700; line-height: 1; color: var(--c); font-variant-numeric: tabular-nums; }
.grp-sub { color: var(--muted); font-size: 12px; margin: 2px 0 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12px; cursor: pointer;
  background: var(--panel); color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.chip[href]:hover { border-color: var(--accent); text-decoration: none; }
.chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chip b { font-weight: 700; }
.chip.zero { opacity: .45; cursor: default; }
.mini { display: grid; }
.mini a { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 0;
  border-top: 1px solid var(--line-2); color: var(--text); font-size: 13px; cursor: pointer; }
.mini a:hover { text-decoration: none; }
.mini a:hover .mt-t { color: var(--accent); }
.mini .mt-t { min-width: 0; display: grid; }
.mini .mt-x { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini .docno { font-weight: 500; line-height: 1.3; }
.mini .mt-d .due { font-size: 12px; padding: 1px 8px; }
.grp .more { margin-top: auto; padding-top: 10px; font-size: 13px; font-weight: 600; }

.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .tick { font-size: 11px; fill: var(--muted); }
.chart .tick.today { fill: var(--accent); font-weight: 700; }
.chart .hit { fill: transparent; cursor: pointer; outline: none; }
.chart .band { fill: transparent; }
.chart .band.on { fill: var(--gray-soft); }
.tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); border-radius: 8px; padding: 8px 10px; font-size: 12px; min-width: 150px; z-index: 5; }
.tip b { display: block; margin-bottom: 4px; }
.tip div { display: flex; align-items: center; gap: 6px; }
.tip div span { margin-left: auto; padding-left: 12px; font-weight: 600; }
.tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.hbars { display: grid; gap: 14px; padding-top: 4px; }
.hbar-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 36px; align-items: center; gap: 10px; font-size: 13px; }
.hbar-row .lbl { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.hbar-row .lbl i { width: 4px; height: 16px; border-radius: 2px; background: var(--c); }
.hbar-row .num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar { display: flex; gap: 2px; height: 20px; }
.hbar s { display: block; height: 100%; text-decoration: none; cursor: pointer; min-width: 3px; }
.hbar s:first-child { border-radius: 4px 0 0 4px; }
.hbar s:last-child { border-radius: 0 4px 4px 0; }
.hbar s:only-child { border-radius: 4px; }
.hbar s:hover { filter: brightness(.9); }

.tableview { margin-top: 12px; font-size: 13px; }
.tableview summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.tableview > div { overflow-x: auto; }
.tableview table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.tableview td, .tableview th { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.tableview td:first-child, .tableview th:first-child { text-align: left; }

.rem-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.rem { flex: 0 0 220px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; padding: 8px 12px;
  font-size: 13px; cursor: pointer; background: var(--panel-2); }
.rem:hover { border-color: var(--accent); }
.rem .when { color: var(--accent); font-weight: 600; font-size: 12px; }
.rem .what { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ============ request list ============ */
.list { display: grid; gap: 8px; }
.it { --c: var(--s-other); background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--c);
  border-radius: 10px; padding: 12px 16px; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px; box-shadow: var(--shadow); }
.it:hover { border-color: var(--accent); border-left-color: var(--c); }
.it.g-chu_tri { --c: var(--s-chu_tri); } .it.g-phoi_hop { --c: var(--s-phoi_hop); } .it.g-mail { --c: var(--s-mail); }
.it.done { opacity: .6; }
/* "Đã xong" page: quieter rows (faded role edge, no priority marks) */
.it.closed { box-shadow: none; border-left-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.it.closed:hover { border-left-color: var(--c); }
.it.closed .t { font-weight: 500; }
.eo-ok { font-size: 12px; font-weight: 500; color: var(--green); white-space: nowrap; }
/* priority = weighted text, never red: red is reserved for deadlines */
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; }
.prio.p-cao::before { content: "▲"; font-size: 9px; }
.prio.p-trung_binh { color: var(--muted); font-weight: 500; }
.prio.p-thap { color: var(--muted); font-weight: 400; }
.tag.urgent { background: none; color: var(--red); box-shadow: inset 0 0 0 1px currentColor; }
.it-main { min-width: 0; display: grid; gap: 3px; }
.it-top { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.it-top .role { margin-right: 4px; }
.it .t { font-weight: 600; font-size: 15px; line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.it.unread .t::before { content: "●"; color: var(--accent); margin-right: 6px; font-size: 10px; vertical-align: 2px; }
.it .s { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.it .meta { display: flex; gap: 4px 14px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
.it-due { align-self: start; text-align: right; }

/* ============ calendar ============ */
.agenda-day { margin-bottom: 18px; }
.agenda-day h3 { font-size: 13px; margin: 0 0 8px; color: var(--muted); text-transform: capitalize; display: flex; align-items: center; gap: 10px; }
.agenda-day h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.agenda-day.today h3 { color: var(--accent); }
.free-rem { margin-bottom: 14px; }
.free-rem input[type=text] { flex: 1 1 260px; }
/* "Sắp tới" strip */
.cal-next .card-head { margin-bottom: 8px; }
.over-link { color: var(--red); font-weight: 600; font-size: 13px; text-decoration: none; }
.over-link:hover { text-decoration: underline; }
.next-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.nx { --c: var(--s-other); flex: 0 0 230px; border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 10px;
  padding: 8px 12px; background: var(--panel-2); cursor: pointer; }
.nx[data-id=""] { cursor: default; }
.nx:hover { border-color: var(--accent); border-left-color: var(--c); }
.nx-w { font-size: 12px; font-weight: 600; color: var(--muted); }
.nx-w.soon { color: var(--amber); }
.nx-t { font-size: 14px; line-height: 1.35; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nx.g-chu_tri, .ev.g-chu_tri, .ag.g-chu_tri { --c: var(--s-chu_tri); }
.nx.g-phoi_hop, .ev.g-phoi_hop, .ag.g-phoi_hop { --c: var(--s-phoi_hop); }
.nx.g-mail, .ev.g-mail, .ag.g-mail { --c: var(--s-mail); }
.ag { border-left: 3px solid var(--c, var(--line)); }
/* toolbar */
.cal-bar { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin: 4px 0 12px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav b { margin-left: 6px; font-size: 15px; white-space: nowrap; }
.cal-bar .legend { margin-left: auto; }
/* event chip (week + month) */
.ev { --c: var(--s-other); display: flex; flex-wrap: wrap; gap: 1px 6px; align-items: baseline; font-size: 13px; line-height: 1.35; padding: 4px 7px;
  border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--c); cursor: pointer; min-width: 0; }
.ev[data-id=""] { cursor: default; }
.ev:hover { border-color: var(--accent); border-left-color: var(--c); }
.ev.past { opacity: .5; }
.ev-t { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); flex: none; }
.ev-k { flex: none; font-size: 11px; font-weight: 600; color: var(--muted); }
.ev-k.over { color: var(--red); }
.ev-x { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.ev:not(.mini) .ev-x { flex: 1 1 100%; }  /* time + kind on top, title below */
.ev.mini { padding: 2px 6px; font-size: 12px; flex-wrap: nowrap; }
.ev.mini .ev-x { -webkit-line-clamp: 1; display: block; white-space: nowrap; text-overflow: ellipsis; }
.ev.mini .ev-k { display: none; }
.ev.mini.k-rem .ev-t::before { content: "⏰"; margin-right: 2px; }
.ev.mini.over .ev-t { color: var(--red); }
.ev.full { font-size: 14px; padding: 7px 10px; }
.cal-none { font-size: 12px; color: var(--muted); padding: 4px 2px; }
/* week */
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-col { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-height: 220px; display: flex; flex-direction: column; gap: 6px; }
.cal-col.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal-col.gone .ev:not(.over) { opacity: .6; }
.cal-dh { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--muted); }
.cal-dh b { color: var(--text); font-size: 14px; }
.cal-col.today .cal-dh, .cal-col.today .cal-dh b { color: var(--accent); }
.cal-dh i { margin-left: auto; font-style: normal; font-weight: 600; background: var(--gray-soft); border-radius: 9px; padding: 0 7px; }
.cal-evs { display: grid; gap: 5px; min-width: 0; }
/* month */
.cal-wh, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-wh span { font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 6px 4px; }
.cal-cell { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px; min-height: 112px;
  display: flex; flex-direction: column; gap: 4px; cursor: pointer; min-width: 0; }
.cal-cell:hover { border-color: var(--accent); }
.cal-cell.out { opacity: .45; }
.cal-cell.today .cal-dn { background: var(--accent); color: var(--on-accent); }
.cal-cell.sel { box-shadow: 0 0 0 2px var(--accent); }
.cal-dn { font-size: 13px; font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.cal-more { font-size: 12px; color: var(--accent); padding: 1px 4px; border-radius: 4px; font-weight: 600; }
.cal-more:hover { background: var(--accent-soft); text-decoration: underline; }
.cal-dh[data-day] { cursor: pointer; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; }
.cal-dh[data-day]:hover { background: var(--accent-soft); }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; }
.dot-n { font-size: 11px; font-weight: 700; border-radius: 8px; padding: 0 5px; line-height: 16px; }
.dot-n.dl { background: var(--red-soft); color: var(--red); }
.dot-n.nr { background: var(--accent-soft); color: var(--accent); }
/* one day's list (dialog) */
.day-modal { width: min(560px, 100%); max-height: min(80vh, 720px); display: flex; flex-direction: column; padding: 16px 18px; }
.day-head { display: flex; align-items: center; gap: 10px; }
.day-head > div { flex: 1; min-width: 0; text-align: center; }
.day-head h2 { font-size: 18px; text-transform: capitalize; }
.day-head .btn:disabled { opacity: .35; cursor: default; }
.day-x { margin-left: 2px; }
.day-list { display: grid; gap: 6px; overflow-y: auto; margin-top: 12px; padding-right: 2px; }
@media (max-width: 600px) {
  .day-wrap { place-items: end stretch; padding: 0; }
  .day-modal { width: 100%; max-height: 85vh; border-radius: 14px 14px 0 0; }
}
@media (max-width: 1100px) {
  .cal-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .cal-week { grid-template-columns: minmax(0, 1fr); }
  .cal-col { min-height: 0; }
  .cal-week.cur .cal-col.gone { display: none; }  /* phones: current week from today on */
}
@media (max-width: 600px) {
  .cal-bar .legend { margin-left: 0; }
  .cal-nav b { width: 100%; margin: 4px 0 0; order: 5; }
  .cal-nav { flex-wrap: wrap; }
  .cal-wh, .cal-grid { gap: 3px; }
  .cal-cell { min-height: 54px; padding: 3px; align-items: center; }
  .cal-cell .cal-evs { display: none; }
  .cal-cell .cal-dots { display: flex; justify-content: center; }
  .nx { flex-basis: 200px; }
}
.ag { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; cursor: pointer; min-width: 0; }
.ag:hover { border-color: var(--accent); }
.ag > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
.ag .time { font-variant-numeric: tabular-nums; min-width: 46px; white-space: nowrap; flex: none; color: var(--muted); font-weight: 600; }
.ag .x { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; flex: none; }
.ag .x:hover { color: var(--red); }
.ag.past { opacity: .55; }

/* ============ runs ============ */
table.runs { width: 100%; border-collapse: collapse; font-size: 13px; }
table.runs td, table.runs th { padding: 9px 10px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
table.runs th { font-size: 12px; color: var(--muted); font-weight: 600; border-bottom-color: var(--line); }
table.runs tr:last-child td { border-bottom: 0; }
.stat { display: inline-block; margin-right: 12px; color: var(--muted); white-space: nowrap; }
.stat b { color: var(--text); font-variant-numeric: tabular-nums; }
.stat.hl, .stat.hl b { color: var(--accent); font-weight: 600; }
table.runs tr.run-news td:first-child { box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
table.runs tr.run-quiet td, table.runs tr.run-quiet .stat b { color: var(--muted); font-weight: 400; }
table.runs tr.run-red td { background: var(--red-soft); }
table.runs tr.run-amber td { background: var(--amber-soft); }

/* ============ drawer ============ */
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(1080px, 92vw); background: var(--panel);
  border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); overflow-y: auto; padding: 0 28px 28px; z-index: 10; }
.drawer { overscroll-behavior: contain; }
/* left:0 instead of 100vw: on Windows 100vw includes the page scrollbar and pushed the left edge off-screen */
.drawer.wide { left: 0; width: auto; }
body:has(.drawer:not(.hidden)) { overflow: hidden; }
.drawer-bar { position: sticky; top: 0; z-index: 2; height: 0; display: flex; justify-content: flex-end; gap: 4px; margin-right: -14px; }
.drawer-bar button { margin-top: 10px; background: var(--panel); }
.drawer h2 { font-size: 18px; margin: 8px 0 12px; line-height: 1.4; }
.d-head { border-bottom: 1px solid var(--line); padding: 20px 80px 16px 0; }
.d-head .d-no { margin-top: 12px; font-size: 13px; }
.drawer .d-no + h2 { margin-top: 2px; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.d-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
.d-main, .d-side { min-width: 0; }
.d-side { border-left: 1px solid var(--line); padding-left: 22px; }
.d-side .kv { grid-template-columns: 95px 1fr; }
/* facts: hairline rows, values in text color; deadline is the loud one */
.kv.facts { gap: 0 12px; font-size: 14px; }
.kv.facts > span { padding: 8px 0; border-top: 1px solid var(--line-2); }
.kv.facts > span:nth-child(-n+2) { border-top: 0; padding-top: 0; }
.kv.facts > span:nth-child(odd) { font-size: 13px; padding-top: 9px; }
.kv.facts > span:nth-child(-n+1) { padding-top: 2px; }
.kv.facts > span:nth-child(even) { color: var(--text); }
.kv .v-due { display: grid; gap: 4px; justify-items: start; }
.kv .v-big { font-size: 18px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kv .v-num { font-variant-numeric: tabular-nums; }
.kv .v-none { color: var(--muted); }
.drawer .sec { margin-top: 18px; }
.drawer .sec h3 { font-size: 14px; font-weight: 600; color: var(--text); margin: 0 0 8px; }
.drawer .sec h3 .ico { width: 16px; height: 16px; vertical-align: -3px; margin-right: 7px; color: var(--muted); }
.drawer pre { white-space: pre-wrap; font: inherit; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 12px; max-height: 340px; overflow: auto; margin: 0; }
.drawer ul { margin: 0; padding-left: 18px; }
details.sec > summary { cursor: pointer; list-style: none; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::before { content: "▸ "; color: var(--muted); }
details.sec[open] > summary::before { content: "▾ "; }
h3.inline { display: inline; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; }
.kv > span:nth-child(odd) { color: var(--muted); }
.kv > span { overflow-wrap: anywhere; }

.dir-box { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: var(--panel); }
.drawer .dir-box h3 { color: var(--text); font-size: 13px; text-transform: none; letter-spacing: 0; }
.dir { padding: 9px 12px; border-radius: 8px; margin-top: 8px; background: var(--panel-2); border-left: 3px solid var(--line); }
.dir.route { border-left-color: var(--accent); }
.dir.mine { border-left-color: var(--st-overdue); background: var(--red-soft); }
.dir-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.dir-t { margin-top: 3px; line-height: 1.6; }

/* ============ AI panel ============ */
.ai-box { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: var(--panel-2); }
.drawer .ai-box > h3 { color: var(--accent); font-size: 13px; text-transform: none; letter-spacing: 0; }
.ai-box h4 { font-size: 13px; margin: 16px 0 6px; }
.ai-ctl { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ai-ctl select { flex: 1 1 200px; }
.ai-free-warn { margin-top: 6px; padding: 8px 10px; border-radius: 8px; font-size: 13px;
  background: var(--red-soft); color: var(--red); border: 1px solid var(--st-overdue); }
.ai-wait { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--accent); }
.spin { width: 16px; height: 16px; border: 2px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-err { margin-top: 10px; color: var(--red); background: var(--red-soft); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.ai-result { margin-top: 12px; font-size: 14px; }
.ai-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.ai-tab { border: 0; background: none; color: var(--muted); font: inherit; padding: 8px 12px; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.ai-tab:hover { color: var(--text); }
.ai-tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.ai-verdict { border-left: 4px solid var(--st-overdue); background: var(--panel); border-radius: 8px; padding: 12px 14px; }
.ai-verdict.info { border-left-color: var(--st-later); }
.ai-concl { font-weight: 600; margin-top: 8px; }
.ai-mine { margin-top: 12px; padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); border: 1px solid var(--accent); }
.ai-mine h4 { margin: 0 0 6px !important; }
.ai-concl p, .ai-mine p, .ai-pane p { margin: 0 0 6px; line-height: 1.65; }
.ai-steps { padding-left: 20px; margin: 0; display: grid; gap: 10px; }
.ai-steps .muted { font-size: 13px; }
.ai-tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
.ai-tbl td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ai-meta { border-top: 1px solid var(--line); padding-top: 8px; }
.rt-sec + .rt-sec { margin-top: 8px; }
.rt-h { font-weight: 600; margin: 4px 0 2px; }
.rt-list, .tg-list { margin: 2px 0 4px; padding-left: 20px; display: grid; gap: 4px; line-height: 1.55; }
.tg { margin-top: 10px; }
.tg-h { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.tg-list li span + span { margin-left: 4px; }

/* ============ settings ============ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; padding: 10px 14px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; border-radius: 8px 8px 0 0;
  display: inline-flex; align-items: center; gap: 7px; }
.tabs .ico { width: 16px; height: 16px; }
.tabs button:hover { color: var(--text); background: var(--gray-soft); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.stab { padding-bottom: 8px; }
.savebar { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; justify-content: flex-end; gap: 14px;
  margin: 8px -32px -40px; padding: 12px 32px; background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(6px); border-top: 1px solid var(--line); }
.savebar.dirty #setMsg { color: var(--amber); font-weight: 600; }

.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 16px; margin-bottom: 16px; }
.set-card { margin-bottom: 0; min-width: 0; }
#setProviders { grid-template-columns: minmax(0, 1fr); }
.set-card[data-p="claude_cli"] .model-list { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); max-height: none; }
.set-card[data-p="claude_cli"] .row input.cp { flex: 1 1 320px; }
.set-card h2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.set-card .row input.k { flex: 1 1 200px; }
/* masked like a password, but a plain text field so browsers don't autofill saved site passwords into it */
.secret { -webkit-text-security: disc; text-security: disc; font-family: monospace; }
.api-more { grid-column: 1 / -1; }
.api-more > summary { cursor: pointer; color: var(--text); font-weight: 600; padding: 12px 16px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--panel); list-style: none; }
.api-more > summary::-webkit-details-marker { display: none; }
.api-more > summary::before { content: "▸ "; color: var(--muted); }
.api-more[open] > summary { margin-bottom: 16px; }
.api-more[open] > summary::before { content: "▾ "; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.set-row label { color: var(--muted); font-size: 13px; }
.set-free { display: block; margin-top: 8px; }
.model-list { display: grid; gap: 4px; margin-top: 10px; max-height: 260px; overflow-y: auto; }
.model-opt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.model-opt > span:nth-child(2) { overflow-wrap: anywhere; }
.model-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.model-opt small { color: var(--muted); }
.model-opt .def { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.set-msg-err { color: var(--red); font-size: 13px; margin-top: 6px; }
.set-msg-ok { color: var(--green); font-size: 13px; margin-top: 6px; }

.me-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; margin-top: 6px; }
.me-grid label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; align-content: start; }
.me-grid .span2 { grid-column: span 3; }
.me-grid .hint { font-weight: 400; font-size: 12px; }
.me-grid input, .me-grid textarea { color: var(--text); font-weight: 400; }

.use-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 6px 0 16px; }
.use-tile { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--panel-2); }
.use-tile b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.use-tile span { color: var(--muted); font-size: 12px; }
.tbl-wrap { overflow-x: auto; }
table.use { width: 100%; border-collapse: collapse; font-size: 13px; }
table.use th, table.use td { padding: 7px 8px; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap; }
table.use th { color: var(--muted); font-size: 12px; font-weight: 600; border-bottom-color: var(--line); }
table.use td.n, table.use th.n { text-align: right; font-variant-numeric: tabular-nums; }
.use-recent { max-height: 460px; overflow-y: auto; }
.use-recent td:nth-child(2) { white-space: normal; min-width: 220px; }
.use-recent tr[data-id] { cursor: pointer; }
.use-recent tr[data-id]:hover { background: var(--gray-soft); }

.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 16px; }
.sys-grid .card { margin-bottom: 0; }
.sys-grid .kv { margin-bottom: 10px; }
.sys-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line-2); }
.sys-row:first-of-type { border-top: 0; }
.sys-row .right { text-align: right; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--panel);
  padding: 10px 16px; border-radius: 8px; z-index: 20; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }

/* ============ responsive ============ */
@media (max-width: 1100px) { .groups { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .d-grid { grid-template-columns: minmax(0, 1fr); }
  .d-side { border-left: 0; padding-left: 0; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 8; height: auto; padding: 10px 16px 0; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line);
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .brand { padding: 0; }
  .logo { width: 30px; height: 30px; }
  nav { grid-column: 1 / -1; grid-row: 2; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 8px; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  /* fade the side that still has menu to scroll to */
  nav.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
  nav.fade-l { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px); mask-image: linear-gradient(to right, transparent, #000 36px); }
  nav.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
  nav a { flex: none; padding: 6px 10px; font-size: 13px; }
  .side-foot { margin: 0; grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 6px; }
  .side-foot .btn { padding: 6px 10px; }
  .run-info { display: none; }
  .theme-btn { width: 30px; height: 30px; text-align: center; font-size: 16px; padding: 0; }
  .theme-btn .tl { display: none; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 16px 16px 32px; }
  .savebar { margin: 8px -16px -32px; padding: 10px 16px; }
  .drawer { left: 0; width: auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); box-shadow: none; border-left: 0; }
  .drawer-bar { margin-right: -6px; }
  .d-head { padding-right: 0; }
  .d-head .it-top { padding-right: 76px; }
}
@media (max-width: 700px) {
  .me-grid { grid-template-columns: minmax(0, 1fr); }
  .me-grid .span2 { grid-column: auto; }
}
@media (max-width: 600px) {
  h1 { font-size: 18px; }
  .card { padding: 14px; }
  .alarms { gap: 10px; }
  .alarm { flex: 1 1 calc(50% - 5px); min-width: 0; padding: 12px; min-height: 118px; }
  .alarm .ic { width: 26px; height: 26px; margin-bottom: 8px; }
  .alarm .num { font-size: 30px; }
  .alarm-break { display: block; flex: 0 0 100%; height: 0; margin-top: -10px; }
  /* zeros: one compact row of small tiles */
  .alarm.zero { flex: 1 1 calc(33.33% - 7px); min-height: 0; padding: 8px 10px; gap: 0; }
  .alarm.zero .ic { display: none; }
  .alarm.zero .num { font-size: 18px; }
  .alarm.zero .lbl { font-size: 12px; }
  table.stack td:empty { display: none; }
  .it { grid-template-columns: minmax(0, 1fr); padding: 11px 13px; }
  .it-due { grid-row: 1; text-align: left; }
  .it-due:has(.it-acts) { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .it-acts { margin: 0 0 0 auto; }
  /* filters on a phone: search on its own row, then sort + Bộ lọc; chip rows scroll sideways */
  .f-search { flex: 1 1 100%; }
  .f-sort { flex: 1 1 0; min-width: 0; }
  .f-sort span { display: none; }
  .f-sort select { width: 100%; }
  .f-more { flex: none; }
  .f-chips { display: grid; gap: 8px; margin: 0 -16px; }
  .chip-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 0 16px; }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip-row + .chip-row { border-left: 0; padding-left: 16px; }
  .fchip { padding: 7px 13px; }
  .f-panel { padding: 12px; }
  .ff, .ff-dates { flex: 1 1 100%; }
  .f-dates { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .f-dates select { grid-column: 1 / -1; }
  .hbar-row { grid-template-columns: 70px minmax(0, 1fr) 30px; }
  .kv { grid-template-columns: 100px minmax(0, 1fr); }
  .tabs button { padding: 9px 10px; font-size: 13px; }
  /* runs table → stacked cards */
  table.stack thead { display: none; }
  table.stack tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 8px; border: 0; padding: 2px 0; }
  table.stack td::before { content: attr(data-l); color: var(--muted); font-size: 12px; }
  .d-actions .seg { width: 100%; }
  .d-actions .seg .btn { flex: 1; justify-content: center; padding: 7px 4px; }
  /* phone: bigger tap targets, no zoom-on-focus, controls full width */
  .btn { min-height: 40px; }
  .btn.small { min-height: 34px; }
  input, select, textarea { font-size: 16px; min-height: 40px; }
  #drawerExpand { display: none; }
  .d-head .it-top { padding-right: 40px; }
  .drawer h2 { font-size: 18px; }
  .d-actions > .btn { flex: 1 1 auto; justify-content: center; }
  .ai-ctl > * { flex: 1 1 100%; justify-content: center; }
  .dir-box, .ai-box { padding: 12px; }
  .drawer .sec { margin-top: 16px; }
  .rem-custom > * { flex: 1 1 100%; }
  .modal { padding: 16px; }
  .modal-a { flex-wrap: wrap; }
  .modal-a .btn { flex: 1 1 auto; justify-content: center; }
  .row > .btn { flex: 0 0 auto; }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* ---- write-back to eOffice: button, status line, confirmation dialog */
.btn.eo-btn { border-color: var(--green); color: var(--green); }
.btn.eo-btn:hover { background: var(--green-soft); }
.btn.danger { background: var(--st-overdue); border-color: var(--st-overdue); color: #fff; }
.btn.danger:disabled { opacity: .45; cursor: not-allowed; }
.eo-status { margin-top: 10px; padding: 8px 12px; border-radius: 8px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.eo-status.run { background: var(--accent-soft); color: var(--accent); }
.eo-status.ok { background: var(--green-soft); color: var(--green); }
.eo-status.err { background: var(--red-soft); color: var(--red); }
/* ---- notice: requests closed because they were handled on eOffice */
.eo-note { background: var(--green-soft); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 10px;
  padding: 7px 10px 7px 14px; margin-bottom: 16px; font-size: 14px; }
.eo-note-row { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; }
.eo-note-t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.eo-note-t .ico { color: var(--green); }
.eo-note-t b { color: var(--green); }
.eo-note ul { margin: 8px 0 4px; padding-left: 26px; }
.eo-note li { margin: 3px 0; overflow-wrap: anywhere; }
.eo-note li .docno { margin-right: 8px; }
.eo-note li.eo-note-all { list-style: none; margin-top: 6px; }
.eo-note li.eo-note-all a { color: var(--accent); text-decoration: none; }
.eo-note li a { color: var(--text); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); }
.eo-note li a:hover { color: var(--accent); }
.eo-note-a { display: flex; gap: 8px; flex-wrap: wrap; }
/* ---- reminders in the detail drawer */
.rem-n { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--accent); background: var(--accent-soft);
  border-radius: 10px; padding: 1px 8px; margin-left: 6px; }
.rem-list { display: grid; gap: 6px; margin-bottom: 12px; }
.rem-it { display: flex; gap: 10px; align-items: center; background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 8px; padding: 7px 10px; }
.rem-it.done { border-left-color: var(--line); opacity: .6; }
.rem-ic { flex: none; width: 20px; display: grid; place-items: center; color: var(--accent); }
.rem-it.done .rem-ic { color: var(--muted); }
.rem-when { min-width: 0; font-size: 14px; }
.rem-when b { font-size: 15px; font-variant-numeric: tabular-nums; margin-right: 4px; }
.rem-sub { display: block; font-size: 12px; color: var(--muted); }
.rem-it:not(.done) .rem-sub { color: var(--accent); }
.rem-it .x { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; flex: none; padding: 2px 6px; }
.rem-it .x:hover { color: var(--red); }
.rem-add { display: grid; gap: 6px; }
.rem-lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rem-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px; padding: 5px 11px;
  font: inherit; font-size: 13px; cursor: pointer; }
.chip-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.rem-custom { display: flex; gap: 8px; flex-wrap: wrap; }
.rem-custom input { flex: 1 1 170px; min-width: 0; }
.rem-foot { margin: 10px 0 0; }
.eo-status.warn { background: var(--amber-soft); color: var(--text); border-left: 3px solid var(--amber); }
.eo-status.warn b { color: var(--amber); }
.eo-status.muted-box { background: var(--gray-soft); color: var(--muted); }
/* ---- "Đã xong" page */
.pill.warn { background: var(--amber); }
.it-acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.it-acts .btn { white-space: nowrap; }
.ok-t { color: var(--green); }
.warn-t { color: var(--amber); font-weight: 600; }
.modal-wrap { position: fixed; inset: 0; background: rgba(10, 14, 20, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
  width: min(520px, 100%); padding: 20px 22px; display: grid; gap: 12px; }
.modal h2 { margin: 0; font-size: 18px; }
.modal p { margin: 0; }
.modal-doc { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.modal-l { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.modal-l textarea { width: 100%; color: var(--text); }
.modal-c { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.modal-c input { margin-top: 3px; }
.modal-a { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
