/* Lãnh đạo · Tổng quan vận hành. Shared tokens only (Sáng/Tối come from appearance.css); title and
   filters sit directly on the workspace, each independent group is a card. */
#leadership-workspace { container:leader / inline-size; }
.leader-page { display:grid; gap:16px; min-width:0; }
.leader-filters { display:flex; flex:0 1 auto; flex-wrap:nowrap; justify-content:flex-end; align-items:start; gap:8px; min-width:0; margin:0; padding:0; border:0; background:transparent; }
.workspace-v2 .leader-filters .action-label { min-width:0; margin:0; }
.leader-filters .action-label > span:first-child { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.workspace-v2 .leader-filters .date-filter-group { display:flex; flex:none; align-items:start; gap:8px; min-width:0; padding-right:0; }
.workspace-v2 .leader-filters .date-filter-group .date-range-edit { position:static; flex:0 0 44px; }
.leader-filters select.action-input { width:8rem; max-width:100%; min-width:0; min-height:44px; }
.leader-filters .leader-project-field { display:grid; gap:6px; min-width:0; max-width:16rem; }
.leader-filters .leader-project-field select { width:12rem; max-width:100%; text-overflow:ellipsis; }
@supports (field-sizing:content) {
  .leader-filters select.action-input { field-sizing:content; width:auto; }
}
.leader-filter-status:empty { display:none; }
.leader-filter-status { display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; font-size:var(--ui-secondary); }
.leader-filter-status .error-text { color:var(--ui-danger-ink); }
.leader-history-more { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; margin:0 0 12px; padding:10px 12px; border:1px solid var(--ui-info-border); border-radius:8px; background:var(--ui-info-surface); color:var(--ui-info-ink); font-size:var(--ui-secondary); }
.leader-notice:empty { display:none; }
.leader-notice { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; }
.leader-notice .notice { margin:0; }
.leader-body { display:grid; gap:16px; min-width:0; }

/* Five tiles of one size: equal columns (one row when they fit, two on phones) and equal row heights.
   The label stays on one line (smaller text) above the volume, so every number sits on the same line. */
.leader-kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,7.5rem),1fr)); grid-auto-rows:1fr; gap:8px; }
.leader-kpi { display:grid; grid-template-rows:auto auto; align-content:start; gap:4px; min-width:0; padding:10px; border:1px solid var(--ui-border); border-radius:12px; background:var(--ui-surface); }
.leader-stage-icon svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
/* The shared .workspace-v2 h3 rule sets 18px; the tile label is smaller so it fits on one line. */
#leadership-workspace .leader-kpi-label { margin:0; font-size:var(--ui-secondary); font-weight:600; line-height:1.35; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.leader-kpi-value { display:flex; align-items:baseline; gap:6px; margin:0; color:var(--ui-ink); line-height:1.15; }
.leader-kpi-value strong { font-size:22px; font-weight:700; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.leader-kpi-unit { font-size:var(--ui-text); font-weight:600; }
.leader-kpi-sub { margin:0; font-size:var(--ui-secondary); line-height:1.4; }
.leader-kpi.tone-info { background:var(--ui-info-surface); border-color:var(--ui-info-border); color:var(--ui-info-ink); }
.leader-kpi.tone-teal { background:var(--ui-teal-surface); border-color:var(--ui-teal-ink); color:var(--ui-teal-ink); }
.leader-kpi.tone-success { background:var(--ui-success-surface); border-color:var(--ui-success-border); color:var(--ui-success-ink); }
.leader-kpi.tone-warning { background:var(--ui-warning-surface); border-color:var(--ui-warning-border); color:var(--ui-warning-ink); }
.leader-kpi.tone-amber { background:var(--ui-amber-surface); border-color:var(--ui-amber-ink); color:var(--ui-amber-ink); }

.leader-card { min-width:0; padding:16px 20px; border:1px solid var(--ui-border); border-radius:12px; background:var(--ui-surface); }
.leader-card-head { margin:0 0 12px; }
.leader-card-head h2 { margin:0; font-size:var(--ui-section-title); line-height:1.4; }
.leader-card-sub { margin:2px 0 0; color:var(--ui-muted); font-size:var(--ui-secondary); }

.leader-stage-table { width:100%; border-collapse:collapse; table-layout:fixed; }
.leader-stage-table th, .leader-stage-table td { padding:10px 12px; border-bottom:1px solid var(--ui-border); text-align:left; vertical-align:middle; }
.leader-stage-table tbody tr:last-child > * { border-bottom:0; }
.leader-stage-table thead th { color:var(--ui-muted); font-size:var(--ui-secondary); font-weight:600; background:var(--ui-surface-muted); }
.leader-stage-table thead th:nth-child(1) { width:22%; } .leader-stage-table thead th:nth-child(2) { width:24%; } .leader-stage-table thead th:nth-child(3) { width:12%; }
.leader-stage-name { font-weight:600; color:var(--ui-ink); }
.leader-stage-label { display:flex; align-items:center; gap:10px; }
.leader-stage-icon { display:grid; place-items:center; color:var(--ui-accent); }
.leader-stage-amount, .leader-stage-rate { font-variant-numeric:tabular-nums; }
.leader-stage-amount strong { color:var(--ui-ink); }
.leader-stage-amount span { color:var(--ui-muted); }
.leader-stage-rate { font-weight:700; color:var(--ui-ink); }
.leader-stage-bar { display:grid; grid-template-columns:minmax(80px,1fr) minmax(0,auto); align-items:center; gap:12px; }
.leader-bar { height:10px; border-radius:999px; background:var(--ui-progress-track); overflow:hidden; }
.leader-bar-fill { display:block; height:100%; border-radius:inherit; background:var(--ui-progress-fill); }
tr[data-stage=delivered] .leader-bar-fill { background:var(--ui-success-solid); }
.leader-bar.is-over .leader-bar-fill { background:var(--ui-warning-solid); }
.leader-stage-note { color:var(--ui-muted); font-size:var(--ui-secondary); white-space:nowrap; }
.leader-stage-note.is-over { color:var(--ui-warning-ink); font-weight:600; }

.leader-trip-scroll { background:var(--ui-workspace); }
.leader-trip-table { width:100%; min-width:720px; border-collapse:collapse; table-layout:fixed; }
.leader-trip-table th, .leader-trip-table td { padding:10px; border-bottom:1px solid var(--ui-border); text-align:left; vertical-align:middle; overflow-wrap:anywhere; }
.leader-trip-table thead th { color:var(--ui-muted); font-size:var(--ui-secondary); font-weight:600; background:var(--ui-surface-muted); }
.leader-trip-table tbody tr:last-child td { border-bottom:0; }
.leader-trip-table th:nth-child(1) { width:48px; }
.leader-trip-table th:nth-child(3) { width:21%; }
.leader-trip-table th:nth-child(4) { width:65px; }
.leader-trip-table th:nth-child(5) { width:13%; }
.leader-trip-table th:nth-child(6) { width:13%; }
.leader-trip-table th:nth-child(7) { width:20%; }
.leader-trip-table .numeric { font-variant-numeric:tabular-nums; }
.leader-trip-row { cursor:pointer; }
/* Row hover: list-rows.css (19/11/2026). */
.leader-trip-project { display:grid; gap:2px; }
.workspace-v2 .leader-trip-open { display:block; min-height:0; min-width:0; padding:2px 0; font-size:var(--ui-text); line-height:1.4; }
.leader-trip-order { color:var(--ui-muted); font-size:var(--ui-secondary); }
.leader-status { white-space:normal; border:1px solid currentColor; }
.leader-status.tone-info { background:var(--ui-info-surface); color:var(--ui-info-ink); }
.leader-status.tone-warning { background:var(--ui-warning-surface); color:var(--ui-warning-ink); }
.leader-status.tone-teal { background:var(--ui-teal-surface); color:var(--ui-teal-ink); }
.leader-status.tone-violet { background:var(--ui-violet-surface); color:var(--ui-violet-ink); }


.leader-back { justify-self:start; }
.leader-detail-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px 16px; }
.leader-facts { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:12px 24px; margin:0 0 16px; }
.leader-facts .order-fact { display:grid; gap:4px; min-width:0; }
.leader-facts dt { color:var(--ui-muted); font-size:var(--ui-secondary); }
.leader-facts dd { margin:0; color:var(--ui-ink); overflow-wrap:anywhere; }
.leader-detail-timeline .driver-checkpoints { margin:0 0 16px; }
.leader-history .order-history-list { max-height:min(70vh,760px); overflow-y:auto; }

