/* Trang quản trị — dùng lại token và nút của styles.css */
body.admin { background: var(--sand); }
body.admin [hidden] { display: none !important; }
.container--wide { max-width: 1320px; }
.admin-user { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #e6e2de; }
.lang-toggle { display: inline-flex; border: 1px solid #555; border-radius: 8px; overflow: hidden; flex: none; }
.lang-toggle button { border: 0; background: transparent; color: #cfcac5; font-family: var(--f-head); font-weight: 700; font-size: 12.5px; padding: 7px 11px; cursor: pointer; }
.lang-toggle button[aria-pressed="true"] { background: #fff; color: var(--ink); }
.btn--sm { min-height: 36px; padding: 6px 14px; font-size: 13.5px; }
.btn--ghost-dark { background: transparent; color: #fff; border-color: #555; }
.btn--ghost-dark:hover { border-color: #fff; }

/* ---------- Login ---------- */
.login { max-width: 400px; margin: 64px auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px 24px; }
.login .display { font-size: 32px; margin: 4px 0 18px; }

/* ---------- Header row ---------- */
.dash-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 24px 0 16px; }
.dash-head h1 { font-family: var(--f-head); font-size: 24px; }
.dash-head__meta { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; text-align: left; cursor: pointer; }
.kpi:hover { border-color: var(--ink); }
.kpi__label { font-family: var(--f-head); font-weight: 600; font-size: 13.5px; color: var(--muted); }
.kpi__value { font-family: var(--f-display); font-weight: 700; font-size: 36px; line-height: 1.1; margin-top: 4px; }
.kpi__sub { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12.5px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-weight: 600; background: var(--gray-bg); color: #444; }
.pill--new { background: var(--amber-bg); color: var(--amber-ink); }
.pill--late { background: var(--pink); color: var(--red-ink); }
.pill--ok { background: var(--green-bg); color: var(--green-ink); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 22px 0 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 0; background: transparent; padding: 11px 14px; font-family: var(--f-head); font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--red); }
.tabs .count { font-weight: 600; color: var(--faint); margin-left: 4px; }

.panel-wrap { padding: 18px 0 48px; }
.grid-2 { display: grid; gap: 14px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; min-width: 0; }
.box h2 { font-family: var(--f-head); font-size: 16px; margin-bottom: 12px; }
.box h2 small { font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 6px; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* ---------- Horizontal bars (một chuỗi, nhãn trực tiếp) ---------- */
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(110px, 40%) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.bar__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar__track { height: 14px; background: var(--sand); border-radius: 4px; overflow: hidden; }
.bar__fill { display: block; height: 100%; background: var(--ink-2); border-radius: 0 4px 4px 0; }
.bar__val { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 2.5em; text-align: right; }
.bar:hover .bar__fill { background: var(--red); }

/* Cột theo ngày */
.cols { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 170px; padding-top: 18px; }
.col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.col__val { font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 3px; font-variant-numeric: tabular-nums; }
.col__bar { width: 100%; max-width: 26px; background: var(--ink-2); border-radius: 4px 4px 0 0; }
.col:hover .col__bar { background: var(--red); }
.cols__axis { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; border-top: 1px solid var(--line); padding-top: 5px; font-size: 11px; color: var(--muted); text-align: center; }

/* ---------- Status stack ---------- */
.stack-row { margin-top: 12px; }
.stack-row__head { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 6px; font-family: var(--f-head); font-weight: 600; }
.stack { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--sand); }
.stack span { display: block; height: 100%; }
.st-new { background: #d9a441; }
.st-doing { background: #5b7fb8; }
.st-done { background: #4f8a55; }
.st-closed { background: #9a948e; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Urgent list ---------- */
.urgent { display: grid; gap: 8px; }
.urgent button { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; text-align: left; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; font-size: 13.5px; }
.urgent button:hover { border-color: var(--ink); }
.urgent b { font-family: var(--f-head); font-size: 13px; }
.urgent .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }

/* ---------- Toolbar + table ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .input, .toolbar .select { min-height: 40px; padding: 8px 10px; font-size: 14px; width: auto; }
.toolbar .input { flex: 1 1 220px; }
.toolbar .spacer { flex: 1; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; font-family: var(--f-head); font-weight: 600; font-size: 12.5px; color: var(--muted); background: var(--sand); padding: 10px 12px; white-space: nowrap; position: sticky; top: 0; }
table.data td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: #faf8f6; }
table.data tr.is-late td:first-child { box-shadow: inset 3px 0 0 var(--red); }
td.nowrap, th.nowrap { white-space: nowrap; }
td.clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge--new { background: var(--amber-bg); color: var(--amber-ink); }
.badge--doing { background: #e2eaf6; color: #2f4f80; }
.badge--done { background: var(--green-bg); color: var(--green-ink); }
.badge--closed { background: var(--gray-bg); color: #555; }
.late { color: var(--red-ink); font-weight: 600; }
.table-foot { font-size: 13px; color: var(--muted); padding: 10px 2px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: flex; justify-content: flex-end; }
.modal__panel { background: #fff; width: min(560px, 100%); height: 100%; overflow-y: auto; padding: 22px 22px 32px; }
.modal__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal__head h2 { font-family: var(--f-head); font-size: 20px; }
.modal__close { border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 36px; height: 36px; cursor: pointer; font-size: 18px; flex: none; }
.detail { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 14px; margin: 0; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.edit { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.edit .field { margin-top: 12px; }
.files a { display: block; color: var(--red-ink); font-weight: 600; margin-bottom: 4px; }
