/* VietSCI Hành chính nội bộ — đồng bộ bộ nhận diện vietscies.com (brand #1800ad, accent #ff6600, Be Vietnam Pro) */
@font-face { font-family: 'Tinos'; src: url('/fonts/Tinos-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Tinos'; src: url('/fonts/Tinos-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Tinos'; src: url('/fonts/Tinos-Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Tinos'; src: url('/fonts/Tinos-BoldItalic.ttf') format('truetype'); font-weight: 700; font-style: italic; font-display: swap; }

:root {
  --brand: #1800ad; --brand-700: #13008c; --brand-900: #0c0561; --brand-950: #070339; --brand-50: #f1efff; --brand-100: #e3dfff;
  --accent: #ff6600; --accent-600: #e85a00; --accent-50: #fff3ea;
  --ink: #16133d; --text: #2b2a3d; --muted: #6b6a80; --faint: #9a99ad; --line: #e6e5f0; --line-2: #d9d8e6;
  --bg: #f6f6fb; --card: #fff; --hover: #f4f3fb;
  --green: #16a34a; --green-50: #e8f7ee; --orange: #ea580c; --orange-50: #fff0e6; --blue: #2563eb; --blue-50: #e8effd;
  --violet: #7c3aed; --violet-50: #f1eafe; --amber: #d97706; --amber-50: #fdf3e2; --red: #dc2626; --red-50: #fdecec; --gray: #6b7280; --gray-50: #f1f2f4;
  --r: 12px; --r-sm: 9px; --sh: 0 1px 2px rgba(22, 19, 61, .05), 0 1px 1px rgba(22, 19, 61, .03);
  --sh-lg: 0 18px 48px -12px rgba(12, 5, 97, .28); --side: 268px; --top: 64px;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 14px/1.55 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { color: var(--ink); margin: 0; line-height: 1.3; letter-spacing: -.01em; }
.ic { flex: none; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- Đầu trang ---------- */
.topbar { position: sticky; top: 0; z-index: 40; height: var(--top); background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.6) blur(10px); border-bottom: 1px solid var(--line); }
.topbar::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--brand) 0 62%, var(--accent) 62%); }
.topbar__in { height: 100%; display: flex; align-items: center; gap: 14px; padding: 0 20px 0 16px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 30px; width: auto; display: block; }
.brand__sep { width: 1px; height: 28px; background: var(--line-2); }
.brand__txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand__txt b { font-size: 14.5px; color: var(--ink); font-weight: 700; letter-spacing: -.01em; }
.brand__txt small { font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.pill-int { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-600); background: var(--accent-50); border: 1px solid #ffd9bf; padding: 2px 7px; border-radius: 99px; margin-left: 4px; }
.search { flex: 1; max-width: 420px; margin-left: 18px; position: relative; }
.search input { width: 100%; height: 38px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 0 12px 0 36px; outline: 0; transition: .15s; }
.search input:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.search .ic { position: absolute; left: 11px; top: 10px; color: var(--faint); }
.search kbd { position: absolute; right: 9px; top: 9px; font: 600 10.5px var(--font); color: var(--faint); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; background: #fff; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.menu-toggle { display: none; }
.me { position: relative; }
.me__btn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.me__btn:hover { border-color: var(--line-2); background: var(--hover); }
.avatar { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--brand), #4b2ee0); flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 17px; }
.me__txt { text-align: left; line-height: 1.2; }
.me__txt b { display: block; font-size: 13px; color: var(--ink); max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me__txt small { font-size: 11.5px; color: var(--muted); }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: 270px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-lg); padding: 6px; opacity: 0; transform: translateY(-4px); pointer-events: none; transition: .15s; }
.dropdown.open { opacity: 1; transform: none; pointer-events: auto; }
.dropdown__head { padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: flex; gap: 10px; align-items: center; }
.dropdown__head small { display: block; color: var(--muted); font-size: 12px; word-break: break-all; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text); width: 100%; border: 0; background: none; text-align: left; cursor: pointer; font-size: 13.5px; }
.dropdown a:hover, .dropdown button:hover { background: var(--hover); color: var(--ink); }
.dropdown .ic { color: var(--muted); }
.dropdown hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.dropdown .danger { color: var(--red); }
.dropdown .danger .ic { color: var(--red); }

/* ---------- Khung ---------- */
.layout { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: calc(100vh - var(--top)); }
.side { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; background: #fff; border-right: 1px solid var(--line); padding: 16px 12px 12px; display: flex; flex-direction: column; scrollbar-width: thin; }
.side__cta { display: flex; align-items: center; justify-content: center; gap: 8px; height: 42px; border-radius: 11px; background: var(--brand); color: #fff; font-weight: 600; border: 0; cursor: pointer; width: 100%; box-shadow: 0 6px 16px -6px rgba(24, 0, 173, .55); transition: .15s; }
.side__cta:hover { background: var(--brand-700); transform: translateY(-1px); }
.nav { margin-top: 14px; }
.nav__h { font-size: 10.5px; font-weight: 700; color: var(--faint); letter-spacing: .08em; text-transform: uppercase; padding: 14px 10px 6px; }
.nav a, .nav button.nav__grp { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text); font-weight: 500; font-size: 13.5px; width: 100%; background: none; border: 0; cursor: pointer; text-align: left; }
.nav a:hover, .nav button.nav__grp:hover { background: var(--hover); color: var(--ink); }
.nav a.active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.nav a.active .ic { color: var(--brand); }
.nav .ic { color: var(--muted); }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--gray-50); color: var(--muted); }
.nav .count.hot { background: var(--accent); color: #fff; }
.nav__grp .chev { margin-left: auto; transition: transform .2s; color: var(--faint); }
.nav__grp[aria-expanded="true"] .chev { transform: rotate(180deg); }
.nav__sub { overflow: hidden; display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.nav__sub.open { grid-template-rows: 1fr; }
.nav__sub > div { min-height: 0; padding-left: 20px; }
.nav__sub a { font-size: 13px; padding: 6px 10px; color: var(--muted); font-weight: 500; position: relative; }
.nav__sub a::before { content: ''; position: absolute; left: -2px; top: 0; bottom: 0; width: 1px; background: var(--line); }
.nav__sub a.active::before { background: var(--brand); width: 2px; }
.gi { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.gi.sm { width: 24px; height: 24px; border-radius: 7px; }
.tone-green { color: var(--green) !important; background: var(--green-50); }
.tone-orange { color: var(--orange) !important; background: var(--orange-50); }
.tone-blue { color: var(--blue) !important; background: var(--blue-50); }
.tone-violet { color: var(--violet) !important; background: var(--violet-50); }
.tone-amber { color: var(--amber) !important; background: var(--amber-50); }
.tone-red { color: var(--red) !important; background: var(--red-50); }
.tone-gray { color: var(--gray) !important; background: var(--gray-50); }
.gi .ic { color: inherit !important; }
.side__foot { margin-top: auto; padding-top: 14px; }
.sync-card { border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; display: flex; gap: 10px; align-items: center; background: linear-gradient(180deg, #fff, var(--bg)); font-size: 12px; color: var(--muted); }
.sync-card b { color: var(--ink); font-size: 12.5px; display: block; }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-50); flex: none; }
.live.off { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-50); }

.main { min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 26px 30px 40px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 23px; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand); }

/* ---------- Chân trang nội bộ ---------- */
.foot { background: var(--brand-950); color: #b9b6dc; margin-top: 10px; }
.foot__in { max-width: 1480px; margin: 0 auto; padding: 22px 30px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; font-size: 12.5px; }
.foot__brand { display: flex; align-items: center; gap: 12px; }
.foot__brand img { width: 34px; height: 34px; background: #fff; border-radius: 9px; padding: 5px; }
.foot__brand b { color: #fff; display: block; font-size: 13px; }
.foot__links { display: flex; gap: 18px; flex-wrap: wrap; margin-left: auto; }
.foot__links a { color: #d6d4f0; display: inline-flex; align-items: center; gap: 6px; }
.foot__links a:hover { color: #fff; }
.foot__bar { border-top: 1px solid rgba(255, 255, 255, .08); }
.foot__bar > div { max-width: 1480px; margin: 0 auto; padding: 10px 30px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: #8d89bf; }
.foot__bar .lock { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- Thành phần ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); }
.card__h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card__h h3 { font-size: 15px; font-weight: 650; }
.card__h .more { margin-left: auto; font-size: 13px; font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
.card__b { padding: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: .15s; }
.btn:hover { background: var(--hover); border-color: #c9c7dc; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 14px -6px rgba(24, 0, 173, .55); }
.btn.primary:hover { background: var(--brand-700); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 14px -6px rgba(255, 102, 0, .55); }
.btn.accent:hover { background: var(--accent-600); }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.success:hover { filter: brightness(.95); }
.btn.danger { color: var(--red); border-color: #f3c4c4; }
.btn.danger:hover { background: var(--red-50); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .gi { margin: 0 auto 12px; width: 52px; height: 52px; border-radius: 14px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* Thống kê */
.hero { position: relative; overflow: hidden; border-radius: 16px; padding: 26px 28px; color: #fff; background: radial-gradient(120% 140% at 100% 0%, #3a1fd6 0%, var(--brand) 42%, var(--brand-900) 100%); box-shadow: var(--sh-lg); margin-bottom: 22px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.hero::after { content: ''; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 102, 0, .55), rgba(255, 102, 0, 0) 68%); }
.hero h1 { color: #fff; font-size: 24px; }
.hero p { margin: 6px 0 0; color: #d8d4ff; max-width: 560px; }
.hero__act { margin-left: auto; display: flex; gap: 10px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero .btn { border-color: rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .1); color: #fff; }
.hero .btn:hover { background: rgba(255, 255, 255, .18); }
.hero .btn.accent { background: var(--accent); border-color: var(--accent); }
.hero__date { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; color: #fff; background: rgba(255, 255, 255, .12); padding: 4px 10px; border-radius: 99px; margin-bottom: 10px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.kpi .gi { width: 44px; height: 44px; border-radius: 12px; }
.kpi b { font-size: 24px; color: var(--ink); line-height: 1.1; display: block; font-weight: 700; letter-spacing: -.02em; }
.kpi span { color: var(--muted); font-size: 12.5px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick button { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: left; transition: .15s; }
.quick button:hover { border-color: var(--brand-100); box-shadow: 0 6px 18px -10px rgba(24, 0, 173, .4); transform: translateY(-1px); }
.quick b { display: block; font-size: 13.5px; color: var(--ink); }
.quick small { color: var(--muted); font-size: 12px; }

/* Bảng */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th { text-align: left; font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 11px 16px; background: #fafafd; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr { cursor: pointer; transition: background .12s; }
table.list tbody tr:hover { background: #fbfbfe; }
.code { font: 600 12.5px ui-monospace, 'SFMono-Regular', Consolas, monospace; color: var(--brand); background: var(--brand-50); padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.t-type { display: flex; align-items: center; gap: 10px; }
.t-type b { color: var(--ink); font-weight: 600; display: block; font-size: 13.5px; }
.t-type small { color: var(--muted); display: block; max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.toolbar { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { color: var(--ink); border-color: var(--line-2); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip em { font-style: normal; font-size: 11px; opacity: .7; }
.toolbar .input { height: 34px; max-width: 240px; }

/* Biểu mẫu */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.field > span em { color: var(--accent-600); font-style: normal; }
.field small.hint { color: var(--faint); font-size: 11.5px; }
.field small.err { color: var(--red); font-size: 12px; font-weight: 500; }
.input { width: 100%; height: 42px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 12px; background: #fff; outline: 0; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b6a80' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center; padding-right: 34px; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
input.input:read-only, textarea.input:read-only { background: var(--bg); color: var(--muted); }
.field.bad .input { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-50); }
.money-in { position: relative; }
.money-in .input { padding-right: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.money-in::after { content: 'đ'; position: absolute; right: 13px; top: 11px; color: var(--muted); font-weight: 600; }
.money-words { font-size: 12px; color: var(--brand); font-style: italic; min-height: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.sec { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sec__h { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.sec__h h3 { font-size: 14.5px; }
.sec__h small { color: var(--muted); font-size: 12px; display: block; font-weight: 400; }
.sec__n { width: 24px; height: 24px; border-radius: 7px; background: var(--brand-50); color: var(--brand); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.items { border: 1px solid var(--line-2); border-radius: 10px; overflow-x: auto; }
.items table { width: 100%; min-width: 620px; border-collapse: collapse; table-layout: fixed; }
.items [data-amt], .items [data-total] { white-space: nowrap; }
.items th { background: #fafafd; font-size: 11.5px; color: var(--muted); font-weight: 650; text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
.items td { padding: 5px; border-bottom: 1px solid var(--line); }
.items input { width: 100%; height: 34px; border: 1px solid transparent; border-radius: 7px; padding: 0 8px; background: none; outline: 0; }
.items input:focus { border-color: var(--brand); background: #fff; }
.items .r { text-align: right; font-variant-numeric: tabular-nums; }
.items tfoot td { font-weight: 700; color: var(--ink); padding: 10px 8px; background: #fafafd; }
.items .rm { width: 30px; height: 30px; border: 0; background: none; color: var(--faint); border-radius: 7px; cursor: pointer; display: grid; place-items: center; }
.items .rm:hover { background: var(--red-50); color: var(--red); }
.items .add { margin: 8px; }

/* Trang tạo đơn */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 0.92fr); gap: 22px; align-items: start; }
.compose__form { overflow: visible; }
.actions-bar { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center; padding: 14px 22px; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); border-top: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); flex-wrap: wrap; }
.actions-bar .spacer { flex: 1; }
.type-head { display: flex; gap: 14px; align-items: center; }
.type-head .gi { width: 46px; height: 46px; border-radius: 13px; }
.preview { position: sticky; top: calc(var(--top) + 18px); }
.preview__bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.preview__bar b { font-size: 13px; color: var(--ink); display: inline-flex; align-items: center; gap: 7px; }
.preview__bar .tag { font-size: 11px; font-weight: 600; color: var(--green); background: var(--green-50); padding: 2px 8px; border-radius: 99px; }
.paper-wrap { background: repeating-linear-gradient(45deg, #ececf4, #ececf4 10px, #e7e7f0 10px, #e7e7f0 20px); border-radius: 14px; padding: 16px; border: 1px solid var(--line); }
.paper { position: relative; overflow: hidden; }

/* Trang A4 (xem trước) — cùng số đo với PDF */
.a4 { width: 210mm; min-height: 297mm; padding: 25mm 20mm 20mm 30mm; background: #fff; color: #000; font-family: 'Tinos', 'Times New Roman', serif; font-size: 13pt; line-height: 1.32; transform-origin: 0 0; box-shadow: 0 10px 30px -10px rgba(12, 5, 97, .3), 0 0 0 1px rgba(0, 0, 0, .04); position: relative; }
.a4 b { font-weight: 700; }
.a4-head { display: grid; grid-template-columns: 42% 58%; margin: -6mm -4mm 0 -4mm; font-size: 12.5pt; text-align: center; }
.a4-head > div { display: flex; flex-direction: column; align-items: center; }
.a4-head .motto { font-size: 13pt; }
.a4-head .rule { display: block; height: 0; border-top: .8pt solid #000; width: 66%; margin-top: 2pt; }
.a4-head .rule.short { width: 19mm; }
.a4-title { font: 700 15pt/1.3 'Tinos', serif; color: #000; text-align: center; margin: 9mm 0 6mm; letter-spacing: 0; }
.a4-to { display: grid; grid-template-columns: 23mm 1fr; margin: 0 0 5mm 12mm; }
.a4-body p { margin: 3pt 0 0; text-align: justify; }
.a4-body p.ind { text-indent: 10mm; }
.a4-gap { height: 11pt; }
.a4-table { width: 100%; border-collapse: collapse; margin: 5pt 0 4pt; font-size: 11.5pt; }
.a4-table th, .a4-table td { border: .6pt solid #000; padding: 3pt 4pt; }
.a4-table th { background: #f2f2f2; }
.a4-table .c { text-align: center; } .a4-table .r { text-align: right; }
.a4-place { text-align: right; font-style: italic; margin: 6pt 0 10pt; }
.a4-signs { display: grid; text-align: center; }
.a4-signs.n3 .h { font-size: 11.5pt; }
.a4-signs .h { display: flex; flex-direction: column; min-height: 40pt; }
.a4-signs .h i { font-style: italic; }
.a4-signs .n { display: block; margin-top: 23mm; }
.a4-foot { position: absolute; left: 30mm; right: 20mm; bottom: 9mm; text-align: center; font-size: 8pt; color: #8a8a8a; }

/* Chi tiết */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.info-list { display: grid; gap: 12px; }
.info-list div { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.info-list span { color: var(--muted); }
.info-list b { color: var(--ink); font-weight: 600; text-align: right; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 26px; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; left: 6px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.timeline li::after { content: ''; position: absolute; left: 10px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.approve::before { background: var(--green); box-shadow: 0 0 0 4px var(--green-50); }
.timeline li.reject::before { background: var(--red); box-shadow: 0 0 0 4px var(--red-50); }
.timeline li.cancel::before { background: var(--gray); box-shadow: 0 0 0 4px var(--gray-50); }
.timeline b { color: var(--ink); }
.timeline small { display: block; color: var(--muted); }
.timeline q { display: block; margin-top: 4px; background: var(--bg); border-radius: 8px; padding: 7px 10px; quotes: none; color: var(--text); }
.status-banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 13.5px; }
.status-banner .gi { width: 36px; height: 36px; }
.status-banner b { display: block; }

/* Modal tạo yêu cầu */
.modal-back { position: fixed; inset: 0; background: rgba(12, 5, 97, .32); backdrop-filter: blur(3px); z-index: 80; display: grid; place-items: center; padding: 20px; opacity: 0; transition: opacity .18s; }
.modal-back.open { opacity: 1; }
.modal { width: min(680px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: #fff; border-radius: 18px; box-shadow: var(--sh-lg); transform: translateY(8px) scale(.985); transition: transform .2s; }
.modal-back.open .modal { transform: none; }
.modal__h { display: flex; align-items: flex-start; gap: 12px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.modal__h h2 { font-size: 20px; font-weight: 700; }
.modal__h p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal__x { margin-left: auto; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.modal__x:hover { background: var(--hover); color: var(--ink); }
.modal__b { padding: 20px 24px 24px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--brand); background: none; border: 0; cursor: pointer; padding: 0; margin-bottom: 14px; }
.pick-h { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 14px; }
.pick-h b { color: var(--ink); }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick button { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; transition: .15s; }
.pick button:hover { border-color: var(--brand-100); background: #fcfcff; box-shadow: 0 8px 22px -14px rgba(24, 0, 173, .5); }
.pick button b { display: block; color: var(--ink); font-size: 14px; font-weight: 600; }
.pick button small { color: var(--muted); font-size: 12px; }
.pick button.lock { opacity: .5; cursor: not-allowed; }

/* Hộp thoại + thông báo */
.toast-zone { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 10px; }
.toast { display: flex; gap: 10px; align-items: center; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--sh-lg); font-size: 13.5px; animation: tin .25s ease; max-width: 380px; }
.toast.ok .ic { color: #6ee7a0; } .toast.err .ic { color: #fca5a5; }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }
.loading { display: grid; place-items: center; padding: 60px; color: var(--muted); }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--brand-100); border-top-color: var(--brand); animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, #f0f0f6, #f8f8fc, #f0f0f6); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

.side-scrim { display: none; }
@media (max-width: 1200px) {
  .compose, .detail { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: var(--top); width: 290px; transform: translateX(-100%); transition: transform .22s; box-shadow: var(--sh-lg); }
  body.nav-open .side { transform: none; }
  body.nav-open .side-scrim { display: block; position: fixed; inset: var(--top) 0 0; background: rgba(12, 5, 97, .25); z-index: 55; }
  .menu-toggle { display: grid; }
  .search { display: none; }
  .brand__sep, .brand__txt small { display: none; }
  .me__txt { display: none; }
  .content { padding: 18px 16px 30px; }
  .foot__in, .foot__bar > div { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 600px) {
  .brand img { height: 24px; }
  .brand__txt { display: none; }
  .form-grid, .pick, .quick { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card__h { flex-wrap: wrap; }
  .kpi { padding: 12px; } .kpi .gi { width: 36px; height: 36px; } .kpi b { font-size: 20px; }
  .hero { padding: 20px; } .hero__act { margin-left: 0; }
  .top-actions .btn span { display: none; }
  .sec { padding: 16px; } .actions-bar { padding: 12px 16px; }
  table.list .hide-sm { display: none; }
}
@media print {
  .topbar, .side, .foot, .actions-bar { display: none !important; }
}
