/* =====================================================================
   PassportManager Design System (M7 - UI Web)
   Trích xuất từ design-prototype/styles.css.
   HYBRID: mọi lớp thành phần được scope dưới `.pm-ui` để KHÔNG xung đột
   với Bootstrap ở các trang cũ. Trang mới bọc nội dung trong
   <div class="pm-ui"> ... </div> để dùng hệ thiết kế này.
   Design tokens đặt ở :root (vô hại, chỉ là biến CSS).
   ===================================================================== */

:root {
    --pm-nav-bg: #101728;
    --pm-nav-bg-2: #0b101d;
    --pm-nav-item: #9aa4b8;
    --pm-nav-item-active: #ffffff;
    --pm-nav-active-bg: rgba(59, 130, 246, 0.18);
    --pm-nav-accent: #3b82f6;

    --pm-page-bg: #f3f5f9;
    --pm-card-bg: #ffffff;
    --pm-border: #e5e9f0;
    --pm-text: #1f2937;
    --pm-text-muted: #6b7280;
    --pm-text-soft: #9ca3af;

    --pm-primary: #2563eb;
    --pm-primary-soft: #eff4ff;
    --pm-green: #16a34a;
    --pm-green-soft: #ecfdf3;
    --pm-amber: #d97706;
    --pm-amber-soft: #fef6e7;
    --pm-red: #dc2626;
    --pm-red-soft: #fdecec;
    --pm-purple: #7c3aed;

    --pm-radius: 14px;
    --pm-radius-sm: 10px;
    --pm-shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
    --pm-shadow-pop: 0 20px 45px rgba(16, 24, 40, 0.22);
}

.pm-ui, .pm-ui * { box-sizing: border-box; }

.pm-ui {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    color: var(--pm-text);
    font-size: 14px;
}

/* ---------- Page header ---------- */
.pm-ui .page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.pm-ui .page-head h1 { font-size: 22px; margin: 0 0 4px; font-weight: 700; }
.pm-ui .page-head p { margin: 0; color: var(--pm-text-muted); font-size: 13px; }

