/* Authenticated SmartOCR workspace. Public pages retain their own composition.
   Một hệ phẳng: nền trang + bề mặt trắng viền 1px, không gradient, không bóng ở vật đứng yên.
   Màu xanh thương hiệu chỉ dùng cho hành động chính, liên kết và dữ liệu; điều hướng dùng nền xám. */
.workspace-app { --sidebar-expanded-width: 248px; --sidebar-width: var(--sidebar-expanded-width); --sidebar-duration: 220ms; --sidebar-ease: cubic-bezier(.22,1,.36,1); --radius: 8px; --radius-control: 6px; background: var(--bg); }

/* Sidebar: bề mặt riêng (trắng / xám đậm) tách khỏi nền nội dung; hàng logo cao bằng thanh trên để hai đường kẻ nối liền.
   Thẻ workspace ở đầu, hai nhóm menu, dưới cùng là cài đặt cá nhân và phiên bản. */
.workspace-app .sidebar { --side-bg: var(--surface); --nav-ink: color-mix(in srgb, var(--ink) 78%, var(--side-bg)); background: var(--side-bg); border-right: 1px solid var(--line); color: var(--ink); }
:root[data-theme='dark'] .workspace-app .sidebar { --side-bg: #17181b; }
.workspace-app .sidebar-brand { height: 60px; padding: 14px 12px 14px 18px; border-bottom: 1px solid var(--line); }
.workspace-app .sidebar .brand { gap: 9px; }
.workspace-app .sidebar .brand-symbol { width: 28px; height: 28px; }
.workspace-app .sidebar .brand-wordmark { font-size: 18px; letter-spacing: -.5px; }

/* Thẻ workspace: chữ viết tắt trên nền xanh VNPT, tên đậm, gói; bấm để xem hạn mức. */
.workspace-app .workspace-context { display: flex; align-items: center; gap: 12px; margin: 14px 12px 6px; padding: 12px 10px 12px 12px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--subtle) 60%, var(--side-bg)); color: var(--ink); transition: border-color .15s ease, background-color .15s ease; }
.workspace-app .workspace-context:hover { border-color: var(--line-strong); background: var(--subtle); }
.ws-mark { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px; background: #1d5089; color: #fff; font-size: 14px; font-weight: 700; letter-spacing: .02em; }
:root[data-theme='dark'] .ws-mark { background: #2b5f99; }
.ws-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ws-info strong { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; line-height: 1.35; }
.ws-info small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.ws-usage { display: block; margin-top: 6px; color: var(--muted); font-size: 11.5px; }
.ws-usage progress { height: 4px; margin: 4px 0 0; }
.ws-usage progress::-webkit-progress-value { background: var(--blue); } .ws-usage progress::-moz-progress-bar { background: var(--blue); }

/* Menu */
.workspace-app .sidebar-nav { padding: 4px 12px 12px; }
.workspace-app .navlabel { padding: 18px 10px 6px; color: var(--faint); font-size: 12px; font-weight: 500; letter-spacing: 0; }
.workspace-app .nav { min-height: 36px; margin: 1px 0; padding: 7px 10px; gap: 11px; border-radius: 8px; color: var(--nav-ink); font-size: 14px; font-weight: 450; transition: background-color .15s ease, color .15s ease; }
.workspace-app .nav .icon { width: 18px; height: 18px; stroke-width: 1.7; color: var(--muted); }
.workspace-app .nav:hover { background: var(--hover); color: var(--ink); }
.workspace-app .nav:hover .icon { color: var(--ink); }
/* Mục đang mở: nền xanh VNPT nhạt, chữ và icon xanh; mục khác giữ icon xám. */
.workspace-app .nav.active { background: color-mix(in srgb, var(--hue-blue) 13%, var(--side-bg)); color: color-mix(in srgb, var(--hue-blue) 72%, var(--ink)); font-weight: 600; box-shadow: none; }
:root[data-theme='dark'] .workspace-app .nav.active { background: color-mix(in srgb, var(--hue-blue) 24%, var(--side-bg)); color: #dbe9fb; }
.workspace-app .nav.active .icon, .workspace-app .nav.active:hover .icon { color: var(--hue-blue); }
.workspace-app .sidebottom { padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.workspace-app .sidebar-toggle { flex-shrink: 0; color: var(--muted); background: transparent; border-color: transparent; }
.workspace-app .sidebar-toggle:hover { color: var(--ink); background: var(--hover); }
.workspace-app .sidebar-toggle > .icon { width: 18px; height: 18px; }
.workspace-app .menu-toggle { flex-shrink: 0; color: var(--ink); background: transparent; border-color: var(--line); }
.workspace-app .menu-toggle:hover { background: var(--hover); }
.workspace-app .sidebar-close { color: var(--muted); border-color: var(--line); background: var(--surface); }
.workspace-app .sidebar :focus-visible { outline-color: var(--link); outline-offset: 1px; }

/* Thanh trên: breadcrumb bên trái, giao diện và tài khoản bên phải. */
.workspace-app .topbar { height: 60px; padding-inline: 32px; gap: 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.workspace-app .breadcrumb { gap: 8px; font-size: 13px; }
.workspace-app .breadcrumb > .icon:first-child { display: none; }
.workspace-app .breadcrumb .icon { width: 14px; height: 14px; }
.workspace-app .topright { gap: 8px; }
.workspace-app .topbar-divider { height: 20px; margin-inline: 4px; }
.workspace-app .user-chip { padding: 3px 8px 3px 3px; border-radius: var(--radius-control); }
.workspace-app .user-chip:hover { background: var(--hover); }
.workspace-app .avatar { width: 30px; height: 30px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 50%; font-size: 12px; text-transform: uppercase; }
.workspace-app .identity b { font-size: 13px; font-weight: 500; }
.workspace-app .identity small { font-size: 12px; margin-top: 0; }
.workspace-mobile-title { display: none; }

/* Vùng nội dung và tiêu đề trang */
.workspace-app .content { max-width: none; padding: 28px 32px 40px; }
@media (min-width: 1600px) { .workspace-app .content { padding-inline: 40px; } }
.workspace-app .title { align-items: flex-end; margin-bottom: 24px; gap: 24px; }
.workspace-app h1 { font-size: 24px; font-weight: 600; letter-spacing: -.4px; line-height: 1.3; }
.workspace-app .title p { margin-top: 4px; font-size: 14px; line-height: 1.6; }
.workspace-app .title-actions { padding: 0; }
.workspace-app h2 { font-size: 16px; font-weight: 600; letter-spacing: -.2px; }

/* Điều khiển: một chiều cao, một bán kính. */
.workspace-app .btn, .workspace-dialog .btn { min-height: 36px; padding: 7px 14px; border-radius: var(--radius-control, 6px); font-size: 14px; font-weight: 500; box-shadow: none; }
.workspace-app .btn.small, .workspace-dialog .btn.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.workspace-app .btn.icononly, .workspace-dialog .btn.icononly { width: 34px; min-height: 34px; padding: 7px; }
.workspace-app .btn.light, .workspace-dialog .btn.light { color: var(--ink); border-color: var(--line-strong); }
.workspace-app .input, .workspace-dialog .input { min-height: 38px; border-radius: 6px; font-size: 14px; padding: 8px 11px; box-shadow: none; }
.workspace-app .input::placeholder, .workspace-dialog .input::placeholder { font-size: 14px; }
.workspace-app .card { border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--elev-1); }
.workspace-app .cardhead { margin-bottom: 16px; }
.workspace-app .section-description { font-size: 13px; margin-top: 2px; line-height: 1.6; }
.workspace-app .pill { border-radius: 4px; padding: 1px 7px; font-size: 12px; line-height: 20px; }
.workspace-app .note { border-radius: var(--radius-control); padding: 10px 14px; font-size: 13px; line-height: 1.6; }
.workspace-app .empty { padding: 40px 20px; }
.workspace-app .empty-icon { display: none; }
.workspace-app .empty h3 { font-size: 15px; font-weight: 600; }

/* Bảng: chỉ đường kẻ và căn lề, không dải nền tiêu đề. */
.workspace-app .card:has(> .tablewrap) { padding: 0; }
.workspace-app .card:has(> .tablewrap) > .cardhead, .workspace-app .card:has(> .tablewrap) > .toolbar { padding: 16px 20px; margin: 0; }
.workspace-app .tablewrap { position: relative; border-top: 1px solid var(--line); }
.workspace-app table { font-size: 14px; }
.workspace-app th { padding: 10px 20px; font-size: 12px; }
.workspace-app td { padding: 13px 20px; }
.workspace-app td > .muted { margin-top: 1px; }
.workspace-app .table-link { font-size: 13px; color: var(--muted); }
.workspace-app .table-link:hover { color: var(--link); }
.workspace-app .cardhead .table-link { color: var(--link); }
.workspace-app .file-glyph { width: 28px; height: 32px; border-radius: 4px; background: var(--surface); color: var(--muted); border-color: var(--line); }
.workspace-app .file-glyph .icon { width: 16px; height: 16px; }
.workspace-app .pagination { font-size: 13px; }
.workspace-app .toolbar { gap: 12px; }
.workspace-app .search { width: 280px; }
.workspace-app .filtergroup { gap: 8px; }
/* Bảng hẹp trên điện thoại: mỗi dòng thành một khối nhãn – giá trị (nhãn lấy từ tiêu đề cột). */
@media (max-width: 640px) {
  .workspace-app .tablewrap table.stack, .workspace-app table.stack tbody, .workspace-app table.stack tr, .workspace-app table.stack td { display: block; }
  .workspace-app table.stack thead { display: none; }
  .workspace-app table.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .workspace-app table.stack tbody tr:last-child { border-bottom: 0; }
  .workspace-app table.stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 3px 0; border: 0; min-width: 0; text-align: right; }
  .workspace-app table.stack td::before { content: attr(data-label); flex-shrink: 0; color: var(--muted); font-size: 13px; text-align: left; }
  .workspace-app table.stack td:first-child { display: block; padding-bottom: 6px; text-align: left; }
  .workspace-app table.stack td:first-child::before, .workspace-app table.stack td[data-label=""]::before { display: none; }
  .workspace-app table.stack td[data-label=""] { justify-content: flex-end; padding-top: 8px; }
}

/* Thẻ chọn mẫu: lọc bằng tab gạch chân, thẻ không icon. */
.workspace-app .tabs { gap: 20px; margin-bottom: 0; padding: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
.workspace-app .tabs .btn { gap: 6px; min-height: 40px; margin: 0 0 -1px; padding: 8px 0 10px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); font-weight: 500; }
.workspace-app .tabs .btn:hover:not(:disabled) { background: none; color: var(--ink); }
.workspace-app .tabs .btn.active { border-bottom-color: var(--ink); color: var(--ink); background: none; }
.tab-count { color: var(--faint); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.btn.active .tab-count { color: var(--muted); }
.type-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 20px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.type-toolbar .tabs { border-bottom: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.type-search { position: relative; width: min(280px,100%); margin: 0 0 8px auto; }
.type-search .icon { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.workspace-app .type-search .input { width: 100%; min-height: 34px; padding: 6px 10px 6px 33px; font-size: 14px; }
.type-empty { grid-column: 1/-1; padding: 48px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.workspace-app .grid3 { gap: 16px; }
.workspace-app .typecard { padding: 18px 20px; border-radius: var(--radius); box-shadow: var(--elev-1); transition: border-color .15s ease; }
.workspace-app .typecard h3 { font-size: 15px; font-weight: 600; }
.workspace-app .type-group { display: block; margin-top: 2px; padding: 0; background: none; color: var(--muted); font-size: 12px; }
.workspace-app .typecard > p { margin: 10px 0 16px; min-height: 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.workspace-app .typecard-footer { padding-top: 0; border-top: 0; }
.workspace-app .typecard-footer > span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.workspace-app .typecard .listitem { padding: 10px 0; font-size: 14px; }
.workspace-app .typecard .listitem b { font-weight: 500; font-variant-numeric: tabular-nums; }
.plan-code { color: var(--muted); font-size: 12px; font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; }
.workspace-app .typecard > .plan-code + h2 { margin-top: 2px; }
.workspace-app .typecard > h2 + p { margin: 2px 0 12px; }

/* Gói & hạn mức: thẻ gói, ba thẻ tính năng mang màu nhận diện (f-ocr/f-extract/f-knowledge), mức dùng theo mẫu. */
.workspace-app .quota-plan { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 24px; }
.quota-plan-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.quota-plan-name { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.quota-plan-name h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.quota-plan-id p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.quota-plan-stats { display: grid; grid-template-columns: repeat(3,minmax(140px,auto)); margin: 0; }
.quota-plan-stats > div { padding: 2px 24px; border-left: 1px solid var(--line); }
.quota-plan-stats dt { color: var(--muted); font-size: 13px; }
.quota-plan-stats dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; white-space: nowrap; }
.quota-plan-stats small { color: var(--muted); font-size: 12px; }
.quota-features { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; margin-bottom: 20px; }
.workspace-app .quota-features > .card { margin: 0; }
.quota-feature { display: flex; flex-direction: column; }
.quota-feature-head { display: flex; align-items: center; gap: 10px; }
.quota-feature-head h2 { flex: 1; margin: 0; font-size: 15px; font-weight: 600; }
.quota-feature-icon, .quota-group-icon { display: grid; place-items: center; flex-shrink: 0; border-radius: 8px; color: var(--hue); background: color-mix(in srgb, var(--hue) var(--tint), var(--surface)); }
.quota-feature-icon { width: 32px; height: 32px; }
.quota-feature-icon .icon { width: 18px; height: 18px; }
.quota-main { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; }
.quota-figure { margin: 0; font-size: 34px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
.quota-figure.warn { color: var(--amber); }
.quota-caption { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.quota-ring { width: 64px; height: 64px; flex-shrink: 0; transform: rotate(-90deg); }
.quota-ring circle { fill: none; stroke: var(--subtle); stroke-width: 6; }
.quota-ring circle.val { stroke: var(--hue); stroke-linecap: round; }
.quota-ring.low circle.val { stroke: var(--amber); }
.quota-ring text { transform: rotate(90deg); transform-origin: 32px 32px; text-anchor: middle; font-size: 13px; font-weight: 600; fill: var(--ink); }
.quota-mix { display: flex; flex: none; gap: 2px; height: 8px; margin: 16px 0 10px; border-radius: 4px; overflow: hidden; background: var(--subtle); }
.quota-mix span { min-width: 4px; background: var(--hue); }
.quota-mix span[data-flex='0'] { display: none; }
.quota-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.quota-legend li { display: flex; align-items: center; gap: 5px; }
.quota-legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--hue); }
.quota-legend b { color: var(--ink); font-weight: 600; }
.quota-facts { margin: auto 0 0; padding-top: 16px; }
.quota-facts > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.quota-facts dt { color: var(--muted); }
.quota-facts dd { min-width: 0; margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.quota-missing { display: flex; flex-direction: column; justify-content: center; flex: 1; margin-top: 16px; padding: 20px; border: 1px dashed var(--line); border-radius: 8px; }
.quota-missing p { margin: 0; font-size: 16px; font-weight: 600; color: var(--muted); }
.quota-missing small { margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.workspace-app .card.quota-detail { padding: 0; }
.workspace-app .card.quota-detail > .cardhead { padding: 16px 20px; margin: 0; border-bottom: 1px solid var(--line); }
.quota-detail .cardhead p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.quota-list { column-width: 300px; column-gap: 40px; padding: 4px 20px 16px; }
.quota-list section { break-inside: avoid; padding-top: 16px; }
.quota-list h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.quota-list h3 small { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
.quota-group-icon { width: 24px; height: 24px; border-radius: 6px; }
.quota-group-icon .icon { width: 14px; height: 14px; }
.quota-list ul { margin: 0; padding: 0; list-style: none; }
.quota-list li { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: baseline; column-gap: 16px; padding: 8px 0 9px; border-bottom: 1px solid var(--line); font-size: 14px; }
.quota-list li:last-child { border-bottom: 0; }
.quota-list li b { font-weight: 500; text-align: right; white-space: nowrap; }
.quota-list li b small { color: var(--muted); font-size: 12px; font-weight: 400; }
.quota-list li progress { grid-column: 1/-1; height: 4px; margin: 7px 0 0; }
.quota-list progress::-webkit-progress-value { background: var(--hue); }
.quota-list progress::-moz-progress-bar { background: var(--hue); }
.workspace-app progress.low::-webkit-progress-value { background: var(--amber); }
.workspace-app progress.low::-moz-progress-bar { background: var(--amber); }
@media (max-width: 1100px) {
  .workspace-app .quota-plan { flex-direction: column; align-items: stretch; }
  .quota-plan-stats { grid-template-columns: repeat(3,minmax(0,1fr)); padding-top: 16px; border-top: 1px solid var(--line); }
  .quota-plan-stats > div:first-child { padding-left: 0; border-left: 0; }
  .quota-features { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .workspace-app .quota-plan { padding: 16px; }
  .quota-plan-stats { grid-template-columns: 1fr; gap: 12px; }
  .quota-plan-stats > div { padding: 0; border-left: 0; }
  .quota-list { padding-inline: 16px; }
  .workspace-app .card.quota-detail > .cardhead { padding: 14px 16px; }
}

/* Tài khoản & bảo mật */
.workspace-app .security-layout { max-width: none; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.25fr); align-items: start; gap: 20px; }
.workspace-app .security-layout > .card { margin: 0; }
.workspace-app .security-layout > .note { grid-column: 1/-1; margin: 0; }
.workspace-app .account-profile .profile-form .field { margin: 16px 0 0; }
.workspace-app .account-profile .profile-form .flex { gap: 8px; }
.workspace-app .account-profile .profile-form .input { flex: 1; }
.workspace-app .account-profile .profile-form .error:empty { display: none; }
.workspace-app .account-profile .formgrid { grid-template-columns: 1fr; gap: 0; margin-top: 16px; }
.workspace-app .account-profile .formgrid > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.workspace-app .account-profile .formgrid > div > small { font-size: 14px; }
.workspace-app .account-profile .formgrid > div > p { margin: 0; font-weight: 500; overflow-wrap: anywhere; text-align: right; }
.workspace-app .security-layout .listitem { font-size: 14px; padding: 12px 0; }
.workspace-app .account-api .token-field label { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.workspace-app .account-api .token-field .keybox { margin-top: 0; padding: 10px 12px; border-color: var(--line); }
.workspace-app .account-api .field { margin: 16px 0; }
.workspace-app .security-layout .input { min-width: 0; }
.workspace-app .account-password form > .field:first-child { margin-top: 16px; }

/* Tổng quan: hai lối vào công việc, dải số liệu chia cột, tài liệu gần đây và hoạt động 7 ngày. */
.workspace-start { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
.workspace-task { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--elev-1); transition: border-color .15s ease, transform .16s var(--ease-out); }
.workspace-task:active { transform: scale(.99); }
.workspace-task-icon { display: grid; place-items: center; flex-shrink: 0; color: var(--muted); }
.workspace-task-icon .icon { width: 20px; height: 20px; }
.workspace-task strong { display: block; font-size: 15px; font-weight: 600; }
.workspace-task small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.workspace-task-arrow { display: grid; place-items: center; flex-shrink: 0; margin-left: auto; color: var(--muted); }
.workspace-task-arrow .icon { width: 16px; height: 16px; }
.workspace-task:hover { border-color: var(--line-strong); }
.workspace-task:hover .workspace-task-arrow, .workspace-task:hover .workspace-task-icon { color: var(--link); }
.workspace-app .stats { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 0; margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; box-shadow: var(--elev-1); }
.workspace-app .stat { padding: 16px 20px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: none; }
.workspace-app .stat:last-child { border-right: 0; }
.workspace-app .stat > .muted { display: block; font-size: 13px; }
.workspace-app .stat b { margin: 6px 0 2px; font-size: 24px; line-height: 1.25; letter-spacing: -.4px; font-weight: 600; }
.workspace-app .stat b.stat-text { font-size: 16px; line-height: 30px; letter-spacing: 0; }
.workspace-app .stat small { display: block; font-size: 12px; }
.workspace-dashboard { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); gap: 20px; align-items: stretch; }
.workspace-dashboard .card { margin: 0; }
.workspace-app .workspace-recent { display: flex; flex-direction: column; }
.workspace-first-document { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px; text-align: center; border-top: 1px solid var(--line); }
.workspace-first-document h3 { font-size: 15px; font-weight: 600; }
.workspace-first-document p { color: var(--muted); font-size: 14px; line-height: 1.6; max-width: 380px; margin: 4px auto 0; }
.workspace-first-document .btn { margin-top: 16px; }
.workspace-week-total { display: flex; align-items: baseline; gap: 8px; }
.workspace-week-total strong { font-size: 24px; font-weight: 600; line-height: 1.25; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.workspace-week-total span { color: var(--muted); font-size: 13px; }
.workspace-activity .cardhead small { color: var(--muted); font-size: 13px; }
.workspace-app .chart { width: 100%; height: auto; max-height: 190px; margin-top: 8px; }
.chart-grid { fill: none; stroke: var(--line); stroke-width: 1; }
.chart-base { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.workspace-chart-note { margin-top: 8px; color: var(--muted); font-size: 13px; }
.workspace-engine-status .note { margin: 20px 0 0; }

/* Bóc tách theo mẫu: hai bước trong một khung chia đôi. */
.workspace-app .drop { border-radius: var(--radius); background: var(--subtle); border-color: var(--line-strong); min-height: 280px; padding: 32px 20px; }
.workspace-app .drop.dragover { background: var(--blue-soft); border-color: var(--link); }
.workspace-app .drop .upload { width: auto; height: auto; margin: 0 auto 12px; border: 0; background: none; color: var(--muted); box-shadow: none; }
.workspace-app .drop .upload .icon { width: 26px; height: 26px; stroke-width: 1.5; }
.workspace-app .drop h3 { font-size: 16px; font-weight: 600; }
.workspace-app .drop > p { margin-top: 2px; font-size: 14px; }
.workspace-app .drop .btn { margin: 16px 0 14px; }
/* OCR toàn văn: một khung tải file, chọn xong thì thay bằng dòng file + nút nhận diện */
.workspace-app .ocr-start { padding: 16px; margin-bottom: 28px; border-radius: var(--radius); }
.workspace-app .ocr-start .drop { min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.workspace-app .ocr-start .drop .btn { margin: 16px 0 14px; }
.ocr-start-file { display: none; align-items: center; gap: 16px; }
.ocr-start.has-files .drop { display: none; }
.ocr-start.has-files .ocr-start-file { display: flex; }
.ocr-start-file #file-list { flex: 1; min-width: 0; }
.ocr-start-file .file { margin-top: 0; padding: 12px 14px; background: var(--subtle); }
.ocr-start-run .btn { min-height: 40px; padding-inline: 20px; }
.ocr-start-hint { margin-top: 12px; color: var(--muted); font-size: 13px; text-align: center; }
.ocr-recent-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ocr-recent-head h2 { font-size: 15px; font-weight: 600; }
.ocr-recent ul { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.ocr-recent li + li { border-top: 1px solid var(--line); }
.ocr-recent a { display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: inherit; text-decoration: none; }
.ocr-recent a:hover { background: var(--subtle); }
.ocr-recent a > .icon { width: 16px; height: 16px; color: var(--faint); }
.ocr-recent-name { flex: 1; min-width: 0; }
.ocr-recent-name b { display: block; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ocr-recent-name small { display: block; margin-top: 1px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
/* OCR toàn văn nhiều file: danh sách file đã chọn (cộng dồn, cuộn khi dài) và bảng theo dõi lô */
.workspace-app .ocr-start[hidden] { display: none; }
.workspace-app .ocr-start.is-compact .drop { min-height: 150px; padding: 20px; }
.workspace-app .ocr-start.is-compact .drop .upload { display: none; }
.workspace-app .ocr-start.dragover { outline: 2px dashed var(--link); outline-offset: -8px; }
.ocr-start-file:has(.ocr-files) { flex-direction: column; align-items: stretch; gap: 12px; }
.ocr-start-file:has(.ocr-files) .ocr-start-run { display: flex; justify-content: center; }
.ocr-start-hint:empty { display: none; }
.ocr-files-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 8px; color: var(--muted); font-size: 14px; }
.ocr-files-head b { color: var(--ink); font-weight: 600; }
.ocr-files-tools { display: flex; gap: 4px; }
.ocr-files { display: grid; gap: 6px; max-height: 340px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.extract-fields { min-width: 0; margin: 0 0 16px; padding: 0 0 16px; border: 0; border-bottom: 1px solid var(--line); }
.extract-fields-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.extract-fields-head h2 { font-size: 15px; font-weight: 600; }
.extract-fields-head p { margin-top: 2px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.extract-fields-tools { display: flex; gap: 4px; }
.workspace-app .extract-checks { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 0; max-height: 264px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.workspace-app .extract-checks .check { align-items: center; margin: 0; cursor: pointer; }
.workspace-app .extract-checks .check:has(input:checked) { border-color: color-mix(in srgb, var(--link) 45%, var(--line)); background: color-mix(in srgb, var(--link) 7%, var(--surface)); }
.ocr-start-over { color: var(--amber); }
.ocr-start-over a { color: inherit; text-decoration: underline; }
.workspace-app .ocr-batch { padding: 16px 0 0; margin-bottom: 28px; border-radius: var(--radius); overflow: hidden; }
.ocr-batch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding: 0 16px; }
.ocr-batch-head h2 { font-size: 15px; font-weight: 600; }
.ocr-batch-head p { margin-top: 2px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.ocr-batch-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ocr-batch-progress { width: auto; margin: 12px 16px; }
.ocr-batch .note { margin: 0 16px 12px; }
.ocr-batch-list { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow-y: auto; border-top: 1px solid var(--line); scrollbar-width: thin; }
.ocr-batch-list li + li { border-top: 1px solid var(--line); }
.ocr-batch-item > a, .ocr-batch-item > div { display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: inherit; text-decoration: none; }
.ocr-batch-item > a:hover { background: var(--subtle); }
.ocr-batch-item > a > .icon { width: 16px; height: 16px; color: var(--faint); }
.ocr-batch-item .file-glyph .ocr-spinner { width: 14px; height: 14px; margin: 0; border-width: 2px; }
.ocr-batch-item:is(.is-pending,.is-skipped) .ocr-recent-name b { color: var(--muted); }
.ocr-recent-name .ocr-batch-note { white-space: normal; overflow-wrap: anywhere; }
.ocr-batch-item:is(.is-error,.is-failed) .ocr-batch-note { color: var(--red); }
@media (max-width: 760px) {
  .ocr-start-file { flex-direction: column; align-items: stretch; }
  .ocr-start-run .btn { width: 100%; }
  .ocr-batch-actions { width: 100%; }
  .workspace-app .extract-checks { max-height: none; }
  .ocr-batch-item > a, .ocr-batch-item > div { flex-wrap: wrap; }
  .ocr-batch-item .ocr-recent-name { flex-basis: calc(100% - 44px); }
  .ocr-batch-item > a > .icon { display: none; }
  .ocr-batch-item .pill { margin-left: 40px; }
  .workspace-app .ocr-start .drop { min-height: 220px; }
}
.workspace-app .check, .workspace-dialog .check { border-radius: 6px; padding: 10px 12px; font-size: 14px; }
.workspace-app .check:has(input:checked), .workspace-dialog .check:has(input:checked) { background: var(--surface); border-color: var(--line-strong); }
.workspace-app .file { border-radius: 6px; background: var(--subtle); }
.workspace-app .preview { border-radius: 6px; }
.workspace-app .activejob { border-radius: var(--radius); border-color: var(--line); background: var(--subtle); }
.workspace-dialog { width: min(680px,calc(100vw - 32px)); border-radius: 8px; padding: 24px; }
.workspace-dialog .modalhead { margin-bottom: 20px; padding-bottom: 16px; }
.workspace-dialog .modalhead h2 { font-size: 18px; font-weight: 600; letter-spacing: -.3px; }
.workspace-dialog .modalfoot { margin-top: 24px; }

/* Cỡ chữ phụ sau đăng nhập: tối thiểu 12px, mô tả 13–14px. */
.workspace-app small, .workspace-app .formhint, .workspace-dialog small, .workspace-dialog .formhint { font-size: 13px; }
.workspace-app .muted, .workspace-dialog .muted { font-size: 14px; }
.workspace-app td .muted { font-size: 13px; }
.workspace-app .link, .workspace-dialog .link { font-size: 14px; }
.workspace-app .field label, .workspace-dialog .field label { font-size: 14px; }
.workspace-app .error, .workspace-dialog .error { font-size: 14px; }
.workspace-app .empty p { font-size: 14px; }
.workspace-app .drop > small { font-size: 13px; }
.workspace-app .file .name b { font-size: 14px; }
.workspace-app .file .name small { font-size: 13px; }

@media (max-width: 1200px) {
  .workspace-app { --sidebar-expanded-width: 232px; }
  .workspace-app .stat { padding: 14px 16px; }
  .workspace-app .security-layout { grid-template-columns: 1fr; }
}
@media (min-width: 961px) {
  .workspace-app .sidebar { overflow: hidden; transition: width var(--sidebar-duration) var(--sidebar-ease); }
  .workspace-app .main { transition: margin-left var(--sidebar-duration) var(--sidebar-ease); }
  .workspace-app .sidebar-brand { position: relative; }
  .workspace-app .sidebar-toggle { position: absolute; right: 12px; transition: right var(--sidebar-duration) var(--sidebar-ease); }
  .workspace-app .nav > span, .workspace-app .navlabel { white-space: nowrap; }
  .workspace-app.sidebar-collapsed { --sidebar-width: 60px; }
  .workspace-app.sidebar-collapsed .sidebar-toggle { right: 13px; }
  .workspace-app.sidebar-collapsed .sidebar-brand { justify-content: center; padding-inline: 10px; }
  .workspace-app.sidebar-collapsed .brand,
  .workspace-app.sidebar-collapsed .ws-info,
  .workspace-app.sidebar-collapsed .navlabel,
  .workspace-app.sidebar-collapsed .nav > span {  display: none; }
  .workspace-app.sidebar-collapsed .sidebar-nav { padding: 8px 10px 12px; }
  .workspace-app.sidebar-collapsed .nav { justify-content: center; width: 38px; min-height: 36px; margin: 2px auto; padding: 8px; gap: 0; }
  .workspace-app.sidebar-collapsed .workspace-context { justify-content: center; margin: 10px 8px 4px; padding: 0; border: 0; background: none; }
  .workspace-app.sidebar-collapsed .navlabel:not(:first-child) { display: block; height: 1px; margin: 10px 6px; padding: 0; overflow: hidden; background: var(--line); color: transparent; }
  .workspace-app.sidebar-collapsed .sidebottom { padding: 10px; }
}
@media (max-width: 960px) {
  .workspace-app .sidebar-toggle { display: none; }
  .workspace-app .sidebar { width: min(280px,calc(100vw - 32px)); transition: transform var(--sidebar-duration) var(--sidebar-ease), visibility 0s linear var(--sidebar-duration); }
  .workspace-app .sidebar.open { transition-delay: 0s; box-shadow: 0 0 40px #0b142233; }
  .workspace-app .main { margin-left: 0; }
}
@media (max-width: 760px) {
  .workspace-app .topbar { height: 56px; padding-inline: 16px; gap: 12px; }
  .workspace-app .topbar-context { gap: 10px; }
  .workspace-mobile-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; font-size: 15px; font-weight: 600; }
  .workspace-app .content { padding: 20px 16px 32px; }
  .workspace-app h1 { font-size: 22px; }
  .workspace-app .title { align-items: flex-start; gap: 16px; margin-bottom: 20px; }
  .workspace-start { grid-template-columns: 1fr; gap: 10px; }
  .workspace-app .stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .workspace-app .stat:nth-child(2) { border-right: 0; }
  .workspace-app .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .workspace-dashboard { grid-template-columns: 1fr; gap: 16px; }
  .workspace-app .drop { min-height: 240px; }
  .type-toolbar { border-bottom: 0; }
  .type-toolbar .tabs { width: 100%; border-bottom: 1px solid var(--line); }
  .type-search { width: 100%; margin: 0; order: -1; }
}
@media (max-width: 550px) {
  .workspace-app .topright { gap: 4px; }
  .workspace-app .topbar-divider { display: none; }
  .workspace-mobile-title { max-width: 130px; }
  .workspace-app .title { flex-direction: column; }
  .workspace-app .card { padding: 16px; }
  .workspace-app .card:has(> .tablewrap) { padding: 0; }
  .workspace-app .card:has(> .tablewrap) > .cardhead, .workspace-app .card:has(> .tablewrap) > .toolbar { padding: 14px 16px; }
  .workspace-app .typecard { padding: 16px; }
  .workspace-dialog { padding: 20px; }
  .workspace-task { padding: 14px 16px; }
}
@media (max-height: 760px) and (min-width: 961px) {
  .workspace-app .sidebar-brand { height: 56px; }
  .workspace-app .navlabel { padding-top: 12px; }
}

/* Danh sách tài liệu gần đây (Tổng quan): hai dòng, tên trọn vẹn, trạng thái căn phải. */
.doc-list { list-style: none; margin: 0 -20px -20px; padding: 0; border-top: 1px solid var(--line); }
.doc-list li + li { border-top: 1px solid var(--line); }
.doc-list a { display: flex; align-items: center; gap: 12px; padding: 11px 20px; color: var(--ink); transition: background-color .15s ease; }
.doc-list a:hover { background: var(--subtle); }
.doc-list a > .icon { width: 16px; height: 16px; color: var(--faint); flex-shrink: 0; }
.doc-list-name { flex: 1; min-width: 0; }
.doc-list-name b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
.doc-list-name small { display: block; margin-top: 1px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-list .pill { flex-shrink: 0; }
.workspace-recent .cardhead { margin-bottom: 14px; }

/* Phân bố trạng thái trong thẻ Hoạt động: một thanh tỉ lệ và bảng số. */
.status-split { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.status-split h3 { font-size: 13px; font-weight: 500; color: var(--muted); }
.status-bar { display: flex; gap: 2px; height: 8px; margin: 10px 0 12px; border-radius: 4px; overflow: hidden; }
.status-bar .seg { min-width: 4px; }
.status-split dl { display: grid; gap: 6px; }
.status-split dl > div { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.status-split dt { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.status-split dd { margin: 0; font-weight: 500; }
.dot, .status-bar .seg { background: var(--faint); }
.dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.dot.green, .seg.green { background: #4a9a76; } .dot.amber, .seg.amber { background: #c69a4f; } .dot.blue, .seg.blue { background: var(--blue); } .dot.red, .seg.red { background: #bf5f6c; } .dot.grey, .seg.grey { background: var(--line-strong); }

/* Bảng tài liệu: loại tài liệu không xuống dòng; mũi tên thay cho chữ "Chi tiết". */
.workspace-app .cell-type { white-space: nowrap; color: var(--muted); }
.workspace-app td.cell-go { width: 40px; padding-left: 0; text-align: right; }
.row-go { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; color: var(--faint); }
.row-go .icon { width: 16px; height: 16px; }
.workspace-app tbody tr:hover .row-go { color: var(--ink); background: var(--hover); }
.workspace-app .doc-table tbody tr[data-href] { cursor: pointer; }
.workspace-app .doc-table tbody tr:hover .document-cell > a { color: var(--link); }
.workspace-app .document-cell > a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }

/* Trang tài liệu: bản gốc dính theo khi cuộn kết quả dài. */
.workspace-app .document-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 20px; align-items: start; }
.workspace-app .document-layout > .card { margin: 0; padding: 20px; }
.workspace-app .document-source { position: sticky; top: 76px; }
.workspace-app .document-source .preview { height: calc(100dvh - 210px); min-height: 420px; margin: 0; }
.workspace-app .document-layout .cardhead { align-items: flex-start; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.workspace-app .document-result .cardhead .flex { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.workspace-app .activejob { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 40px 24px; border-style: solid; }
.workspace-app .activejob .ocr-spinner { margin-bottom: 8px; }
.workspace-app .document-result .activejob { border: 0; border-radius: 0; background: none; padding: 48px 24px 40px; }
.error-code { display: inline-block; margin-top: 4px; color: var(--faint); font-size: 12px; font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; }
.ocr-message .error-code { margin-top: 0; }

/* Kết quả bóc tách: nhãn bên trái, giá trị đủ rộng bên phải, cờ kiểm tra ở cuối dòng. */
.field-list { margin: 0; }
.field-row { display: grid; grid-template-columns: minmax(120px,32%) minmax(0,1fr) auto; gap: 4px 16px; align-items: start; padding: 11px 0; border-bottom: 1px solid var(--line); }
.field-row:last-child { border-bottom: 0; }
.field-row dt { padding-top: 1px; color: var(--muted); font-size: 13px; }
.field-row dd { margin: 0; min-width: 0; }
.field-value { font-size: 14px; font-weight: 500; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.field-items { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.field-items li { position: relative; padding-left: 12px; }
.field-items li::before { content: ''; position: absolute; left: 0; top: .7em; width: 4px; height: 1px; background: var(--faint); }
.field-json { margin: 0; font: 12px/1.6 ui-monospace, 'SFMono-Regular', Consolas, monospace; white-space: pre-wrap; }
.field-missing { color: var(--faint); font-weight: 400; }
.field-row.not-applicable dt { color: var(--faint); }
.detected-note { margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-flag { padding-top: 1px; }

@media (hover: hover) and (pointer: fine) {
  .workspace-app .typecard:hover { border-color: var(--line-strong); }
}
@media (max-width: 1100px) {
  .workspace-app .document-layout { grid-template-columns: 1fr; }
  .workspace-app .document-source { position: static; }
  .workspace-app .document-source .preview { height: 60vh; }
  .workspace-app .document-result { order: -1; }
}
@media (max-width: 640px) {
  .field-row { grid-template-columns: minmax(0,1fr) auto; }
  .field-row dt { grid-column: 1; }
  .field-row .field-flag { grid-column: 2; grid-row: 1; }
  .field-row dd { grid-column: 1 / -1; }
  .doc-list { margin: 0 -16px -16px; }
  .doc-list a { padding-inline: 16px; }
  .doc-list .pill { display: none; }
  .workspace-app .document-layout > .card { padding: 16px; }
}

/* Bảng tài liệu trên điện thoại: tên + trạng thái ở dòng 1, loại · trang · thời gian ở dòng 2. */
@media (max-width: 640px) {
  .workspace-app table.doc-table tr { display: flex; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
  .workspace-app table.doc-table td { display: block; padding: 0; text-align: left; border: 0; }
  .workspace-app table.doc-table td::before { display: none; }
  .workspace-app table.doc-table td:first-child { flex: 1 1 0; min-width: 0; padding: 0; }
  .workspace-app table.doc-table td:nth-child(6) { flex: none; margin-left: 12px; text-align: right; }
  /* Ngắt dòng: tên + trạng thái ở dòng 1, thông tin phụ (order 2) bắt đầu dòng 2. */
  .workspace-app table.doc-table tr::before { content: ''; order: 1; flex-basis: 100%; }
  .workspace-app table.doc-table td.cell-type, .workspace-app table.doc-table td.num, .workspace-app table.doc-table td.cell-date { order: 2; margin-top: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; }
  .workspace-app table.doc-table td:first-child + td { padding-left: 38px; }
  .workspace-app table.doc-table td.cell-owner::before, .workspace-app table.doc-table td.num::before { display: inline; content: '\00a0·\00a0'; }
  .workspace-app table.doc-table td.cell-date { flex-basis: 100%; margin-top: 0; padding-left: 38px; }
  .workspace-app table.doc-table td.num::after { content: ' trang'; }
  .workspace-app table.doc-table td.cell-go { display: none; }
  .workspace-app .filtergroup .search, .workspace-app .toolbar .search { width: 100%; flex: 1 1 100%; }
  .workspace-app table.doc-table .document-cell { min-width: 0; }
  .workspace-app table.doc-table .document-cell > a { display: block; min-width: 0; max-width: none; overflow-wrap: normal; }
}

/* Icon tiêu đề trang (chỉ còn ở trang dùng thử) */
.workspace-app .title-copy { display: flex; align-items: center; gap: 14px; }
.title-icon { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 10px; color: var(--page-hue, var(--hue-blue)); background: color-mix(in srgb, var(--page-hue, var(--hue-blue)) var(--tint), var(--surface)); }
.title-icon .icon { width: 22px; height: 22px; stroke-width: 1.7; }

/* KPI: ô icon mang màu ý nghĩa của chỉ số. */
.stat.hue-blue { --hue: var(--hue-blue); } .stat.hue-green { --hue: var(--hue-green); } .stat.hue-amber { --hue: var(--hue-amber); } .stat.hue-teal { --hue: var(--hue-teal); }
.workspace-app .stat { display: grid; grid-template-columns: 40px minmax(0,1fr); column-gap: 14px; align-items: start; padding: 18px 20px; }
.workspace-app .stat > * { grid-column: 2; }
.stat-icon { grid-column: 1 !important; grid-row: 1 / span 3; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: var(--hue); background: color-mix(in srgb, var(--hue) var(--tint), var(--surface)); }
.stat-icon .icon { width: 20px; height: 20px; }
.workspace-app .stat b { margin: 2px 0 0; }

/* Biểu đồ: mọi cột mang sắc xanh nhạt, hôm nay đậm. */
.workspace-app .chart rect.bar { fill: color-mix(in srgb, var(--hue-blue) 30%, var(--surface)); }
.workspace-app .chart rect.bar.today { fill: var(--hue-blue); }

/* Mẫu tài liệu: thẻ theo nhóm nghiệp vụ; icon nhóm trên nền xám trung tính, lưới tự lên 4 cột khi màn đủ rộng. */
.workspace-app .grid3 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.type-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.type-section + .type-section { margin-top: 28px; }
.type-section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.workspace-app .type-section-head h2 { font-size: 15px; }
.typecard-top { display: flex; align-items: flex-start; gap: 12px; }
.workspace-app .typecard .typeicon { display: grid; place-items: center; width: 36px; height: 36px; margin: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--subtle); }
.workspace-app .typecard .typeicon .icon { width: 18px; height: 18px; }
.workspace-app .typecard:hover .typeicon { color: var(--ink); }
/* Trong khu đã có tiêu đề nhóm thì nhãn nhóm trên thẻ là lặp lại. */
.type-section .type-group { display: none; }
@media (max-width: 550px) { .type-cards { gap: 12px; } }
/* Ảnh mẫu: dải ảnh tràn mép trên thẻ (phần đầu tài liệu), bấm để mở hộp xem ảnh lớn. */
.workspace-app .typecard:has(.type-sample) { overflow: hidden; }
.type-sample { position: relative; display: block; margin: -18px -20px 14px; padding: 0; border: 0; border-bottom: 1px solid var(--line); background: var(--subtle); cursor: zoom-in; aspect-ratio: 16 / 10; overflow: hidden; }
.type-sample img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .25s ease; }
.type-sample:hover img { transform: scale(1.03); }
.type-sample:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.type-sample-tag { position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgb(15 23 42 / .72); color: #fff; font-size: 12px; font-weight: 500; opacity: 0; transform: translateY(4px); transition: opacity .15s ease, transform .15s ease; }
.type-sample-tag .icon { width: 14px; height: 14px; }
.type-sample:is(:hover,:focus-visible) .type-sample-tag { opacity: 1; transform: none; }
@media (hover: none) { .type-sample-tag { opacity: 1; transform: none; } }
@media (max-width: 550px) { .type-sample { margin: -16px -16px 12px; } }
@media (prefers-reduced-motion: reduce) { .type-sample img, .type-sample-tag { transition: none; } .type-sample:hover img { transform: none; } }
/* Giấy tờ hai mặt: hai nửa ảnh mặt trước/mặt sau cạnh nhau. Nhãn số mặt cần tải ở góc trên trái. */
.type-sample.is-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; background: color-mix(in srgb, var(--hue, var(--blue)) 6%, var(--subtle)); }
.type-sample-side { position: relative; display: grid; place-items: center; min-width: 0; }
.type-sample.is-pair .type-sample-side img { width: 100%; height: auto; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: var(--elev-1); }
.type-sample-side small { position: absolute; left: 4px; bottom: 4px; max-width: calc(100% - 8px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 1px 6px; border-radius: 4px; background: rgb(255 255 255 / .9); color: var(--ink); font-size: 11px; font-weight: 500; }
.type-format { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 600; line-height: 1.5; box-shadow: 0 0 0 1px var(--line); white-space: nowrap; }
.type-sample > .type-format { position: absolute; left: 10px; top: 10px; }
.is-pair > .type-format, .sample-format.is-pair .type-format { color: var(--hue-violet, #6d28d9); }
#modal.sample-dialog { width: min(980px, calc(100vw - 32px)); }
.sample-format { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.sample-format .type-format { flex: none; }
.sample-variants { margin-bottom: 14px; }
.sample-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sample-sides .sample-figure { margin: 0; }
.sample-side-head { margin-bottom: 6px; }
.sample-side-head b { display: block; font-size: 14px; }
.sample-side-head small { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; }
.sample-caption { margin: 8px 0 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.sample-caption a { color: inherit; text-decoration: underline; }
@media (max-width: 640px) { .sample-sides { grid-template-columns: 1fr; } }
/* Ô tải mặt trước/sau: ảnh mẫu mờ của đúng mặt đó làm hướng dẫn. */
.pair-guide { position: relative; display: block; width: min(200px, 80%); padding: 0; border: 0; background: none; cursor: zoom-in; }
.pair-guide img { display: block; width: 100%; height: auto; border-radius: 6px; opacity: .55; filter: saturate(.6); transition: opacity .15s ease; }
.pair-guide:is(:hover,:focus-visible) img { opacity: .9; }
.pair-guide small { position: absolute; right: 6px; top: 6px; padding: 1px 6px; border-radius: 4px; background: rgb(15 23 42 / .7); color: #fff; font-size: 11px; }
.sample-figure { margin: 0 0 16px; }
.sample-figure > a { display: grid; place-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--subtle); cursor: zoom-in; }
.sample-figure img { display: block; max-width: 100%; max-height: 68vh; width: auto; height: auto; border-radius: 4px; box-shadow: var(--elev-1); }
.sample-fields { display: grid; gap: 4px; padding: 12px 14px; border-radius: 8px; background: var(--subtle); font-size: 13px; line-height: 1.6; }
.sample-fields span { color: var(--muted); }
.sample-pick { display: flex; justify-content: flex-end; margin-top: 16px; }

/* Màu theo loại xử lý (nhất quán mọi trang): OCR toàn văn xanh lơ, bóc tách tím, hỏi đáp xanh ngọc. */
.f-ocr { --hue: var(--hue-cyan); } .f-extract { --hue: var(--hue-violet); } .f-knowledge { --hue: var(--hue-teal); }
.workspace-app .file-glyph:is(.f-ocr,.f-extract,.f-knowledge) { border-color: transparent; color: var(--hue); background: color-mix(in srgb, var(--hue) var(--tint), var(--surface)); }
/* Mẫu tài liệu: icon nhóm mang sắc của nhóm nghiệp vụ. */
.tone-admin { --hue: var(--hue-blue); } .tone-identity { --hue: var(--hue-violet); } .tone-legal { --hue: var(--hue-amber); } .tone-education { --hue: var(--hue-teal); } .tone-health { --hue: var(--hue-rose); } .tone-other { --hue: var(--hue-slate); }
.workspace-app .typecard[class*='tone-'] .typeicon { border-color: transparent; color: var(--hue); background: color-mix(in srgb, var(--hue) var(--tint), var(--surface)); }
.workspace-app .typecard[class*='tone-']:hover { border-color: color-mix(in srgb, var(--hue) 35%, var(--line)); }
.workspace-app .typecard[class*='tone-']:hover .typeicon { color: var(--hue); }
.workspace-app .tabs .btn.active { border-bottom-color: var(--blue); }
.kb .kb-tabs button.active { border-color: var(--blue); }
.kb .kb-bot.selected { background: color-mix(in srgb, var(--hue-blue) 10%, var(--surface)); }

/* Avatar chatbot: mỗi chatbot một sắc cố định theo tên. */
.kb-avatar.hue-0 { --hue: var(--hue-blue); } .kb-avatar.hue-1 { --hue: var(--hue-teal); } .kb-avatar.hue-2 { --hue: var(--hue-violet); } .kb-avatar.hue-3 { --hue: var(--hue-amber); } .kb-avatar.hue-4 { --hue: var(--hue-rose); } .kb-avatar.hue-5 { --hue: var(--hue-indigo); }
.kb .kb-bot .kb-avatar[class*='hue-'] { color: var(--hue); background: color-mix(in srgb, var(--hue) var(--tint), var(--surface)); box-shadow: none; }

.workspace-app .tab-count { color: var(--faint); }
.kb .kb-btn-remove:hover:not(:disabled) { color: var(--red); background: var(--red-bg); }
.workspace-app .document-result .cardhead > div:first-child { flex: 1; min-width: 0; }
.workspace-app .document-result .cardhead { flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.workspace-app .document-result .cardhead .ocr-stats { order: 3; flex-basis: 100%; margin: 0; padding: 0; border: 0; gap: 4px 12px; }
.workspace-app .document-result .cardhead .flex { flex-wrap: nowrap; }
.workspace-app .document-result .section-description .pill { margin-left: 4px; vertical-align: 1px; }

/* Kéo mép phải thanh điều hướng để đổi độ rộng (chỉ màn hình máy tính). */
.sidebar-resizer { display: none; }
@media (min-width: 961px) {
  .workspace-app .sidebar { overflow: visible; }
  .workspace-app .sidebar-nav, .workspace-app .sidebottom, .workspace-app .sidebar-brand { overflow: hidden; }
  .sidebar-resizer { display: block; position: absolute; top: 0; right: -4px; bottom: 0; z-index: 2; width: 8px; cursor: col-resize; touch-action: none; }
  .sidebar-resizer::after { content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background-color .15s ease; }
  .sidebar-resizer:hover::after, .sidebar-resizer:focus-visible::after, .sidebar-resizing .sidebar-resizer::after { background: var(--hue-blue); }
  .sidebar-resizer:focus-visible { outline: none; }
  .workspace-app.sidebar-collapsed .sidebar-resizer { display: none; }
  .workspace-app.sidebar-resizing, .workspace-app.sidebar-resizing * { cursor: col-resize !important; user-select: none; }
  .workspace-app.sidebar-resizing .sidebar, .workspace-app.sidebar-resizing .main, .workspace-app.sidebar-resizing .sidebar-toggle { transition: none !important; }
  .workspace-app .nav > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .workspace-app .workspace-context { min-width: 0; }
}

.app-version { margin-top: 24px; color: var(--faint); font-size: 12px; text-align: right; }
/* Danh sách phiên: phiên hiện tại lên đầu, khung cuộn khoảng 6 dòng. */
.workspace-app .session-list { max-height: 400px; margin: 0 -20px -20px; padding: 0 20px; overflow-y: auto; border-top: 1px solid var(--line); scrollbar-width: thin; }

/* ===== Tổng quan =====
   Hàng 1: băng màu (tiêu đề + hành động | 4 KPI). Hàng 2: tài liệu gần đây | hoạt động 7 ngày.
   Hàng 3: ba thẻ trả lời "còn việc gì", "xử lý kiểu gì", "hỏi đáp thế nào". */
.overview-hero { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 24px 40px; }
.overview-hero-actions { flex-wrap: nowrap; }
.overview-hero-actions { margin-top: 18px; }
.ov-kpis { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); margin: 0 0 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--elev-1); }
.ov-kpis > div { min-width: 0; padding: 16px 20px; }
.ov-kpis > div + div { border-left: 1px solid var(--line); }
.ov-kpis dt { color: var(--muted); font-size: 13px; }
.ov-kpis dd { margin: 4px 0 2px; font-size: 28px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; }
.ov-kpis dd.good { color: var(--green); } .ov-kpis dd.warn { color: var(--amber); }
.ov-kpis small { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; }
.ov-main { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(0,1fr); gap: 20px; align-items: stretch; margin-bottom: 20px; }
.ov-main .card, .ov-row .card { margin: 0; }
.ov-main .workspace-activity .cardhead { margin-bottom: 4px; }
.ov-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.ov-side .ov-todo { flex: 1; }
.ov-row { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(0,1fr); gap: 20px; }
.ov-row .cardhead { margin-bottom: 12px; }
.ov-row .cardhead small { color: var(--muted); font-size: 13px; }
.ov-empty { color: var(--muted); font-size: 14px; line-height: 1.6; }
.ov-knowledge .ov-empty + .btn { margin-top: 14px; }
/* Cần xử lý: mỗi dòng mở Lịch sử đã lọc theo trạng thái */
.ov-list { list-style: none; margin: 0 -10px; padding: 0; }
.ov-list a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--ink); transition: background-color .15s ease; }
.ov-list a:hover { background: var(--subtle); }
.ov-list span { flex: 1; min-width: 0; }
.ov-list b { display: block; font-size: 14px; font-weight: 500; }
.ov-list small { display: block; color: var(--muted); font-size: 12px; }
.ov-list em { font-style: normal; font-size: 18px; font-weight: 600; }
.ov-list a > .icon { width: 15px; height: 15px; color: var(--faint); }
/* Theo loại xử lý: thanh tỉ lệ một màu theo kiểu xử lý */
.ov-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ov-bars li > div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.ov-bars li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-bars b { flex-shrink: 0; font-weight: 600; }
.ov-bars b small { color: var(--muted); font-size: 12px; font-weight: 400; }
.ov-bars i { display: block; height: 6px; margin-top: 6px; border-radius: 3px; background: var(--subtle); overflow: hidden; }
.ov-bars s { display: block; height: 100%; border-radius: 3px; background: var(--hue, var(--blue)); text-decoration: none; }
/* Hỏi đáp */
.ov-kb-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; }
.ov-kb-stats > div { padding: 10px 12px; } .ov-kb-stats > div + div { border-left: 1px solid var(--line); }
.ov-kb-stats b { display: block; font-size: 20px; font-weight: 600; }
.ov-kb-stats small { color: var(--muted); font-size: 12px; }
.ov-bots { list-style: none; margin: 0; padding: 0; }
.ov-bots li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.ov-bots li + li { border-top: 1px solid var(--line); }
.ov-bots .kb-avatar { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px; color: var(--hue); background: color-mix(in srgb, var(--hue) var(--tint), var(--surface)); font-size: 12px; font-weight: 600; }
.ov-bots b { display: block; font-size: 14px; font-weight: 500; }
.ov-bots small { color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  .ov-main, .ov-row { grid-template-columns: 1fr; }
  .ov-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ov-kpis > div:nth-child(3) { border-left: 0; }
  .ov-kpis > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 550px) { .ov-kpis > div { padding: 14px 16px; } .ov-kpis dd { font-size: 24px; } }

/* Lịch sử tài liệu: ô tìm có biểu tượng, hai bộ lọc, số kết quả bên phải; cột loại xử lý có tên chatbot ở dòng phụ. */
.workspace-app .history-toolbar { flex-wrap: wrap; justify-content: flex-start; gap: 8px; border-bottom: 1px solid var(--line); }
.history-search { position: relative; flex: 1 1 240px; max-width: 340px; }
.history-search .icon { position: absolute; top: 50%; left: 12px; width: 16px; height: 16px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.workspace-app .history-search .input { width: 100%; padding-left: 36px; }
.workspace-app .history-toolbar select.input { width: auto; min-width: 176px; }
.history-toolbar [hidden] { display: none; }
/* Thẻ Lịch sử luôn tràn viền như thẻ bảng (bảng nằm trong #history-results nên không khớp rule :has(> .tablewrap)). */
.workspace-app .history-card { padding: 0; overflow: hidden; }
.workspace-app .history-card > .toolbar { margin: 0; padding: 16px 20px; }
.workspace-app #history-results > .pagination, .workspace-app #user-results > .pagination { margin: 0; padding: 14px 20px; }
.history-count { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.workspace-app .history-card .empty { padding: 48px 24px; }
.workspace-app .doc-table .cell-type small { display: block; max-width: 220px; margin-top: 1px; overflow: hidden; color: var(--faint); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
/* Hạn dùng: dòng phụ chỉ tô màu khi sắp hoặc đã hết hạn. */
.workspace-app .expiry-note { margin-top: 1px; font-size: 12px; }
.workspace-app .expiry-note.amber { color: var(--amber); }
.workspace-app .expiry-note.red { color: var(--red); }
/* Thao tác không hoàn tác: tách cuối hộp thoại, chữ hậu quả bên trái, nút bên phải. */
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.danger-zone p { margin: 2px 0 0; }
/* Bảng tài khoản: cột thao tác co sát nút và canh phải (thẳng lề với ô đếm trên thanh lọc); các cột ngắn không xuống dòng,
   phần rộng còn lại dồn cho tài khoản và workspace ở mọi bề rộng. */
.workspace-app .user-table .row-actions { flex-wrap: nowrap; justify-content: flex-end; gap: 8px; }
@media (min-width: 641px) {
  .workspace-app table.user-table th:last-child, .workspace-app table.user-table td:last-child { width: 1%; }
}
@media (min-width: 1100px) {
  .workspace-app table.user-table td:nth-child(n+3) { white-space: nowrap; }
}
/* Bảng workspace: thao tác co sát nút; tablet gộp cột gói thành dòng phụ dưới tên để hai nút thao tác không bị đẩy ra ngoài khung. */
.workspace-app .ws-table .plan-inline { display: none; }
@media (min-width: 641px) {
  .workspace-app table.ws-table th:last-child, .workspace-app table.ws-table td:last-child { width: 1%; white-space: nowrap; }
}
@media (min-width: 641px) and (max-width: 1099px) {
  .workspace-app table.ws-table th:nth-child(2), .workspace-app table.ws-table td:nth-child(2) { display: none; }
  .workspace-app .ws-table .plan-inline { display: block; }
  .workspace-app table.ws-table th, .workspace-app table.ws-table td { padding-inline: 12px; }
  .workspace-app table.ws-table th:first-child, .workspace-app table.ws-table td:first-child { min-width: 0; padding-left: 20px; }
  .workspace-app table.ws-table th:last-child, .workspace-app table.ws-table td:last-child { padding-right: 20px; }
}
/* Vai trò: cột riêng trên màn rộng; tablet gộp thành dòng phụ dưới tài khoản để bảng không tràn ngang. */
.workspace-app .user-table .role-inline { display: none; }
@media (min-width: 641px) and (max-width: 1099px) {
  .workspace-app table.user-table th:nth-child(4), .workspace-app table.user-table td:nth-child(4) { display: none; }
  .workspace-app .user-table .role-inline { display: block; }
  .workspace-app table.user-table th, .workspace-app table.user-table td { padding-inline: 12px; }
  .workspace-app table.user-table th:first-child, .workspace-app table.user-table td:first-child { min-width: 0; padding-left: 20px; }
  .workspace-app table.user-table th:last-child, .workspace-app table.user-table td:last-child { padding-right: 20px; }
}
/* Bảng không tràn ngang: cột tên co giãn và cắt bằng "…", các cột còn lại cố định. */
@media (min-width: 641px) {
  .workspace-app table.doc-table { table-layout: fixed; width: 100%; }
  .workspace-app table.doc-table th:nth-child(2) { width: 17%; }
  .workspace-app table.doc-table th:nth-child(3) { width: 13%; }
  .workspace-app table.doc-table th:nth-child(4) { width: 72px; }
  .workspace-app table.doc-table th:nth-child(5) { width: 136px; }
  .workspace-app table.doc-table th:nth-child(6) { width: 144px; }
  .workspace-app table.doc-table th:nth-child(7) { width: 48px; }
  .workspace-app table.doc-table .document-cell { min-width: 0; }
  .workspace-app table.doc-table .document-cell > a { display: block; min-width: 0; max-width: none; }
  .workspace-app table.doc-table .cell-type { overflow: hidden; text-overflow: ellipsis; }
  .workspace-app .doc-table .cell-type small { max-width: none; }
}
@media (max-width: 640px) {
  .history-search { flex-basis: 100%; max-width: none; }
  .workspace-app .history-toolbar select.input { padding-inline: 10px 30px; background-position: right 8px center; font-size: 14px; }
  .workspace-app .history-toolbar select.input { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .workspace-app .history-card > .toolbar { padding: 14px 16px; }
  .workspace-app #history-results > .pagination, .workspace-app #user-results > .pagination { padding: 14px 16px; }
  .history-count { flex: 1; order: 4; margin-left: 0; }
  .history-toolbar [data-act="clear-history"], .history-toolbar [data-act="clear-users"] { order: 5; min-height: 32px; padding-block: 4px; }
  .workspace-app .doc-table .cell-type small { display: none; }
}

/* Danh mục mẫu: công tắc bật/tắt ngay trên dòng; mẫu đang tắt giữ tên ở màu chữ chính, chữ phụ mờ hơn. */
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; }
.switch-track { position: relative; flex: none; width: 30px; height: 18px; border-radius: 9px; background: var(--line-strong); transition: background-color .16s ease; }
.switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); transition: transform .16s cubic-bezier(.2,.8,.2,1); }
.switch[aria-checked="true"] { color: var(--ink); }
.switch[aria-checked="true"] .switch-track { background: var(--green); }
.switch[aria-checked="true"] .switch-track::after { transform: translateX(12px); }
.switch:hover .switch-track { box-shadow: 0 0 0 3px var(--subtle); }
.switch:active .switch-track::after { width: 16px; }
.switch:disabled { cursor: progress; opacity: .7; }
.workspace-app .catalog-table tr.is-off td:not(:first-child), .workspace-app .catalog-table tr.is-off .plan-code { color: var(--faint); }
.workspace-app .catalog-table td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (min-width: 641px) {
  .workspace-app table.catalog-table th:last-child, .workspace-app table.catalog-table td:last-child { width: 1%; white-space: nowrap; }
}
@media (max-width: 1099px) {
  .workspace-app table.catalog-table th:nth-child(2), .workspace-app table.catalog-table td:nth-child(2) { display: none; }
}
@media (max-width: 640px) {
  .workspace-app table.catalog-table th:nth-child(4), .workspace-app table.catalog-table td:nth-child(4) { display: none; }
}
/* Bảng trường trong hộp thoại cấu hình mẫu. */
.type-fields { max-height: 420px; overflow: auto; margin: 8px 0 12px; }
.type-fields td { vertical-align: top; padding-block: 8px; }
.type-fields td .input { min-height: 36px; }
.type-fields td .plan-code { margin-top: 4px; }
.type-fields table { table-layout: fixed; }
.type-fields th:nth-child(1) { width: 72px; }
.type-fields th:nth-child(3) { width: 84px; }
.type-fields th:nth-child(4) { width: 56px; }
.type-fields td.type-field-order { min-width: 0; padding-inline: 8px 4px; white-space: nowrap; }
.type-fields td .input { width: 100%; }
.type-fields td .plan-code { overflow-wrap: anywhere; }
.type-fields th, .type-fields td { padding-inline: 10px; }
.type-field-order .btn.icononly { width: 28px; min-height: 28px; padding: 5px; border-color: transparent; background: transparent; box-shadow: none; }
.type-field-order .field-up .icon { transform: rotate(-90deg); }
.type-field-order .field-down .icon { transform: rotate(90deg); }
.type-fields tbody tr:first-child .field-up, .type-fields tbody tr:last-child .field-down { visibility: hidden; }
.type-field-default { text-align: center; }
.type-field-default input { width: 16px; height: 16px; margin-top: 10px; accent-color: var(--blue); }
.type-fields th:nth-child(3) { white-space: nowrap; text-align: center; }
.type-field-add { display: flex; align-items: flex-end; gap: 8px; }
.type-field-add[hidden] { display: none; }
.type-field-add .field { flex: 1; margin: 0; }
@media (max-width: 640px) {
  .type-fields th:nth-child(1) { width: 60px; }
  .type-fields th:nth-child(3) { width: 64px; }
  .type-fields th:nth-child(4) { width: 48px; }
  .type-fields th, .type-fields td { padding-inline: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .switch-track, .switch-track::after { transition: none; }
}

/* Nhật ký quản trị: giờ hẹp, nhóm theo ngày; thao tác + dòng phụ chi tiết là cột rộng nhất. */
.audit-date { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: 13px; }
.workspace-app #audit-results > .pagination { margin: 0; padding: 14px 20px; }
.workspace-app .audit-date .input { width: auto; min-width: 0; font-variant-numeric: tabular-nums; }
.workspace-app table.audit-table td.cell-date { width: 72px; min-width: 0; padding-right: 0; color: var(--muted); }
.workspace-app table.audit-table td.cell-action { width: 46%; }
.workspace-app table.audit-table td .muted { font-size: 13px; }
.workspace-app table.audit-table .audit-note { margin-top: 3px; line-height: 1.45; }
.workspace-app table.audit-table td.cell-action .pill { font-size: 13px; line-height: 20px; padding-inline: 8px; }
.workspace-app table.audit-table tr.audit-day th { padding: 20px 20px 8px; color: var(--ink); font-size: 13px; font-weight: 600; white-space: normal; }
.workspace-app table.audit-table tbody tr.audit-day:first-child th { padding-top: 14px; }
.workspace-app table.audit-table tr.audit-day:hover { background: none; }
.workspace-app table.audit-table tr:has(+ tr.audit-day) td { border-bottom: 0; }
@media (max-width: 760px) {
  .workspace-app .audit-toolbar .audit-date { flex: 1 1 calc(50% - 4px); }
  .workspace-app .audit-date .input { flex: 1; width: 100%; min-width: 0; }
  .workspace-app .audit-toolbar select.input { flex: 1 1 100%; }
  .workspace-app #audit-results > .pagination { padding: 14px 16px; }
}
/* Điện thoại: dòng 1 là thao tác + giờ, dòng 2 là người thực hiện · đối tượng; chi tiết nằm dưới thao tác. */
@media (max-width: 640px) {
  .workspace-app table.audit-table tr { display: flex; flex-wrap: wrap; align-items: baseline; padding: 12px 16px; }
  .workspace-app table.audit-table tr.audit-day { display: block; padding: 16px 16px 6px; border-bottom: 1px solid var(--line); }
  .workspace-app table.audit-table tr.audit-day th { display: block; padding: 0; border: 0; }
  .workspace-app table.audit-table td { display: block; padding: 0; border: 0; text-align: left; }
  .workspace-app table.audit-table td::before { display: none; }
  .workspace-app table.audit-table td.cell-action { order: 1; flex: 1 1 0; width: auto; min-width: 0; padding: 0; }
  .workspace-app table.audit-table td.cell-date { order: 2; width: auto; margin-left: 12px; padding: 0; font-variant-numeric: tabular-nums; }
  .workspace-app table.audit-table tr:not(.audit-day)::before { content: ''; order: 3; flex-basis: 100%; }
  .workspace-app table.audit-table td.cell-actor, .workspace-app table.audit-table td.cell-target { order: 4; margin-top: 4px; color: var(--muted); font-size: 13px; }
  .workspace-app table.audit-table td.cell-actor { flex: none; }
  .workspace-app table.audit-table td.cell-target { flex: 1 1 0; min-width: 0; }
  .workspace-app table.audit-table td.cell-target::before { display: inline; content: '\00a0→\00a0'; font-size: 13px; color: var(--faint); }
  .workspace-app table.audit-table td.cell-target > div { display: inline; }
  .workspace-app table.audit-table td.cell-target > .muted { display: none; }
  .workspace-app table.audit-table td.cell-target.is-empty { display: none; }
}

/* Giấy tờ hai mặt: hai ô tải riêng cho mặt trước và mặt sau. */
.pair-zone > small { display: block; margin-top: 10px; color: var(--muted); font-size: 13px; text-align: center; }
.pair-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair-slot { display: flex; flex-direction: column; min-height: 220px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--subtle); }
.pair-slot.dragover { border-color: var(--link); background: var(--blue-soft); }
.pair-slot.has-file { border-style: solid; background: var(--surface); }
.pair-slot-head { padding: 12px 14px 0; }
.pair-slot-head b { display: block; font-size: 15px; font-weight: 600; }
.pair-slot-head small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.pair-slot-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px; text-align: center; }
.pair-slot-body .upload { color: var(--muted); }
.pair-slot-body .upload .icon { width: 24px; height: 24px; stroke-width: 1.5; }
.pair-slot-body p { color: var(--muted); font-size: 14px; }
.pair-slot.has-file .pair-slot-body { flex-direction: row; justify-content: flex-start; gap: 12px; text-align: left; }
.pair-slot .name { flex: 1; min-width: 0; }
.pair-slot .name b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.pair-slot .name small { color: var(--muted); font-size: 12px; }
.pair-thumb { width: 120px; height: 80px; flex-shrink: 0; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; }
.ocr-start.has-files .pair-zone + .ocr-start-file { margin-top: 12px; justify-content: flex-end; }
@media (max-width: 640px) { .pair-slots { grid-template-columns: 1fr; } .pair-slot { min-height: 160px; } }
