/* ==========================================================================
   DepotPro — hệ thống giao diện
   Bảng màu lấy từ bãi container: nhựa đường, bê tông, vàng tín hiệu xe nâng,
   xanh reefer, đỏ hư hỏng. Số container hiển thị như được kẻ trên vỏ cont:
   số kiểm tra (check digit) nằm trong ô vuông.
   ========================================================================== */

:root {
    --asphalt: #1f252b;
    --asphalt-2: #2a3138;
    --asphalt-3: #3a434c;
    --concrete: #eceeea;
    --concrete-2: #e2e5df;
    --paper: #ffffff;
    --line: #d4d8d1;
    --line-2: #e6e8e3;
    --ink: #1f252b;
    --ink-2: #4c5660;
    --ink-3: #78828a;
    --signal: #f2a900;
    --signal-2: #d99700;
    --signal-soft: #fff3d1;
    --reefer: #1673a6;
    --reefer-soft: #e1eff7;
    --damage: #c23b30;
    --damage-soft: #fbe8e5;
    --clear: #2e7d4f;
    --clear-soft: #e2f1e7;
    --radius: 6px;
    --radius-lg: 10px;
    --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-plate: "Barlow Condensed", "Be Vietnam Pro", system-ui, sans-serif;
    --sidebar-w: 236px;
    --topbar-h: 60px;

    --bs-body-font-family: var(--font);
    --bs-body-font-size: .9375rem;
    --bs-body-line-height: 1.5;
    --bs-body-color: var(--ink);
    --bs-body-bg: #ffffff;
    --bs-tertiary-bg: #f6f7f5;
    --bs-border-color: var(--line);
    --bs-border-radius: var(--radius);
    --bs-link-color: #0f5f8c;
    --bs-link-color-rgb: 15, 95, 140;
    --bs-link-hover-color: #0b4566;
    --bs-secondary-color: var(--ink-3);
    --bs-emphasis-color: var(--ink);
    --bs-focus-ring-color: rgba(242, 169, 0, .45);
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--concrete); font-feature-settings: "tnum" 1; }
h1, h2, h3, h4, h5 { color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0; }
h2 { font-size: 1.125rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
.text-muted, .muted { color: var(--ink-3) !important; }
.small, small { font-size: .8125rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
::selection { background: var(--signal-soft); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ───────────────────────── Khung ứng dụng ───────────────────────── */

.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
    background: var(--asphalt); color: #c9cfd4; position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: .65rem; padding: 1rem 1.1rem 1.1rem; color: #fff; text-decoration: none; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 5px; background: var(--signal);
    display: grid; place-items: center; flex: none;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.brand-sub { font-size: .75rem; color: #8f99a2; font-weight: 400; }
.nav-group { padding: .35rem .6rem .6rem; }
.nav-group-title { font-size: .75rem; color: #7d8790; padding: .6rem .6rem .35rem; }
.side-link {
    display: flex; align-items: center; gap: .7rem; padding: .55rem .65rem; border-radius: var(--radius);
    color: #d3d8dc; text-decoration: none; font-size: .9rem; position: relative;
}
.side-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; color: #9aa4ad; }
.side-link:hover { background: var(--asphalt-2); color: #fff; }
.side-link.active { background: var(--asphalt-3); color: #fff; }
.side-link.active::before {
    content: ""; position: absolute; left: -.6rem; top: .45rem; bottom: .45rem; width: 4px;
    border-radius: 0 3px 3px 0; background: var(--signal);
}
.side-link.active i { color: var(--signal); }
.side-count {
    margin-left: auto; min-width: 1.5rem; padding: 0 .4rem; border-radius: 999px; text-align: center;
    font-size: .75rem; font-weight: 600; background: var(--asphalt-3); color: #e8ecef; line-height: 1.4rem;
}
.side-count.hot { background: var(--signal); color: var(--signal-ink, #1f252b); }
.sidebar-foot { margin-top: auto; padding: .9rem 1.1rem; border-top: 1px solid var(--asphalt-2); font-size: .82rem; }
.sidebar-foot .who { color: #fff; font-weight: 500; }
.sidebar-foot a { color: #9aa4ad; text-decoration: none; }
.sidebar-foot a:hover { color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: var(--topbar-h); display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem;
    background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-weight: 600; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-search { margin-left: auto; position: relative; width: min(340px, 40vw); }
.topbar-search input {
    width: 100%; height: 38px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--concrete);
    padding: 0 .75rem 0 2.2rem; font-family: var(--font-plate); font-size: 1.05rem; letter-spacing: .04em; text-transform: uppercase;
}
.topbar-search input::placeholder { font-family: var(--font); font-size: .875rem; letter-spacing: 0; text-transform: none; color: var(--ink-3); }
.topbar-search input:focus { background: #fff; border-color: var(--signal-2); outline: none; box-shadow: 0 0 0 3px var(--signal-soft); }
.topbar-search i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.live-dot { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--ink-3); white-space: nowrap; }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.live-dot.on::before { background: var(--clear); box-shadow: 0 0 0 3px var(--clear-soft); }
.menu-btn { display: none; border: 0; background: none; font-size: 1.4rem; padding: .25rem; color: var(--ink); }

.content { padding: 1.5rem; max-width: 1480px; width: 100%; }

/* Thanh tab dưới cho điện thoại (nhân viên bãi) */
.tabbar {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; background: var(--asphalt);
    padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
    grid-template-columns: repeat(5, 1fr);
}
.tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: .1rem; color: #aab3bb; text-decoration: none;
    font-size: .7rem; padding: .35rem 0; border-radius: var(--radius); position: relative;
}
.tabbar a i { font-size: 1.3rem; }
.tabbar a.active { color: var(--signal); }
.tabbar .dot { position: absolute; top: .15rem; right: calc(50% - 1.1rem); background: var(--signal); color: var(--asphalt); font-size: .65rem; font-weight: 700; border-radius: 999px; padding: 0 .3rem; }

@media (max-width: 991.98px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: 0; top: 0; width: 270px; z-index: 1045; transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
    .menu-btn { display: block; }
    .topbar { padding: 0 1rem; }
    .content { padding: 1rem 1rem 6rem; }
    .tabbar { display: grid; }
    .topbar-search { width: auto; flex: 1; }
    .live-dot span { display: none; }
}

/* ───────────────────────── Số container ───────────────────────── */

.cno {
    font-family: var(--font-plate); font-weight: 600; letter-spacing: .045em; white-space: nowrap;
    display: inline-flex; align-items: center; gap: .28em; color: var(--ink); font-size: 1.08em; line-height: 1;
}
.cno-check {
    border: 1.5px solid currentColor; border-radius: 2px; padding: .08em .22em .04em; line-height: 1; min-width: 1.15em; text-align: center;
}
.cno.invalid .cno-check { color: var(--damage); }
a.cno { text-decoration: none; }
a.cno:hover .cno-owner, a.cno:hover .cno-serial { text-decoration: underline; text-decoration-thickness: 1px; }
.cno-xl { font-size: 2.6rem; font-weight: 700; gap: .22em; letter-spacing: .03em; }
.cno-xl .cno-check { border-width: 3px; border-radius: 4px; padding: .04em .14em 0; }
.cno-lg { font-size: 1.5rem; font-weight: 700; }
.cno-lg .cno-check { border-width: 2px; }

.type-tag {
    display: inline-block; font-family: var(--font-plate); font-weight: 600; font-size: .95rem; letter-spacing: .04em;
    padding: .05rem .4rem; border-radius: 4px; background: var(--concrete-2); color: var(--ink-2); line-height: 1.35;
}
.type-tag.rf { background: var(--reefer-soft); color: var(--reefer); }
.pos-tag { font-family: var(--font-plate); font-weight: 600; font-size: 1rem; letter-spacing: .05em; color: var(--ink); white-space: nowrap; }

/* ───────────────────────── Bề mặt & bố cục ───────────────────────── */

.page-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head .lead-text { color: var(--ink-3); margin: .2rem 0 0; font-size: .9rem; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel + .panel { margin-top: 1rem; }
.grid-2 > .panel, .grid-2-even > .panel, .grid-2 > div > .panel:first-child { margin-top: 0; }
.panel-head { display: flex; align-items: center; gap: .75rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line-2); }
.panel-head h2 { margin: 0; font-size: 1rem; }
.panel-head .hint { color: var(--ink-3); font-size: .8125rem; }
.panel-head .tools { margin-left: auto; display: flex; gap: .4rem; align-items: center; }
.panel-body { padding: 1.1rem; }
.panel-body.tight { padding: 0; }
.panel-foot { padding: .8rem 1.1rem; border-top: 1px solid var(--line-2); background: #fafbf9; border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 1199.98px) { .grid-2, .grid-2-even { grid-template-columns: 1fr; } }

/* Dải số liệu tổng quan */
.strip {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--paper);
    border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 1rem;
}
.strip-cell { padding: .9rem 1.1rem; border-right: 1px solid var(--line-2); text-decoration: none; color: inherit; min-width: 0; }
.strip-cell:last-child { border-right: 0; }
a.strip-cell:hover { background: #fafbf8; }
.strip-label { font-size: .8125rem; color: var(--ink-3); display: flex; align-items: center; gap: .35rem; }
.strip-value { font-family: var(--font-plate); font-weight: 600; font-size: 2rem; line-height: 1.1; margin-top: .15rem; letter-spacing: .01em; }
.strip-value small { font-family: var(--font); font-size: .8rem; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.strip-sub { font-size: .78rem; color: var(--ink-3); }
.strip-cell.alert .strip-value { color: var(--damage); }
.strip-cell.reefer .strip-value { color: var(--reefer); }
@media (max-width: 767.98px) {
    .strip { grid-template-columns: 1fr 1fr; }
    .strip-cell { border-bottom: 1px solid var(--line-2); }
    .strip-cell:nth-child(2n) { border-right: 0; }
    .strip-value { font-size: 1.65rem; }
}

/* ───────────────────────── Nút ───────────────────────── */

.btn { font-weight: 500; border-radius: var(--radius); --bs-btn-padding-y: .45rem; --bs-btn-padding-x: .9rem; --bs-btn-font-size: .9rem; }
.btn i { margin-right: .35rem; }
.btn-icon i { margin: 0; }
.btn-signal { background: var(--signal); border: 1px solid var(--signal-2); color: var(--asphalt); font-weight: 600; }
.btn-signal:hover, .btn-signal:focus { background: #ffb700; border-color: var(--signal-2); color: var(--asphalt); }
.btn-signal:active { background: var(--signal-2) !important; color: var(--asphalt) !important; }
.btn-ink { background: var(--asphalt); border: 1px solid var(--asphalt); color: #fff; }
.btn-ink:hover { background: var(--asphalt-3); color: #fff; }
.btn-line { background: var(--paper); border: 1px solid var(--line); color: var(--ink); }
.btn-line:hover { background: var(--concrete); border-color: #c4c9c1; color: var(--ink); }
.btn-reefer { background: var(--reefer); border: 1px solid #0f5f8c; color: #fff; }
.btn-reefer:hover { background: #0f5f8c; color: #fff; }
.btn-danger-line { background: var(--paper); border: 1px solid #e6b7b1; color: var(--damage); }
.btn-danger-line:hover { background: var(--damage-soft); color: var(--damage); }
.btn-lg-touch { min-height: 52px; font-size: 1rem; padding: .7rem 1.2rem; }
.btn:disabled, .btn.disabled { opacity: .5; }

/* ───────────────────────── Biểu mẫu ───────────────────────── */

.form-label { font-size: .8125rem; font-weight: 500; color: var(--ink-2); margin-bottom: .3rem; }
.form-control, .form-select { border-color: var(--line); border-radius: var(--radius); font-size: .9375rem; padding: .5rem .75rem; }
.form-control:focus, .form-select:focus { border-color: var(--signal-2); box-shadow: 0 0 0 3px var(--signal-soft); }
.form-control.plate-input {
    font-family: var(--font-plate); font-weight: 600; font-size: 1.6rem; letter-spacing: .08em; text-transform: uppercase; padding: .35rem .75rem;
}
.form-text { font-size: .78rem; color: var(--ink-3); }
.field-error, .text-danger.field-validation-error { font-size: .8rem; color: var(--damage) !important; }
.input-validation-error { border-color: var(--damage) !important; }
.check-card {
    display: flex; gap: .7rem; align-items: center; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--paper); cursor: pointer; user-select: none;
}
.check-card input { width: 1.25rem; height: 1.25rem; accent-color: var(--asphalt); flex: none; }
.check-card:has(input:checked) { border-color: var(--asphalt-3); background: #f7f8f6; }

/* Chọn nhanh dạng nút (loại hư hỏng, mức độ…) */
.choice-group { display: flex; flex-wrap: wrap; gap: .4rem; }
.choice-group input { position: absolute; opacity: 0; pointer-events: none; }
.choice-group label {
    border: 1px solid var(--line); border-radius: 999px; padding: .4rem .85rem; font-size: .875rem; cursor: pointer; background: var(--paper);
    min-height: 38px; display: inline-flex; align-items: center;
}
.choice-group input:checked + label { background: var(--asphalt); border-color: var(--asphalt); color: #fff; }
.choice-group input:focus-visible + label { outline: 3px solid var(--signal); outline-offset: 2px; }
.choice-group.sev input[value="3"]:checked + label { background: var(--damage); border-color: var(--damage); }
.choice-group.sev input[value="2"]:checked + label { background: #b26b00; border-color: #b26b00; }

/* ───────────────────────── Nhãn trạng thái ───────────────────────── */

.chip {
    display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 500; padding: .12rem .55rem;
    border-radius: 999px; background: var(--concrete-2); color: var(--ink-2); white-space: nowrap; line-height: 1.45;
}
.chip i { font-size: .85em; }
.chip-ok { background: var(--clear-soft); color: var(--clear); }
.chip-warn { background: var(--signal-soft); color: #8a5a00; }
.chip-danger { background: var(--damage-soft); color: var(--damage); }
.chip-reefer { background: var(--reefer-soft); color: var(--reefer); }
.chip-ink { background: var(--asphalt); color: #fff; }
.chip-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ───────────────────────── Bảng ───────────────────────── */

.table-ops { width: 100%; margin: 0; font-size: .875rem; border-collapse: separate; border-spacing: 0; }
.table-ops th {
    font-size: .78rem; font-weight: 500; color: var(--ink-3); text-align: left; padding: .6rem .9rem; border-bottom: 1px solid var(--line);
    background: #fafbf9; white-space: nowrap; position: sticky; top: 0;
}
.table-ops td { padding: .6rem .9rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table-ops tbody tr:last-child td { border-bottom: 0; }
.table-ops tbody tr:hover td { background: #fafbf8; }
.table-ops .r { text-align: right; }
.table-ops tr.clickable { cursor: pointer; }
.table-ops tfoot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; background: #fafbf9; }
.table-wrap { overflow-x: auto; }
.empty {
    padding: 2.2rem 1rem; text-align: center; color: var(--ink-3);
}
.empty i { font-size: 1.8rem; display: block; margin-bottom: .4rem; color: #b6bcb3; }

/* Danh sách dạng thẻ cho điện thoại */
.row-list { list-style: none; margin: 0; padding: 0; }
.row-list > li { border-bottom: 1px solid var(--line-2); }
.row-list > li:last-child { border-bottom: 0; }
.row-item { display: flex; gap: .85rem; align-items: center; padding: .8rem 1.1rem; text-decoration: none; color: inherit; }
a.row-item:hover { background: #fafbf8; }
.row-item .meta { font-size: .8rem; color: var(--ink-3); }
.row-item .end { margin-left: auto; text-align: right; }

/* ───────────────────────── Quy trình (stepper) ───────────────────────── */

.flow { list-style: none; margin: 0; padding: .5rem 0; counter-reset: none; }
.flow-step { position: relative; }
.flow-link {
    display: grid; grid-template-columns: 34px 1fr; gap: .75rem; padding: .6rem 1rem; text-decoration: none; color: inherit; position: relative;
}
.flow-link:hover { background: #fafbf8; }
.flow-step::after {
    content: ""; position: absolute; left: calc(1rem + 16px); top: 2.7rem; bottom: -.4rem; width: 2px; background: var(--line-2); z-index: 0;
}
.flow-step:last-child::after { display: none; }
.flow-num {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: .9rem;
    background: var(--paper); border: 2px solid var(--line); color: var(--ink-3); position: relative; z-index: 1;
}
.flow-title { font-weight: 600; font-size: .9rem; line-height: 1.25; margin-top: .1rem; }
.flow-hint { font-size: .78rem; color: var(--ink-3); line-height: 1.35; display: block; }
.flow-status { font-size: .78rem; margin-top: .15rem; display: block; }
.flow-step.done .flow-num { background: var(--asphalt); border-color: var(--asphalt); color: #fff; }
.flow-step.done::after { background: var(--asphalt-3); }
.flow-step.current .flow-num { background: var(--signal); border-color: var(--signal-2); color: var(--asphalt); box-shadow: 0 0 0 4px var(--signal-soft); }
.flow-step.current .flow-link { background: #fffbef; }
.flow-step.waiting .flow-num { border-color: var(--signal-2); color: #8a5a00; border-style: dashed; }
.flow-step.skipped .flow-num { border-style: dashed; color: #b2b8b0; }
.flow-step.skipped .flow-title { color: var(--ink-3); font-weight: 500; }
.flow-step.selected .flow-link { box-shadow: inset 3px 0 0 var(--asphalt); }
.flow-actor { font-size: .7rem; background: var(--concrete-2); color: var(--ink-2); padding: 0 .35rem; border-radius: 3px; margin-left: .3rem; font-weight: 500; }

.wizard { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 1rem; align-items: start; }
.wizard-side { position: sticky; top: calc(var(--topbar-h) + 1rem); }
@media (max-width: 991.98px) {
    .wizard { grid-template-columns: 1fr; }
    .wizard-side { position: static; }
    .wizard-side .flow { display: flex; overflow-x: auto; padding: .6rem .5rem; gap: .25rem; scroll-snap-type: x mandatory; }
    .wizard-side .flow-step { flex: none; scroll-snap-align: center; }
    .wizard-side .flow-step::after { display: none; }
    .wizard-side .flow-link { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: .35rem .5rem; width: 92px; gap: .3rem; }
    .wizard-side .flow-hint, .wizard-side .flow-status { display: none; }
    .wizard-side .flow-title { font-size: .72rem; font-weight: 500; }
    .wizard-side .flow-actor { display: none; }
    .wizard-side .flow-step.selected .flow-link { box-shadow: inset 0 -3px 0 var(--asphalt); }
    .visit-card-side { display: none; }
}

.step-head { display: flex; align-items: flex-start; gap: .9rem; padding: 1.1rem 1.2rem; border-bottom: 1px solid var(--line-2); }
.step-head .step-badge {
    width: 42px; height: 42px; border-radius: 50%; background: var(--signal); color: var(--asphalt); display: grid; place-items: center;
    font-weight: 700; font-size: 1.1rem; flex: none;
}
.step-head.done .step-badge { background: var(--asphalt); color: #fff; }
.step-head h2 { margin: .15rem 0 .1rem; font-size: 1.15rem; }
.step-head p { margin: 0; color: var(--ink-3); font-size: .85rem; }
.step-body { padding: 1.2rem; }
.step-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; padding: 1rem 1.2rem; border-top: 1px solid var(--line-2); background: #fafbf9; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.step-actions .ms-auto { margin-left: auto; }
@media (max-width: 575.98px) {
    .step-actions { position: sticky; bottom: 64px; z-index: 5; }
    .step-actions .btn { flex: 1; }
}

.callout { display: flex; gap: .7rem; padding: .75rem .9rem; border-radius: var(--radius); font-size: .875rem; background: var(--concrete); }
.callout i { font-size: 1.1rem; flex: none; margin-top: .05rem; }
.callout-warn { background: var(--signal-soft); color: #6d4700; }
.callout-danger { background: var(--damage-soft); color: #8d261d; }
.callout-ok { background: var(--clear-soft); color: #1f5c39; }
.callout-reefer { background: var(--reefer-soft); color: #0d4f74; }

/* Thẻ thông tin lượt container */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem 1.2rem; margin: 0; }
.facts dt { font-size: .75rem; color: var(--ink-3); font-weight: 500; }
.facts dd { margin: .1rem 0 0; font-weight: 500; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .875rem; margin: 0; }
.kv dt { color: var(--ink-3); font-weight: 400; }
.kv dd { margin: 0; text-align: right; font-weight: 500; }

/* ───────────────────────── Ảnh 6 mặt ───────────────────────── */

.face-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
@media (max-width: 575.98px) { .face-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; } }
.face-tile {
    border: 1.5px dashed #bfc5bc; border-radius: var(--radius-lg); background: #f7f8f6; overflow: hidden; display: flex; flex-direction: column;
    position: relative; min-height: 150px;
}
.face-tile.has { border-style: solid; border-color: var(--line); background: var(--paper); }
.face-tile .shot { aspect-ratio: 4 / 3; background: var(--concrete-2); display: grid; place-items: center; position: relative; overflow: hidden; }
.face-tile .shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face-tile .shot .face-icon { width: 58%; opacity: .55; }
.face-tile .cap { display: flex; align-items: center; gap: .4rem; padding: .5rem .65rem; font-size: .85rem; font-weight: 500; }
.face-tile .cap .count { margin-left: auto; font-size: .75rem; color: var(--ink-3); font-weight: 400; }
.face-tile .ok-mark {
    position: absolute; top: .45rem; left: .45rem; background: var(--clear); color: #fff; border-radius: 999px; font-size: .72rem;
    padding: .05rem .45rem; z-index: 2;
}
.face-tile .shoot {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
    border: 0; background: transparent; color: var(--ink-2); font-weight: 500; font-size: .85rem; cursor: pointer; z-index: 1;
}
.face-tile.has .shoot { inset: auto .45rem .45rem auto; width: 40px; height: 40px; border-radius: 50%; background: rgba(31,37,43,.82); color: #fff; }
.face-tile.has .shoot span { display: none; }
.face-tile .shoot i { font-size: 1.5rem; }
.face-tile.has .shoot i { font-size: 1.05rem; }
.face-tile.uploading::after {
    content: "Đang tải ảnh…"; position: absolute; inset: 0; background: rgba(255,255,255,.82); display: grid; place-items: center;
    font-size: .85rem; font-weight: 500; z-index: 3;
}
.thumbs { display: flex; gap: .4rem; flex-wrap: wrap; }
.thumbs a { display: block; width: 74px; height: 56px; border-radius: 5px; overflow: hidden; border: 1px solid var(--line); position: relative; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.thumbs .del {
    position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6);
    color: #fff; font-size: .7rem; display: grid; place-items: center; padding: 0;
}

.compare { display: grid; grid-template-columns: 110px 1fr 1fr; gap: .6rem; align-items: center; }
.compare .hdr { font-size: .78rem; color: var(--ink-3); font-weight: 500; }
.compare .face-name { font-weight: 500; font-size: .875rem; }
.compare .pic { aspect-ratio: 4/3; border-radius: var(--radius); overflow: hidden; background: var(--concrete-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-3); font-size: .8rem; position: relative; }
.compare .pic img { width: 100%; height: 100%; object-fit: cover; }
.compare .pic .shoot-out { position: absolute; inset: 0; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; color: var(--ink-2); font-size: .8rem; }
@media (max-width: 575.98px) { .compare { grid-template-columns: 1fr 1fr; } .compare .face-name { grid-column: 1 / -1; margin-top: .4rem; } .compare .hdr.first { display: none; } }

/* Xem ảnh lớn */
.lightbox { position: fixed; inset: 0; background: rgba(15,18,21,.92); z-index: 2000; display: none; flex-direction: column; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 90px); margin: auto; display: block; }
.lightbox .lb-bar { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; color: #dfe4e8; font-size: .85rem; }
.lightbox .lb-bar button { margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.6rem; }
.lightbox .hash { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; color: #9aa4ad; word-break: break-all; }

/* ───────────────────────── Sơ đồ trải phẳng container (đánh dấu hư hỏng) ───────────────────────── */

.net-wrap { position: relative; }
.net-svg { width: 100%; height: auto; display: block; touch-action: manipulation; }
.net-svg .face { fill: #e9edf0; stroke: #9aa6b0; stroke-width: 2; cursor: crosshair; transition: fill .12s; }
.net-svg .face:hover { fill: #dde5ea; }
.net-svg .face.active { fill: #fff3d1; stroke: var(--signal-2); }
.net-svg .rib { stroke: #c8d0d6; stroke-width: 1; pointer-events: none; }
.net-svg .face-label { font: 500 var(--fs, 15px) var(--font); fill: #5d6973; pointer-events: none; }
.net-svg .net-hint { font: 11px var(--font); fill: #8b969f; pointer-events: none; }
.net-svg .rib.bar { stroke: #aeb8c0; stroke-width: 3; }
.net-svg .rib.mid { stroke: #9aa6b0; stroke-width: 2; }
.net-portrait { display: none; }
@media (max-width: 575.98px) { .net-landscape { display: none; } .net-portrait { display: block; } }
.net-svg .pin circle { fill: var(--damage); stroke: #fff; stroke-width: 2.5; }
.net-svg .pin.out circle { fill: #b26b00; }
.net-svg .pin text { font: 700 12px var(--font); fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.net-svg .ghost circle { fill: none; stroke: var(--asphalt); stroke-width: 2; stroke-dasharray: 4 3; }
.net-readonly .face { cursor: default; }
.net-readonly .face:hover { fill: #e9edf0; }

.damage-list .dmg { display: grid; grid-template-columns: 28px 1fr auto; gap: .7rem; align-items: start; padding: .7rem 0; border-bottom: 1px solid var(--line-2); }
.damage-list .dmg:last-child { border-bottom: 0; }
.dmg-no { width: 26px; height: 26px; border-radius: 50%; background: var(--damage); color: #fff; font-weight: 700; font-size: .8rem; display: grid; place-items: center; }
.dmg-no.out { background: #b26b00; }

/* Bottom sheet trên điện thoại */
@media (max-width: 575.98px) {
    .modal-sheet .modal-dialog { margin: 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: none; }
    .modal-sheet .modal-content { border-radius: 16px 16px 0 0; border: 0; max-height: 92vh; }
    .modal-sheet .modal-body { overflow-y: auto; }
}
.modal-content { border-radius: var(--radius-lg); border-color: var(--line); }
.modal-header { border-bottom-color: var(--line-2); }
.modal-footer { border-top-color: var(--line-2); background: #fafbf9; }

/* ───────────────────────── Sơ đồ bãi ───────────────────────── */

.block-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.block-tab {
    border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); padding: .45rem .75rem; text-decoration: none; color: var(--ink);
    display: flex; align-items: center; gap: .55rem; font-size: .875rem;
}
.block-tab b { font-family: var(--font-plate); font-size: 1.2rem; font-weight: 700; }
.block-tab .fill { width: 54px; height: 6px; border-radius: 3px; background: var(--concrete-2); overflow: hidden; }
.block-tab .fill span { display: block; height: 100%; background: var(--asphalt-3); }
.block-tab.active { border-color: var(--asphalt); box-shadow: inset 0 -3px 0 var(--signal); }

.yard { overflow-x: auto; padding-bottom: .5rem; }
.yard-grid { display: grid; gap: 4px; min-width: max-content; }
.yard-axis { font-size: .72rem; color: var(--ink-3); text-align: center; align-self: center; font-variant-numeric: tabular-nums; }
.stack {
    width: 58px; height: 64px; border-radius: 5px; border: 1px solid var(--line); background: var(--paper); position: relative; padding: 3px;
    display: flex; flex-direction: column-reverse; gap: 2px; cursor: pointer; text-align: left;
}
.stack:hover { border-color: var(--ink-3); }
.stack .tier { height: 9px; width: 100%; border-radius: 2px; background: var(--concrete-2); flex: none; display: block; }
.stack .tier.c { background: #6e7a84; }
.stack .tier.c.rf { background: var(--reefer); }
.stack .tier.c.dm { background: var(--damage); }
.stack .tier.c.out { background: var(--signal); }
.stack .h { position: absolute; top: 2px; right: 4px; font-size: .68rem; font-weight: 600; color: var(--ink-3); }
.stack.full { background: #f5f6f4; }
.stack.found { outline: 3px solid var(--signal); outline-offset: 1px; }
.stack.pick-ok:hover { border-color: var(--asphalt); background: #fffbef; }
.stack.pick-no { opacity: .45; cursor: not-allowed; }
.stack.suggest { border: 2px solid var(--signal-2); background: #fffbef; }
.stack.chosen { border: 2px solid var(--asphalt); background: var(--signal-soft); box-shadow: 0 0 0 3px var(--signal-soft); }
.legend { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .78rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend i { width: 14px; height: 9px; border-radius: 2px; display: inline-block; }

.stack-pop { min-width: 250px; }
.stack-pop .tier-row { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--line-2); font-size: .85rem; }
.stack-pop .tier-row:last-child { border-bottom: 0; }
.stack-pop .tn { width: 22px; height: 22px; border-radius: 4px; background: var(--concrete-2); display: grid; place-items: center; font-size: .72rem; font-weight: 600; flex: none; }

/* ───────────────────────── Reefer ───────────────────────── */

.timer { font-family: var(--font-plate); font-weight: 600; font-size: 1.25rem; letter-spacing: .03em; font-variant-numeric: tabular-nums; color: var(--reefer); }
.timer-xl { font-size: 3rem; line-height: 1; }
.plug-card { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: 1rem 1.1rem; border-radius: var(--radius-lg); background: var(--reefer-soft); border: 1px solid #b9d9eb; }
.plug-card .plug-ico { width: 52px; height: 52px; border-radius: 50%; background: var(--reefer); color: #fff; display: grid; place-items: center; font-size: 1.5rem; }

/* ───────────────────────── Bảng phí / phiếu thu ───────────────────────── */

.fee-table td.amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fee-total { display: flex; align-items: baseline; justify-content: space-between; padding: .9rem 1.1rem; border-top: 2px solid var(--asphalt); }
.fee-total .lbl { font-weight: 600; }
.fee-total .val { font-family: var(--font-plate); font-weight: 700; font-size: 2rem; letter-spacing: .01em; }

/* ───────────────────────── Luồng hoạt động ───────────────────────── */

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 30px 1fr auto; gap: .65rem; padding: .6rem 1.1rem; border-bottom: 1px solid var(--line-2); font-size: .85rem; }
.feed li:last-child { border-bottom: 0; }
.feed .ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--concrete-2); color: var(--ink-2); }
.feed .tone-danger .ico { background: var(--damage-soft); color: var(--damage); }
.feed .tone-reefer .ico { background: var(--reefer-soft); color: var(--reefer); }
.feed .tone-ok .ico { background: var(--clear-soft); color: var(--clear); }
.feed .tone-money .ico { background: var(--signal-soft); color: #8a5a00; }
.feed .when { font-size: .75rem; color: var(--ink-3); white-space: nowrap; }
.feed .who { color: var(--ink-3); font-size: .78rem; }
.feed li.fresh { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { background: var(--signal-soft); } to { background: transparent; } }

.toast-stack { position: fixed; right: 1rem; bottom: 1rem; z-index: 1080; display: flex; flex-direction: column; gap: .5rem; max-width: min(380px, calc(100vw - 2rem)); }
.toast-item {
    background: var(--asphalt); color: #fff; border-radius: var(--radius-lg); padding: .75rem .9rem; display: grid; grid-template-columns: 22px 1fr; gap: .6rem;
    font-size: .85rem; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: toastIn .2s ease-out;
}
.toast-item i { color: var(--signal); font-size: 1.05rem; }
.toast-item a { color: #fff; }
.toast-item .t-sub { color: #aab3bb; font-size: .78rem; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }
@media (max-width: 991.98px) { .toast-stack { bottom: 5rem; } }

/* Biểu đồ thanh ngang đơn giản */
.hbar { display: grid; grid-template-columns: 96px 1fr 64px; gap: .6rem; align-items: center; font-size: .85rem; padding: .35rem 0; }
.hbar .track { height: 12px; background: var(--concrete-2); border-radius: 3px; overflow: hidden; display: flex; }
.hbar .seg { height: 100%; }
.hbar .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ───────────────────────── Đăng nhập ───────────────────────── */

.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--paper); }
.login-art { background: var(--asphalt); color: #fff; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 3rem; }
.login-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-art .quote { position: relative; max-width: 30rem; }
.login-art .quote h2 { color: #fff; font-size: 1.6rem; font-weight: 600; line-height: 1.3; }
.login-art .quote p { color: #aab3bb; margin: 0; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-form form { width: min(380px, 100%); }
.login-form .demo-accounts { font-size: .8rem; color: var(--ink-3); border-top: 1px solid var(--line-2); margin-top: 1.5rem; padding-top: 1rem; }
.login-form .demo-accounts button { border: 1px solid var(--line); background: var(--concrete); border-radius: var(--radius); padding: .25rem .55rem; font-size: .8rem; margin: .2rem .2rem 0 0; }
@media (max-width: 991.98px) { .login-page { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ───────────────────────── In ấn ───────────────────────── */

@media print {
    .sidebar, .topbar, .tabbar, .no-print, .toast-stack { display: none !important; }
    .app-shell { display: block; }
    .content { padding: 0; max-width: none; }
    body { background: #fff; }
    .panel { border: 0; }
}

/* Đầu hồ sơ lượt container */
.visit-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.4rem; margin-bottom: 1.1rem; }
.visit-head .plate-line { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.visit-head .tags { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.visit-head .facts-inline { display: flex; gap: 1.4rem; flex-wrap: wrap; font-size: .85rem; color: var(--ink-2); width: 100%; }
.visit-head .facts-inline b { font-weight: 500; color: var(--ink); }
.visit-head .facts-inline span { white-space: nowrap; }
@media (max-width: 575.98px) { .visit-head .cno-xl { font-size: 2rem; } .visit-head .facts-inline { gap: .3rem 1rem; } }

/* Phiếu thu */
.receipt-doc { background: #fff; color: #1f252b; max-width: 760px; margin: 0 auto; padding: 1.75rem 2rem; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.receipt-doc .rd-head { display: flex; gap: 1rem; align-items: flex-start; border-bottom: 2px solid var(--asphalt); padding-bottom: .9rem; margin-bottom: 1rem; }
.receipt-doc .rd-depot { font-size: .8rem; color: var(--ink-2); line-height: 1.45; }
.receipt-doc .rd-depot b { font-size: .95rem; color: var(--ink); }
.receipt-doc .rd-no { margin-left: auto; text-align: right; font-size: .8rem; color: var(--ink-2); white-space: nowrap; }
.receipt-doc .rd-title { font-size: 1.35rem; font-weight: 700; letter-spacing: .06em; text-align: center; margin: .2rem 0 .1rem; }
.receipt-doc .rd-sub { text-align: center; font-size: .82rem; color: var(--ink-3); margin-bottom: 1rem; }
.receipt-doc .rd-meta { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem 1.5rem; font-size: .875rem; margin-bottom: 1rem; }
.receipt-doc .rd-meta span { color: var(--ink-3); }
.receipt-doc table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.receipt-doc th { text-align: left; font-weight: 500; font-size: .78rem; color: var(--ink-3); border-bottom: 1px solid var(--line); padding: .45rem .3rem; }
.receipt-doc td { padding: .5rem .3rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.receipt-doc td.r, .receipt-doc th.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.receipt-doc .rd-total { display: flex; justify-content: space-between; align-items: baseline; padding: .7rem .3rem; border-top: 2px solid var(--asphalt); margin-top: -1px; }
.receipt-doc .rd-total b { font-family: var(--font-plate); font-size: 1.9rem; }
.receipt-doc .rd-words { font-size: .85rem; font-style: italic; color: var(--ink-2); padding: 0 .3rem; }
.receipt-doc .rd-foot { display: grid; grid-template-columns: 1fr auto; gap: 1.25rem; margin-top: 1.1rem; align-items: start; }
.receipt-doc .rd-pay { font-size: .82rem; color: var(--ink-2); line-height: 1.5; }
.receipt-doc .rd-sign { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; font-size: .82rem; margin-top: 1.5rem; }
.receipt-doc .rd-sign div { min-height: 80px; }
.receipt-doc .rd-sign i { display: block; color: var(--ink-3); font-size: .74rem; }
.receipt-doc .stamp-paid { display: inline-block; border: 2px solid var(--clear); color: var(--clear); font-weight: 700; padding: .15rem .6rem; border-radius: 4px; transform: rotate(-4deg); letter-spacing: .05em; }
.receipt-doc .stamp-void { border-color: var(--damage); color: var(--damage); }
@media (max-width: 575.98px) {
    .receipt-doc { padding: 1.1rem; border-radius: 0; border-left: 0; border-right: 0; }
    .receipt-doc .rd-meta { grid-template-columns: 1fr; }
    .receipt-doc .rd-head { flex-direction: column; }
    .receipt-doc .rd-no { margin-left: 0; text-align: left; }
    .receipt-doc .rd-foot { grid-template-columns: 1fr; }
}
@media print {
    @page { size: A5 portrait; margin: 8mm; }
    .receipt-doc { border: 0; padding: 0; max-width: none; }
}

.feed-scroll { max-height: calc(100vh - var(--topbar-h) - 8rem); overflow-y: auto; }
@media (min-width: 1200px) { .sticky-side { position: sticky; top: calc(var(--topbar-h) + 1rem); } }
.table-ops .btn, .table-ops .chip { white-space: nowrap; }
.table-ops td.fw-medium, .table-ops td.num { white-space: nowrap; }
.wizard > *, .grid-2 > *, .grid-2-even > *, .main, .content { min-width: 0; }
@media (max-width: 575.98px) {
    .topbar { gap: .6rem; }
    .topbar-title { flex: 1; min-width: 0; font-size: .95rem; }
    .topbar-search { flex: 0 1 140px; }
    .page-head h1 { font-size: 1.3rem; }
    .page-head .actions { margin-left: 0; width: 100%; }
    .page-head .actions .btn { flex: 1; }
    .panel-head { flex-wrap: wrap; }
    .panel-head .hint { width: 100%; order: 3; }
}

@media (max-width: 575.98px) {
    .step-actions { flex-direction: column; align-items: stretch; }
    .step-actions > .ms-auto, .step-actions .ms-auto { margin-left: 0 !important; }
    .step-actions > span, .step-actions > .chip { text-align: center; align-self: center; }
}
.row-item > div:first-of-type { min-width: 0; }
@media (max-width: 575.98px) {
    .row-item { flex-wrap: wrap; gap: .5rem .85rem; padding: .75rem 1rem; }
    .row-item .end { margin-left: 0; text-align: left; flex-basis: 100%; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
    .row-item .end .meta { margin-top: 0 !important; }
    .row-item > .bi-chevron-right { display: none; }
    .row-item > .bi:first-child + div { flex: 1; }
    .strip-sub { font-size: .72rem; }
}
.face-tile:not(.has) .shot .face-icon { position: absolute; top: 12%; left: 50%; transform: translateX(-50%); width: 44%; opacity: .35; }
.face-tile:not(.has) .shoot { justify-content: flex-end; padding-bottom: 10%; }
.face-tile:not(.has) .shoot i { display: none; }
.face-tile:not(.has) .shoot span::before { content: "\F220"; font-family: "bootstrap-icons"; margin-right: .35rem; }
.face-tile .shoot span { text-align: center; padding: 0 .5rem; line-height: 1.25; }
