:root {
  color-scheme: light;
  --red: #C8102E;
  --red-hover: #B00D28;
  --red-deep: #7A0A1C;
  --red-50: #FFF5F6;
  --red-100: #FDE8EB;
  --red-200: #F8CBD2;
  --red-300: #EE9AA6;
  --ink: #1D1A1B;
  --ink-2: #4B4446;
  --muted: #776E70;
  --line: #F0E4E6;
  --line-2: #E3D2D5;
  --bg: #FBF7F7;
  --surface: #FFFFFF;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(122, 10, 28, .05), 0 6px 20px rgba(122, 10, 28, .06);
  --font: 'Be Vietnam Pro', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --topbar-h: 112px;
  --pen: #2E6DB4; /* màu cột điểm bị trừ (đã kiểm tra phân biệt được với đỏ, kể cả người mù màu) */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
h1, h2 { margin: 0; }

/* ---------- Nút & ô nhập ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-outline { background: var(--surface); border-color: var(--line-2); color: var(--red); }
.btn-outline:hover:not(:disabled) { border-color: var(--red-300); background: var(--red-50); }
.btn-outline:disabled { color: var(--muted); opacity: .55; cursor: default; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover:not(:disabled) { border-color: var(--red-300); color: var(--red); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.on-red { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.icon-btn.on-red svg { fill: currentColor; stroke: none; }
.icon-btn.on-red:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.6); color: #fff; }
:focus-visible { outline: 3px solid rgba(200, 16, 46, .35); outline-offset: 2px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input {
  height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff;
}
.field input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(200, 16, 46, .15); }
.form-error { min-height: 20px; margin: 0 0 10px; color: var(--red); font-size: 13px; font-weight: 500; }

/* ---------- Đăng nhập ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    linear-gradient(180deg, var(--red) 0, var(--red) 38vh, var(--bg) 38vh);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border-radius: 18px;
  padding: 28px 24px 24px; box-shadow: 0 10px 40px rgba(122, 10, 28, .18);
}
.login-head { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.login-head h1 { font-size: 20px; }
.login-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.brand-mark {
  display: inline-grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 14px;
  background: var(--red); color: #fff; font-weight: 700; letter-spacing: .5px;
}

/* ---------- Thanh trên cùng ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--red); color: #fff; box-shadow: 0 2px 10px rgba(122,10,28,.2); }
.topbar-inner {
  max-width: 920px; margin: 0 auto; padding: 12px 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--red); font-weight: 700; font-size: 15px;
}
.who-text { display: grid; min-width: 0; }
.who-text strong { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text span { font-size: 13px; opacity: .9; }
.who-text b { font-weight: 600; letter-spacing: .3px; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 48px; min-width: 180px; padding: 6px; border-radius: 12px;
  background: #fff; color: var(--ink); box-shadow: 0 10px 30px rgba(0,0,0,.18); z-index: 30;
}
.menu button {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 8px; background: none;
}
.menu button:hover { background: var(--red-50); color: var(--red); }

.tabs { max-width: 920px; margin: 0 auto; padding: 0 16px 12px; display: flex; gap: 8px; }
.tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 14px;
  color: #fff; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
}
.tab svg { width: 18px; height: 18px; }
.tab:hover { background: rgba(255,255,255,.2); }
.tab.active { background: #fff; color: var(--red); border-color: #fff; }

/* Thanh tổng điểm thu gọn */
.mini-total {
  position: fixed; left: 0; right: 0; top: var(--topbar-h); z-index: 15;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line-2);
  font-size: 14px; color: var(--ink-2);
  transform: translateY(-120%); opacity: 0; transition: transform .2s, opacity .2s; pointer-events: none;
}
.mini-total.show { transform: none; opacity: 1; }
.mini-points b { font-size: 18px; color: var(--red); }

/* ---------- Bố cục ---------- */
.container { max-width: 920px; margin: 0 auto; padding: 16px 16px 48px; }
.view.loading .task-list, .view.loading .month-body { opacity: .5; transition: opacity .15s; }

.datebar { display: flex; align-items: center; gap: 8px; }
.date-label {
  position: relative; flex: 1; min-width: 0; height: 52px; padding: 0 14px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer;
}
.date-label:hover { border-color: var(--red-300); }
.date-label span { font-size: 12px; color: var(--muted); line-height: 1.2; }
.date-label strong { font-size: 17px; line-height: 1.25; }
.date-label input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0;
}
.date-label input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.datebar .btn { height: 52px; }
.window-note { margin: 8px 2px 14px; font-size: 13px; color: var(--muted); text-align: center; }
.window-note b { color: var(--ink-2); font-weight: 600; }
.badge-old {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 99px;
  background: var(--red-100); color: var(--red-deep); font-size: 12px; font-weight: 600;
}