/* ---------- Buttons ---------- */
.pm-ui .btn, .pm-modal-overlay .btn {
    display: inline-flex; align-items: center; gap: 7px;
    border: 1px solid transparent; border-radius: var(--pm-radius-sm);
    padding: 9px 15px; font-size: 13px; font-weight: 600;
    cursor: pointer; background: #fff; color: var(--pm-text); text-decoration: none;
}
.pm-ui .btn i, .pm-modal-overlay .btn i { font-size: 15px; }
.pm-ui .btn-primary, .pm-modal-overlay .btn-primary { background: var(--pm-primary); color: #fff; }
.pm-ui .btn-primary:hover, .pm-modal-overlay .btn-primary:hover { background: #1d4ed8; }
.pm-ui .btn-light, .pm-modal-overlay .btn-light { background: #fff; border-color: var(--pm-border); color: var(--pm-text); }
.pm-ui .btn-light:hover, .pm-modal-overlay .btn-light:hover { background: #f8fafc; }
.pm-ui .btn-secondary { background: #fff; border-color: var(--pm-border); color: var(--pm-text); }
.pm-ui .btn-secondary:hover { background: #f8fafc; }
.pm-ui .btn-sm, .pm-modal-overlay .btn-sm { padding: 6px 11px; font-size: 12px; }
.pm-ui .btn-danger-soft, .pm-modal-overlay .btn-danger-soft { background: var(--pm-red-soft); color: var(--pm-red); }
.pm-ui .btn-ghost { background: transparent; color: var(--pm-text-muted); }
.pm-ui .btn-ghost:hover { background: #f1f5f9; }
.pm-ui .btn:disabled, .pm-modal-overlay .btn:disabled { opacity: .55; cursor: default; }

/* ---------- Cards ---------- */
.pm-ui .card { background: var(--pm-card-bg); border: 1px solid var(--pm-border); border-radius: var(--pm-radius); box-shadow: var(--pm-shadow-card); }
.pm-ui .card-pad { padding: 18px; }

/* ---------- Filter bar / fields ---------- */
.pm-ui .filter-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.pm-ui .field label { display: block; font-size: 12px; font-weight: 600; color: var(--pm-text-muted); margin-bottom: 6px; }
.pm-ui .input, .pm-ui .select {
    width: 100%; border: 1px solid var(--pm-border); border-radius: var(--pm-radius-sm);
    padding: 9px 12px; font-size: 13px; color: var(--pm-text); background: #fff;
}
.pm-ui .input:focus, .pm-ui .select:focus { outline: none; border-color: var(--pm-primary); }
.pm-ui .input-icon { position: relative; }
.pm-ui .input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--pm-text-soft); }
.pm-ui .input-icon .input { padding-left: 34px; }

/* ---------- Channel cards ---------- */
.pm-ui .channels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.pm-ui .channel { border-radius: var(--pm-radius); padding: 18px; color: #fff; position: relative; overflow: hidden; }
.pm-ui .channel.online { background: linear-gradient(135deg, #2563eb, #1e40af); }
.pm-ui .channel.embassy { background: linear-gradient(135deg, #16a34a, #15803d); }
.pm-ui .channel .ch-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.pm-ui .channel .ch-icon { width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 20px; }
.pm-ui .channel .ch-title { font-size: 15px; font-weight: 700; }
.pm-ui .channel .ch-sub { font-size: 12px; opacity: .85; }
.pm-ui .ch-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pm-ui .ch-stat b { font-size: 22px; font-weight: 700; display: block; line-height: 1.1; }
.pm-ui .ch-stat span { font-size: 11px; opacity: .9; }

/* ---------- Table ---------- */
.pm-ui .table-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; }
.pm-ui .table-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.pm-ui .table-head .count { color: var(--pm-text-muted); font-size: 12px; }
.pm-ui .list-meta { margin-top: 3px; color: var(--pm-text-muted); font-size: 11px; }
.pm-ui .pagination { border-top: 1px solid var(--pm-border); display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; color: var(--pm-text-muted); font-size: 12px; }
.pm-ui .pagination > div { display: inline-flex; gap: 4px; }
.pm-ui .pagination button:disabled { cursor: default; opacity: .4; }
.pm-ui .pager { border-top: 1px solid var(--pm-border); display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; color: var(--pm-text-muted); font-size: 12px; }
.pm-ui .pager button:disabled { cursor: default; opacity: .4; }
.pm-ui table { width: 100%; border-collapse: collapse; }
.pm-ui .table-wrap { overflow-x: auto; }
.pm-ui .text-sm { font-size: 12px; }
.pm-ui thead th {
    text-align: left; font-size: 11.5px; font-weight: 700; color: var(--pm-text-muted);
    text-transform: uppercase; letter-spacing: .3px; padding: 10px 14px;
    border-bottom: 1px solid var(--pm-border); background: #fafbfd;
}
.pm-ui tbody td { padding: 13px 14px; border-bottom: 1px solid #f1f4f8; font-size: 13px; vertical-align: middle; }
.pm-ui tbody tr:hover { background: #fafbff; }
.pm-ui .applicant-name { font-weight: 600; }
.pm-ui .entity-counts { display: flex; align-items: center; gap: 5px; margin-top: 3px; color: var(--pm-text-muted); font-size: 11px; }
.pm-ui .entity-counts i { width: 3px; height: 3px; border-radius: 50%; background: var(--pm-text-soft); }
.pm-ui .muted, .pm-modal-overlay .muted { color: var(--pm-text-muted); }
.pm-ui .mono { font-family: 'Consolas', monospace; font-size: 12.5px; }

/* ---------- Badges ---------- */
.pm-ui .badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
    border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.4;
}
.pm-ui .badge i { font-size: 11px; }
.pm-ui .b-blue { background: var(--pm-primary-soft); color: var(--pm-primary); }
.pm-ui .b-green { background: var(--pm-green-soft); color: var(--pm-green); }
.pm-ui .b-amber { background: var(--pm-amber-soft); color: var(--pm-amber); }
.pm-ui .b-red { background: var(--pm-red-soft); color: var(--pm-red); }
.pm-ui .b-gray { background: #f1f4f8; color: #64748b; }
.pm-ui .b-purple { background: #f3ecff; color: var(--pm-purple); }
.pm-ui .days-pill { background: var(--pm-amber-soft); color: var(--pm-amber); }
.pm-ui .warn-pill { background: #fff4e5; color: #b45309; border: 1px dashed #f0b968; }

/* ---------- Modal ---------- */
.pm-ui .modal-overlay,
.pm-modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); display: none;
    align-items: flex-start; justify-content: center; padding: 48px 16px; z-index: 1070; overflow-y: auto;
}
.pm-ui .modal-overlay.open, .pm-modal-overlay.open { display: flex; }
.pm-modal-overlay { font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif; color: var(--pm-text); font-size: 14px; }
.pm-modal-overlay .modal, .pm-ui .modal { position: relative; display: block; background: #fff; width: 100%; max-width: 640px; border-radius: 16px; box-shadow: var(--pm-shadow-pop); overflow: hidden; }
.pm-modal-overlay .modal.narrow, .pm-ui .modal.narrow { max-width: 560px; }
.pm-modal-overlay .modal-head, .pm-ui .modal-head { padding: 18px 20px; border-bottom: 1px solid var(--pm-border); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pm-modal-overlay .modal-head h2, .pm-ui .modal-head h2 { margin: 0 0 3px; font-size: 17px; font-weight: 700; }
.pm-modal-overlay .modal-head .sub, .pm-ui .modal-head .sub { font-size: 12.5px; color: var(--pm-text-muted); }
.pm-modal-overlay .modal-close, .pm-ui .modal-close { background: none; border: none; font-size: 18px; color: var(--pm-text-soft); cursor: pointer; line-height: 1; }
.pm-modal-overlay .modal-body, .pm-ui .modal-body { padding: 18px 20px; max-height: 64vh; overflow-y: auto; }
.pm-modal-overlay .modal-foot, .pm-ui .modal-foot { padding: 14px 20px; border-top: 1px solid var(--pm-border); display: flex; justify-content: flex-end; gap: 10px; }

.pm-ui .summary-row { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--pm-text-muted); margin-bottom: 16px; }
.pm-ui .summary-row b { color: var(--pm-text); }
.pm-ui .section-title { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.pm-ui .section-title h4 { margin: 0; font-size: 13.5px; font-weight: 700; }

/* ---------- Document tiles / attempts / info boxes ---------- */
.pm-ui .doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.pm-ui .doc-tile { border: 1px solid var(--pm-border); border-radius: 12px; padding: 12px; display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.pm-ui .doc-tile:hover { border-color: var(--pm-primary); background: var(--pm-primary-soft); }
.pm-ui .doc-ic { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; font-size: 17px; flex-shrink: 0; }
.pm-ui .doc-ic.blue { background: var(--pm-primary-soft); color: var(--pm-primary); }
.pm-ui .doc-ic.green { background: var(--pm-green-soft); color: var(--pm-green); }
.pm-ui .doc-ic.amber { background: var(--pm-amber-soft); color: var(--pm-amber); }
.pm-ui .doc-ic.purple { background: #f3ecff; color: var(--pm-purple); }
.pm-ui .doc-ic.red { background: var(--pm-red-soft); color: var(--pm-red); }
.pm-ui .doc-tile .dt-name { font-weight: 600; font-size: 13px; }
.pm-ui .doc-tile .dt-meta { font-size: 11.5px; color: var(--pm-text-muted); margin-top: 2px; }

.pm-ui .attempt { display: flex; align-items: center; gap: 12px; border: 1px solid var(--pm-border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.pm-ui .attempt .a-when { font-size: 12px; color: var(--pm-text-muted); min-width: 92px; }
.pm-ui .attempt .a-code { font-family: 'Consolas', monospace; font-size: 12px; color: var(--pm-text); }
.pm-ui .attempt .a-actions { margin-left: auto; }

.pm-ui .info-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.pm-ui .info-box { border: 1px solid var(--pm-border); border-radius: 12px; padding: 12px 14px; }
.pm-ui .info-box .lbl { font-size: 11.5px; color: var(--pm-text-muted); margin-bottom: 4px; }
.pm-ui .info-box .val { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 7px; }

.pm-ui .alert-red, .pm-modal-overlay .alert-red { background: var(--pm-red-soft); border: 1px solid #f6cccc; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: 12.5px; color: #991b1b; }
.pm-ui .alert-green { background: var(--pm-green-soft, #ecfdf5); border: 1px solid #bbf7d0; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: 12.5px; color: #166534; }
.pm-ui .alert-red b { color: #7f1d1d; }

/* ---------- Override rows / library grid ---------- */
.pm-ui .ovr-row { display: flex; align-items: center; gap: 12px; border: 1px solid var(--pm-border); border-radius: 12px; padding: 11px 14px; margin-bottom: 10px; }
.pm-ui .ovr-row .file-ic { width: 34px; height: 34px; border-radius: 8px; background: var(--pm-red-soft); color: var(--pm-red); display: grid; place-items: center; font-size: 16px; }
.pm-ui .ovr-row .f-name { font-weight: 600; font-size: 13px; }
.pm-ui .ovr-row .f-meta { font-size: 11.5px; color: var(--pm-text-muted); }
.pm-ui .ovr-row .r-actions { margin-left: auto; display: flex; gap: 6px; }

.pm-ui .lib-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pm-ui .lib-tile { border: 1px solid var(--pm-border); border-radius: 12px; overflow: hidden; cursor: pointer; }
.pm-ui .lib-tile.selected { border-color: var(--pm-primary); box-shadow: 0 0 0 2px var(--pm-primary-soft); }
.pm-ui .lib-thumb { height: 96px; background: #f1f4f8; display: grid; place-items: center; color: var(--pm-text-soft); font-size: 30px; }
.pm-ui .lib-thumb.pdf { background: #fef2f2; color: var(--pm-red); }
.pm-ui .lib-thumb.img { background: #eff6ff; color: var(--pm-primary); }
.pm-ui .lib-meta { padding: 9px 10px; }
.pm-ui .lib-meta .ln { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-ui .lib-meta .ls { font-size: 11px; color: var(--pm-text-muted); }
.pm-ui .lib-caption { margin-top: 14px; font-size: 12px; color: var(--pm-text-muted); }
.pm-ui .lib-caption b { color: var(--pm-text); }

/* ---------- Kebab dropdown ---------- */
.pm-ui .kebab { position: relative; display: inline-block; }
.pm-ui .kebab-btn { border: 1px solid var(--pm-border); background: #fff; color: var(--pm-text-muted); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; font-size: 15px; }
.pm-ui .kebab-btn:hover { background: #f8fafc; color: var(--pm-text); }
.pm-ui .kebab-menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--pm-border); border-radius: 12px; box-shadow: var(--pm-shadow-pop); padding: 6px; min-width: 210px; z-index: 30; display: none; }
.pm-ui .kebab.open .kebab-menu { display: block; }
.pm-ui .kebab-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--pm-text); cursor: pointer; white-space: nowrap; background: none; border: none; width: 100%; text-align: left; }
.pm-ui .kebab-item:hover { background: #f4f6fb; }
.pm-ui .kebab-item i { font-size: 15px; width: 18px; text-align: center; color: var(--pm-text-muted); }
.pm-ui .kebab-item.danger, .pm-ui .kebab-item.danger i { color: var(--pm-red); }
.pm-ui .kebab-item.success, .pm-ui .kebab-item.success i { color: var(--pm-green); }
.pm-ui .kebab-sep { height: 1px; background: var(--pm-border); margin: 5px 2px; }

/* ---------- App (lượt xin visa) tabs ---------- */
.pm-ui .app-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pm-ui .app-tab { border: 1px solid var(--pm-border); background: #fff; border-radius: 999px; padding: 7px 14px; font-size: 12.5px; font-weight: 600; color: var(--pm-text-muted); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.pm-ui .app-tab .cnt { background: #eef1f6; color: var(--pm-text-muted); border-radius: 999px; padding: 0 7px; font-size: 11px; }
.pm-ui .app-tab.active { border-color: var(--pm-primary); color: var(--pm-primary); background: var(--pm-primary-soft); }
.pm-ui .app-tab.active .cnt { background: #dbe6ff; color: var(--pm-primary); }
.pm-ui .app-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--pm-text-muted); margin-bottom: 14px; }
.pm-ui .app-meta b { color: var(--pm-text); }

/* ---------- Timeline (lịch sử) ---------- */
.pm-ui .timeline { list-style: none; margin: 0; padding: 4px 0 0 4px; }
.pm-ui .timeline li { position: relative; padding: 0 0 16px 20px; border-left: 2px solid var(--pm-border); }
.pm-ui .timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.pm-ui .timeline li::before { content: ""; position: absolute; left: -6px; top: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--pm-primary); box-shadow: 0 0 0 3px var(--pm-primary-soft); }
.pm-ui .timeline li.red::before { background: var(--pm-red); box-shadow: 0 0 0 3px var(--pm-red-soft); }
.pm-ui .timeline li.green::before { background: var(--pm-green); box-shadow: 0 0 0 3px var(--pm-green-soft); }
.pm-ui .tl-head { display: flex; align-items: center; gap: 8px; }
.pm-ui .tl-head .tl-status { font-weight: 600; font-size: 13px; }
.pm-ui .tl-meta { font-size: 11.5px; color: var(--pm-text-muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.pm-ui .history-filter { display: inline-flex; padding: 2px; border-radius: 6px; background: #eef1f6; }
.pm-ui .history-filter button { border: 0; border-radius: 4px; background: transparent; color: var(--pm-text-muted); padding: 5px 7px; font-size: 11px; cursor: pointer; }
.pm-ui .history-filter button.active { background: #fff; color: var(--pm-primary); box-shadow: var(--pm-shadow-card); }
.pm-ui .history-stream { display: none; }
.pm-ui .history-stream.active { display: block; }
.pm-ui .history-code { margin-left: auto; color: var(--pm-text-muted); font-family: Consolas, monospace; font-size: 10.5px; }

/* ---------- Source badge ---------- */
.pm-ui .src { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.pm-ui .src.machine { background: #eef2ff; color: #4f46e5; }
.pm-ui .src.human { background: #ecfdf3; color: var(--pm-green); }

/* ---------- Segmented control ---------- */
.pm-ui .seg { display: inline-flex; background: #eef1f6; border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.pm-ui .seg button { border: none; background: none; padding: 7px 16px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--pm-text-muted); cursor: pointer; }
.pm-ui .seg button.active { background: #fff; color: var(--pm-text); box-shadow: var(--pm-shadow-card); }

/* ---------- Add-form (thêm lượt nộp) ---------- */
.pm-ui .add-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; background: #fafbfd; border: 1px solid var(--pm-border); border-radius: 12px; padding: 14px; margin-top: 6px; }
.pm-ui .add-form .full { grid-column: 1 / -1; }

/* ---------- Account picker (eVISA) ---------- */
.pm-ui .acc-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-bottom: 1px solid #edf0f4; background: #fff; text-align: left; color: var(--pm-text); cursor: pointer; }
.pm-ui .acc-row.selected { background: var(--pm-primary-soft); }
.pm-ui .acc-row > i { color: var(--pm-text-soft); font-size: 17px; }
.pm-ui .acc-row.selected > i { color: var(--pm-primary); }
.pm-ui .acc-row > span { display: grid; gap: 2px; }
.pm-ui .acc-row b { font-size: 12.5px; }
.pm-ui .acc-row small { color: var(--pm-text-muted); font-size: 11.5px; }
.pm-ui .acc-row em { margin-left: auto; font-style: normal; }

.pm-ui .code-box { display: flex; gap: 8px; align-items: center; margin: 12px 0; }
.pm-ui .code-box input { flex: 1; font-size: 20px; font-weight: 700; text-align: center; letter-spacing: 3px; border: 1px solid var(--pm-border); border-radius: 10px; padding: 12px; }

/* ---------- Offcanvas (Chuẩn bị & nộp) ---------- */
.pm-oc-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.4); display: none; z-index: 1055; }
.pm-oc-overlay.open { display: block; }
.pm-oc-overlay .pm-oc-panel { position: fixed; top: 0; right: 0; height: 100vh; width: 560px; max-width: 94vw; background: #fff; box-shadow: var(--pm-shadow-pop); z-index: 1056; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s ease; font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif; color: var(--pm-text); font-size: 14px; }
.pm-oc-overlay.open .pm-oc-panel { transform: translateX(0); }
.pm-ui .oc-head, .pm-oc-overlay .oc-head { padding: 18px 20px; border-bottom: 1px solid var(--pm-border); display: flex; align-items: flex-start; justify-content: space-between; }
.pm-ui .oc-head h2, .pm-oc-overlay .oc-head h2 { margin: 0 0 3px; font-size: 17px; font-weight: 700; }
.pm-ui .oc-head .sub, .pm-oc-overlay .oc-head .sub { font-size: 12.5px; color: var(--pm-text-muted); }
.pm-ui .oc-body, .pm-oc-overlay .oc-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.pm-ui .oc-foot, .pm-oc-overlay .oc-foot { padding: 14px 20px; border-top: 1px solid var(--pm-border); display: flex; justify-content: space-between; gap: 10px; }

/* ---------- Workspace tabs ---------- */
.pm-ui .workspace-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--pm-border); margin: 16px 0 18px; }
.pm-ui .workspace-tab { border: none; border-bottom: 2px solid transparent; background: none; padding: 9px 10px; color: var(--pm-text-muted); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pm-ui .workspace-tab.active { color: var(--pm-primary); border-bottom-color: var(--pm-primary); }
.pm-ui .workspace-tab span { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 9px; background: #eef1f6; font-size: 10.5px; }
.pm-ui .workspace-tab .tab-readiness { margin-left: 2px; padding: 0 5px; font-weight: 700; }
.pm-ui .workspace-tab .tab-readiness.warning { background: var(--pm-amber-soft); color: #a16207; }
.pm-ui .workspace-tab .tab-readiness.complete { background: var(--pm-green-soft); color: var(--pm-green); }
.pm-ui .workspace-view { display: none; }
.pm-ui .workspace-view.active { display: block; }

/* ---------- Current application (breadcrumb + case switcher) ---------- */
.pm-ui .current-application { margin: -2px 0 16px; padding: 11px 12px; border: 1px solid var(--pm-border); border-radius: 8px; background: #fafbfd; }
.pm-ui .case-breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--pm-text-muted); font-size: 11.5px; }
.pm-ui .case-breadcrumb i { color: var(--pm-text-soft); font-size: 12px; }
.pm-ui .case-breadcrumb i:first-child, .pm-ui .case-breadcrumb i:nth-of-type(3) { color: var(--pm-primary); font-size: 14px; }
.pm-ui .current-application-main { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 7px; }
.pm-ui .current-application-main > div { display: grid; gap: 2px; }
.pm-ui .current-application-main span { color: var(--pm-text-muted); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.pm-ui .current-application-main b { font-size: 14px; }
.pm-ui .current-application-main small { color: var(--pm-text-muted); font-size: 11.5px; }
.pm-ui .case-switcher { position: relative; flex-shrink: 0; }
.pm-ui .case-switcher summary { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--pm-border); border-radius: 6px; color: var(--pm-text-muted); background: #fff; cursor: pointer; list-style: none; }
.pm-ui .case-switcher summary::-webkit-details-marker { display: none; }
.pm-ui .case-switcher[open] summary { color: var(--pm-primary); border-color: var(--pm-primary); }
.pm-ui .case-switcher > div { position: absolute; right: 0; top: 36px; z-index: 10; min-width: 228px; padding: 5px; border: 1px solid var(--pm-border); border-radius: 7px; background: #fff; box-shadow: var(--pm-shadow-pop); }
.pm-ui .case-switcher button { display: block; width: 100%; padding: 8px 9px; border: 0; border-radius: 5px; background: transparent; text-align: left; color: var(--pm-text); cursor: pointer; font-size: 11.5px; }
.pm-ui .case-switcher button:hover { background: var(--pm-primary-soft); color: var(--pm-primary); }
.pm-ui .case-switcher-sep { height: 1px; margin: 4px 3px; background: var(--pm-border); }
.pm-ui .case-switcher .case-new { color: var(--pm-primary); font-weight: 600; }

/* ---------- Agent state + resubmit context ---------- */
.pm-ui .agent-state { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--pm-border); border-radius: 8px; font-size: 12px; margin-bottom: 14px; }
.pm-ui .agent-state i { grid-row: span 2; color: var(--pm-text-soft); font-size: 17px; }
.pm-ui .agent-state small { color: var(--pm-text-muted); }
.pm-ui .resubmit-context { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; padding: 11px 12px; border: 1px solid #f4dcae; border-radius: 8px; background: var(--pm-amber-soft); color: #805109; font-size: 12.5px; }
.pm-ui .resubmit-context i { font-size: 17px; }
.pm-ui .resubmit-context span { display: block; margin-top: 3px; color: #92600a; }

/* ---------- Account picker (chọn/tạo tài khoản eVISA) ---------- */
.pm-ui .account-picker { margin-top: 12px; border: 1px solid var(--pm-border); border-radius: 8px; overflow: hidden; }
.pm-ui .account-picker-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--pm-border); }
.pm-ui .account-picker-head > div { display: grid; gap: 2px; font-size: 12.5px; }
.pm-ui .account-picker-head small { color: var(--pm-text-muted); font-size: 11.5px; }
.pm-ui .account-filters { display: grid; grid-template-columns: 1fr 150px; gap: 8px; padding: 10px 12px; background: #fafbfd; border-bottom: 1px solid var(--pm-border); }
.pm-ui .account-search { position: relative; }
.pm-ui .account-search i { position: absolute; left: 10px; top: 9px; color: var(--pm-text-soft); }
.pm-ui .account-search .input { padding-left: 30px; }
.pm-ui .account-results { max-height: 250px; overflow-y: auto; }
.pm-ui .account-results-foot { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-top: 1px solid var(--pm-border); color: var(--pm-text-muted); font-size: 11.5px; }

/* ---------- Ready state (đã sẵn sàng) ---------- */
.pm-ui .ready-box { text-align: center; padding: 24px 12px; }
.pm-ui .ready-box .r-ic { width: 56px; height: 56px; border-radius: 50%; background: var(--pm-green-soft); color: var(--pm-green); display: grid; place-items: center; font-size: 28px; margin: 0 auto 12px; }
.pm-ui .ready-box h3 { margin: 0 0 6px; font-size: 16px; }
.pm-ui .ready-box p { margin: 0; color: var(--pm-text-muted); font-size: 13px; }

/* ---------- Level tags (passport/application/submission) ---------- */
.pm-ui .lv-tag { padding: 2px 8px; border-radius: 999px; font-size: 10.5px; }
.pm-ui .lv-tag.passport { background: #f3ecff; color: var(--pm-purple); }
.pm-ui .lv-tag.application { background: var(--pm-primary-soft); color: var(--pm-primary); }
.pm-ui .lv-tag.submission { background: var(--pm-amber-soft); color: var(--pm-amber); }
.pm-ui .own-head { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--pm-text-muted); margin-bottom: 8px; }

/* ---------- Stepper ---------- */
.pm-ui .stepper { display: flex; align-items: center; gap: 4px; margin-bottom: 18px; }
.pm-ui .step { display: flex; align-items: center; gap: 8px; flex: 1; }
.pm-ui .step .dot { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--pm-border); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--pm-text-muted); background: #fff; }
.pm-ui .step.active .dot { background: var(--pm-primary); color: #fff; border-color: var(--pm-primary); }
.pm-ui .step.done .dot { background: var(--pm-green-soft); color: var(--pm-green); border-color: var(--pm-green); }
.pm-ui .step .st-label { font-size: 12px; font-weight: 600; color: var(--pm-text-muted); }
.pm-ui .step.active .st-label { color: var(--pm-text); }
.pm-ui .step .st-line { flex: 1; height: 2px; background: var(--pm-border); }
.pm-ui .step.done .st-line { background: var(--pm-green); }
.pm-ui .step-panel { display: none; }
.pm-ui .step-panel.active { display: block; }
.pm-ui .step-hint { background: var(--pm-primary-soft); border-radius: 12px; padding: 12px 14px; font-size: 12.5px; color: #1e40af; margin-bottom: 14px; display: flex; gap: 8px; }
.pm-ui .step-hint.warn { background: #fff4e5; color: #92600a; }
.pm-ui .step-hint i { font-size: 15px; }

/* ---------- Intake form ---------- */
.pm-ui .intake-wrap { max-width: 920px; margin: 0 auto; }
.pm-ui .ai-drop { border: 1px dashed var(--pm-border); border-radius: var(--pm-radius); padding: 18px; text-align: center; margin-bottom: 16px; background: #fafbfd; }
.pm-ui .ai-drop .ai-ic { width: 48px; height: 48px; border-radius: 12px; background: linear-gradient(135deg,#3b82f6,#7c3aed); color: #fff; display: grid; place-items: center; font-size: 22px; margin: 0 auto 10px; }
.pm-ui .ai-drop h3 { margin: 0 0 4px; font-size: 15px; }
.pm-ui .ai-drop p { margin: 0 0 12px; font-size: 12.5px; color: var(--pm-text-muted); }
.pm-ui .intake-card { margin-bottom: 14px; }
.pm-ui .intake-card > summary, .pm-ui .intake-card > .ic-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; font-weight: 700; font-size: 14px; cursor: pointer; list-style: none; }
.pm-ui .intake-card > summary::-webkit-details-marker { display: none; }
.pm-ui .intake-card > summary::after { content: "\203A"; transform: rotate(90deg); font-size: 20px; color: var(--pm-text-soft); transition: transform .15s; }
.pm-ui .intake-card[open] > summary::after { transform: rotate(-90deg); }
.pm-ui .intake-body { padding: 4px 18px 18px; border-top: 1px solid var(--pm-border); }
.pm-ui .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pm-ui .form-grid .full { grid-column: 1 / -1; }
.pm-ui .form-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.pm-ui .pp-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pm-ui .pp-tab { border: 1px solid var(--pm-border); background: #fff; border-radius: 10px; padding: 8px 12px; font-size: 12.5px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.pm-ui .pp-tab.active { border-color: var(--pm-primary); background: var(--pm-primary-soft); color: var(--pm-primary); font-weight: 600; }
.pm-ui .pp-tab .cur { font-size: 10px; background: var(--pm-green-soft); color: var(--pm-green); padding: 1px 6px; border-radius: 999px; }
.pm-ui .intake-actions { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--pm-border); padding: 14px 0; display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- Topbar ---------- */
.pm-ui .topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.pm-ui .topbar .back { color: var(--pm-text-muted); text-decoration: none; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.pm-ui .topbar .back:hover { color: var(--pm-text); }

/* ---------- Document manager grids ---------- */
.pm-ui .document-context { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid var(--pm-border); border-radius: 8px; background: #fafbfd; margin-bottom: 10px; font-size: 12.5px; }
.pm-ui .document-context > div { display: grid; gap: 3px; }
.pm-ui .document-context small { color: var(--pm-text-muted); }
.pm-ui .document-manager { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
@media (max-width: 420px) { .pm-ui .document-manager { grid-template-columns: repeat(2, 1fr); } }
.pm-ui .override-manager { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }

/* ---------- Icon action buttons ---------- */
.pm-ui .icon-action { width: 28px; height: 28px; display: inline-grid; place-items: center; border: 1px solid var(--pm-border); border-radius: 6px; background: #fff; color: var(--pm-text-muted); cursor: pointer; }
.pm-ui .icon-action:hover { color: var(--pm-primary); border-color: var(--pm-primary); }
.pm-ui .icon-action.danger:hover { color: var(--pm-red); border-color: var(--pm-red); }
.pm-ui .doc-tile .icon-action { margin-left: auto; }

/* ---------- Thumbnail document tiles ---------- */
.pm-ui .thumb-tile { display: grid; grid-template-columns: 1fr; gap: 0; min-width: 0; padding: 7px; border-radius: 8px; cursor: default; position: relative; }
.pm-ui .thumb-tile:hover { background: #fff; }
.pm-ui .thumb-tile .icon-action { position: absolute; top: 12px; right: 12px; margin: 0; opacity: 0; }
.pm-ui .thumb-tile:hover .icon-action, .pm-ui .thumb-tile:focus-within .icon-action { opacity: 1; }
.pm-ui .thumb-tile.inherited { border-style: dashed; }
.pm-ui .thumb-tile.overridden { border-color: #e9c26b; box-shadow: inset 0 2px 0 var(--pm-amber); }
.pm-ui .thumb-tile.inherited .dt-meta { color: var(--pm-text-muted); }
.pm-ui .thumb-tile.overridden .dt-meta { color: var(--pm-amber); font-weight: 700; }
.pm-ui .doc-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 1.38 / 1; overflow: hidden; border-radius: 5px; color: #fff; font-size: 29px; }
.pm-ui .doc-thumb::after { content: ""; position: absolute; inset: auto 9px 8px; height: 2px; background: rgba(255,255,255,.55); box-shadow: 0 -7px 0 rgba(255,255,255,.28); }
.pm-ui .doc-thumb span { position: absolute; top: 7px; left: 7px; padding: 2px 4px; border-radius: 3px; background: rgba(15,23,42,.52); color: #fff; font-family: Consolas, monospace; font-size: 8px; font-weight: 700; }
.pm-ui .passport-thumb { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.pm-ui .portrait-thumb { background: linear-gradient(135deg, #2563eb, #7dd3fc); }
.pm-ui .portrait-thumb::before { content: ""; position: absolute; width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.3); }
.pm-ui .portrait-thumb i { position: relative; z-index: 1; }
.pm-ui .vaccine-thumb { background: linear-gradient(135deg, #16a34a, #86efac); }
.pm-ui .stay-thumb { background: linear-gradient(135deg, #d97706, #fcd34d); }
.pm-ui .flight-thumb { background: linear-gradient(135deg, #0f766e, #67e8f9); }
.pm-ui .financial-thumb { background: linear-gradient(135deg, #059669, #6ee7b7); }
.pm-ui .visa-thumb { background: linear-gradient(135deg, #0369a1, #7dd3fc); }
.pm-ui .empty-thumb { border: 1px dashed #e29393; background: var(--pm-red-soft); color: var(--pm-red); }
.pm-ui .empty-thumb::after { display: none; }
.pm-ui .doc-caption { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; padding: 7px 1px 1px; min-width: 0; }
.pm-ui .doc-caption .dt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.pm-ui .doc-caption .dt-meta { flex-shrink: 0; font-size: 10px; }
.pm-ui .doc-tile.missing { border-style: dashed; }
.pm-ui .doc-tile.missing .dt-meta { color: var(--pm-red); }
.pm-ui .submission-context { border-color: #f4dcae; background: var(--pm-amber-soft); }

/* ---------- Attempts: channel groups + submission editor ---------- */
.pm-ui .channel-group { border: 1px solid var(--pm-border); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.pm-ui .cg-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #fafbfd; border-bottom: 1px solid var(--pm-border); }
.pm-ui .cg-head .cg-title { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.pm-ui .cg-head .cg-title i { color: var(--pm-primary); }
.pm-ui .cg-head.embassy .cg-title i { color: var(--pm-green); }
.pm-ui .sub-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 12px; align-items: center; padding: 11px 14px; border-bottom: 1px solid #f1f4f8; }
.pm-ui .sub-row:last-child { border-bottom: none; }
.pm-ui .sub-row .s-date { font-size: 12px; color: var(--pm-text-muted); }
.pm-ui .sub-row .s-main { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.pm-ui .sub-row .s-code { font-family: 'Consolas', monospace; font-size: 11.5px; color: var(--pm-text-muted); }
.pm-ui .sub-row .s-actions { display: flex; align-items: center; gap: 6px; }
.pm-ui .cg-foot { padding: 10px 14px; }
.pm-ui .submission-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--pm-border); background: #fafbfd; }
.pm-ui .submission-editor .full { grid-column: 1 / -1; }
.pm-ui .submission-editor-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.pm-ui .submission-override { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--pm-border); border-radius: 8px; font-size: 12px; }
.pm-ui .submission-override small { display: block; color: var(--pm-text-muted); margin-top: 3px; }
.pm-ui .submission-override-panel { margin: -1px 10px 10px; padding: 12px; border: 1px solid #f0b968; border-radius: 0 0 8px 8px; background: #fffaf0; }
.pm-ui .submission-override-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.pm-ui .submission-override-head > div { display: grid; gap: 4px; }
.pm-ui .submission-override-head b { font-size: 12.5px; }
.pm-ui .submission-override-head small { color: var(--pm-text-muted); font-size: 11.5px; }

/* ---------- Responsive helpers ---------- */
@media (max-width: 900px) {
    .pm-ui .filter-grid, .pm-ui .channels, .pm-ui .info-2, .pm-ui .doc-grid { grid-template-columns: 1fr; }
    .pm-ui .form-grid, .pm-ui .form-grid.three, .pm-ui .add-form { grid-template-columns: 1fr; }
    .pm-ui .lib-grid { grid-template-columns: repeat(2, 1fr); }
    .pm-ui .submission-editor { grid-template-columns: 1fr; }
}