@container leader (max-width:640px) {
  .leader-card { padding:14px 12px; }
  .leader-stage-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .leader-stage-table, .leader-stage-table tbody { display:block; }
  .leader-stage-table tr { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px 12px; padding:10px 0; border-bottom:1px solid var(--ui-border); }
  .leader-stage-table tbody tr:last-child { border-bottom:0; }
  .leader-stage-table :is(th,td) { display:block; padding:0; border:0; }
  .leader-stage-amount { grid-column:1; }
  .leader-stage-rate { grid-column:2; grid-row:1; text-align:right; }
  .leader-stage-name { grid-column:1; grid-row:1; }
  .leader-stage-amount { grid-row:2; }
  .leader-stage-table td:last-child { grid-column:1 / -1; }
  .leader-stage-bar { grid-template-columns:minmax(0,1fr); gap:6px; }
  .leader-stage-note { white-space:normal; }
}

/* One scope selector; filters align with the title without squeezing it on phones. */
#leader-branch { width:180px; min-width:0; min-height:44px; }
#leader-branch[hidden] { display:none; }
body[data-workspace-view=leadership] #workspace-panel > .hero { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,max-content); align-items:start; gap:16px; }
body[data-workspace-view=leadership] #workspace-panel > .hero .workspace-title { min-width:0; width:auto; }
body[data-workspace-view=leadership] #workspace-panel > .hero .hero-controls { display:flex; flex-wrap:nowrap; justify-content:flex-end; align-items:start; gap:8px; min-width:0; max-width:100%; }
body[data-workspace-view=leadership] #workspace-panel > .hero #reload { flex:none; }
.leader-stage-bar { grid-template-columns:minmax(80px,1fr); }
tr[data-stage=transit] .leader-bar-fill { background:var(--ui-warning-solid); }
tr[data-stage=site] .leader-bar-fill { background:var(--ui-amber-ink); }
@media(max-width:600px) {
 .leader-filters:has(.date-range-edit:not([hidden])) { flex-wrap:wrap; }
 #leader-branch { width:130px; }
 body[data-workspace-view=leadership] #profile-view .sidebar-label { display:none; }
}