/* ---------- Thẻ tổng điểm ---------- */
.total-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  border-top: 4px solid var(--red); padding: 16px 18px 14px;
}
.total-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.total-label { font-size: 14px; color: var(--muted); font-weight: 500; }
.total-value { display: flex; align-items: baseline; gap: 8px; }
#total-points { font-size: 52px; font-weight: 700; line-height: 1.05; color: var(--red); letter-spacing: -1px; }
.total-value .unit { font-size: 18px; color: var(--ink-2); font-weight: 600; }
.save-state { font-size: 13px; color: var(--muted); white-space: nowrap; padding-top: 2px; }
.save-state.saving { color: var(--ink-2); }
.save-state.error { color: var(--red); font-weight: 600; }

.meter {
  position: relative; height: 10px; margin: 14px 0 8px; border-radius: 99px; background: var(--red-100); overflow: hidden;
}
.meter-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--red); border-radius: 99px; transition: width .25s; }
.meter-over {
  position: absolute; top: 0; bottom: 0; left: 100%; width: 0; border-radius: 0 99px 99px 0; transition: width .25s;
  background: repeating-linear-gradient(135deg, var(--red-deep) 0 4px, var(--red) 4px 8px);
}
.total-sub { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.today-list { list-style: none; margin: 12px 0 0; padding: 12px 0 0; border-top: 1px dashed var(--line-2); display: flex; flex-wrap: wrap; gap: 6px; }
.today-list:empty { display: none; }
.today-list li {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 4px 10px; border-radius: 99px; background: var(--red-50); border: 1px solid var(--red-200); font-size: 13px;
}
.today-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-list li b { color: var(--red-deep); font-weight: 600; flex: none; }

/* ---------- Danh sách công việc ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; margin: 18px 0 6px; flex-wrap: wrap; }
.search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px;
}
.search:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(200, 16, 46, .12); }
.search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; height: 100%; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { position: relative; width: 40px; height: 24px; border-radius: 99px; background: var(--line-2); transition: background .15s; flex: none; }
.switch-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .switch-ui { background: var(--red); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid rgba(200, 16, 46, .35); outline-offset: 2px; }
.hint { margin: 4px 2px 10px; font-size: 13px; color: var(--muted); }

.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.task {
  display: grid; grid-template-columns: 1fr auto 96px; align-items: center; gap: 14px;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .15s, background .15s;
}
.task.has-qty { border-color: var(--red-200); background: var(--red-50); box-shadow: inset 4px 0 0 var(--red); }
.task-name { font-weight: 600; line-height: 1.3; }
.task-meta { margin-top: 3px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.task-meta .fav {
  display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; border-radius: 99px;
  background: var(--red-100); color: var(--red-deep); font-size: 12px; font-weight: 600;
}
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 11px; background: #fff; overflow: hidden; }
.stepper button {
  width: 42px; height: 44px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--red); font-weight: 500;
}
.stepper button:hover:not(:disabled) { background: var(--red-50); }
.stepper button:disabled { color: var(--line-2); cursor: default; }
.stepper input {
  width: 58px; height: 44px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  text-align: center; font-size: 18px; font-weight: 600; background: none; -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; background: var(--red-50); }
.stepper input:disabled { color: var(--muted); }
.task-points { text-align: right; line-height: 1.15; }
.task-points b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.task.has-qty .task-points b { color: var(--red); }
.task-points small { font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 24px 0; }

/* ---------- Tổng kết tháng ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.tile { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: grid; gap: 2px; align-content: start; }
.tile-hero { border-top: 4px solid var(--red); }
.tile-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.tile-value { font-size: 28px; font-weight: 700; line-height: 1.15; }
.tile-hero .tile-value { color: var(--red); font-size: 34px; }
.tile-sub { font-size: 13px; color: var(--ink-2); }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px 18px; margin-bottom: 14px; }
.card-head { margin-bottom: 14px; }
.card-head h2 { font-size: 17px; }
.card-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

/* Biểu đồ thanh ngang */
.hbar-chart { display: grid; gap: 2px; }
.hbar-row {
  display: grid; grid-template-columns: minmax(150px, 34%) 1fr; align-items: center; gap: 12px;
  padding: 5px 8px; margin: 0 -8px; border-radius: 8px; cursor: pointer;
}
.hbar-row:hover { background: var(--red-50); }
.hbar-row.selected { background: var(--red-50); box-shadow: inset 3px 0 0 var(--red); }
.hbar-label { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; }
.hbar-rank { width: 20px; flex: none; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.hbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-row.me .hbar-name { font-weight: 700; }
.you-pill { flex: none; padding: 0 7px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; }
.hbar-track { display: flex; align-items: center; gap: 8px; min-width: 0; height: 26px; border-left: 1px solid var(--line-2); }
.hbar-bar { height: 18px; min-width: 0; border-radius: 0 4px 4px 0; background: var(--red-300); transition: width .3s; }
.hbar-row.me .hbar-bar { background: var(--red); }
.hbar-value { font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Biểu đồ cột theo ngày */
.col-chart { position: relative; display: grid; grid-template-columns: 40px 1fr; gap: 6px; }
.col-axis { position: relative; height: 220px; }
.col-axis span { position: absolute; right: 0; transform: translateY(50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-plot { position: relative; height: 220px; }
.col-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); }
.col-ref { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px solid var(--red-300); z-index: 1; pointer-events: none; }
.col-ref span {
  position: absolute; right: 0; bottom: 2px; font-size: 11px; font-weight: 600; color: var(--red-deep);
  background: rgba(255,255,255,.85); padding: 0 4px; border-radius: 4px;
}
.col-bars { position: absolute; inset: 0; display: flex; z-index: 2; }
.col-slot { flex: 1; position: relative; display: flex; justify-content: center; align-items: flex-end; min-width: 0; outline-offset: -2px; }
.col-slot.has-val { cursor: pointer; }
.col-slot.has-val:hover { background: rgba(200, 16, 46, .05); }
.col-slot.future { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(0,0,0,.025) 6px 8px); }
.col-bar {
  position: absolute; left: 50%; transform: translateX(-50%); width: 70%; max-width: 22px;
  border-radius: 4px 4px 0 0; background: var(--red); transition: height .3s;
}
/* Điểm bị trừ: cột xám đậm quay xuống dưới vạch 0 */
.col-neg {
  position: absolute; left: 50%; transform: translateX(-50%); width: 70%; max-width: 22px;
  border-radius: 0 0 4px 4px; background: var(--pen); pointer-events: none;
}
.col-neg-hit { position: absolute; left: 0; right: 0; bottom: 0; cursor: pointer; z-index: 3; }
.col-neg-hit:hover { background: rgba(46, 109, 180, .08); }
.col-neg-val { position: absolute; left: 50%; transform: translate(-50%, 3px); font-size: 11px; font-weight: 600; color: var(--ink-2); white-space: nowrap; pointer-events: none; }
.col-zero { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid #CDBFC2; z-index: 1; pointer-events: none; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: -6px 0 12px; font-size: 12px; color: var(--muted); }
.chart-legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.key-work { background: var(--red); }
.key-pen { background: var(--pen); }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--red-deep); text-decoration: underline; cursor: pointer; }
.admin-table tr.flash td { background: #FFF1DC; }
.col-slot.today .col-bar { background: var(--red-deep); }
.col-peak { position: absolute; left: 50%; transform: translate(-50%, -4px); font-size: 11px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.col-days { grid-column: 2; display: flex; }
.col-days span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); min-width: 0; }
.col-days span.today { color: var(--red); font-weight: 700; }

.table-card summary { cursor: pointer; font-weight: 600; color: var(--red); }
.table-wrap { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.me td { font-weight: 600; background: var(--red-50); }

/* ---------- Tooltip, toast, dialog ---------- */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 260px;
  padding: 8px 11px; border-radius: 10px; background: #fff; color: var(--ink);
  box-shadow: 0 6px 24px rgba(0,0,0,.16); border: 1px solid var(--line-2); font-size: 13px;
}
.tooltip .tt-value { font-size: 16px; font-weight: 700; }
.tooltip .tt-line { color: var(--ink-2); }
.tooltip .tt-muted { color: var(--muted); font-size: 12px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: calc(100% - 32px);
}
.toast.error { background: var(--red); }
.dialog { border: 0; border-radius: 16px; padding: 22px; width: min(420px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.dialog::backdrop { background: rgba(29, 26, 27, .45); }
.dialog h2 { font-size: 18px; margin-bottom: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dialog-copy { margin: -6px 0 14px; color: var(--ink-2); font-size: 14px; }

/* ---------- Đăng nhập / thiết lập / đổi mật khẩu ---------- */
.login-note { margin: 14px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.notice { margin: -8px 0 16px; padding: 10px 12px; border-radius: 10px; background: var(--red-50); border: 1px solid var(--red-200); font-size: 13px; color: var(--red-deep); }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.btn-link { background: none; border: 0; color: var(--muted); font-weight: 500; margin-top: 6px; }
.btn-link:hover { color: var(--red); }
.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; }
.dialog { overflow-x: hidden; }
.field input, .field select { width: 100%; min-width: 0; }
.field select {
  height: 46px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff;
}
.field select:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(200, 16, 46, .15); }
.pass-row { display: flex; gap: 8px; align-items: center; }
.pass-row input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; letter-spacing: .5px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-2); margin: -4px 0 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }
.credential { display: grid; gap: 8px; padding: 14px; margin-bottom: 16px; border-radius: 12px; background: var(--red-50); border: 1px dashed var(--red-300); }
.credential div { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.credential span { font-size: 13px; color: var(--muted); }
.credential b { font-family: ui-monospace, Consolas, monospace; font-size: 18px; letter-spacing: .5px; word-break: break-all; text-align: right; }
.menu-who { padding: 8px 12px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.menu-who b { display: block; color: var(--ink); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Quản trị tài khoản ---------- */
body.wide .container, body.wide .topbar-inner, body.wide .tabs { max-width: 1280px; }
.admin-table .u-actions { flex-wrap: nowrap; }
.card-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.search-sm { height: 42px; flex: none; margin-bottom: 4px; }
.admin-table td { vertical-align: middle; }
.admin-table tr.inactive td { color: var(--muted); }
.admin-table .u-name { font-weight: 600; }
.admin-table .u-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.admin-table .u-actions button {
  height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: #fff;
  font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.admin-table .u-actions button:hover { border-color: var(--red-300); color: var(--red); background: var(--red-50); }
.admin-table .u-actions button.primary { border-color: var(--red-200); color: var(--red); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap; }
.pill + .pill { margin-left: 4px; }
.pill-admin { background: var(--red); color: #fff; }
.pill-user { background: #F1ECED; color: var(--ink-2); }
.pill-ok { background: #E8F3EC; color: #1F6B3A; }
.pill-warn { background: #FFF1DC; color: #8A5300; }
.pill-bad { background: var(--red-100); color: var(--red-deep); }
.pill-me { background: var(--ink); color: #fff; margin-left: 6px; }
.pill-owner { background: var(--red-deep); color: #fff; }
.u-muted { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- Lọc theo vùng công việc ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 6px; margin: 4px 0 2px; }
.chip {
  flex: none; height: 34px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-2); background: #fff;
  font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.chip:hover { border-color: var(--red-300); color: var(--red); }
.chip[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.chip small { font-weight: 500; opacity: .75; margin-left: 4px; }
.task-meta .grp { padding: 0 7px; border-radius: 99px; background: #F1ECED; color: var(--ink-2); font-size: 12px; font-weight: 600; }

/* Mục trong danh sách công việc: Đã ghim / Hay dùng / theo vùng */
.task-section { list-style: none; margin: 10px 2px 0; font-size: 13px; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.task-section:first-child { margin-top: 0; }
.task-section small { font-weight: 500; color: var(--muted); }
.task-section::after { content: ''; flex: 1; border-top: 1px solid var(--line-2); }
.task-section.sub { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.task-name { display: flex; align-items: flex-start; gap: 6px; }
.pin-btn {
  flex: none; width: 26px; height: 26px; margin: -3px 0 -3px -4px; border: 0; border-radius: 6px; background: none;
  font-size: 18px; line-height: 1; color: #B5A9AB;
}
.pin-btn:hover { color: var(--red); background: var(--red-50); }
.pin-btn[aria-pressed="true"] { color: var(--red); }

/* Quản trị xem trang nhập điểm: chỉ xem, không có điểm */
.review-note { margin-bottom: 12px; padding: 12px 14px; border-radius: 12px; background: #EEF4FB; border: 1px solid #C9DBF0; font-size: 14px; color: #1F3F66; }
.review-note a { color: inherit; font-weight: 600; }

/* Cửa sổ rộng (bảng điểm ngày): padding nằm ở lớp trong để bấm ra nền mờ là đóng được */
.dialog-wide { padding: 0; width: min(860px, calc(100% - 24px)); max-height: calc(100vh - 32px); }
.dialog-body { padding: 18px 20px 20px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.dialog-head h2 { margin-bottom: 4px; }
.dialog-head .dialog-copy { margin: 0 0 6px; }
.dialog-x { width: 38px; height: 38px; }
.dialog-wide .table-wrap { margin: 8px 0 14px; }

/* Bảng điểm theo công việc của một ngày */
.day-detail-table tfoot td { font-weight: 600; border-bottom: 0; }
.day-detail-table tfoot tr:first-child td { border-top: 2px solid var(--line-2); }
.day-detail-table tfoot tr.pen td { color: var(--ink-2); font-weight: 500; }
.day-detail-table tfoot tr.grand td { font-size: 16px; color: var(--red); }

/* Thời gian tính điểm */
.shift-now { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 8px; }
.shift-now b { font-size: 26px; color: var(--red); }
.shift-now span { color: var(--ink-2); font-size: 14px; }
.time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Điểm bị trừ ---------- */
.penalty-list { list-style: none; margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: #FFF6F0; border: 1px solid #F6D6C2; display: grid; gap: 6px; }
.penalty-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--ink-2); }
.penalty-list li b { color: var(--red-deep); white-space: nowrap; font-variant-numeric: tabular-nums; }
.penalty-list li small { display: block; color: var(--muted); font-size: 12px; }
.penalty-list-lg { margin: 0; background: none; border: 0; padding: 0; }
.penalty-list-lg li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.penalty-list-lg li:last-child { border-bottom: 0; }
.hbar-pen { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- Chọn kỳ tổng kết ---------- */
.segmented { display: inline-flex; padding: 3px; margin-bottom: 10px; border-radius: 12px; background: #fff; border: 1px solid var(--line-2); }
.segmented button { height: 36px; padding: 0 16px; border: 0; border-radius: 9px; background: none; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.segmented button[aria-pressed="true"] { background: var(--red); color: #fff; }
.date-label.no-picker { cursor: default; }
.date-label.no-picker:hover { border-color: var(--line-2); }
.col-val { position: absolute; left: 50%; transform: translate(-50%, -4px); font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.col-chart.wide-buckets .col-days span { font-size: 12px; color: var(--ink-2); }

/* ---------- Quản trị: mục con, bộ lọc, biểu mẫu ---------- */
.subtabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line-2); overflow-x: auto; overflow-y: hidden; }
.subtabs a {
  flex: none; padding: 10px 14px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--muted);
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.subtabs a:hover { color: var(--red); }
.subtabs a.active { color: var(--red); border-bottom-color: var(--red); }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.filters .search-sm { flex: 1 1 240px; margin: 0; }
.select { height: 42px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; min-width: 0; }
.check-inline { margin: 0; }
.admin-table tr.inactive td { color: var(--muted); }
.admin-table td.wrap { white-space: normal; min-width: 220px; }
.penalty-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 12px; align-items: end; }
.penalty-form .field { margin-bottom: 12px; }
.penalty-form .field-wide { grid-column: 1 / -1; }
.penalty-form select, .penalty-form input { width: 100%; height: 46px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; min-width: 0; }
.penalty-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-bottom: 4px; }
.penalty-actions .form-error { margin: 0; flex: 1; }
.mini-nav { display: flex; align-items: center; gap: 8px; }
.mini-nav strong { min-width: 110px; text-align: center; }
.role-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: -4px 0 12px; font-size: 13px; color: var(--muted); }
.role-legend .pill { margin-right: 4px; }

/* ---------- Điện thoại ---------- */
@media (max-width: 640px) {
  :root { --topbar-h: 106px; }
  .topbar-inner { padding: 10px 16px 8px; }
  .who-text strong { font-size: 16px; }
  .tab { font-size: 13px; height: 38px; }
  .datebar .btn { padding: 0 12px; }
  #total-points { font-size: 44px; }
  .task { grid-template-columns: 1fr auto; gap: 10px 12px; }
  .task-info { grid-column: 1 / -1; }
  .stepper { justify-self: start; }
  .stepper button { width: 48px; }
  .task-points { justify-self: end; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile-hero { grid-column: 1 / -1; }
  .hbar-row { grid-template-columns: 1fr; gap: 2px; }
  .hbar-track { border-left: 0; }
  .col-days span:not(.tick) { visibility: hidden; }
  .penalty-form { grid-template-columns: 1fr 1fr; }
  .penalty-form .field-wide { grid-column: 1 / -1; }
  .penalty-actions { grid-column: 1 / -1; }
  .tabs { gap: 6px; }
  .tab { gap: 6px; padding: 0 6px; font-size: 12.5px; }
  .tab svg { width: 16px; height: 16px; }
}

/* Bảng tài khoản thành dạng thẻ trên màn hình hẹp */
@media (max-width: 760px) {
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
  .admin-table tr { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
  .admin-table td { border: 0; padding: 4px 0; white-space: normal; display: flex; justify-content: space-between; gap: 12px; }
  .admin-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; flex: none; }
  .admin-table td.u-actions-cell { padding-top: 8px; }
  .admin-table td.u-actions-cell::before { content: none; }
  .admin-table .u-actions { justify-content: flex-start; width: 100%; flex-wrap: wrap; }
}
