/* CSS viết tay, không cần build.
   Hướng: giấy tờ địa chính — nền lưới bản đồ mờ, xanh dương là màu chủ đạo (thanh trên, nút chính, dữ liệu đã có),
   đỏ chỉ cho bắt buộc / xoá, vàng cho ô còn trống, xanh lá cho thông báo thành công. Viền thay cho bóng; chỉ
   trang A4 có bóng như tờ giấy. */
:root {
    --ink: #1f2b3d;
    --ink-2: #3a4a61;
    --brand: #1d5bd6;
    --brand-dark: #1747a6;
    --brand-soft: #e7eefc;
    --brand-line: #bcd0f5;
    --paper: #edf1f7;
    --grid: rgba(29, 91, 214, 0.06);
    --sheet: #ffffff;
    --line: #cdd5e0;
    --line-soft: #e3e8ef;
    --muted: #5d6b7c;
    --seal: #b42318;
    --seal-soft: #fdecea;
    --parcel: #2e6b4e;
    --parcel-soft: #e3f0e8;
    --amber: #8a5a00;
    --amber-soft: #fff3d6;
    --focus: #1d5bd6;
    --r-panel: 10px;
    --r-ctl: 6px;
    --r-chip: 4px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    color: var(--ink);
    font: 15px/1.5 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-variant-numeric: tabular-nums;
    background-color: var(--paper);
    /* Lưới ô 24px như tờ bản đồ địa chính. */
    background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 24px 24px;
}
a { color: var(--brand-dark); text-decoration-color: rgba(29, 91, 214, 0.35); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code { font-size: 13px; background: var(--line-soft); padding: 1px 5px; border-radius: var(--r-chip); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
main.container { padding-top: 28px; padding-bottom: 48px; }
.stack > * + * { margin-top: 20px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.right { text-align: right; margin-top: 16px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; font-weight: 400; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }

/* Thanh trên cùng: mực xanh đen + con dấu đỏ */
.topbar { background: var(--brand); color: #fff; }
.topbar-inner { display: flex; align-items: center; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.seal { width: 34px; height: 34px; color: #fff; flex-shrink: 0; transform: rotate(-8deg); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-title { font-weight: 600; font-size: 16px; }
.brand-sub { font-size: 12.5px; color: rgba(255, 255, 255, 0.75); }

.flash { margin-top: 16px; padding: 10px 14px; border-radius: var(--r-ctl); border: 1px solid; font-weight: 500; }
.flash-success { background: var(--parcel-soft); border-color: #b9d8c6; color: #1f4d37; }
.flash-error { background: var(--seal-soft); border-color: #f2c2bd; color: #8a1c13; }

/* Tiêu đề trang */
.page-head .crumbs { display: flex; gap: 8px; font-size: 14px; color: var(--muted); }
.page-head .crumbs a { color: var(--brand); }
.page-head .h1 { margin-top: 2px; }
.h1 { font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 4px; }
.h2 { font-size: 16px; font-weight: 600; margin: 0; }
.hint { margin: 2px 0 14px; font-size: 14px; }
.page-head p { margin: 0; }

/* Khối nội dung: tờ trắng viền mảnh, không bóng */
.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-panel); }
.panel-pad { padding: 18px 20px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); }

/* Khung import trang chủ */
.dropzone {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 20px;
    padding: 26px 28px;
    background: var(--sheet);
    border: 1.5px dashed #8fa7d6;
    border-radius: var(--r-panel);
    transition: border-color 0.15s, background-color 0.15s;
}
.dropzone p { margin: 0; max-width: 60ch; }
.dropzone-icon { width: 52px; height: 52px; color: var(--brand); }
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.busy { opacity: 0.6; pointer-events: none; }
@media (max-width: 720px) { .dropzone { grid-template-columns: 1fr; text-align: left; } }

/* Nút */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-ctl);
    background: var(--sheet);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.12s, border-color 0.12s;
}
.btn:hover { background: #f4f6f7; border-color: #b9c3c8; }
.btn:disabled, .btn.disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-lg { min-height: 42px; padding: 8px 20px; font-size: 15px; }
.btn-sm { min-height: 30px; padding: 3px 10px; font-size: 13.5px; }
.btn-quiet-danger { border-color: transparent; background: transparent; color: var(--seal); }
.btn-quiet-danger:hover { background: var(--seal-soft); border-color: #f2c2bd; }
.link-sm { font-size: 13.5px; margin-left: 8px; color: var(--ink-2); }

/* Nhóm nút xuất: nhãn + định dạng */
.seg { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--r-ctl); overflow: hidden; background: var(--sheet); }
.seg-label { padding: 6px 10px; font-size: 13.5px; color: var(--muted); background: #f5f7f8; border-right: 1px solid var(--line); }
.seg-btn { padding: 6px 12px; font-size: 13.5px; font-weight: 600; text-decoration: none; color: var(--brand-dark); }
.seg-btn + .seg-btn { border-left: 1px solid var(--line-soft); }
.seg-btn:hover { background: var(--brand-soft); }

/* Ô nhập */
.input {
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-ctl);
    background: var(--sheet);
    color: var(--ink);
    font: inherit;
    font-size: 14.5px;
}
.input:hover { border-color: #b9c3c8; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(29, 91, 214, 0.18); }
select.input { padding-right: 28px; }
.w-auto { width: auto; }
.w-search { width: 320px; max-width: 100%; }
.field { display: block; }
.field > span { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.grid3 { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .grid3 { grid-template-columns: 1fr; } .grid3 > [style] { grid-column: auto !important; } }

/* Bảng */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.scroll-x { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 12px; background: #f4f7fc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #f5f8fe; }
.table .num { text-align: right; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }
.strong-link { font-weight: 600; }

.tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: var(--r-chip); font-size: 12px; font-weight: 500; line-height: 20px; vertical-align: 1px; }
.tag-warn { background: var(--amber-soft); color: var(--amber); }

/* Bước chọn cột */
.step-title { display: flex; align-items: center; gap: 10px; }
.step-no { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 13px; font-weight: 700; }
.panel-pad.step .step-title { margin-bottom: 14px; }
.req { color: var(--seal); font-weight: 700; }
.warn { color: var(--amber); font-size: 13.5px; }
.table td .warn { margin-top: 4px; }
.row-missing td { background: var(--seal-soft) !important; }
.col-chip {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 28px;
    padding: 0 6px;
    border: 1px solid var(--brand-line);
    border-radius: var(--r-chip);
    background: var(--brand-soft);
    font-weight: 700;
    font-size: 13.5px;
    color: var(--brand-dark);
}
.col-chip-empty { border-style: dashed; border-color: #b9c3cf; background: transparent; color: #a3adb7; font-weight: 400; }
.samples { display: flex; flex-wrap: wrap; gap: 6px; }
.table td.samples { display: table-cell; }
.sample { display: inline-block; margin: 2px 6px 2px 0; padding: 1px 8px; border-radius: var(--r-chip); background: var(--brand-soft); color: var(--brand-dark); font-size: 13.5px; }
.pad-sm { padding: 12px 20px; border-top: 1px solid var(--line-soft); }
.action-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    backdrop-filter: blur(6px);
}

/* Trang xem/sửa một thông báo */
.record-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 20px; background: var(--sheet); border-bottom: 1px solid var(--line); }
.record-title { margin: 0 8px; }
.record-title .muted { margin-left: 6px; font-size: 14px; }
.record-layout { display: flex; height: calc(100vh - 60px - 55px); }
.record-form { width: 330px; flex-shrink: 0; overflow-y: auto; padding: 18px 20px; background: var(--sheet); border-right: 1px solid var(--line); }
.record-form .field + .field { margin-top: 12px; }
.record-preview { flex: 1; min-width: 0; overflow: auto; padding: 24px 16px; }
.record-preview .print-area { width: max-content; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 20px; }
@media (max-width: 860px) {
    .record-layout { flex-direction: column; height: auto; }
    .record-form { width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* Trang A4 TBXN mẫu 16: 210mm, lề 20/20/20/30mm, Times New Roman 14pt. */
.notice-page { width: 210mm; min-height: 297mm; padding: 20mm 20mm 20mm 30mm; background: #fff; color: #000; box-shadow: 0 1px 2px rgba(23, 71, 166, 0.12), 0 8px 24px rgba(23, 71, 166, 0.1); font: 14pt/1.3 "Times New Roman", Tinos, serif; font-variant-numeric: normal; }
.notice-page .b { font-weight: bold; }
.notice-page .i { font-style: italic; }
.np-header { display: grid; grid-template-columns: 40% 60%; text-align: center; font-size: 13pt; line-height: 1.35; }
.np-rule { border-top: 1px solid #000; margin: 3px auto 6px; }
.np-rule.short { width: 60px; }
.np-rule.long { width: 210px; }
.np-title { margin: 18px 0; text-align: center; font-weight: bold; }
.np-p { margin: 0 0 2px; white-space: pre-wrap; }
.np-p.indent { text-indent: 10mm; }
.np-p.justify { text-align: justify; }
.np-footer { display: grid; grid-template-columns: 45% 55%; margin-top: 14px; }
.small12 { font-size: 12pt; }
.small11 { font-size: 11pt; }
.sign-space { height: 22mm; }
.cell-filled { background: var(--brand-soft); color: var(--brand-dark); border-radius: 2px; }
.cell-empty { background: var(--amber-soft); color: var(--amber); border-radius: 2px; }
.notice-page [data-field] { cursor: pointer; }
.notice-page [data-field]:hover { outline: 1px solid currentColor; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

@page landscape { size: A4 landscape; margin: 0; }
@media print {
    @page { size: A4; margin: 0; }
    body { background: #fff; }
    .no-print, .topbar { display: none !important; }
    .record-layout { display: block; height: auto; }
    .record-preview { padding: 0; overflow: visible; background: #fff; }
    .record-preview .print-area { zoom: 1 !important; margin: 0; display: block; }
    .notice-page { break-after: page; }
    .page-landscape { page: landscape; }
    .notice-page { box-shadow: none; }
    .cell-filled, .cell-empty { background: none !important; color: inherit !important; }
    .notice-page [data-field]:hover { outline: none; }
}

/* Bảng lô: đủ mọi cột, cuộn ngang; STT dính trái, thao tác dính phải. Cột chia 3 nhóm (Thông báo / Người sử dụng
   đất / Thửa đất) bằng hàng tiêu đề nhóm và vạch dọc đầu nhóm (.g-start). Mỗi dòng một hàng: ô dài cắt bớt (.clip). */
.container-wide { max-width: 1680px; }
.table-wide { font-size: 14px; border-collapse: separate; border-spacing: 0; }
.table-wide th, .table-wide td { padding: 0 10px; height: 44px; border-bottom: 1px solid var(--line-soft); }
.table-wide thead th { height: 36px; background: #f4f7fc; border-bottom: 1px solid var(--line); }
.table-wide .group-row th { height: 30px; font-size: 12px; font-weight: 600; color: var(--brand-dark); background: var(--brand-soft); border-bottom: 1px solid var(--brand-line); }
.table-wide .group-row .group { text-align: left; border-left: 2px solid var(--brand-line); }
.table-wide .g-start { border-left: 2px solid var(--line-soft); }
.table-wide thead .g-start { border-left-color: var(--brand-line); }
.table-wide tbody tr:nth-child(even) td { background: #fafbfd; }
.table-wide tbody tr:hover td { background: #f2f6fe; }
.table-wide .strong { font-weight: 600; }
.table-wide .cccd { letter-spacing: 0.02em; }
.table-wide .clip { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-wide .clip-sm { width: 170px; min-width: 170px; }
.table-wide .clip-md { width: 230px; min-width: 230px; }
.table .tag { margin-left: 0; }
.missing { font-size: 12.5px; color: var(--amber); }
.missing::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #e0a526; vertical-align: 1px; }
.code { display: inline-block; padding: 1px 7px; border-radius: var(--r-chip); background: #eef2f8; font-size: 13px; font-weight: 600; color: var(--ink-2); }

/* Người: nút Ông/Bà cố định bề rộng + tên */
.person { display: flex; align-items: center; gap: 8px; }
.gender {
    flex-shrink: 0;
    width: 40px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--brand-line);
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}
.gender:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.gender-unknown { border-style: dashed; background: transparent; color: var(--muted); }
.person-name { padding: 2px 4px; margin: -2px -4px; border-radius: 3px; }
.placeholder { color: #a3adb7; font-size: 13px; }

.sticky-left, .sticky-right { position: sticky; z-index: 1; background: var(--sheet); }
.sticky-left { left: 0; box-shadow: inset -1px 0 0 var(--line); }
.sticky-right { right: 0; box-shadow: inset 1px 0 0 var(--line); white-space: nowrap; }
.table-wide thead .sticky-left, .table-wide thead .sticky-right { background: #f4f7fc; }
.table-wide .group-row .sticky-left, .table-wide .group-row .sticky-right { background: var(--brand-soft); }
.table-wide tbody tr:nth-child(even) td.sticky-left, .table-wide tbody tr:nth-child(even) td.sticky-right { background: #fafbfd; }
.table-wide tbody tr:hover td.sticky-left, .table-wide tbody tr:hover td.sticky-right { background: #f2f6fe; }

/* Nhóm thao tác cuối dòng */
.row-actions { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-ctl); overflow: hidden; background: var(--sheet); }
.row-actions a { padding: 4px 9px; font-size: 13px; text-decoration: none; color: var(--ink-2); }
.row-actions a + a { border-left: 1px solid var(--line-soft); }
.row-actions a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.row-actions .ra-main { font-weight: 600; color: var(--brand-dark); }

/* Sửa tại chỗ trong bảng lô */
.table-wide td.editable, .table-wide span.editable { cursor: text; }
.table-wide td.editable:hover, .table-wide span.editable:hover { box-shadow: inset 0 0 0 1px var(--brand-line); background: #fff !important; }
.table-wide td.editing, .table-wide span.editing { box-shadow: none !important; overflow: visible; }
.table-wide td.editing .cell-input { width: 100% !important; min-width: 0; box-sizing: border-box; }
.cell-input { height: 32px; padding: 3px 7px; border: 1px solid var(--brand); border-radius: 4px; font: inherit; font-size: 14px; color: var(--ink); background: #fff; box-shadow: 0 0 0 3px rgba(29, 91, 214, 0.18); outline: none; }
.saving { opacity: 0.55; }
.cell-error { box-shadow: inset 0 0 0 1px var(--seal) !important; background: var(--seal-soft) !important; }
.table-wide tbody tr.row-saved td { background: #e9f5ee; transition: background-color 0.8s; }
.edit-hint { font-size: 13px; color: var(--muted); padding: 10px 16px; border-top: 1px solid var(--line-soft); }

/* Sửa trực tiếp trên trang A4 */
.notice-page [data-field] { cursor: text; }
.notice-page [data-field="ngay_thong_bao"] { cursor: pointer; }
.notice-page .doc-editing { outline: 2px solid var(--brand) !important; outline-offset: 1px; background: #fff !important; color: #000 !important; min-width: 2em; display: inline-block; text-indent: 0; }
.input.linked { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29, 91, 214, 0.18); }
.form-hint { margin: 0 0 14px; padding: 8px 10px; border-radius: var(--r-ctl); background: var(--brand-soft); color: var(--brand-dark); font-size: 13px; }

/* Phân trang: nhóm nút số dòng / trang + số trang (không dùng ô chọn thả xuống) */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-soft); font-size: 14px; }
.pager-size { display: flex; align-items: center; gap: 10px; }
.pager .seg-btn { min-width: 44px; text-align: center; color: var(--ink-2); font-weight: 500; }
.pager .seg-btn.is-active { background: var(--brand); color: #fff; }
.pager-pages { display: flex; align-items: center; gap: 4px; }
.page-btn { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--sheet); color: var(--ink-2); font-weight: 500; text-decoration: none; }
a.page-btn:hover { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-dark); }
.page-btn.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-btn.disabled { opacity: 0.4; }
.page-gap { padding: 0 4px; color: var(--muted); }
.pager-top { border-top: 0; border-bottom: 1px solid var(--line-soft); }

/* Tab loại giấy trên trang xem/sửa */
.doc-tabs { display: inline-flex; margin-left: 12px; padding: 3px; gap: 2px; border-radius: 8px; background: #eef2f8; }
.doc-tab { padding: 5px 14px; border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--ink-2); text-decoration: none; }
.doc-tab:hover { color: var(--brand-dark); background: rgba(255, 255, 255, 0.6); }
.doc-tab.is-active { background: var(--sheet); color: var(--brand-dark); font-weight: 600; box-shadow: 0 0 0 1px var(--brand-line); }

/* Đơn mẫu 15 */
.don-title { font-size: 16pt; margin: 14px 0 6px; }
.don-kinh-gui { margin-bottom: 12px; }
.np-p.don-note { font-size: 12pt; font-style: italic; }
.don-sign { width: 55%; margin: 16px 0 0 auto; text-align: center; min-height: 40mm; }
.page-landscape { width: 297mm; min-height: 210mm; padding: 30mm 20mm 20mm 15mm; }
.ds-label { text-align: right; margin-bottom: 6px; }
.ds-thua { width: 100%; margin-top: 12px; border-collapse: collapse; table-layout: fixed; font-size: 13pt; }
.ds-thua th, .ds-thua td { border: 1px solid #000; padding: 4px 4px; text-align: center; vertical-align: middle; }
.ds-thua th { font-weight: bold; }

/* Nhóm xuất cả lô theo loại giấy; nhãn loại trong nhóm thao tác dòng */
.export-groups { display: flex; flex-wrap: wrap; gap: 8px; }
.row-actions .ra-label { padding: 4px 6px 4px 9px; font-size: 12px; font-weight: 600; color: var(--muted); background: #f5f7fa; border-left: 1px solid var(--line-soft); }
.row-actions .ra-label + a { border-left: 0; }

/* Trang chủ: lọc lô, trạng thái, nhãn */
.inline-form { display: inline; margin: 0; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--line-soft); }
.filter-bar .seg-btn { font-weight: 500; color: var(--ink-2); }
.filter-bar .seg-btn.is-active { background: var(--brand); color: #fff; }
.count { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; background: rgba(31, 43, 61, 0.08); font-size: 12px; font-weight: 600; text-align: center; }
.is-active .count { background: rgba(255, 255, 255, 0.25); }
.tag-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 20px; border-bottom: 1px solid var(--line-soft); }
.tag-filter-chip { padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--ink-2); text-decoration: none; background: var(--sheet); }
.tag-filter-chip:hover { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand-dark); }
.tag-filter-chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.status { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 999px; border: 1px solid; font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; }
button.status { cursor: pointer; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-todo { border-color: #f0d9a6; background: var(--amber-soft); color: var(--amber); }
.status-done { border-color: #b9dcc6; background: #e9f5ee; color: #1f6b43; }
.batch-list tr.is-done .strong-link { color: var(--muted); }
.batch-list td { vertical-align: top; padding-top: 12px; padding-bottom: 12px; }

.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 6px; }
.tag-chip { display: inline-flex; align-items: center; height: 24px; border: 1px solid var(--brand-line); border-radius: 999px; background: var(--brand-soft); font-size: 12.5px; overflow: hidden; }
.tag-chip a { padding: 0 4px 0 10px; color: var(--brand-dark); text-decoration: none; font-weight: 500; }
.tag-chip a:hover { text-decoration: underline; }
.tag-remove { width: 22px; height: 22px; border: 0; background: transparent; color: var(--brand-dark); font-size: 15px; line-height: 1; cursor: pointer; opacity: 0.6; }
.tag-remove:hover { opacity: 1; color: var(--seal); }
.tag-add { position: relative; }
.tag-add summary { list-style: none; display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border: 1px dashed #b9c3cf; border-radius: 999px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.tag-add summary::-webkit-details-marker { display: none; }
.tag-add summary:hover { border-color: var(--brand); color: var(--brand-dark); }
.tag-add[open] summary { border-style: solid; border-color: var(--brand); color: var(--brand-dark); }
.tag-add-form { position: absolute; z-index: 5; top: 30px; left: 0; width: 240px; padding: 8px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-ctl); box-shadow: 0 6px 20px rgba(23, 71, 166, 0.12); }
.page-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.page-meta .tags { margin-top: 0; }

/* Đăng nhập, menu tài khoản, quản lý người dùng */
.topbar-inner { justify-content: space-between; gap: 16px; }
.user-nav { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.nav-link, .nav-user, .nav-logout { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: var(--r-ctl); color: rgba(255, 255, 255, 0.9); text-decoration: none; font: inherit; font-size: 14px; }
.nav-link:hover, .nav-user:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #fff; color: var(--brand-dark); font-size: 12px; font-weight: 700; }
.nav-logout { border: 1px solid rgba(255, 255, 255, 0.4); background: transparent; cursor: pointer; }
.nav-logout:hover { background: #fff; color: var(--brand-dark); }
@media (max-width: 720px) { .user-nav .nav-user span:not(.avatar), .brand-sub { display: none; } }

.login-wrap { display: grid; place-items: center; min-height: calc(100vh - 60px); padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; padding: 28px; display: grid; gap: 14px; }
.login-card .flash { margin: 0; }
.narrow { max-width: 560px; }
.stack-sm > * + * { margin-top: 12px; }
.grid4 { display: grid; gap: 14px; grid-template-columns: repeat(4, 1fr); margin-top: 12px; }
@media (max-width: 900px) { .grid4 { grid-template-columns: 1fr 1fr; } }
.input-sm { min-height: 30px; padding: 3px 8px; font-size: 14px; }
.inline-edit { flex-wrap: nowrap; }
.user-table td { vertical-align: middle; }
.user-table tr.is-inactive td { color: var(--muted); }
.tag-me { background: var(--brand-soft); color: var(--brand-dark); }
.status-off { border-color: #e2c4c0; background: var(--seal-soft); color: var(--seal); }
.status:disabled { cursor: not-allowed; opacity: 0.7; }
.pw-reset { display: inline-block; margin-right: 6px; }
.pw-reset .tag-add-form { left: auto; right: 0; width: 280px; flex-wrap: nowrap; }
.login-card p, .login-card .h1 { margin: 0; }

/* Nút thao tác nhỏ có icon (trạng thái lô, xoá) */
.act-group { display: inline-flex; align-items: center; gap: 6px; }
.act {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: var(--r-ctl);
    background: var(--sheet);
    color: var(--ink-2);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.act svg { flex-shrink: 0; }
.act-success { border-color: #b9dcc6; color: #1f6b43; }
.act-success:hover { background: #1f8a55; border-color: #1f8a55; color: #fff; }
.act-neutral:hover { background: #f4f6f9; border-color: #b9c3cf; color: var(--ink); }
.act-danger { border-color: #f2c2bd; color: var(--seal); }
.act-danger:hover { background: var(--seal); border-color: var(--seal); color: #fff; }
.batch-list .actions { vertical-align: top; }
