/* JUN Workboard · giao diện. Màu theo tuyến lấy từ tab DANH_MUC; ở đây chỉ là màu khung. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e2e5ea;
  --border-strong: #cfd4dc;
  --text: #1a1d23;
  --muted: #667085;
  --accent: #e2562b;
  --accent-ink: #ffffff;
  --accent-soft: #fdebe5;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --green: #15803d;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --radius: 12px;
  --topbar: 56px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111318; --surface: #1a1d24; --surface-2: #232733; --border: #2c313d; --border-strong: #3a4150;
    --text: #e8eaef; --muted: #9aa3b2; --accent: #f06a3f; --accent-soft: #3a2119;
    --red: #f87171; --red-soft: #3b1d1d; --amber: #fbbf24; --amber-soft: #3a2f12; --green: #4ade80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111318; --surface: #1a1d24; --surface-2: #232733; --border: #2c313d; --border-strong: #3a4150;
  --text: #e8eaef; --muted: #9aa3b2; --accent: #f06a3f; --accent-soft: #3a2119;
  --red: #f87171; --red-soft: #3b1d1d; --amber: #fbbf24; --amber-soft: #3a2f12; --green: #4ade80;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body.busy { cursor: progress; }
body.busy .topbar::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 2px; width: 30%; background: var(--accent);
  animation: busy 1s ease-in-out infinite;
}
@keyframes busy { 0% { left: -30%; } 100% { left: 100%; } }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 18px; }
h3 { font-size: 14px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pre { white-space: pre-wrap; }
.red { color: var(--red); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* ---------- nút & điều khiển */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--text); }
.btn.small { min-height: 30px; padding: 0 12px; font-size: 13px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(.95); }
.btn.ghost { background: transparent; }
.btn.ok { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn.warn { background: var(--amber-soft); border-color: #f59e0b; color: var(--amber); }
.btn.danger { color: var(--red); border-color: var(--red-soft); }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, [role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-row { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.btn-row.wrap { flex-wrap: wrap; justify-content: flex-start; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 999px;
  border: 0; background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.count {
  position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; font-style: normal;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  --chip: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip.on { border-color: var(--chip); background: color-mix(in srgb, var(--chip) 14%, var(--surface)); font-weight: 600; }
.chip:not([style]).on { border-color: var(--text); background: var(--surface-2); }
.chips.pick .chip.on { border-color: var(--accent); background: var(--accent-soft); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; cursor: pointer; white-space: nowrap; }
.toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
.seg-ctl { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; }
.seg-ctl button { border: 0; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; padding: 5px 12px; cursor: pointer; }
.seg-ctl button.on { background: var(--text); color: var(--surface); font-weight: 600; }
.pill {
  --pill: #94a3b8;
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  color: color-mix(in srgb, var(--pill) 75%, var(--text)); background: color-mix(in srgb, var(--pill) 16%, var(--surface));
}
.badge { display: inline-block; padding: 0 7px; border-radius: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.tag { display: inline-block; padding: 0 6px; border-radius: 5px; background: var(--surface-2); font-size: 11px; font-weight: 600; }
.tag.task { background: #ede9fe; color: #6d28d9; }

/* ---------- màn hình đăng nhập / thông báo */
.screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.screen-card {
  width: min(460px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
  padding: 28px 24px; text-align: center; display: grid; gap: 14px; justify-items: center;
}
.screen-card p { margin: 0; }
.screen-brand { display: flex; align-items: center; gap: 10px; }
.screen-brand h1 { font-size: 22px; }
.notice { background: var(--amber-soft); color: var(--amber); padding: 8px 12px; border-radius: 10px; font-size: 13px; }
.gsi-btn { min-height: 44px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.demo-users { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
.demo-user {
  display: grid; gap: 2px; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.demo-user:hover { border-color: var(--accent); }
.demo-user span { color: var(--muted); font-size: 12px; }
.demo-user.stranger { border-style: dashed; }

/* ---------- khung ứng dụng */
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand-ball {
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent); flex: none;
  background-image: radial-gradient(circle at 50% 50%, transparent 9px, rgba(255,255,255,.85) 9px, rgba(255,255,255,.85) 10.5px, transparent 10.5px),
    linear-gradient(90deg, transparent 10px, rgba(255,255,255,.85) 10px, rgba(255,255,255,.85) 12px, transparent 12px);
}
.brand-ball.big { width: 34px; height: 34px; }
.demo-badge { font-size: 11px; font-weight: 700; color: var(--amber); background: var(--amber-soft); padding: 2px 8px; border-radius: 999px; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
/* Dải tai thỏ phía trên thanh trên cùng khi mở như ứng dụng trên điện thoại */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 31; background: var(--surface); }
.tabs { display: flex; gap: 2px; flex: 1; justify-content: center; }
.tabs a {
  position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap;
}
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a.on { color: var(--text); background: var(--surface-2); }
.tabs a.on svg { color: var(--accent); }
.tabs .count { position: static; margin-left: 2px; }
.me { display: flex; align-items: center; gap: 6px; }
.me-name { display: grid; line-height: 1.15; text-align: right; cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.me-name:hover { background: var(--surface-2); }
.me-name span { font-size: 11.5px; color: var(--muted); }

.filterbar {
  position: sticky; top: calc(var(--topbar) + env(safe-area-inset-top, 0px)); z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border);
}
.month-nav { display: flex; align-items: center; gap: 4px; }
.month-nav strong { min-width: 112px; text-align: center; font-size: 15px; }
.person-filter select, .field select, .field input, .field textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 7px 10px; min-height: 36px;
}
.person-filter select { border-radius: 999px; padding-right: 28px; }
.line-chips { flex: 1; min-width: 0; }
.view-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.view { padding: 14px 16px 40px; max-width: 1600px; margin: 0 auto; }

/* ---------- FullCalendar */
.cal-wrap { padding: 8px; }
.fc { --fc-border-color: var(--border); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-2);
  --fc-today-bg-color: color-mix(in srgb, var(--accent) 8%, transparent); --fc-list-event-hover-bg-color: var(--surface-2);
  --fc-event-border-color: transparent; font-size: 12.5px; }
.fc .fc-col-header-cell-cushion { color: var(--muted); font-weight: 600; text-decoration: none; padding: 6px 4px; text-transform: uppercase; font-size: 11.5px; }
.fc .fc-daygrid-day-number { color: var(--text); text-decoration: none; font-weight: 600; padding: 4px 6px; }
.fc .fc-day-other .fc-daygrid-day-number { color: var(--muted); opacity: .6; }
.fc .is-sun { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number { background: var(--accent); color: #fff; border-radius: 999px; min-width: 24px; text-align: center; margin: 2px; padding: 2px 6px; }
.fc .fc-daygrid-event { margin: 1px 3px; border-radius: 6px; }
.fc .fc-daygrid-day-frame { min-height: 96px; }
.fc .fc-event.post-ev { border-width: 0 0 0 3px; border-style: solid; color: var(--text); cursor: pointer; }
.fc .fc-event.post-ev .post-chip { color: var(--text); }
.post-chip, .ev-chip, .sk-chip { display: flex; align-items: center; gap: 4px; min-width: 0; padding: 1px 4px; overflow: hidden; }
.post-chip .ttl, .ev-chip .ttl, .sk-chip .ttl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.post-chip .time { font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.post-chip .st { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.post-chip .flag { color: var(--amber); font-weight: 700; flex: none; }
.post-chip .ico, .ev-chip .ico { flex: none; font-size: 11px; }
.fc .fc-event.is-late { box-shadow: inset 0 0 0 1.5px var(--red); }
.fc .fc-event.is-late .post-chip .ttl { color: var(--red); font-weight: 600; }
.fc .fc-event.is-posted { opacity: .55; }
.fc .fc-event.is-cancel { opacity: .45; text-decoration: line-through; }
.fc .fc-event.bg-ev { font-size: 11.5px; font-weight: 600; cursor: pointer; }
.fc .fc-event.bg-ev .ev-chip { color: inherit; }
.fc .fc-event.sk-ev { cursor: pointer; }
.fc .fc-event.sk-ev .sk-chip { color: inherit; font-weight: 600; }
.fc .fc-event.tentative { background-image: repeating-linear-gradient(45deg, transparent 0 6px, rgba(255,255,255,.25) 6px 12px); }
.sk-chip .time, .sk-chip .place, .sk-chip .dept { font-weight: 400; opacity: .9; flex: none; }
.sk-chip .dept { font-size: 10.5px; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; }
.sk-chip .tag { background: rgba(255,255,255,.3); color: inherit; }
.fc .fc-event.shoot-ev { border-width: 0 0 0 3px; border-style: dashed; color: var(--text); }
.fc a.fc-event, .fc a.fc-event:hover { color: inherit; }
.fc .fc-more-link { color: var(--muted); font-weight: 600; }
.fc .fc-list { border-radius: 10px; overflow: hidden; }
.fc .fc-list-day-cushion { background: var(--surface-2); }
.fc .fc-list-event td { border-color: var(--border); }
.fc .fc-list-event .post-chip, .fc .fc-list-event .sk-chip { padding: 0; }
.fc .fc-popover { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); border-radius: 10px; }
.fc .fc-popover-header { background: var(--surface-2); }
.fc-event-dragging, .fc-event-mirror { box-shadow: 0 6px 18px rgba(0,0,0,.18) !important; }

.agenda { margin-top: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.agenda .sec-head { margin-bottom: 2px; }
.agenda-ev { font-size: 12.5px; font-weight: 600; padding: 2px 0; cursor: pointer; }
.agenda-item {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--border); border-left: 4px solid var(--line); cursor: pointer;
}
.agenda-item .time { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.agenda-item .ttl { font-size: 13px; overflow-wrap: anywhere; }
.agenda-item.late { box-shadow: inset 0 0 0 1.5px var(--red); }
.agenda-item.late .ttl { color: var(--red); }
.unscheduled { margin-top: 14px; padding: 12px 14px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.sec-head { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; }
.unsched-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.unsched-item {
  display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); border-left: 4px solid var(--line, var(--muted));
  background: var(--surface); cursor: grab; user-select: none;
}

/* ---------- Timeline */
.tl-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-bottom: 10px; font-size: 12.5px; }
.legend-items { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 5px; }
.lg i { width: 14px; height: 8px; border-radius: 3px; display: inline-block; }
.lg i.lg-late { background: var(--red); }
.lg i.lg-warn { background: transparent; outline: 1.5px dashed var(--red); }
.lg i.lg-mk { width: 9px; height: 9px; transform: rotate(45deg); background: var(--text); border-radius: 1px; }
.tl-scroll { overflow: auto; max-height: calc(100vh - 210px); position: relative; }
.tl-inner { position: relative; }
.tl-head { position: sticky; top: 0; z-index: 4; display: flex; background: var(--surface); border-bottom: 1px solid var(--border); }
.tl-corner {
  position: sticky; left: 0; z-index: 5; width: var(--label); flex: none; padding: 8px 12px; font-weight: 700; font-size: 12px; color: var(--muted);
  background: var(--surface); border-right: 1px solid var(--border);
}
.tl-days { display: flex; }
.tl-day { width: var(--w); flex: none; display: grid; justify-items: center; padding: 4px 0; font-size: 11px; color: var(--muted); border-left: 1px solid transparent; }
.tl-day .dn { font-weight: 700; color: var(--text); font-size: 12px; }
.tl-day.sun .dn, .tl-day.sun .wd { color: var(--red); }
.tl-day.out { opacity: .5; }
.tl-day.m1 { border-left-color: var(--border-strong); }
.tl-day.today .dn { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 5px; }
.tl-body { position: relative; }
.tl-grid { position: absolute; top: 0; bottom: 0; pointer-events: none; z-index: 0;
  background-image: repeating-linear-gradient(90deg, transparent 0 calc(var(--w) - 1px), color-mix(in srgb, var(--border) 60%, transparent) calc(var(--w) - 1px) var(--w)); }
.tl-sun { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--red) 6%, transparent); }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: .7; }
.tl-row { position: relative; display: flex; min-height: 46px; border-bottom: 1px solid var(--border); }
.tl-row:hover .tl-label, .tl-row:hover { background-color: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.tl-label {
  position: sticky; left: 0; z-index: 3; width: var(--label); flex: none; padding: 6px 10px 6px 12px; cursor: pointer;
  background: var(--surface); border-right: 1px solid var(--border); border-left: 4px solid var(--line); min-width: 0;
}
.tl-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.tl-name .st { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.tl-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-sub .stuck { color: var(--red); font-weight: 600; }
.tl-sub .ok { color: var(--green); }
.tl-track { position: relative; z-index: 1; flex: none; }
.seg {
  --c: #94a3b8;
  position: absolute; top: 13px; height: 20px; border-radius: 5px; background: var(--c); color: #fff; font-size: 10.5px; font-weight: 600;
  display: flex; align-items: center; padding: 0 5px; overflow: hidden; white-space: nowrap; cursor: pointer; user-select: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); margin-left: 1px;
}
.seg span { overflow: hidden; text-overflow: ellipsis; }
.seg.done { background: color-mix(in srgb, var(--c) 35%, var(--surface)); color: var(--text); }
.seg.done::after { content: "✓"; margin-left: auto; padding-left: 3px; }
.seg.late { background: var(--red); }
.seg.warn { outline: 2px dashed var(--red); outline-offset: 1px; }
.seg.dim { opacity: .28; }
.seg.draggable { cursor: grab; }
.seg.dragging, .marker.dragging { cursor: grabbing; z-index: 6; box-shadow: 0 6px 16px rgba(0,0,0,.25); transition: none; }
.conn { position: absolute; top: 22px; height: 0; border-top: 2px dotted var(--border-strong); }
.marker {
  --line: var(--text);
  position: absolute; top: 16px; width: 14px; height: 14px; transform: rotate(45deg); background: var(--line); border: 2px solid var(--surface);
  border-radius: 2px; cursor: pointer; box-shadow: 0 0 0 1px var(--line);
}
.marker.dragging { transform: rotate(45deg); }
.drag-tip {
  position: fixed; z-index: 100; transform: translate(-50%, -100%); background: var(--text); color: var(--surface); padding: 3px 8px;
  border-radius: 6px; font-size: 12px; font-weight: 600; pointer-events: none; white-space: nowrap;
}

/* ---------- Việc của tôi */
.view-viec { max-width: 980px; }
.tasks-head { display: flex; align-items: baseline; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin: 4px 2px 12px; }
.counts { display: flex; gap: 8px; flex-wrap: wrap; }
.count-badge { padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; }
.count-badge.red { color: var(--red); border-color: var(--red-soft); background: var(--red-soft); }
.count-badge.amber { color: var(--amber); border-color: var(--amber-soft); background: var(--amber-soft); }
.count-badge.zero { opacity: .55; }
.work-group { margin-bottom: 12px; padding: 4px 0; overflow: hidden; }
.work-group > h3, .work-group > summary { display: flex; align-items: center; gap: 8px; padding: 10px 14px 6px; font-size: 13px; }
.work-group > summary { cursor: pointer; font-weight: 700; padding-bottom: 10px; }
.work-group .n { margin-left: 4px; color: var(--muted); font-weight: 600; }
.work-group.red > h3 { color: var(--red); }
.work-group.amber > h3 { color: var(--amber); }
.work-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--border);
  border-left: 3px solid var(--line);
}
.work-row.late { background: color-mix(in srgb, var(--red) 4%, transparent); }
.work-row.finished { opacity: .6; }
.work-row.finished .work-title { text-decoration: line-through; }
.cb input { width: 20px; height: 20px; accent-color: #16a34a; cursor: pointer; }
.work-main { min-width: 0; cursor: pointer; }
.work-title { font-size: 13.5px; overflow-wrap: anywhere; }
.work-sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.work-sub .dot { width: 7px; height: 7px; }
.work-side { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.due { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.due.red { color: var(--red); }
.link-ico { text-decoration: none; }

.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.board-col { background: var(--surface-2); border-radius: var(--radius); padding: 8px; min-height: 200px; border: 2px solid transparent; }
.board-col.over { border-color: var(--accent); }
.board-col h3 { display: flex; align-items: center; gap: 6px; padding: 4px 4px 8px; font-size: 13px; }
.board-col h3 .n { margin-left: auto; color: var(--muted); }
.board-cards { display: grid; gap: 8px; }
.board-card {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--line); border-radius: 10px; padding: 8px 10px;
  cursor: grab; box-shadow: var(--shadow); display: grid; gap: 4px;
}
.board-card.late { box-shadow: inset 0 0 0 1.5px var(--red); }
.board-card.dragging { opacity: .5; }
.bc-title { font-size: 13px; overflow-wrap: anywhere; }
.bc-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); }
.view-viec:has(.board) { max-width: 1600px; }

/* ---------- Ngăn chi tiết */
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(15, 18, 25, .35); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(520px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: -8px 0 32px rgba(0,0,0,.12);
  transform: translateX(105%); transition: transform .22s ease; visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: flex-start; gap: 8px; padding: 14px 14px 10px 18px; border-bottom: 1px solid var(--border); }
.drawer-title { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; }
.drawer-heading { display: flex; gap: 10px; align-items: stretch; }
.drawer-heading .stripe { width: 5px; border-radius: 3px; flex: none; }
.drawer-heading .stripe.task { background: #7c3aed; }
.eyebrow { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.heading-text { font-size: 16px; overflow-wrap: anywhere; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 18px 24px; overscroll-behavior: contain; }
.drawer-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 18px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); }
.drawer-content { display: grid; gap: 14px; }
.status-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flag { color: var(--amber); font-weight: 700; font-size: 12.5px; }
.form-grid { display: grid; gap: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; }
.field textarea { resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus, .person-filter select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); border-color: var(--accent); }
.hint { color: var(--muted); font-size: 11.5px; }
.check { display: inline-flex; gap: 8px; align-items: center; min-height: 36px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.info { display: grid; gap: 8px; }
.info-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 13.5px; }
.info-label { color: var(--muted); font-size: 12.5px; }
.info-val { overflow-wrap: anywhere; }
.review { background: var(--surface-2); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.review-note { background: var(--amber-soft); color: var(--text); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.steps { display: grid; gap: 8px; }
.step-list { display: grid; gap: 6px; }
.step-row { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.step-row.focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.step-row.done .step-title { color: var(--muted); }
.step-row.adding { border-style: dashed; border-color: var(--accent); }
.step-head { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: start; padding: 8px 10px; }
.step-head.clickable { cursor: pointer; }
.step-head.clickable:hover { background: var(--surface-2); border-radius: 10px; }
.step-head .dot { margin-top: 5px; }
.step-title { font-size: 13px; overflow-wrap: anywhere; }
.step-meta { font-size: 12px; color: var(--muted); }
.step-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.step-form, .own-form { display: grid; gap: 10px; padding: 4px 10px 10px; border-top: 1px dashed var(--border); margin-top: 2px; padding-top: 10px; }
.own-form { border-top: 1px dashed var(--border); }

.chat-log { display: grid; gap: 10px; }
.chat-msg { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
.chat-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.chat-meta .thread { font-weight: 700; color: var(--accent); }
.chat-meta .thread.space { color: var(--text); }
.chat-text { font-size: 13px; overflow-wrap: anywhere; }
.chat-btn-fake { display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border-strong); font-size: 12px; font-weight: 600; color: #1a73e8; }

.confirm-wrap { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px; background: rgba(15, 18, 25, .4); }
.confirm-box { width: min(380px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; display: grid; gap: 14px; }
.confirm-box p { margin: 0; }
.toasts { position: fixed; z-index: 90; left: 16px; bottom: 16px; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast {
  position: relative; padding: 10px 34px 10px 14px; border-radius: 12px; background: var(--text); color: var(--surface); box-shadow: var(--shadow);
  font-size: 13.5px; animation: toast-in .2s ease; transition: opacity .3s;
}
.toast.err { background: var(--red); color: #fff; }
.toast.warn { background: var(--amber-soft); color: var(--text); border: 1px solid #f59e0b; }
.toast.warn ul { margin: 6px 0 0; padding-left: 18px; color: var(--red); }
.toast.out { opacity: 0; }
.toast-x { position: absolute; top: 4px; right: 6px; border: 0; background: transparent; color: inherit; font-size: 18px; cursor: pointer; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Điện thoại */
@media (max-width: 1100px) {
  .tabs a span { display: none; }
  .tabs a { padding: 8px 12px; }
}
@media (max-width: 760px) {
  body { font-size: 14px; }
  .topbar { gap: 8px; padding: 0 16px; }
  .brand span:not(.brand-ball):not(.demo-badge) { display: none; }
  .me-name { display: none; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; justify-content: space-around; gap: 0;
    background: var(--surface); border-top: 1px solid var(--border); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .tabs a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; border-radius: 10px; flex: 1; }
  .tabs a span { display: block; }
  .tabs a.on { background: transparent; color: var(--accent); }
  .tabs .count { position: absolute; top: 2px; right: calc(50% - 22px); }
  .filterbar { padding: 8px 16px; gap: 8px; }
  .month-nav strong { min-width: 96px; font-size: 14px; }
  .line-chips { order: 5; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .view-actions { margin-left: 0; width: 100%; }
  .view-actions .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .view { padding: 10px 16px calc(84px + env(safe-area-inset-bottom)); }
  .cal-wrap { padding: 2px; border-radius: 10px; }
  .fc { font-size: 11px; }
  .fc .fc-daygrid-day-frame { min-height: 74px; }
  .fc .fc-daygrid-event { margin: 1px 1px; }
  .post-chip, .ev-chip, .sk-chip { padding: 0 2px; gap: 2px; }
  .post-chip .time { display: none; }
  .fc .fc-list-event .post-chip .time { display: inline; }
  /* Lưới tháng trên điện thoại: mỗi bài là một vạch màu theo tuyến, chạm ngày để xem danh sách bên dưới */
  .fc-daygrid .fc-daygrid-event { height: 7px; min-height: 0; overflow: hidden; margin: 2px 3px; border-radius: 3px; }
  .fc-daygrid .fc-event.post-ev, .fc-daygrid .fc-event.bg-ev { border-left-width: 0; background-color: var(--line-c) !important; }
  .fc-daygrid .fc-event.bg-ev { opacity: .45; }
  .fc-daygrid .post-chip, .fc-daygrid .ev-chip { display: none; }
  .fc-daygrid .fc-event.is-late { box-shadow: 0 0 0 1.5px var(--red); }
  .fc .fc-daygrid-day-frame { min-height: 64px; }
  .fc .fc-daygrid-more-link { font-size: 10px; }
  .fc .is-sel { box-shadow: inset 0 0 0 2px var(--accent); }
  .drawer { width: 100vw; border-left: 0; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .work-row { grid-template-columns: auto 1fr; }
  .work-side { grid-column: 2; justify-content: flex-start; }
  .board { grid-template-columns: repeat(4, 78vw); }
  .tl-scroll { max-height: calc(100vh - 250px); }
  .toasts { top: 10px; bottom: auto; left: 12px; right: 12px; width: auto; }
  .demo-users { grid-template-columns: 1fr 1fr; }
  .info-row { grid-template-columns: 92px 1fr; }
}
