:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --text: #1a2433;
  --muted: #6b7686;
  --line: #e1e6ee;
  --primary: #0b5cad;
  --primary-2: #0a4f95;
  --primary-soft: #e8f1fb;
  --primary-rgb: 11,92,173;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --warn-soft: #fff6e0;
  --ok: #1e8e3e;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 30, 54, .06), 0 2px 8px rgba(16, 30, 54, .05);
  --bottom-nav: 0px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 15.5px; line-height: 1.4; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 22.5px; margin: 0; }
h2 { font-size: 16px; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small-txt { font-size: 13.5px; }
.err-txt { color: var(--danger); font-weight: 600; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; gap: 16px;
  padding: env(safe-area-inset-top) 20px 0; height: calc(52px + env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; white-space: nowrap; }
.brand img { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 0 0 1.5px rgba(255,255,255,.5); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: #dce9f7; padding: 7px 13px; border-radius: 8px; font-weight: 500; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.16); color: #fff; }
.user-btn { background: rgba(255,255,255,.14); border: 0; color: #fff; padding: 6px 12px; border-radius: 20px; cursor: pointer; display: flex; gap: 6px; align-items: center; max-width: 220px; }
.user-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 16px; top: calc(48px + env(safe-area-inset-top)); background: #fff; color: var(--text); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.18); min-width: 200px; overflow: hidden; z-index: 40; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 11px 16px; background: none; border: 0; color: var(--text); cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--bg); }
.menu .who { padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }

main { max-width: 1500px; margin: 0 auto; padding: 16px 20px 40px; }
.page.narrow { max-width: 1100px; margin: 0 auto; }
.bottom-nav { display: none; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.page-head .back { font-size: 14px; display: inline-block; margin-bottom: 2px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--text); cursor: pointer; font-weight: 600; white-space: nowrap;
  min-height: 38px; transition: background .15s, border-color .15s;
}
.btn:hover { background: #f7f9fc; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { color: var(--danger); border-color: #f1c7c7; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: 14px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

input[type=text], input[type=search], input[type=password], input[type=tel], input:not([type]), select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid #cfd7e3; border-radius: 8px; background: #fff;
  min-height: 36px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 54px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.15); }
input:disabled, select:disabled, textarea:disabled { background: #f6f8fb; color: var(--text); -webkit-text-fill-color: var(--text); opacity: 1; }
.toolbar select { width: auto; min-width: 170px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.form-grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .s2 { grid-column: span 2; }
.form-grid .full { grid-column: 1 / -1; }
.field > .lbl, label.f > span { display: block; font-size: 13px; font-weight: 600; color: #4a5566; margin-bottom: 3px; }
label.f { display: block; min-width: 0; }
.field { min-width: 0; }
.req { color: var(--danger); font-style: normal; }
.checks { display: flex; gap: 10px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.check.bad-check { color: var(--danger); }
.check.bad-check input { accent-color: var(--danger); }
.check.bad-check:has(input:checked) { background: var(--danger-soft); border-color: #f1c7c7; }
.check:has(input:checked):not(.bad-check) { background: var(--primary-soft); border-color: #bcd5f0; }
.code-row { display: flex; gap: 6px; }
.code-row input { font-size: 19.5px; letter-spacing: 2px; font-weight: 700; }

/* ---------- Panels ---------- */
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 12px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-head h2 { display: flex; align-items: center; gap: 8px; }
.count-badge { background: var(--primary-soft); color: var(--primary); font-size: 13px; padding: 1px 8px; border-radius: 10px; font-weight: 700; }
.count-badge:empty { display: none; }
.sub-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: #fbfcfe; }
.sub-card.spouse { margin-top: 12px; background: #f7f9ff; border-color: #d6e2f5; }
.sub-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.sub-head b { color: var(--primary); }
.stack > * + * { margin-top: 10px; }
.empty { text-align: center; color: var(--muted); padding: 14px; border: 1.5px dashed var(--line); border-radius: 10px; }
.alert { padding: 10px 12px; border-radius: 10px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.alert.warn { background: var(--warn-soft); border: 1px solid #f1d58a; }
.alert.err { background: var(--danger-soft); border: 1px solid #f1c7c7; color: var(--danger); }
.bad-debt { display: inline-flex; align-items: center; gap: 3px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 10px; vertical-align: middle; white-space: nowrap; letter-spacing: .2px; }
h1 .bad-debt { font-size: 13px; padding: 2px 9px; }

/* ---------- Tổng quan ---------- */
.overview { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: linear-gradient(180deg, #f4f8fd, #fbfcfe); border: 1px solid #d9e5f3; }
.ov-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--primary); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#edit-assets { margin-left: auto; }
.ov-title .muted { font-weight: 400; font-size: 13px; }
.ov-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.ov-tile { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; min-width: 0; }
.ov-tile small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-tile b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-tile.danger { border-color: #f1c7c7; background: var(--danger-soft); } .ov-tile.danger b { color: var(--danger); }
.ov-tile.ok b { color: var(--ok); }
.ov-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ov-badges:empty { display: none; }
.sticker { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 800; letter-spacing: .3px; padding: 4px 11px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); border: 1.5px dashed currentColor; transform: rotate(-1.5deg); }
.sticker.bad { background: var(--danger); color: #fff; border: 1.5px solid #8e1b1b; box-shadow: 0 2px 6px rgba(198,40,40,.35); }
.sticker.good { background: #e8f5e9; color: var(--ok); }
.ov-text { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.ov-text > div { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; }
.ov-text > div:only-child { grid-column: 1 / -1; }
.ov-text small, .ov-books small { color: var(--muted); font-size: 12px; }
.ov-text p { margin: 2px 0 0; font-size: 14px; }
.ov-books { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ov-books li { background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--primary); border-radius: 8px; padding: 6px 9px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.ov-books li > b { color: var(--primary); }
.ov-books li.loan { border-left-color: #d35400; }
.ov-books li.loan > b { color: #d35400; }
@media (max-width: 560px) { .ov-text { grid-template-columns: 1fr; } }
.ov-lines { display: flex; gap: 6px 18px; flex-wrap: wrap; margin-top: 8px; font-size: 14px; }

/* ---------- Board ---------- */
.tabs { display: none; }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.col { background: #e9edf4; border-radius: 14px; padding: 9px; min-height: 200px; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; }
.col-head h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.col-head .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cc); }
.group { margin-bottom: 7px; }
.group-head { display: flex; align-items: center; gap: 8px; width: 100%; background: #fff; border: 0; border-left: 4px solid var(--sc); border-radius: 8px; padding: 7px 10px; cursor: pointer; font-weight: 600; font-size: 14.5px; text-align: left; }
.group-head .n { margin-left: auto; background: var(--bg); padding: 1px 8px; border-radius: 10px; font-size: 13px; }
.group-head .chev { transition: transform .15s; color: var(--muted); font-size: 11px; }
.group.collapsed .chev { transform: rotate(-90deg); }
.group.collapsed .cards { display: none; }
.group.zero .group-head { opacity: .55; font-weight: 500; }
.cards { display: flex; flex-direction: column; gap: 7px; padding: 7px 0 2px; }
.card { background: #fff; border-radius: 10px; padding: 10px 11px; box-shadow: var(--shadow); cursor: pointer; border-left: 4px solid var(--sc); transition: transform .1s, box-shadow .1s; }
.card:hover { box-shadow: 0 4px 14px rgba(16,30,54,.12); }
.card:active { transform: scale(.99); }
.card-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.card .code { font-weight: 700; color: var(--primary); }
.card .name { font-weight: 700; margin-top: 2px; }
.card .content { font-size: 13.5px; color: #4a5566; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.card-foot .chips { display: flex; gap: 6px; }
.card select { margin-top: 7px; min-height: 30px; padding: 4px 8px; font-size: 13.5px; border-radius: 7px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; padding: 2px 9px; border-radius: 12px; background: color-mix(in srgb, var(--sc, #0b5cad) 14%, #fff); color: color-mix(in srgb, var(--sc, #0b5cad) 80%, #000); white-space: nowrap; }
.pill.big { font-size: 14px; padding: 4px 12px; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; gap: 7px; }
.row-item { background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; display: flex; align-items: center; gap: 12px; color: var(--text); }
.row-item:hover { box-shadow: 0 4px 14px rgba(16,30,54,.1); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; font-size: 14px; }
.avatar.bad { background: var(--danger-soft); color: var(--danger); box-shadow: 0 0 0 2px var(--danger); }
.row-main { flex: 1; min-width: 0; }
.row-main .t { font-weight: 700; }
.row-main .s { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { text-align: right; font-size: 14px; color: var(--muted); flex-shrink: 0; }

/* ---------- Images ---------- */
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #e6eaf0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.thumb .x { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 17px; line-height: 1; cursor: pointer; }
.thumb.pending { display: grid; place-items: center; }
.thumb.pending::after { content: ""; width: 20px; height: 20px; border: 3px solid #c9d2df; border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; position: absolute; }
@keyframes spin { to { transform: rotate(360deg); } }
.add-img { aspect-ratio: 1; border: 1.5px dashed #b8c3d3; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; color: var(--primary); font-size: 21.5px; background: #fff; }
.add-img span { font-size: 11.5px; font-weight: 600; }
.add-img input { display: none; }
.add-img:hover { background: var(--primary-soft); }

.loc-box { margin-top: 6px; }
.loc-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.loc-actions .coords { font-size: 13px; color: var(--muted); }
.map { width: 100%; height: 160px; border: 0; border-radius: 8px; margin-top: 8px; background: #e6eaf0; }

.repeat-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.8fr auto; gap: 8px; align-items: end; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; margin-bottom: 6px; }
.repeat-row .idx { display: none; }
.repeat-row.loans-row { grid-template-columns: 1fr 1.4fr 1fr auto; }
input[type=date] { width: 100%; padding: 7px 10px; border: 1px solid #cfd7e3; border-radius: 8px; background: #fff; min-height: 36px; }

.logs { list-style: none; margin: 0; padding: 0; font-size: 13.5px; max-height: 260px; overflow: auto; }
.logs li { padding: 6px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; }
.logs li:last-child { border: 0; }
.logs time { color: var(--muted); white-space: nowrap; }

.cust-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cust-box .row-main .t a { color: var(--text); }
.quick-links { display: flex; gap: 6px; flex-wrap: wrap; }
.search-results { margin-top: 8px; }
.search-results button { display: flex; width: 100%; gap: 10px; text-align: left; padding: 8px 10px; border: 1px solid var(--line); background: #fff; border-radius: 10px; margin-bottom: 6px; cursor: pointer; align-items: center; }
.search-results button:hover { border-color: var(--primary); background: var(--primary-soft); }

.action-bar { position: sticky; bottom: 0; z-index: 20; background: rgba(243,245,249,.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 10px 0; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 8px; }
.panel .action-bar { background: rgba(255,255,255,.95); margin: 12px -16px -14px; padding: 10px 16px; border-radius: 0 0 var(--radius) var(--radius); }

.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; align-items: start; }
.order-side { position: sticky; top: 64px; }

/* ---------- QR ---------- */
.qr-video { position: relative; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; margin-bottom: 8px; }
.qr-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.qr-frame { position: absolute; inset: 18% 22%; border: 3px solid rgba(255,255,255,.9); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.qr-opts { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.qr-opts .btn { flex: 1; }
.qr-paste summary { cursor: pointer; color: var(--primary); font-size: 14px; margin: 6px 0; }
.qr-paste textarea { margin-bottom: 6px; }

/* ---------- Users ---------- */
.perm-table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.perm-table th, .perm-table td { padding: 7px; border-bottom: 1px solid var(--line); text-align: center; }
.perm-table th:first-child, .perm-table td:first-child { text-align: left; }
.perm-table input { width: 20px; height: 20px; accent-color: var(--primary); }
.perm-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.modal .check { border: 0; padding: 0; background: none !important; }

/* ---------- Modal / Toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15,25,40,.5); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h2 { margin-bottom: 12px; font-size: 18.5px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.big-option { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: left; margin-bottom: 8px; color: var(--text); }
.big-option:hover { border-color: var(--primary); background: var(--primary-soft); }
.big-option:disabled { opacity: .6; }
.big-option .ico { font-size: 26px; width: 36px; text-align: center; }
.big-option b { display: block; }
.big-option small { color: var(--muted); }
@keyframes fade { from { opacity: 0; } }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 120; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox button { position: absolute; background: rgba(255,255,255,.15); color: #fff; border: 0; width: 46px; height: 46px; border-radius: 50%; font-size: 26px; cursor: pointer; }
.lightbox .close { top: calc(14px + env(safe-area-inset-top)); right: 14px; }
.lightbox .prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lightbox .next { right: 10px; top: 50%; transform: translateY(-50%); }
.lightbox .cnt { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); color: #fff; font-size: 15.5px; }

#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--bottom-nav) + env(safe-area-inset-bottom)); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: #1f2a3a; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: fade .2s; font-size: 15.5px; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, #0b5cad 0%, #0a3d73 100%); }
.login { background: #fff; border-radius: 18px; padding: 28px 24px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login .logo { width: 52px; height: 52px; margin-bottom: 10px; }
.login h1 { font-size: 21.5px; margin-bottom: 4px; }
.login p { margin: 0 0 18px; color: var(--muted); font-size: 15.5px; }
.login .btn { width: 100%; margin-top: 6px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .ov-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .order-layout { grid-template-columns: 1fr; }
  .order-side { position: static; }
}
@media (max-width: 900px) {
  :root { --bottom-nav: 60px; }
  body { font-size: 16px; }
  .topbar { padding-left: 14px; padding-right: 14px; }
  .nav { display: none; }
  .brand span { font-size: 17px; }
  main { padding: 12px 10px calc(var(--bottom-nav) + 24px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: #fff; border-top: 1px solid var(--line);
    height: calc(var(--bottom-nav) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
  .bottom-nav a .i { font-size: 21.5px; line-height: 1; }
  .bottom-nav a.active { color: var(--primary); }
  .action-bar { bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom)); margin-left: -10px; margin-right: -10px; padding: 8px 10px; }
  .panel .action-bar { margin: 12px -12px -12px; padding: 8px 12px; border-radius: 0; }
  .action-bar .btn { flex: 1; }
  .tabs { display: flex; gap: 6px; margin-bottom: 10px; position: sticky; top: calc(52px + env(safe-area-inset-top)); z-index: 10; background: var(--bg); padding: 6px 0; }
  .tabs button { flex: 1; border: 1.5px solid #cfd7e3; background: #fff; border-radius: 10px; padding: 6px 4px; font-weight: 600; font-size: 13.5px; cursor: pointer; line-height: 1.25; }
  .tabs button b { display: block; font-size: 18.5px; }
  .tabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
  .board { grid-template-columns: 1fr; }
  .col { display: none; background: transparent; padding: 0; }
  .col.active { display: block; }
  .col-head { display: none; }
  .form-grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 12px; }
  .page-head h1 { font-size: 20.5px; }
  .hide-m { display: none !important; }
  .toolbar select { flex: 1; }
  .user-btn span { display: none; }
  .repeat-row, .repeat-row.loans-row { grid-template-columns: 1fr 1fr; }
  .repeat-row .wide { grid-column: 1 / -1; }
  .repeat-row .idx { display: flex; grid-column: 1 / -1; justify-content: space-between; align-items: center; font-weight: 700; color: var(--primary); }
  .repeat-row .del-wide { display: none; }
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}
@media (min-width: 901px) { .hide-d { display: none !important; } }
@media (max-width: 560px) {
  .form-grid.c2 { grid-template-columns: 1fr; }
  .form-grid.c4 .full-m { grid-column: 1 / -1; }
  .form-grid.c4 > .s2 { grid-column: 1 / -1; }
  .ov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .imgs { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Người đứng tên / người đứng vay ---------- */
.form-grid.c4 .s3 { grid-column: span 3; }
.stand-for { display: inline-block; font-size: 13px; font-weight: 600; color: #8a4b00; background: #fff3e0; border: 1px solid #ffd59e; border-radius: 6px; padding: 1px 8px; margin-left: 4px; vertical-align: middle; }
.stand-for.big { font-size: 14px; margin: 4px 0 0; }
.stand-for .muted { color: #a0703a; font-weight: 500; }
.sticker.warn { background: #fff3e0; color: #b35400; border-color: #d35400; }
.seg.compact label { flex: 1 1 auto; min-width: 0; }
.seg.compact span { padding: 7px 10px; font-size: 14px; }
.sub-card.borrower { background: #fffaf3; border-color: #ffd59e; }
.info-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.info-head .t a { color: var(--text); }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.info-grid > div { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; min-width: 0; }
.info-grid small { display: block; color: var(--muted); font-size: 12px; }
.info-grid b { font-weight: 600; font-size: 14px; word-break: break-word; }
#borrow .search-results + .btn, #borrow-pick > .btn { margin-top: 4px; }
@media (max-width: 900px) { .form-grid.c4 .s3 { grid-column: 1 / -1; } .info-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .info-grid { grid-template-columns: 1fr; } }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; border: 1.5px solid #cfd7e3; border-radius: 9px; font-weight: 600; background: #fff; }
.seg input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.seg input:disabled + span { cursor: default; opacity: .8; }
.marital-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); gap: 10px 12px; align-items: start; padding: 10px; border: 1px solid #d6e2f5; border-radius: 10px; background: #f7f9ff; }
.marital-row #marital-doc:empty { display: none; }
@media (max-width: 900px) { .marital-row { grid-template-columns: 1fr; } }

/* ---------- Icon Flaticon (UIcons) ---------- */
.fi { display: inline-flex; align-items: center; justify-content: center; line-height: 1; vertical-align: -0.14em; font-size: 1.05em; }
.fi::before { line-height: 1; }
.btn .fi { font-size: 1.1em; }
.nav a { display: inline-flex; align-items: center; gap: 6px; }
.panel-head h2 .fi, .sub-head .fi { color: var(--primary); }
.add-img .fi { font-size: 24px; }
.big-option .ico .fi { font-size: 26px; color: var(--primary); }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; }
.user-btn .fi { font-size: 19.5px; }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.14); border: 0; color: #fff; padding: 7px 12px; border-radius: 20px; cursor: pointer; font-weight: 600; }
.icon-btn .fi { font-size: 19.5px; }
.credit { text-align: center; font-size: 11.5px; color: var(--muted); margin: 18px 0 0; }
.credit a { color: var(--muted); }

/* Menu trượt (điện thoại) */
.drawer-back { position: fixed; inset: 0; background: rgba(15,25,40,.45); z-index: 110; animation: fade .15s; }
.drawer { position: absolute; left: 0; top: 0; bottom: 0; width: min(300px, 84vw); background: #fff; box-shadow: 4px 0 30px rgba(0,0,0,.2);
  padding: calc(14px + env(safe-area-inset-top)) 10px calc(14px + env(safe-area-inset-bottom)); overflow: auto; animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(-100%); } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.drawer a, .drawer button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 10px; border-radius: 10px; background: none; border: 0;
  color: var(--text); font-size: 16px; font-weight: 600; text-align: left; cursor: pointer; }
.drawer a .fi, .drawer button .fi { font-size: 20.5px; color: var(--primary); width: 22px; }
.drawer a:hover, .drawer button:hover { background: var(--primary-soft); }
.drawer #d-logout { color: var(--danger); margin-top: 8px; border-top: 1px solid var(--line); border-radius: 0; }
.drawer #d-logout .fi { color: var(--danger); }

/* Nút tạo nhanh */
.fab { position: fixed; right: 16px; bottom: calc(var(--bottom-nav) + 16px + env(safe-area-inset-bottom)); z-index: 25; width: 56px; height: 56px;
  border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 26px; box-shadow: 0 6px 18px rgba(var(--primary-rgb),.45); }

@media (max-width: 900px) {
  .topbar { gap: 8px; }
  .user-btn { padding: 7px 10px; }
  .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; background: none; border: 0;
    font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; position: relative; padding: 4px 2px; }
  .bottom-nav button .n { font-size: 19.5px; line-height: 1.1; color: var(--cc); min-height: 20px; }
  .bottom-nav button.active { color: var(--text); background: color-mix(in srgb, var(--cc) 10%, #fff); }
  .bottom-nav button.active::before { content: ""; position: absolute; top: 0; left: 18%; right: 18%; height: 3px; border-radius: 0 0 3px 3px; background: var(--cc); }
  .bottom-nav + .fab, .fab { bottom: calc(var(--bottom-nav) + 14px + env(safe-area-inset-bottom)); }
}

/* ---------- Trang hồ sơ: 2 cột ---------- */
.person-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; align-items: start; }
.person-side { position: sticky; top: 64px; max-height: calc(100vh - 76px); overflow: auto; padding-bottom: 8px; }
.person-side .panel { margin-bottom: 12px; }
@media (max-width: 1100px) { .person-layout { grid-template-columns: 1fr; } .person-side { position: static; max-height: none; } }

/* Lịch sử yêu cầu: nổi bật thời gian */
.req-list { display: flex; flex-direction: column; gap: 8px; }
.req-item { display: flex; gap: 10px; align-items: stretch; border: 1px solid var(--line); border-left: 4px solid var(--sc); border-radius: 10px; padding: 8px; color: var(--text); background: #fff; }
.req-item:hover { box-shadow: 0 4px 14px rgba(16,30,54,.1); }
.req-time { flex: 0 0 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: var(--primary-soft); color: var(--primary); border-radius: 8px; padding: 6px 4px; }
.req-time b { font-size: 14.5px; }
.req-time span { font-size: 18.5px; font-weight: 800; line-height: 1.2; }
.req-time small { font-size: 11.5px; color: #4a6f99; }
.req-body { min-width: 0; flex: 1; }
.req-body .t { font-weight: 700; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.req-body .s { font-size: 13.5px; color: var(--muted); }
.req-body .s.c { color: #4a5566; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Link đang chia sẻ */
.share-item { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; background: #fbfcfe; }
.share-url { font-weight: 600; font-size: 14px; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* Hộp thoại xuất hồ sơ */
.ex-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.ex-tabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border: 1.5px solid #cfd7e3; border-radius: 12px; background: #fff; cursor: pointer; font: inherit; }
.ex-tabs button .fi { font-size: 24px; color: var(--primary); margin-bottom: 2px; }
.ex-tabs button b { font-size: 14px; }
.ex-tabs button small { font-size: 11.5px; color: var(--muted); }
.ex-tabs button.active { border-color: var(--primary); background: var(--primary-soft); }
.ex-pane > * + * { margin-top: 10px; }
.btn.wide { width: 100%; }
.link-box { border: 1px solid #bcd5f0; background: var(--primary-soft); border-radius: 10px; padding: 10px; }
.link-box input { font-weight: 600; color: var(--primary); }

/* ---------- Hồ sơ: 4 phần ---------- */
/* Lịch sử ở cột phải chỉ khi màn hình rất rộng */
.person-layout { grid-template-columns: minmax(0, 1fr) 330px; }
@media (max-width: 1399px) { .person-layout { grid-template-columns: 1fr; } .person-side { position: static; max-height: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; } .person-side .panel { margin: 0; } }
/* Các khoản vay ở cột trái, thông tin ở giữa */
.pf-grid { display: grid; grid-template-columns: 310px minmax(0, 1fr); grid-template-areas: "loans main"; gap: 12px; align-items: start; }
.pf-main { grid-area: main; min-width: 0; container-type: inline-size; }
.pf-loans { grid-area: loans; min-width: 0; position: sticky; top: 64px; }
@media (max-width: 1000px) { .pf-grid { grid-template-columns: 1fr; grid-template-areas: "main" "loans"; } .pf-loans { position: static; } }
@container (max-width: 640px) { .form-grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid.c4 .s3 { grid-column: 1 / -1; } .marital-row { grid-template-columns: 1fr; } }

/* Tiêu đề từng phần, có số thứ tự và màu riêng */
.sec-title { display: flex; align-items: center; gap: 10px; margin: -14px -16px 12px; padding: 10px 16px; border-radius: var(--radius) var(--radius) 0 0;
  background: var(--sec-bg); border-bottom: 1px solid var(--sec-line); }
.sec-title h2 { flex: 1; display: flex; align-items: center; gap: 8px; color: var(--sec-fg); font-size: 16.5px; }
.sec-title h2 .fi { color: var(--sec-fg); }
.sec-no { width: 24px; height: 24px; border-radius: 50%; background: var(--sec-fg); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.panel.sec-self, .panel.sec-spouse, .panel.sec-assets, .panel.sec-debts { border-top: 4px solid var(--sec-fg); }
.sec-self   { --sec-fg: #0b5cad; --sec-bg: #eef5fd; --sec-line: #d3e3f6; }
.sec-spouse { --sec-fg: #c2185b; --sec-bg: #fdf0f5; --sec-line: #f6d3e1; background: #fffbfd; }
.sec-assets { --sec-fg: #2e7d32; --sec-bg: #eff8f0; --sec-line: #d4ebd6; }
.sec-debts  { --sec-fg: #d35400; --sec-bg: #fff4ec; --sec-line: #fadcc5; }
.sec-spouse input, .sec-spouse select { border-color: #ecc5d6; }
.sec-spouse input:focus { border-color: #c2185b; box-shadow: 0 0 0 3px rgba(194,24,91,.15); }
.sec-spouse .add-img { color: #c2185b; border-color: #e7b3c9; }
.spouse-empty { padding: 4px 2px; }
.sec-self .marital-row { background: #f6f9fe; border-color: #d3e3f6; }
.sub-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 8px; padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
.sub-title:first-of-type { margin-top: 4px; }
.sub-title b { display: flex; align-items: center; gap: 6px; color: var(--sec-fg); }
.sec-assets .sub-card { background: #fbfdfb; border-color: #d4ebd6; }

/* Các khoản vay (cột hẹp) */
.debt-sum { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.debt-sum > div { background: #fff; border: 1px solid #fadcc5; border-radius: 8px; padding: 5px 7px; min-width: 0; }
.debt-sum small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.debt-sum b { display: block; font-size: 14px; color: #a04000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.debt-item { border: 1px solid var(--line); border-left: 3px solid #d35400; border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; background: #fffcfa; }
.debt-item.card { border-left-color: #8e44ad; background: #fdfbff; }
.debt-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.debt-head b { font-size: 14px; color: #a04000; }
.debt-item.card .debt-head b { color: #6c3483; }
.debt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
.debt-grid .full { grid-column: 1 / -1; }
.icon-del { border: 0; background: none; color: var(--danger); cursor: pointer; font-size: 16px; padding: 4px; border-radius: 6px; }
.icon-del:hover { background: var(--danger-soft); }
.sec-debts .empty { padding: 10px; font-size: 14px; }
@media (max-width: 1000px) { .debt-sum { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { .sec-title { margin: -12px -12px 10px; padding: 9px 12px; } }
.debt-sum { grid-template-columns: 1fr; gap: 0; border: 1px solid #fadcc5; border-radius: 10px; background: #fff; overflow: hidden; }
.debt-sum > div { display: flex; align-items: baseline; gap: 6px; border: 0; border-radius: 0; padding: 6px 10px; }
.debt-sum > div + div { border-top: 1px dashed #fadcc5; }
.debt-sum small:first-child { flex: 1; font-size: 13.5px; color: #4a5566; }
.debt-sum b { font-size: 15.5px; }
.debt-sum small:last-child:not(:first-child) { flex: 0 0 auto; }
@media (max-width: 1000px) { .debt-sum { grid-template-columns: 1fr; } }
a.share-url { display: block; text-decoration: none; }
a.share-url:hover { text-decoration: underline; }
a.share-url .fi:last-child { font-size: .85em; opacity: .7; }
a.share-url.big { white-space: normal; word-break: break-all; background: #fff; border: 1px solid #bcd5f0; border-radius: 8px; padding: 8px 10px; font-size: 15.5px; }

/* ---------- Chữ lớn (+50%): điều chỉnh kích thước khung cho vừa ---------- */
.topbar { height: calc(62px + env(safe-area-inset-top)); }
.menu { top: calc(58px + env(safe-area-inset-top)); min-width: 300px; }
.order-side, .person-side, .pf-loans { top: 74px; }
.person-side { max-height: calc(100vh - 86px); }
input[type=text], input[type=search], input[type=password], input[type=tel], input:not([type]), select, textarea, input[type=date] { min-height: 48px; padding: 9px 12px; }
textarea { min-height: 76px; }
.btn { min-height: 50px; padding: 10px 18px; }
.btn.small { min-height: 42px; padding: 7px 13px; }
.avatar { width: 50px; height: 50px; }
.check input, .perm-table input { width: 24px; height: 24px; }
.imgs { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.thumb .x { width: 30px; height: 30px; }
.modal { max-width: 720px; }
.drawer { width: min(380px, 88vw); }
.ov-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.req-time { flex-basis: 136px; }
.pf-grid { grid-template-columns: 400px minmax(0, 1fr); }
.person-layout { grid-template-columns: minmax(0, 1fr) 430px; }
.order-layout { grid-template-columns: minmax(0, 1fr) 420px; }
.toolbar select { min-width: 240px; }
.col-head h2 { font-size: 16px; }
@container (max-width: 860px) { .form-grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid.c4 .s3 { grid-column: 1 / -1; } .marital-row { grid-template-columns: 1fr; } }
@media (max-width: 1700px) { .person-layout { grid-template-columns: 1fr; } .person-side { position: static; max-height: none; } }
@media (max-width: 1550px) { .brand span, .user-btn span { display: none; } }
@media (max-width: 1400px) { .order-layout { grid-template-columns: 1fr; } .order-side { position: static; } .nav a { padding: 7px 10px; } }
@media (max-width: 1250px) { .pf-grid { grid-template-columns: 1fr; grid-template-areas: "main" "loans"; } .pf-loans { position: static; } .board { grid-template-columns: 1fr; } .col { display: none; } .col.active { display: block; } }
@media (max-width: 1250px) and (min-width: 901px) { .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); height: 78px; }
  .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; background: none; border: 0; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; position: relative; }
  .bottom-nav button .n { font-size: 19px; color: var(--cc); } .bottom-nav button.active { color: var(--text); background: color-mix(in srgb, var(--cc) 10%, #fff); }
  main { padding-bottom: 110px; } .col-head { display: none; } }
@media (max-width: 1100px) { .nav a span, .nav a { font-size: 13px; } }
@media (max-width: 900px) {
  :root { --bottom-nav: 78px; }
  .topbar { height: calc(60px + env(safe-area-inset-top)); }
  .bottom-nav button span { font-size: 11.5px; }
  .bottom-nav button .n { font-size: 19px; min-height: 30px; }
  .tabs { top: calc(60px + env(safe-area-inset-top)); }
  .fab { width: 64px; height: 64px; font-size: 20px; }
  .debt-grid { grid-template-columns: 1fr; }
  .ex-tabs button small { display: none; }
  .req-time { flex-basis: 118px; }
}
@media (max-width: 900px) {
  .sec-title h2 { font-size: 15.5px; }
  .sec-title .btn { font-size: 0; gap: 0; padding: 8px 11px; min-height: 44px; }
  .sec-title .btn .fi { font-size: 16px; }
  .action-bar { flex-wrap: nowrap; gap: 8px; }
  .action-bar .btn { flex: 1 1 0; min-width: 0; padding: 8px 10px; }
  .person-layout .action-bar [data-act="export"], .action-bar [data-act="export-img"] { display: none; }
  .quick-links .btn { flex: 1 1 auto; }
  .page-head h1 { font-size: 19px; }
}

/* ---------- Chống tràn chữ trên màn hình hẹp ---------- */
.order-layout > *, .person-layout > *, .pf-grid > *, .board > * { min-width: 0; }
@media (max-width: 1400px) { .order-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1700px) { .person-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1250px) { .pf-grid { grid-template-columns: minmax(0, 1fr); } }
.panel-head { flex-wrap: wrap; }
.panel-head h2 { flex-wrap: wrap; min-width: 0; }
.seg span { white-space: normal; overflow-wrap: anywhere; }
.row-main .t, .cust-box .row-main .t { overflow-wrap: anywhere; }
.page-head > div { min-width: 0; }
.page-head h1 { overflow-wrap: anywhere; }
.info-head .row-main, .cust-box .row-main { min-width: 0; }
.card .name, .card .content, .req-body .t { overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .seg.compact { display: grid; grid-template-columns: 1fr 1fr 1fr; }
  .seg.compact span { padding: 7px 6px; font-size: 11.5px; line-height: 1.25; }
  .panel-head h2 .muted { flex-basis: 100%; }
  .sticker { white-space: normal; }
  .ov-badges { gap: 4px; }
}
.share-url { white-space: normal; overflow-wrap: anywhere; word-break: break-all; }
@media (max-width: 900px) { .action-bar .btn { font-size: 13.5px; padding: 8px 6px; gap: 4px; } }

/* ---------- Ảnh đại diện ---------- */
.avatar.icon { background: var(--avbg); color: var(--av); font-size: 20px; }
.avatar.icon .fi { font-size: 22px; }
.avatar.photo { padding: 0; overflow: hidden; background: #e6eaf0; }
.avatar.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.bad { box-shadow: 0 0 0 2.5px var(--danger); }
.avatar.lg { width: 72px; height: 72px; }
.avatar.lg .fi { font-size: 34px; }
.avatar.sm { width: 40px; height: 40px; }
.avatar.sm .fi { font-size: 18px; }
.avatar-edit { position: relative; display: inline-block; cursor: pointer; flex-shrink: 0; }
.avatar-edit .cam { position: absolute; right: -2px; bottom: -2px; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 13px; border: 2px solid #fff; }
.ph-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ub-img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

/* ---------- Đơn: khách hàng gọn ---------- */
.cust-panel { padding: 10px 14px; }
.cust-compact { display: flex; align-items: center; gap: 10px; }
.cc-main { flex: 1; min-width: 0; }
.cc-name { font-weight: 700; font-size: 1.05em; overflow-wrap: anywhere; }
.cc-name a { color: var(--text); }
.cc-meta { font-size: .86em; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.cc-act { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- Đơn: phương án đứng vay nổi bật ---------- */
.panel.borrow-hl { border: 2px solid #f59e0b; background: linear-gradient(180deg, #fff7e6, #fff 60%); box-shadow: 0 4px 16px rgba(245,158,11,.18); }
.panel.borrow-hl .panel-head h2 { color: #b45309; }
.panel.borrow-hl .panel-head h2 .fi { color: #b45309; }
.borrow-select select { border: 2px solid #f59e0b; font-weight: 700; background: #fffdf7; }
.borrow-select > span { color: #b45309 !important; }

/* ---------- Mã yêu cầu cạnh tiêu đề ---------- */
.code-chip { display: inline-flex; align-items: center; font-size: .82em; font-weight: 800; color: #fff; background: var(--primary); padding: 3px 10px; border-radius: 8px; letter-spacing: .3px; }
.code-chip.new { background: #e8eef6; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.f .flbl { display: block; font-size: 12px; font-weight: 600; color: #4a5566; margin-bottom: 3px; }
#status-new { margin-top: 6px; border-color: var(--primary); }

/* ---------- Nội dung yêu cầu: nổi bật ở mọi nơi ---------- */
.req-content > span { color: #b45309 !important; font-size: 13px !important; }
.req-content textarea { background: #fff8e1; border: 1.5px solid #f5c451; border-left: 5px solid #f59e0b; font-weight: 600; color: #3d2a00; }
.req-content textarea:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.2); }
.ov-text > div.req-hl { background: #fff8e1; border: 1px solid #f5c451; border-left: 5px solid #f59e0b; }
.ov-text > div.req-hl small { color: #b45309; font-weight: 700; }
.ov-text > div.req-hl p { font-weight: 600; color: #3d2a00; }
.card .content { background: #fff8e1; border-left: 3px solid #f59e0b; padding: 4px 8px; border-radius: 6px; color: #3d2a00; font-weight: 600; margin-top: 5px; }
.req-body .s.c { background: #fff8e1; border-left: 3px solid #f59e0b; padding: 3px 8px; border-radius: 6px; color: #3d2a00; font-weight: 600; margin-top: 3px; }

/* ---------- Tổng quan: nhãn thẳng hàng ---------- */
.ov-badges { align-items: center; }
.sticker { transform: none; line-height: 1.3; padding: 4px 11px; border-radius: 7px; }
.sticker.bad { box-shadow: none; }

/* ---------- Phương án đứng vay: gọn ---------- */
.borrow-head { margin-bottom: 8px; }
.borrow-head h2 { flex-wrap: wrap; gap: 8px; }
select.borrow-mini { width: auto; min-height: 34px; padding: 4px 30px 4px 10px; font-size: 13.5px; font-weight: 700; border: 2px solid #f59e0b; border-radius: 8px;
  background-color: #fffdf7; color: #8a4b00; }
#borrow:empty { display: none; }
.info-head { gap: 10px; margin-bottom: 8px; align-items: center; }
.ih-line { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.ih-name { font-weight: 700; overflow-wrap: anywhere; }
.ih-name a { color: var(--text); }
.ih-phone { color: var(--muted); font-size: .92em; white-space: nowrap; }
.ih-act { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.info-grid.row { display: flex; flex-wrap: wrap; gap: 6px; }
.info-grid.row > div { flex: 0 1 auto; min-width: 0; }
@media (max-width: 900px) { .ih-act { margin-left: 0; } }

/* ---------- Mục: nội dung theo hàng ngang ---------- */
.form-grid.inline-lbl { gap: 8px 16px; }
.inline-lbl > label.f:not(.full), .inline-lbl > div.f:not(.full) { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.inline-lbl > label.f:not(.full) > span, .inline-lbl > div.f:not(.full) > .flbl { flex: 0 0 104px; margin: 0; font-size: 13px; }
.inline-lbl > label.f:not(.full) > span::after, .inline-lbl > div.f:not(.full) > .flbl::after { content: ":"; }
.inline-lbl > label.f:not(.full) > input, .inline-lbl > label.f:not(.full) > select, .inline-lbl > div.f:not(.full) > select { flex: 1 1 140px; width: auto; min-width: 0; }
.inline-lbl #status-new { flex: 1 1 100%; margin: 2px 0 0 114px; }
.inline-lbl input:disabled { background: transparent; border-color: transparent; padding-left: 2px; font-weight: 600; }
/* Ô thông tin: "Mục: nội dung" trên một dòng */
.info-grid.row > div { display: flex; align-items: baseline; gap: 6px; }
.info-grid.row small { font-size: 12.5px; white-space: nowrap; }
.info-grid.row small::after { content: ":"; }
@media (max-width: 900px) {
  .form-grid.c2.inline-lbl { grid-template-columns: 1fr; }
  .inline-lbl > label.f:not(.full) > span, .inline-lbl > div.f:not(.full) > .flbl { flex-basis: 96px; }
  .inline-lbl #status-new { margin-left: 0; }
}

/* ---------- Phương án đứng vay: chỉ nổi bật lựa chọn ---------- */
#borrow-panel.panel { border: 0; background: var(--panel); box-shadow: var(--shadow); }
#borrow-panel .panel-head h2, #borrow-panel .panel-head h2 .fi { color: var(--text); }
#borrow-panel .panel-head h2 .fi { color: var(--primary); }
select.borrow-mini { border: 1.5px solid #cfd7e3; background-color: #fff; color: var(--text); font-weight: 600; }
select.borrow-mini.on { border: 2px solid #f59e0b; background-color: #fff3d6; color: #a14a00; font-weight: 800; box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
#borrow-panel .sub-card.borrower { background: #fbfcfe; border-color: var(--line); }

/* ---------- Ô chọn thấp hơn, các mục cách xa hơn ---------- */
select { min-height: 36px !important; padding-top: 5px !important; padding-bottom: 5px !important; }
select.borrow-mini { min-height: 30px !important; padding-top: 3px !important; padding-bottom: 3px !important; }
.card select { min-height: 30px !important; }
.form-grid { gap: 16px 20px; }
.form-grid.inline-lbl { gap: 14px 24px; }
.debt-grid { gap: 10px 10px; }
.stack > * + * { margin-top: 14px; }
@media (max-width: 900px) { .form-grid { gap: 14px 12px; } .form-grid.inline-lbl { gap: 12px; } }
.inline-lbl input:disabled { min-height: 30px !important; padding-top: 3px !important; padding-bottom: 3px !important; }

/* ---------- "Mục: nội dung" hai cặp trên một hàng ---------- */
.form-grid.c2.inline-lbl { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.inline-lbl > label.f:not(.full) > span, .inline-lbl > div.f:not(.full) > .flbl { flex: 0 0 auto !important; white-space: nowrap; }
.inline-lbl > label.f:not(.full), .inline-lbl > div.f:not(.full) { flex-wrap: nowrap; }
.inline-lbl > div.f:not(.full) { flex-wrap: wrap; }
.inline-lbl #status-new { margin-left: 0 !important; }
@media (max-width: 480px) { .form-grid.c2.inline-lbl { grid-template-columns: 1fr !important; } }

/* ==========================================================
   Rà soát giao diện quản lý: "Mục: nội dung" trên một hàng,
   các cặp mục có khoảng cách. (Không áp dụng cho phần Tổng quan.)
   ========================================================== */
/* Hồ sơ người: lưới 2 cặp mỗi hàng */
.pf-main .form-grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 14px 28px; }
.pf-main .form-grid.c4 > .s2 { grid-column: span 1; }
.pf-main .form-grid.c4 > .s3, .pf-main .form-grid.c4 > .full { grid-column: 1 / -1; }
.pf-main .form-grid.c2 { gap: 14px 28px; }
.marital-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; }

/* Mục: nội dung */
.pf-main label.f:not(:has(textarea)),
.debt-grid label.f,
.modal .stack > label.f:not(:has(textarea)),
#pw label.f {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.pf-main label.f:not(:has(textarea)) > span,
.debt-grid label.f > span,
.modal .stack > label.f:not(:has(textarea)) > span,
#pw label.f > span {
  flex: 0 1 auto; min-width: 84px; max-width: 46%; margin: 0; white-space: normal; line-height: 1.25;
}
.pf-main label.f:not(:has(textarea)) > span::after,
.debt-grid label.f > span::after,
.modal .stack > label.f:not(:has(textarea)) > span::after,
#pw label.f > span::after { content: ":"; }
.pf-main label.f:not(:has(textarea)) > input, .pf-main label.f:not(:has(textarea)) > select,
.debt-grid label.f > input, .debt-grid label.f > select,
.modal .stack > label.f:not(:has(textarea)) > input, .modal .stack > label.f:not(:has(textarea)) > select,
#pw label.f > input {
  flex: 1 1 120px; width: auto; min-width: 0;
}
.modal .stack > label.f:not(:has(textarea)) > span, #pw label.f > span { min-width: 120px; }

/* Các khoản vay (cột hẹp): mỗi mục một hàng */
.debt-grid { grid-template-columns: 1fr !important; gap: 10px; }
.debt-grid label.f > span { min-width: 96px; }

/* Ảnh: nhãn vẫn ở trên */
.pf-main .field > .lbl { margin-bottom: 6px; }

@media (max-width: 480px) {
  .pf-main .form-grid.c4, .pf-main .form-grid.c2, .marital-row { grid-template-columns: 1fr !important; }
}
/* Ô nhập cùng chiều cao với ô chọn */
input[type=text], input[type=search], input[type=password], input[type=tel], input:not([type]), input[type=date] { min-height: 38px !important; padding-top: 6px !important; padding-bottom: 6px !important; }
select { min-height: 38px !important; }
.pf-main .field:has(> .check) > .lbl { display: none; }
.pf-main .field:has(> .check) { display: flex; align-items: center; }
.check.bad-check { padding: 5px 12px; }
.marital-row { grid-template-columns: 1fr !important; }
.marital-row label.f > select { flex: 0 1 300px !important; }
.imgs { grid-template-columns: repeat(auto-fill, minmax(78px, 92px)) !important; }
.pf-main .field:has(> input[data-k$="location.address"]) { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; align-items: center; }
.pf-main .field:has(> input[data-k$="location.address"]) > .lbl { margin: 0; min-width: 84px; }
.pf-main .field:has(> input[data-k$="location.address"]) > .lbl::after { content: ":"; }
.pf-main .field:has(> input[data-k$="location.address"]) > .loc-box { grid-column: 1 / -1; }
.modal .stack > label.f:not(:has(textarea)) > span, #pw label.f > span { flex: 0 0 150px; max-width: 45%; }

/* ==========================================================
   Chế độ xem: các phần đã lưu bị khoá, bấm "Sửa" để chỉnh
   ========================================================== */
.locked input:disabled:not([type=checkbox]), .locked select:disabled, .locked textarea:disabled {
  border-color: transparent !important; background: transparent !important; box-shadow: none !important;
  padding-left: 2px !important; font-weight: 600; color: var(--text); -webkit-text-fill-color: var(--text);
  -webkit-appearance: none; appearance: none; cursor: default; resize: none;
}
.locked input:disabled::placeholder, .locked textarea:disabled::placeholder { color: transparent; }
.locked input[type=date]:disabled::-webkit-calendar-picker-indicator { display: none; }
/* Nội dung yêu cầu vẫn giữ nền vàng nổi bật khi chỉ xem */
.locked .req-content textarea:disabled { background: #fff8e1 !important; border: 1.5px solid #f5c451 !important; border-left: 5px solid #f59e0b !important; padding-left: 12px !important; color: #3d2a00; -webkit-text-fill-color: #3d2a00; }
/* Ô chọn phương án đứng vay khi khoá: vẫn nổi bật lựa chọn */
.locked select.borrow-mini.on:disabled { background: #fff3d6 !important; border: 2px solid #f59e0b !important; color: #a14a00; -webkit-text-fill-color: #a14a00; padding: 3px 10px !important; font-weight: 800; }
.locked select.borrow-mini:not(.on):disabled { padding: 3px 10px !important; border: 1.5px solid #e1e6ee !important; }
/* Ẩn các nút chỉnh sửa khi đang khoá */
.locked .add-img, .locked .thumb .x, .locked [data-scan], .locked [data-act="del"], .locked [data-act="loc-get"], .locked [data-act="loc-clear"],
.locked [data-act="pf-clear"], .locked [data-act="borrower-clear"], .locked [data-act="new-borrower"], .locked #status-new { display: none !important; }
.locked .check { cursor: default; }
.locked .imgs:not(:has(.thumb))::after { content: "Chưa có ảnh"; color: var(--muted); font-size: 13px; }
/* Nút Sửa */
.edit-btn { border-color: #bcd5f0; color: var(--primary); }
.edit-btn.on { background: var(--primary-soft); border-color: var(--primary); cursor: default; }
.item-btns { display: flex; gap: 6px; align-items: center; }
.sec-title .edit-btn, .panel-head .edit-btn { margin-left: 4px; }
.debt-head .edit-btn { margin-left: auto; margin-right: 4px; min-height: 30px; padding: 3px 9px; }
.lockable.editing { outline: 2px dashed rgba(var(--primary-rgb),.35); outline-offset: -2px; }
.panel.lockable.editing { outline-offset: 2px; }
.locked input:disabled::placeholder, .locked textarea:disabled::placeholder { color: transparent !important; -webkit-text-fill-color: transparent !important; }
.sec-title .edit-btn { font-size: 13px !important; gap: 4px !important; }
.sec-title .edit-btn .fi { font-size: 14px !important; }

/* ---------- Thanh nút Xoá / Huỷ / Lưu: trên cùng, góc phải, luôn ghim ---------- */
.mgr-bar { position: sticky; top: calc(62px + env(safe-area-inset-top)); z-index: 25; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(243,245,249,.96); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  margin: -8px -4px 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); min-height: 48px; }
.mgr-title { flex: 1; min-width: 0; font-weight: 700; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgr-bar .action-bar { position: static !important; margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important; flex-wrap: nowrap; gap: 6px; justify-content: flex-end; flex: 0 0 auto; }
.mgr-bar .action-bar .btn { flex: 0 0 auto !important; min-height: 34px !important; padding: 5px 12px !important; font-size: 13.5px !important; border-radius: 8px; }
.mgr-bar .action-bar .btn.danger { background: #fff; }
@media (max-width: 900px) {
  .mgr-bar { top: calc(60px + env(safe-area-inset-top)); margin: -6px -10px 8px; padding: 6px 10px; }
  .mgr-title { font-size: 12.5px; }
  .mgr-bar .action-bar .btn { padding: 5px 10px !important; font-size: 13px !important; }
  main { padding-bottom: calc(var(--bottom-nav) + 16px + env(safe-area-inset-bottom)); }
}
@media (max-width: 400px) { .mgr-title { display: none; } .mgr-bar { justify-content: flex-end; } }

/* ---------- Nút Sửa / Thêm nhỏ gọn ---------- */
.edit-btn, [data-act="add"], .sec-title .edit-btn, .panel-head .edit-btn, .debt-head .edit-btn {
  min-height: 28px !important; padding: 2px 9px !important; font-size: 12px !important; border-radius: 7px !important; gap: 4px !important; line-height: 1.2;
}
.edit-btn .fi, [data-act="add"] .fi, .sec-title .edit-btn .fi { font-size: 12px !important; }
.sub-title [data-act="add"] { background: #fff; color: var(--primary); border: 1px solid #bcd5f0; }
.sub-title [data-act="add"]:hover { background: var(--primary-soft); }
.sec-title [data-scan] { min-height: 30px !important; padding: 3px 9px !important; font-size: 12.5px; }
.page:has(.person-layout) .mgr-bar [data-act="export"] { display: none !important; }
.pf-loans, .order-side, .person-side { top: 124px !important; }
.person-side { max-height: calc(100vh - 136px) !important; }
.sec-title { flex-wrap: wrap; row-gap: 6px; }
.sec-title h2 { min-width: 0; }
@media (max-width: 480px) {
  .sec-title .edit-btn.on { font-size: 0 !important; gap: 0 !important; padding: 2px 8px !important; }
  .sec-title .edit-btn.on .fi { font-size: 14px !important; }
}

/* Nợ xấu đã hiện cạnh tên: ẩn ô tích khi chỉ xem */
.sec-self.locked .field:has(> .bad-check) { display: none !important; }
/* Nút "Lưu" thay cho "Sửa" khi đang chỉnh */
.edit-btn.on { background: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; cursor: pointer !important; }
.edit-btn.on .fi { color: #fff; }
.edit-btn.on:hover { background: var(--primary-2) !important; }
@media (max-width: 480px) {
  .sec-title .edit-btn.on { font-size: 12px !important; gap: 4px !important; padding: 2px 9px !important; }
  .sec-title .edit-btn.on .fi { font-size: 12px !important; }
}

/* ---------- Google Drive ---------- */
.drive-st { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.drive-st.ok { color: var(--ok); } .drive-st.err { color: var(--danger); }
.drive-rows { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; font-size: 14px; }
.drive-rows span:first-child { color: var(--muted); }
.drive-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bk-dir { word-break: break-all; font-size: 13px; }

/* ---------- Cài đặt & cấu hình giao diện ---------- */
.brand img { width: 30px; height: 30px; object-fit: contain; }
.brand img.custom, .drawer-brand img.custom, .bp-bar img.custom { background: #fff; border-radius: 7px; padding: 2px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt small { font-weight: 400; font-size: 11.5px; opacity: .85; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.login .logo.custom { object-fit: contain; }
.login .slogan { margin: -4px 0 6px; font-style: italic; color: var(--primary); }
.drawer-brand { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin: -4px -4px 8px; background: var(--primary); color: #fff; border-radius: 10px; }
.drawer-brand img { width: 34px; height: 34px; object-fit: contain; flex-shrink: 0; }
.drawer-brand .small-txt { opacity: .85; }
.set-tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; }
.set-tabs a { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.set-tabs a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.set-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.set-head h2 { display: flex; align-items: center; gap: 6px; }
.set-head h2 .fi { color: var(--primary); }
.set-acts { display: flex; gap: 6px; }
.brand-img { display: flex; gap: 12px; align-items: center; }
.bi-prev { width: 64px; height: 64px; border-radius: 12px; border: 1px solid var(--line); background: repeating-conic-gradient(#f0f2f6 0 25%, #fff 0 50%) 0 0 / 14px 14px; display: grid; place-items: center; flex-shrink: 0; }
.bi-prev.favicon { width: 44px; height: 44px; border-radius: 8px; }
.bi-prev img { max-width: 82%; max-height: 82%; object-fit: contain; }
.bi-prev img.dim { opacity: .45; }
.bi-info { min-width: 0; }
.bi-btns { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sw { width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--c), 0 0 0 4px #fff, 0 0 0 5px var(--text); }
.sw-custom { display: inline-flex; align-items: center; gap: 6px; border: 1px dashed #b8c3d3; border-radius: 18px; padding: 3px 10px 3px 4px; cursor: pointer; font-size: 14px; }
.sw-custom input[type=color] { width: 28px; height: 28px; padding: 0; border: 0; min-height: 0; background: none; cursor: pointer; }
.brand-preview { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.bp-tab { display: flex; align-items: center; gap: 7px; background: #e8eaee; padding: 7px 12px; font-size: 13px; }
.bp-tab img { width: 16px; height: 16px; object-fit: contain; }
.bp-tab span { background: #fff; padding: 3px 10px; border-radius: 6px 6px 0 0; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-bar { display: flex; align-items: center; gap: 9px; background: var(--primary); color: #fff; padding: 8px 12px; }
.bp-bar img { width: 28px; height: 28px; object-fit: contain; }
.bp-bar span { display: flex; flex-direction: column; line-height: 1.15; }
.bp-bar small { opacity: .85; font-size: 11.5px; }
.bp-body { padding: 12px; display: flex; align-items: center; gap: 10px; }
#set-body .sub-head { justify-content: flex-start; gap: 6px; font-weight: 700; margin: 0; }

/* ---------- Bảng đơn dịch vụ: tab phân loại + cột tình trạng + lưới thẻ ---------- */
.board, .board.board { display: block; }
.bd-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.bd-tab { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; text-align: left; font: inherit; color: var(--text); box-shadow: var(--shadow); transition: border-color .12s, background .12s; position: relative; }
.bd-tab:hover { border-color: color-mix(in srgb, var(--cc) 45%, var(--line)); }
.bd-tab.on { border-color: var(--cc); background: color-mix(in srgb, var(--cc) 8%, #fff); box-shadow: 0 0 0 2px color-mix(in srgb, var(--cc) 25%, transparent), var(--shadow); }
.bd-tab.on::after { content: ""; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%) rotate(45deg); width: 12px; height: 12px; background: color-mix(in srgb, var(--cc) 8%, #fff); border-right: 1.5px solid var(--cc); border-bottom: 1.5px solid var(--cc); }
.bd-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 21px; color: var(--cc); background: color-mix(in srgb, var(--cc) 12%, #fff); flex-shrink: 0; }
.bd-tab.on .bd-ico { background: var(--cc); color: #fff; }
.bd-tl { display: flex; flex-direction: column; min-width: 0; }
.bd-tl b { font-size: 16px; }
.bd-tl small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-n { margin-left: auto; font-size: 26px; font-weight: 800; color: var(--cc); line-height: 1; }

.bd-main { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.bd-side { position: sticky; top: 124px; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; display: flex; flex-direction: column; gap: 2px; border-top: 4px solid var(--cc); }
.bd-side-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 6px 10px 4px; }
.bd-side-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.st-item { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 9px; cursor: pointer; font: inherit; font-size: 14.5px; color: var(--text); text-align: left; }
.st-item:hover { background: var(--bg); }
.st-item .dot, .bd-sec-h .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sc); flex-shrink: 0; }
.st-item .lb { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-item .n { font-size: 13px; font-weight: 700; background: var(--bg); border-radius: 10px; padding: 1px 8px; min-width: 26px; text-align: center; }
.st-item.on { background: color-mix(in srgb, var(--sc) 13%, #fff); font-weight: 700; }
.st-item.on .n { background: var(--sc); color: #fff; }

.bd-list { min-width: 0; }
.bd-sec { margin-bottom: 18px; }
.bd-sec-h { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0 0 8px; padding: 2px 2px 6px; border-bottom: 2px solid color-mix(in srgb, var(--sc) 35%, transparent); cursor: pointer; }
.bd-sec-h .n { font-size: 12.5px; font-weight: 700; color: #fff; background: var(--sc); border-radius: 10px; padding: 1px 8px; }
.bd-empty { text-align: center; color: var(--muted); padding: 50px 20px; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); }
.bd-empty .fi { font-size: 40px; opacity: .45; display: block; margin-bottom: 8px; }

.oc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.oc { background: var(--panel); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); border-top: 3px solid var(--sc); cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: box-shadow .12s, transform .12s; min-width: 0; }
.oc:hover { box-shadow: 0 6px 18px rgba(16,30,54,.13); transform: translateY(-1px); }
.oc-top { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.oc-code { font-weight: 800; color: var(--primary); font-size: 13.5px; }
.oc-st { font-weight: 700; color: color-mix(in srgb, var(--sc) 80%, #000); background: color-mix(in srgb, var(--sc) 14%, #fff); border-radius: 8px; padding: 0 7px; }
.oc-date { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.oc-who { display: flex; align-items: center; gap: 9px; min-width: 0; }
.oc-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: var(--sc); background: color-mix(in srgb, var(--sc) 14%, #fff); flex-shrink: 0; font-size: 14.5px; }
.oc-nm { min-width: 0; line-height: 1.3; }
.oc-nm b { font-size: 15px; }
.oc-nm .bad-debt { font-size: 11px; vertical-align: 1px; }
.oc-ph { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.oc-borrow { font-size: 12.5px; color: #b54708; background: #fff4e5; border-radius: 7px; padding: 3px 8px; display: flex; gap: 5px; align-items: center; }
.oc-content { font-size: 13.5px; color: #3d4757; background: #fffbe6; border-left: 3px solid #f4c430; border-radius: 6px; padding: 5px 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.oc-foot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: auto; }
.oc-handler { display: inline-flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-chips { margin-left: auto; display: flex; gap: 8px; }
.oc-chips span { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; color: #4a5566; }
select.oc-sel { min-height: 30px; height: 30px; padding: 2px 8px; font-size: 13px; border-radius: 8px; border-color: color-mix(in srgb, var(--sc) 40%, var(--line)); background-color: color-mix(in srgb, var(--sc) 7%, #fff); font-weight: 600; }

/* Máy tính bảng/máy tính: đã có tab phân loại ở trên, không cần thanh dưới */
@media (min-width: 901px) { .bottom-nav { display: none !important; } main { padding-bottom: 24px; } }
@media (max-width: 1100px) and (min-width: 901px) { .bd-main { grid-template-columns: 200px minmax(0, 1fr); } .bd-tl small { display: none; } }
/* Điện thoại: phân loại chọn ở thanh dưới, tình trạng là hàng nút cuộn ngang */
@media (max-width: 900px) {
  .bd-tabs { display: none; }
  .bd-main { grid-template-columns: 1fr; gap: 10px; }
  .bd-side { position: sticky; top: calc(60px + env(safe-area-inset-top)); z-index: 9; flex-direction: row; overflow-x: auto; gap: 6px; padding: 8px 2px; margin: -4px -10px 0; border-radius: 0; box-shadow: none; background: var(--bg); border-top: 0; scrollbar-width: none; }
  .bd-side::-webkit-scrollbar { display: none; }
  .bd-side-h, .bd-side-sep { display: none; }
  .st-item { width: auto; flex-shrink: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 6px 12px; font-size: 13.5px; }
  .st-item:first-child, .bd-side > .st-item:nth-child(2) { margin-left: 8px; }
  .st-item.on { border-color: var(--sc); }
  .st-item .lb { overflow: visible; }
  .oc-grid { grid-template-columns: 1fr; gap: 8px; }
  .bd-sec { margin-bottom: 14px; }
}
.oc select.oc-sel { min-height: 30px !important; height: 30px; }
@media (max-width: 1100px) and (min-width: 901px) { .bd-main { grid-template-columns: 215px minmax(0, 1fr); } .st-item .lb { white-space: normal; line-height: 1.25; } }

/* Nút thêm mới ở đầu trang: gọn, bo tròn */
.btn.add-btn { min-height: 36px; padding: 6px 14px 6px 11px; font-size: 14px; font-weight: 600; border-radius: 18px; gap: 6px; box-shadow: 0 2px 6px rgba(var(--primary-rgb), .25); }
.btn.add-btn .fi { font-size: 13px; }
.fab { width: 50px; height: 50px; font-size: 22px; }
@media (max-width: 900px) { .btn.add-btn { min-height: 32px; font-size: 13px; padding: 4px 12px 4px 9px; } }
.lk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 4px 0; }
.lk-row .lk-url { word-break: break-all; }