body[data-workspace-view=leadership] #workspace-panel > .hero { grid-template-areas:"title controls"; }
body[data-workspace-view=leadership] #workspace-panel > .hero .workspace-title { grid-area:title; }
body[data-workspace-view=leadership] #workspace-panel > .hero .hero-controls { grid-area:controls; }
@container workspace (max-width:1000px) { body[data-workspace-view=leadership] #workspace-panel > .hero { grid-template-columns:minmax(0,1fr); grid-template-areas:"title" "controls"; } }

body[data-workspace-view=leadership] #refresh-status { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }

.leader-plan-note { margin:0 0 12px; color:var(--ui-muted); }
/* The filters live in the title block: its usual bottom space would stand between them and the figures. */
.workspace-v2:not(.driver-mode)[data-workspace-view=leadership] #workspace-panel > .hero { row-gap:8px; padding-bottom:0; margin-bottom:12px; }
.leader-trip-quantity { font-variant-numeric:tabular-nums; }
.leader-trip-quantity small { display:block; }
.leader-trip-expanded[hidden] { display:none; }
.leader-trip-expanded > td { background:var(--ui-surface-muted); padding:16px; }
.leader-trip-process { position:sticky; left:0; width:calc(100cqw - 32px); max-width:100%; }
.leader-delivery-result { display:grid; gap:6px; margin-top:14px; }
.leader-delivery-result p { margin:0; }
.leader-delivery-result.tone-full { color:var(--ui-success-ink); }
.leader-delivery-result.tone-partial { color:var(--ui-warning-ink); }
.leader-delivery-result.tone-failed { color:var(--ui-danger-ink); }

@container leader (max-width: 719px) {
  .leader-trip-scroll { overflow:visible; }
  .leader-trip-table, .leader-trip-table tbody { display:block; min-width:0; }
  .leader-trip-table thead {
    position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap;
  }
  .leader-trip-table .leader-trip-row {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 12px;
    padding:12px 6px; border-bottom:1px solid var(--ui-border);
  }
  .leader-trip-table .leader-trip-row > td { padding:0; border:0; }
  .leader-trip-row > td:nth-child(2) { grid-column:1/-1; grid-row:1; }
  .leader-trip-row > td[data-label]:not([data-label=""])::before {
    content:attr(data-label); display:block; margin-bottom:2px; color:var(--ui-muted); font-size:var(--ui-secondary);
  }
  .leader-trip-expanded:not([hidden]), .leader-trip-expanded > td { display:block; }
  .leader-trip-expanded > td { padding:12px 6px; }
  .leader-trip-process { position:static; width:100%; }
}
