/* =========================================================================
   KIOSK NIÊM YẾT – theo giao diện "Bảng niêm yết TTHC (Kiosk)" của App Quản lý TTHC
   ========================================================================= */
:root {
    --brand: #c51f24;
    --brand-dark: #a8241f;
    --brand-deep: #74161a;
    --brand-50: #fef2f2;
    --brand-100: #fee2e2;
    --paper: #f6f4ef;
    --ink: #0f172a;
    --slate-50: #f8fafc; --slate-100: #f1f5f9; --slate-200: #e2e8f0; --slate-300: #cbd5e1;
    --slate-400: #94a3b8; --slate-500: #64748b; --slate-600: #475569; --slate-700: #334155; --slate-800: #1e293b; --slate-900: #0f172a;
    --card: #c51f24; --card-hover: #b51b20; --card-accent: #c51f24;
    --font: 'Be Vietnam Pro', -apple-system, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', Consolas, monospace;
}
.theme-burgundy { --card: linear-gradient(180deg, #881337, #9f1239 50%, #701a35); --card-hover: #881337; --card-accent: #9f1239; }
.theme-blue { --card: linear-gradient(180deg, #1e40af, #1d4ed8 50%, #1e3a8a); --card-hover: #1e40af; --card-accent: #1d4ed8; }
.theme-emerald { --card: linear-gradient(180deg, #065f46, #047857 50%, #064e3b); --card-hover: #065f46; --card-accent: #047857; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--slate-800); background: var(--paper); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden] { display: none !important; }

.kiosk { min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); }
.k-wrap { max-width: 1700px; margin: 0 auto; width: 100%; padding: 0 24px; }

/* ---------------- 1. Đầu trang ---------------- */
.k-header { background: #fff; border-bottom: 1px solid var(--slate-200); padding: 14px 0; user-select: none; }
.k-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.k-brand { display: flex; align-items: center; gap: 14px; }
.k-logo { width: 56px; height: 56px; stroke: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.15)); transition: transform .2s; }
.k-logo:hover { transform: scale(1.05); }
.k-brand h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; color: var(--brand); }
.k-subtitle { margin: 4px 0 0; font-size: 14px; font-weight: 700; color: var(--slate-800); }
.k-slogan { margin: 2px 0 0; font-size: 11px; font-style: italic; color: var(--slate-500); }
.k-slogan:empty { display: none; }
.k-header.bg-red { background: #b91c1c; color: #fff; }
.k-header.bg-blue { background: #1e3a8a; color: #fff; }
.k-header.bg-slate { background: #0f172a; color: #fff; }
.k-header[class*="bg-"] h1 { color: #fff; }
.k-header[class*="bg-"] .k-subtitle { color: #fcd34d; }
.k-header[class*="bg-"] .k-slogan { color: #e2e8f0; }

.k-header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.k-chips { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; font-weight: 500; }
.k-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid; }
.k-chip b { font-weight: 700; padding: 0 6px; border-radius: 999px; color: #fff; font-size: 12px; font-variant-numeric: tabular-nums; }
.k-chip .sep { opacity: .4; }
.chip-blue { background: #eff6ff; color: #1e3a8a; border-color: #bfdbfe; } .chip-blue b { background: #2563eb; }
.chip-green { background: #ecfdf5; color: #064e3b; border-color: #a7f3d0; } .chip-green b { background: #059669; }
.chip-amber { background: #fffbeb; color: #78350f; border-color: #fde68a; } .chip-amber b { background: #d97706; }
.chip-teal { background: #f0fdfa; color: #134e4a; border-color: #99f6e4; } .chip-teal b { background: #0d9488; } .chip-teal b.sky { background: #0284c7; }
.k-header-tools { display: flex; align-items: center; gap: 10px; }
.k-clock { display: flex; align-items: center; gap: 6px; padding: 4px 12px; background: var(--brand-50); border: 1px solid #fecaca; border-radius: 8px; color: var(--brand); }
.k-clock svg { width: 16px; height: 16px; }
.k-clock span { font-family: var(--mono); font-weight: 700; font-size: 16px; letter-spacing: .06em; }
.k-tool { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--slate-200); background: #fff; color: var(--slate-700); }
.k-tool:hover { background: var(--slate-100); }
.contrast-ico { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--slate-700); overflow: hidden; display: flex; }
.contrast-ico i { width: 50%; height: 100%; background: var(--slate-800); }
.contrast-ico i + i { background: #fff; }
.k-config-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 0; border-radius: 8px; background: var(--slate-900); color: #fff; font-weight: 600; font-size: 13px; }
.k-config-btn:hover { background: var(--slate-800); }
.k-config-btn svg { width: 16px; height: 16px; }

/* ---------------- 2. Thanh công cụ ---------------- */
.k-toolbar { background: rgba(255,255,255,.7); border-bottom: 1px solid var(--slate-200); padding: 12px 0; }
.k-toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.k-home { display: inline-flex; align-items: center; gap: 10px; padding: 12px 24px; border: 0; border-radius: 12px; background: var(--brand); color: #fff; font-size: 17px; font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.1); transition: transform .1s, background .15s; }
.k-home:hover { background: var(--brand-dark); }
.k-home:active, .k-config-btn:active, .k-pakn-btn:active { transform: scale(.96); }
.k-home svg { width: 22px; height: 22px; }
.k-search { flex: 1; min-width: 240px; max-width: 760px; position: relative; }
.k-search input { width: 100%; padding: 14px 48px 14px 54px; border: 2px solid var(--slate-300); border-radius: 12px; background: #fff; font-size: 18px; font-weight: 500; outline: none; transition: border-color .15s, box-shadow .15s; }
.k-search input::placeholder { color: var(--slate-400); }
.k-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-100); }
.k-search-ico { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--slate-400); pointer-events: none; }
.k-search-clear { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--slate-400); padding: 4px; }
.k-search-drop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40; background: #fff; border: 1px solid var(--slate-200); border-radius: 12px; box-shadow: 0 25px 50px -12px rgba(0,0,0,.3); max-height: 65vh; overflow-y: auto; padding: 8px; }
.sd-head { display: flex; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--slate-100); font-size: 12px; font-weight: 700; color: var(--slate-500); }
.sd-head button { border: 0; background: none; color: var(--slate-400); font-weight: 700; font-size: 12px; }
.sd-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border-radius: 8px; cursor: pointer; }
.sd-item + .sd-item { border-top: 1px solid var(--slate-100); }
.sd-item:hover { background: #fef2f2b3; }
.sd-left { display: flex; gap: 12px; min-width: 0; }
.sd-num { width: 24px; height: 24px; border-radius: 50%; background: var(--brand-100); color: #991b1b; font: 700 11px var(--mono); display: grid; place-items: center; flex-shrink: 0; margin-top: 2px; }
.sd-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--slate-500); }
.sd-code { font: 800 11px var(--mono); color: #b91c1c; background: var(--brand-50); border: 1px solid #fecaca; padding: 1px 6px; border-radius: 4px; }
.sd-name { margin: 2px 0 0; font-size: 14px; font-weight: 700; color: var(--slate-800); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sd-item:hover .sd-name { color: #b91c1c; }
.sd-actions { display: flex; gap: 8px; flex-shrink: 0; }
.sd-qr { padding: 8px; border: 0; border-radius: 8px; background: var(--slate-100); color: var(--slate-600); }
.sd-qr:hover { background: #fef3c7; color: #92400e; }
.sd-qr svg { width: 16px; height: 16px; }
.sd-view { padding: 6px 10px; border: 0; border-radius: 8px; background: #dc2626; color: #fff; font-weight: 700; font-size: 12px; }
.sd-empty { padding: 32px; text-align: center; color: var(--slate-400); font-size: 13px; }

/* 2 thủ tục liên thông (khai sinh, khai tử) cạnh ô tìm kiếm */
.k-lt { display: flex; gap: 10px; flex-shrink: 0; }
.k-lt-btn { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 14px 0 8px; border: 1.5px solid #c9b3ba; border-radius: 12px; background: #fff; text-align: left; color: #4a1a26; transition: border-color .15s, box-shadow .15s, transform .1s; }
.k-lt-btn:hover { border-color: #7a2d3f; box-shadow: 0 4px 12px -6px rgba(90,25,40,.35); }
.k-lt-btn:active { transform: scale(.97); }
.k-lt-ico { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border: 1.5px solid #c9b3ba; border-radius: 8px; background: #fdf8f9; color: #4a1a26; }
.k-lt-ico svg { width: 24px; height: 24px; stroke-width: 1.8; }
.k-lt-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.k-lt-txt b { font-size: 14.5px; font-weight: 700; color: #5b1f2e; white-space: nowrap; }
.k-lt-txt small { font-size: 11.5px; color: var(--slate-500); white-space: nowrap; }
.k-toolbar-right { display: flex; gap: 8px; }
.k-pakn-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 1px solid #fcd34d; border-radius: 8px; background: #fffbeb; color: #78350f; font-size: 12px; font-weight: 700; }
.k-pakn-btn:hover { background: #fef3c7; }
.k-pakn-btn svg { width: 16px; height: 16px; color: #d97706; }
.k-stats-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 1px solid var(--slate-300); border-radius: 8px; background: #fff; color: var(--slate-700); font-size: 12px; font-weight: 700; text-decoration: none; }
.k-stats-btn:hover { background: var(--slate-100); }
.k-stats-btn svg { width: 16px; height: 16px; color: #4f46e5; }

/* ---------------- 3. Lưới thẻ ---------------- */
.k-main { flex: 1; padding-top: 24px; padding-bottom: 24px; display: flex; flex-direction: column; }
.k-loading { padding: 80px 0; text-align: center; color: var(--slate-500); font-weight: 600; }
#k-grid-view { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.k-grid { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 18px; align-content: start; flex: 1; touch-action: pan-y; user-select: none; }
.k-card { position: relative; min-width: 0; aspect-ratio: 1 / 1.414; padding: 10px; border: 0; border-radius: 24px; background: var(--card); color: #fff; text-align: center; box-shadow: 0 10px 24px -10px rgba(127,29,29,.55); transition: transform .2s, box-shadow .2s, background .2s; outline: none; }
.k-card:hover { transform: translateY(-4px); box-shadow: 0 18px 34px -12px rgba(127,29,29,.6); background: var(--card-hover); }
.k-card:focus-visible { box-shadow: 0 0 0 4px #fcd34d; }
.k-card-in { height: 100%; border-radius: 16px; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.85); display: flex; flex-direction: column; padding: 22px 20px 18px; }
.k-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.k-badge-logo { width: 44px; height: 44px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex-shrink: 0; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.k-badge-logo svg { width: 40px; height: 40px; stroke: none; }
.k-count { padding: 6px 12px; border-radius: 8px; background: #fff; color: var(--card-accent); font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.k-card-name { margin: auto 0; padding: 16px 0; font-weight: 800; text-transform: uppercase; line-height: 1.3; letter-spacing: -.01em; text-shadow: 0 1px 2px rgba(0,0,0,.15); display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; font-size: 22px; -webkit-line-clamp: 4; }
.k-card-name.long { font-size: 18px; -webkit-line-clamp: 5; }
.k-card-name.xlong { font-size: 16px; -webkit-line-clamp: 6; }
.k-card-dept { padding-top: 14px; border-top: 1px dashed rgba(255,255,255,.45); display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; color: rgba(255,255,255,.9); }
.k-card-dept span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-card-dept svg { width: 15px; height: 15px; }

.k-pagebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: rgba(255,255,255,.9); border: 1px solid var(--slate-200); border-radius: 12px; font-size: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.k-pagebar-info { display: flex; align-items: center; gap: 8px; color: var(--slate-800); }
.k-autoslide { background: #d1fae5; color: #065f46; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; animation: kpulse 2s infinite; }
@keyframes kpulse { 50% { opacity: .5; } }
.k-pager { display: flex; align-items: center; gap: 6px; }
.k-pager > button { padding: 6px; border: 0; border-radius: 8px; background: var(--slate-100); color: var(--slate-800); display: grid; }
.k-pager > button:disabled { opacity: .3; cursor: not-allowed; }
.k-pager > button svg { width: 16px; height: 16px; }
#k-page { padding: 4px 12px; border-radius: 8px; background: var(--slate-100); border: 1px solid var(--slate-200); font: 700 12px var(--mono); }
.k-pagejump { display: flex; gap: 4px; margin-left: 8px; }
.k-pagejump button { width: 26px; height: 26px; border: 0; border-radius: 6px; background: var(--slate-100); font: 700 11px var(--mono); }
.k-pagejump button.on { background: var(--brand); color: #fff; }

/* ---------------- Danh mục 1 nhóm ---------------- */
.k-group { flex: 1; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--slate-200); border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.k-group-head { padding: 16px 24px; background: linear-gradient(120deg, var(--brand-deep) 0%, var(--brand-dark) 100%); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.k-group-title { display: flex; align-items: center; gap: 12px; }
.k-back { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 0; border-radius: 8px; background: rgba(255,255,255,.2); color: #fff; font-weight: 700; font-size: 12px; }
.k-back:hover { background: rgba(255,255,255,.3); }
.k-back svg { width: 16px; height: 16px; }
.k-group-kicker { display: flex; align-items: center; gap: 8px; color: #fcd34d; font-size: 12px; font-weight: 500; }
.k-pill-w { background: rgba(255,255,255,.15); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); color: #fff; padding: 2px 8px; border-radius: 999px; font-weight: 600; font-variant-numeric: tabular-nums; }
.k-group-head h2 { margin: 2px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.k-group-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.k-group-search { position: relative; }
.k-group-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: rgba(255,255,255,.7); }
.k-group-search input { width: 260px; padding: 7px 12px 7px 32px; border: 1px solid rgba(255,255,255,.3); border-radius: 8px; background: rgba(255,255,255,.1); color: #fff; font-size: 12px; outline: none; }
.k-group-search input::placeholder { color: rgba(255,255,255,.7); }
.k-group-search input:focus { background: #fff; color: var(--slate-900); }
.k-group-search input:focus::placeholder { color: var(--slate-400); }
.k-group-tools select { padding: 7px 10px; border: 1px solid rgba(255,255,255,.3); border-radius: 8px; background: rgba(255,255,255,.1); color: #fff; font-size: 12px; outline: none; }
.k-group-tools select option { color: var(--slate-800); }
.k-print { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 0; border-radius: 8px; background: #fff; color: #7f1d1d; font-size: 12px; font-weight: 700; }
.k-print svg { width: 16px; height: 16px; }

.k-proc-list { flex: 1; overflow-y: auto; padding: 16px 24px; }
.k-proc { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 12px; border-radius: 12px; transition: background .15s; }
.k-proc + .k-proc { border-top: 1px solid var(--slate-100); }
.k-proc:hover { background: rgba(248,250,252,.8); }
.k-proc-left { display: flex; align-items: flex-start; gap: 14px; flex: 1; min-width: 0; }
.k-stt { width: 32px; height: 32px; border-radius: 8px; background: var(--brand-100); color: var(--brand); border: 1px solid #fecaca; font: 900 14px var(--mono); display: grid; place-items: center; flex-shrink: 0; margin-top: 2px; }
.k-proc-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.k-code { display: inline-block; font-size: 12px; font-weight: 600; color: #9f1d22; background: var(--brand-50); padding: 2px 8px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--brand-100); font-variant-numeric: tabular-nums; }
.k-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid; }
.k-tag svg { width: 12px; height: 12px; }
.tag-full { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.tag-part { background: #e0f2fe; color: #075985; border-color: #7dd3fc; }
.tag-onestop { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.tag-lt { background: #f3e8ff; color: #6b21a8; border-color: #d8b4fe; }
.k-proc h3 { margin: 6px 0 4px; font-size: 16px; font-weight: 700; color: var(--slate-900); line-height: 1.4; }
.k-proc-sub { font-size: 12px; color: var(--slate-500); }
.k-proc-actions { display: grid; grid-template-columns: repeat(3, 144px); gap: 12px; flex-shrink: 0; }
.k-act { height: 56px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 8px; border-radius: 12px; border: 1px solid var(--slate-200); background: var(--slate-100); color: var(--slate-700); font-size: 14px; font-weight: 700; transition: all .15s; text-decoration: none; }
.k-act svg { width: 20px; height: 20px; }
.k-act-qr:hover { background: #fffbeb; border-color: #fcd34d; }
.k-act-qr .qr-ico { width: 36px; height: 36px; border-radius: 8px; background: #fff; border: 1px solid var(--slate-200); display: grid; place-items: center; }
.k-act-qr .qr-ico svg { width: 22px; height: 22px; color: var(--slate-800); }
.k-act-qr:hover .qr-ico svg { color: var(--brand); }
.k-act-qr .qr-txt { text-align: left; line-height: 1.15; }
.k-act-qr .qr-txt b { display: block; font-size: 11px; font-weight: 900; text-transform: uppercase; color: var(--brand); }
.k-act-qr .qr-txt span { font-size: 11px; color: var(--slate-500); font-weight: 400; white-space: nowrap; }
.k-act-view:hover { background: var(--brand-50); border-color: #fecaca; color: var(--brand); }
.k-act-submit { background: var(--brand); border-color: var(--brand); color: #fff; }
.k-act-submit:hover { background: #991b1b; }
.k-empty { padding: 64px 0; text-align: center; color: var(--slate-400); }
.k-empty svg { width: 48px; height: 48px; stroke-width: 1; color: var(--slate-300); }
.k-group-foot { padding: 12px 24px; background: var(--slate-50); border-top: 1px solid var(--slate-200); display: flex; justify-content: space-between; font-size: 12px; color: var(--slate-500); }
.k-link { border: 0; background: none; color: var(--brand); font-weight: 700; font-size: 12px; }
.k-link:hover { text-decoration: underline; }

/* ---------------- 4. Chân trang ---------------- */
.k-footer { background: var(--slate-900); color: #cbd5e1; border-top: 2px solid #f59e0b; padding: 10px 0; font-size: 12px; user-select: none; }
.k-footer-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.k-foot-info { display: flex; align-items: center; gap: 8px; color: #e2e8f0; }
.k-foot-info p { margin: 0; font-weight: 500; }
.k-i { width: 20px; height: 20px; border-radius: 50%; background: #fbbf24; color: #020617; font-weight: 900; font-size: 11px; display: grid; place-items: center; flex-shrink: 0; }
.k-marquee { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 560px; overflow: hidden; padding: 0 16px; }
.k-live { width: 8px; height: 8px; border-radius: 50%; background: #34d399; flex-shrink: 0; animation: kping 1.4s infinite; }
@keyframes kping { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.7); } 100% { box-shadow: 0 0 0 8px rgba(52,211,153,0); } }
.k-marquee-box { overflow: hidden; white-space: nowrap; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.k-marquee-box span { display: inline-block; padding-left: 100%; animation: kmarquee 22s linear infinite; color: rgba(252,211,77,.9); font-weight: 500; font-size: 11px; }
@keyframes kmarquee { to { transform: translateX(-100%); } }
.k-foot-right { display: flex; align-items: center; gap: 12px; }
.k-hotline { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: var(--slate-800); border: 1px solid var(--slate-700); border-radius: 8px; color: #fcd34d; font-weight: 700; }
.k-hotline svg { width: 14px; height: 14px; color: #fbbf24; }
.k-hotline b { font-family: var(--mono); color: #fff; }
.k-foot-sys { color: var(--slate-400); }

/* ---------------- Hộp thoại ---------------- */
.k-dlg { padding: 0; border: 1px solid var(--slate-200); border-radius: 16px; box-shadow: 0 25px 50px -12px rgba(0,0,0,.35); max-height: 94vh; color: var(--slate-700); }
.k-dlg[open] { display: flex; flex-direction: column; animation: kscale .18s ease-out; }
@keyframes kscale { from { transform: scale(.96); opacity: 0; } }
.k-dlg::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }
.k-dlg-xl { width: min(1150px, calc(100vw - 32px)); }
.k-dlg-md { width: min(680px, calc(100vw - 32px)); }
.k-dlg-sm { width: min(380px, calc(100vw - 32px)); }
.k-dlg-dark-head, .k-dlg-red-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; color: #fff; flex-shrink: 0; }
.k-dlg-dark-head { background: var(--slate-900); }
.k-dlg-red-head { background: var(--brand); }
.k-dlg-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.k-dlg-head-left h3 { margin: 0; font-size: 15px; font-weight: 700; text-transform: uppercase; }
.k-dlg-head-left p { margin: 2px 0 0; font-size: 12px; color: #fee2e2; }
.k-dlg-sub { font-size: 13px; color: #cbd5e1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-head-ico { padding: 8px; border-radius: 8px; background: rgba(255,255,255,.2); display: grid; color: #fcd34d; }
.k-head-ico.k-amber { background: #f59e0b; color: #020617; }
.k-dlg-x { padding: 6px; border: 0; border-radius: 8px; background: none; color: #cbd5e1; display: grid; }
.k-dlg-x:hover { background: rgba(255,255,255,.12); color: #fff; }
.k-dlg-x svg { width: 22px; height: 22px; }
.k-dlg-body { padding: 24px 28px; overflow-y: auto; flex: 1; min-height: 0; font-size: 14px; }
.k-dlg-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: var(--slate-50); border-top: 1px solid var(--slate-200); flex-shrink: 0; }
.k-center { text-align: center; }
.k-code-dark { font: 900 15px var(--mono); color: #fcd34d; background: var(--slate-800); padding: 2px 10px; border-radius: 4px; border: 1px solid var(--slate-700); }

.k-btn-red, .k-btn-dark, .k-btn-gray, .k-btn-light { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; font-weight: 700; font-size: 14px; border: 1px solid transparent; text-decoration: none; }
.k-btn-red { background: var(--brand); color: #fff; }
.k-btn-red:hover { background: #991b1b; }
.k-btn-dark { background: var(--slate-800); color: #fff; }
.k-btn-gray { background: var(--slate-100); color: var(--slate-800); }
.k-btn-light { background: #fff; color: var(--slate-800); border-color: var(--slate-300); }
.k-btn-light:hover { background: var(--slate-100); }
.k-block { width: 100%; }
.k-link-gray { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--slate-500); font-size: 12px; font-weight: 600; }
.k-link-gray svg { width: 14px; height: 14px; }

/* Chi tiết */
.k-label-red { display: block; font-size: 12px; font-weight: 900; letter-spacing: .05em; color: var(--brand); margin-bottom: 6px; }
.d-name { margin: 0 0 18px; font-size: 24px; font-weight: 700; color: var(--slate-900); line-height: 1.35; }
.d-submit { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 18px; border-radius: 14px; background: linear-gradient(120deg, #fef2f2, #fff7ed); border: 1px solid #fecaca; margin-bottom: 18px; }
.d-submit-text strong { display: block; font-size: 16px; color: #7f1d1d; }
.d-submit-text span { font-size: 13px; color: var(--slate-600); }
.d-submit-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.d-submit-actions svg { width: 18px; height: 18px; }
.d-cells { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--slate-200); border: 1px solid var(--slate-200); border-radius: 12px; overflow: hidden; margin-bottom: 20px; }
.d-cell { background: #fff; padding: 8px 12px; min-width: 0; }
.d-cell.wide { grid-column: span 2; }
.d-cell small { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--slate-400); }
.d-cell span { font-size: 13px; font-weight: 600; color: var(--slate-800); }
.d-cell span.on { color: #047857; }
.d-portal-info h4 { margin: 22px 0 8px; font-size: 12px; font-weight: 900; letter-spacing: .05em; color: var(--slate-500); text-transform: uppercase; }
.d-box { padding: 14px 18px; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: 12px; line-height: 1.6; }
.d-box ol, .d-box ul { margin: 0; padding-left: 20px; }
.d-box li + li { margin-top: 6px; }
.d-steps { white-space: pre-line; }
.d-table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border: 1px solid var(--slate-200); border-radius: 12px; overflow: hidden; }
.d-table th { background: var(--slate-50); text-align: left; padding: 8px 12px; font-size: 11px; text-transform: uppercase; color: var(--slate-500); border-bottom: 1px solid var(--slate-200); }
.d-table td { padding: 8px 12px; border-bottom: 1px solid var(--slate-100); vertical-align: top; }
.d-table tr:last-child td { border-bottom: 0; }
.d-group-row td { background: #fffbeb; font-weight: 700; color: #92400e; font-size: 12px; }
.d-req { color: var(--brand); font-weight: 700; }
.d-loading { padding: 24px; text-align: center; color: var(--slate-500); }
.d-loading.err { color: #b91c1c; }

/* QR */
.q-name { margin: 10px 0 14px; font-size: 14px; font-weight: 700; color: var(--slate-900); line-height: 1.4; }
.q-box { display: inline-block; padding: 14px; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: 14px; }
.q-box img { width: 230px; height: 230px; display: block; border-radius: 8px; background: #fff; }
.q-hint { font-size: 12px; color: var(--slate-500); line-height: 1.6; margin: 14px 0; }

/* PAKN */
.pakn-note { padding: 14px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; font-size: 12px; color: #78350f; line-height: 1.6; }
.pakn-h { margin: 16px 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .05em; color: var(--brand); }
.pakn-card { display: flex; gap: 14px; padding: 16px; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: 12px; margin-bottom: 10px; }
.pakn-card h5 { margin: 0; font-size: 14px; color: var(--slate-900); }
.pakn-card p { margin: 2px 0 0; font-size: 12px; color: var(--slate-500); }
.pakn-qr { width: 72px; height: 72px; background: #fff; border: 1px solid var(--slate-200); border-radius: 8px; padding: 2px; flex-shrink: 0; }
.pakn-ico { padding: 12px; background: var(--brand-100); color: var(--brand); border-radius: 12px; height: fit-content; display: grid; }
.pakn-ico svg { width: 24px; height: 24px; }
.pakn-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--brand); text-decoration: none; }
.pakn-link svg { width: 14px; height: 14px; }
.pakn-list { margin: 8px 0 0; padding-left: 16px; font-size: 12px; font-weight: 500; }
.pakn-list li + li { margin-top: 4px; }
.pakn-foot { border-top: 1px solid var(--slate-100); padding-top: 12px; margin-top: 8px; font-size: 12px; color: var(--slate-500); }
.pakn-foot p { margin: 4px 0; }

/* Cấu hình */
.cfg-form fieldset { border: 1px solid var(--slate-200); border-radius: 12px; padding: 12px 16px 14px; margin: 0 0 14px; }
.cfg-form legend { padding: 0 6px; font-size: 12px; font-weight: 800; color: var(--slate-900); text-transform: uppercase; letter-spacing: .03em; }
.cfg-form label { display: block; font-size: 12px; font-weight: 700; color: var(--slate-700); margin-top: 10px; }
.cfg-input { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--slate-300); border-radius: 8px; background: #fff; font-size: 13px; font-weight: 500; }
.cfg-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.cfg-check { display: flex !important; align-items: center; gap: 8px; font-weight: 600 !important; }
.cfg-check input { width: 16px; height: 16px; accent-color: var(--brand); }
.cfg-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.cfg-hint { margin: 6px 0 0; font-size: 12px; color: var(--slate-500); }
.cfg-lock { text-align: center; padding: 20px; }
.cfg-lock .cfg-input { max-width: 200px; margin: 10px auto; text-align: center; font-size: 18px; letter-spacing: .3em; }
.cfg-msg { display: block; margin-top: 8px; color: #b91c1c; font-size: 12px; font-weight: 600; }

/* ---------------- Tương phản cao ---------------- */
.kiosk.contrast, .kiosk.contrast .k-main { background: #000; color: #fff; }
.kiosk.contrast .k-header, .kiosk.contrast .k-toolbar { background: #000; border-color: #444; }
.kiosk.contrast .k-brand h1, .kiosk.contrast .k-subtitle { color: #fde047; }
.kiosk.contrast .k-card { background: #000; box-shadow: inset 0 0 0 3px #fde047; color: #fde047; }
.kiosk.contrast .k-card-in { box-shadow: none; }
.kiosk.contrast .k-count { background: #fde047; color: #000; }
.kiosk.contrast .k-card-dept { color: #fff; border-color: #fde047; }
.kiosk.contrast .k-search input { background: #000; color: #fff; border-color: #fde047; }
.kiosk.contrast .k-group, .kiosk.contrast .k-proc-list { background: #000; color: #fff; border-color: #444; }
.kiosk.contrast .k-proc h3 { color: #fde047; font-size: 19px; }
.kiosk.contrast .k-pagebar { background: #111; color: #fff; border-color: #444; }

/* ---------------- Màn hình nhỏ ---------------- */
@media (max-width: 1280px) {
    .k-grid { grid-template-columns: repeat(min(var(--cols, 5), 4), minmax(0, 1fr)); }
    .k-lt-txt small { display: none; }
}
@media (max-width: 1100px) {
    .k-lt { order: 3; width: 100%; }
    .k-lt-btn { flex: 1; }
    .k-lt-txt small { display: block; white-space: normal; }
}
@media (max-width: 1024px) {
    .k-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .k-header-right { align-items: flex-start; }
    .k-proc { flex-direction: column; align-items: stretch; }
    .k-proc-actions { grid-template-columns: repeat(3, 1fr); }
    .d-cells { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    .k-wrap { padding: 0 14px; }
    .k-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .k-card { border-radius: 16px; padding: 7px; }
    .k-card-in { padding: 14px 12px 12px; }
    .k-card-name { font-size: 15px !important; }
    .k-count { font-size: 14px; padding: 4px 8px; }
    .k-badge-logo { width: 32px; height: 32px; } .k-badge-logo svg { width: 28px; height: 28px; }
    .k-brand h1 { font-size: 18px; }
    .k-hide-sm, .k-config-btn span, .k-stats-btn span, .k-marquee, .k-foot-sys { display: none; }
    .k-group-search input { width: 100%; }
    .k-act-qr .qr-txt span { display: none; }
    .k-lt { flex-direction: column; }
    .k-lt-txt small { display: none; }
    .cfg-2 { grid-template-columns: 1fr; }
}

/* ---------------- In bảng niêm yết ---------------- */
@media print {
    .k-header, .k-toolbar, .k-footer, .k-group-tools, .k-back, .k-group-foot, .k-proc-actions, #k-grid-view { display: none !important; }
    .kiosk, .k-main, body { background: #fff; }
    .k-group { border: 0; box-shadow: none; }
    .k-group-head { background: none; color: #000; padding: 0 0 12px; border-bottom: 2px solid #000; }
    .k-group-kicker { color: #000; }
    .k-proc { break-inside: avoid; padding: 10px 0; }
}
