:root {
    --primary: #08245b;
    --primary-hover: #173a75;
    --primary-soft: #edf2fa;
    --focus: rgba(8, 36, 91, .15);
    --shadow: 0 4px 18px rgba(24, 42, 72, .035);
    --ink: #202c40;
    --muted: #6b778c;
    --line: #e3e8ef;
    --bg: #f5f7fa;
    --card: #fff;
    --danger: #c62828;
    --warn: #b45309;
    --ok: #027a48;
}
.auth-dialog { border: 0; border-radius: 12px; padding: 28px; width: min(440px, calc(100vw - 32px)); max-height: 90vh; overflow: auto; }
.auth-dialog::backdrop { background: rgba(28, 36, 48, .5); }
.auth-login-form { display: grid; gap: 16px; }
.auth-code-row { display: flex; align-items: end; gap: 12px; }
.auth-code-row .field { flex: 1; min-width: 0; }
.auth-code-row .btn { margin-bottom: 0; flex-shrink: 0; }
.auth-wechat { margin-top: 16px; width: 100%; }
.auth-notice:empty, .auth-error:empty { display: none; }
.account-summary { display: grid; gap: 12px; }
@media (max-width: 640px) { .auth-wechat, #bindWechat { display: none; } }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background: var(--bg);
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; }
.brand span { color: var(--primary); }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 6px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
}
.btn:hover { border-color: var(--primary); color: var(--primary-hover); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-danger { color: var(--danger); border-color: #f3c0c0; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.wrap { max-width: 1180px; margin: 24px auto; padding: 0 20px 48px; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px 18px;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; }

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    background: #eef2f6;
}
.badge.running { background: #e6f7ff; color: #0065a8; }
.badge.aa_ready { background: #fff6e5; color: var(--warn); }
.badge.filled { background: #e8f8f2; color: var(--ok); }
.badge.needs_photo { background: #fff3e8; color: var(--warn); }
.badge.failed { background: #fdecec; color: var(--danger); }

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    margin: 12px 0 0;
    overflow-x: auto;
}
.tab {
    border: 0;
    background: transparent;
    padding: 10px 16px;
    cursor: pointer;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.tab.active { color: var(--primary-hover); border-bottom-color: var(--primary); font-weight: 600; }
.tab.has-error { color: var(--danger); }
.tab.has-error.active { border-bottom-color: var(--danger); }
.tab-error-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    border-radius: 50%;
    background: var(--danger);
    vertical-align: middle;
}

.section {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 16px 0;
    overflow: hidden;
    background: #fff;
}
.section h3 {
    margin: 0;
    padding: 12px 16px;
    background: #f8fafb;
    border-bottom: 1px solid var(--line);
    font-size: 15px;
}
.section h3 small { color: var(--muted); font-weight: 400; margin-left: 8px; }
.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    padding: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; scroll-margin-top: 88px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; color: var(--ink); }
.field label .en { color: var(--muted); margin-left: 6px; font-weight: 400; }
.req { color: #d92d20; margin-left: 2px; }
input[type="text"], input[type="date"], input[type="email"], input[type="password"], select, textarea {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    font: inherit;
    width: 100%;
}
.field.invalid input[type="text"],
.field.invalid input[type="date"],
.field.invalid input[type="email"],
.field.invalid select,
.field.invalid textarea {
    border-color: var(--danger);
    background: #fff5f5;
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12);
}
.field.invalid .radios {
    border: 1px solid var(--danger);
    border-radius: 6px;
    padding: 8px 10px;
    background: #fff5f5;
}
.field.invalid.repeatable {
    border-color: var(--danger);
    background: #fff5f5;
}
@keyframes field-pulse {
    0% { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0.42); }
    70% { box-shadow: 0 0 0 8px rgba(198, 40, 40, 0); }
    100% { box-shadow: none; }
}
.field.invalid.field-pulse input[type="text"],
.field.invalid.field-pulse input[type="date"],
.field.invalid.field-pulse input[type="email"],
.field.invalid.field-pulse select,
.field.invalid.field-pulse textarea,
.field.invalid.field-pulse .radios,
.field.invalid.field-pulse.repeatable {
    animation: field-pulse 0.7s ease-out 2;
}
.field-error {
    color: var(--danger);
    font-size: 12px;
    line-height: 1.4;
}
.field-hint {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}
#schedulingHint, #schedulingStatus { padding: 0 16px; }
#schedulingHint { padding-top: 12px; }
.scheduling-actions { display: flex; gap: 8px; padding: 0 16px 16px; }
#schedulingStatus { padding-bottom: 16px; }
#schedulingStatus.is-error { color: var(--danger); }
.field.code-highlight input { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
textarea { min-height: 72px; resize: vertical; }
.radios { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.radios label { display: flex; gap: 6px; align-items: center; font-size: 14px; }
.repeatable { grid-column: 1 / -1; border: 1px dashed var(--line); border-radius: 8px; padding: 12px; }
.repeat-item { border-bottom: 1px solid var(--line); margin-bottom: 12px; padding-bottom: 12px; }

.layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.logbox {
    background: #111827;
    color: #d7e4fa;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    height: calc(100vh - 140px);
    overflow: auto;
    padding: 12px;
    border-radius: 8px;
    white-space: pre-wrap;
}
.status-line { font-size: 13px; color: var(--muted); }
.aa { font-family: ui-monospace, Menlo, monospace; font-weight: 700; color: var(--primary-hover); }

.muted { color: var(--muted); }
.auth-card { max-width: 640px; margin: 80px auto; }
.auth-card .top-actions { padding: 0 16px 8px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-title h2 { margin-bottom: 4px; }
.brand a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: #111;
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    display: none;
}

@media (max-width: 640px) {
    .layout, .grid { grid-template-columns: 1fr; }
    .logbox { height: 240px; }
}

/* DS-160 review workbench */
.apply-page {
    min-width: 320px;
    background: var(--bg);
}
.apply-page button, .apply-page input, .apply-page select, .apply-page textarea { font-family: inherit; }
.apply-page .btn {
    min-height: 38px;
    border-radius: 9px;
    padding: 8px 14px;
    font-weight: 600;
    transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
}
.apply-page .btn:focus-visible,
.apply-page input:focus-visible,
.apply-page select:focus-visible,
.apply-page textarea:focus-visible,
.apply-page button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 1px;
}
.apply-page .btn-primary { background: var(--primary-hover); border-color: var(--primary-hover); }
.apply-page .btn-primary:hover { background: #173a75; border-color: #173a75; }
.apply-page .btn-quiet { border-color: transparent; background: transparent; color: var(--primary-hover); }
.apply-page .btn-small { min-height: 32px; padding: 5px 10px; font-size: 12px; }

.workbench-header {
    position: sticky;
    z-index: 30;
    top: 0;
    min-height: 78px;
    padding: 12px clamp(16px, 3vw, 40px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}
.workbench-identity { display: flex; align-items: center; gap: 18px; min-width: 0; }
.back-link { color: var(--muted); text-decoration: none; white-space: nowrap; font-size: 14px; }
.back-link:hover { color: var(--primary-hover); }
.identity-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.identity-line h1 { margin: 0; font-size: 19px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.identity-meta { display: flex; align-items: center; gap: 12px; margin-top: 4px; font-size: 12px; }
.status-badge, .subtle-status, .completion-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eef1f6;
    color: #667389;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.status-badge.awaiting_review { background: #fff4dc; color: #956000; }
.status-badge.approved, .status-badge.awaiting_signature { background: var(--primary-soft); color: var(--primary-hover); }
.status-badge.customer_changes { background: #fff0ef; color: #a33b32; }
.aa-copy { padding: 0; border: 0; background: none; color: var(--primary-hover); font: inherit; font-weight: 700; cursor: pointer; }
.aa-copy:disabled { color: var(--muted); cursor: default; }
.save-state { color: var(--muted); }
.save-state::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #a2aec0; }
.save-state[data-state="dirty"] { color: #9b6700; }
.save-state[data-state="dirty"]::before { background: #e4a11b; }
.save-state[data-state="saving"]::before { background: #3763a0; animation: wb-pulse 1s infinite; }
.save-state[data-state="saved"] { color: var(--primary-hover); }
.save-state[data-state="saved"]::before { background: var(--primary); }
.save-state[data-state="failed"] { color: var(--danger); }
.save-state[data-state="failed"]::before { background: var(--danger); }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.task-strip {
    max-width: 1320px;
    margin: 14px auto 0;
    padding: 11px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 5px 18px rgba(24, 42, 72, .035);
}
.task-indicator { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: #a2aec0; }
.task-indicator.queued, .task-indicator.running { background: #3763a0; box-shadow: 0 0 0 5px #eaf0fa; animation: wb-pulse 1.2s infinite; }
.task-indicator.succeeded { background: var(--primary); }
.task-indicator.failed, .task-indicator.interrupted { background: var(--danger); }
.task-strip-copy { display: flex; flex: 1; align-items: baseline; gap: 10px; min-width: 0; }
.task-strip-copy span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

.workbench-shell {
    width: min(1320px, calc(100% - 32px));
    margin: 18px auto 72px;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
.workbench-nav {
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 112px);
    overflow-y: auto;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(24, 42, 72, .035);
}
.side-tabs { display: flex; flex-direction: column; gap: 3px; }
.side-tab {
    width: 100%;
    min-height: 52px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
}
.side-tab:hover { background: #f1f4f9; }
.side-tab-group.active > .side-tab { color: var(--primary-hover); background: var(--primary-soft); }
.side-tab span { display: flex; flex-direction: column; gap: 2px; font-weight: 600; }
.side-tab small { color: var(--muted); font-weight: 400; font-size: 11px; }
.side-tab b { min-width: 23px; padding: 3px 6px; border-radius: 999px; background: #fff0ef; color: var(--danger); text-align: center; font-size: 11px; }
.side-tab i { color: var(--primary); font-style: normal; }
.side-sections { margin: 3px 0 8px 18px; padding-left: 10px; border-left: 1px solid #dce4ef; }
.side-sections button { width: 100%; padding: 7px 5px; display: flex; justify-content: space-between; gap: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; text-align: left; font-size: 12px; }
.side-sections button:hover { color: var(--primary-hover); }
.side-sections b { color: var(--danger); font-size: 11px; }
.tool-links { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.tool-links-title { display: block; padding: 0 8px 7px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.tool-link { width: 100%; padding: 8px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 7px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.tool-link:hover { background: #f1f4f9; }
.tool-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; background: #edf2fa; color: var(--primary-hover); font-size: 11px; font-weight: 700; }
.tool-state { color: var(--muted); font-size: 10px; }
.tool-state.complete { color: var(--primary-hover); }
.mobile-nav-label, .mobile-section-select { display: none; }

.workbench-content { min-width: 0; }
.content-heading { min-height: 82px; margin-bottom: 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.eyebrow, .section-kicker { margin: 0 0 5px; color: var(--primary-hover); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.content-heading h2, .drawer-header h2, .dialog-heading h2 { margin: 0; font-size: 24px; line-height: 1.2; }
.content-heading p:not(.eyebrow) { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.completion-pill { background: #fff4dc; color: #8b5c00; }
.completion-pill.complete { background: var(--primary-soft); color: var(--primary-hover); }
.apply-page .section {
    scroll-margin-top: 98px;
    margin: 0 0 16px;
    overflow: visible;
    border-radius: 12px;
    border-color: var(--line);
    box-shadow: 0 7px 24px rgba(24, 42, 72, .035);
}
.section-heading {
    min-height: 66px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    background: #fafbfe;
    border-radius: 12px 12px 0 0;
}
.section-heading h3 { margin: 0; padding: 0; border: 0; background: none; font-size: 16px; }
.section-heading h3 small { display: block; margin: 3px 0 0; color: var(--muted); font-size: 11px; font-weight: 400; }
.apply-page .grid { padding: 20px; gap: 18px 20px; }
.apply-page .field { position: relative; gap: 8px; scroll-margin-top: 110px; }
.field-label { display: flex; flex-direction: column; gap: 2px; color: var(--ink); font-size: 14px; font-weight: 600; }
.field-label small { color: var(--muted); font-size: 11px; font-weight: 400; }
.apply-page input[type="text"], .apply-page input[type="date"], .apply-page input[type="email"], .apply-page input[type="password"], .apply-page select, .apply-page textarea {
    min-height: 42px;
    padding: 9px 11px;
    border-color: #ccd5e2;
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.apply-page textarea { min-height: 88px; }
.apply-page input:hover, .apply-page select:hover, .apply-page textarea:hover { border-color: #9eacc0; }
.apply-page input:focus, .apply-page select:focus, .apply-page textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); outline: 0; }
.apply-page input:disabled, .apply-page select:disabled, .apply-page textarea:disabled { background: #f2f4f8; color: #6b778c; cursor: not-allowed; }
.apply-page .field-hint { margin: 0; color: var(--muted); }
.lock-note { position: absolute; top: 1px; right: 0; color: #8b6a24; font-size: 10px; font-weight: 500; }
.radios { min-height: 42px; padding: 8px 11px; gap: 10px; border: 1px solid #ccd5e2; border-radius: 9px; background: #fff; }
.radios label { padding: 3px 8px 3px 3px; cursor: pointer; }
.radios input { accent-color: var(--primary-hover); }
.checkbox-control { min-height: 42px; padding: 9px 11px; display: flex; align-items: center; border: 1px solid #ccd5e2; border-radius: 9px; background: #fff; }
.checkbox-control input { accent-color: var(--primary-hover); }
.validation-summary { margin-bottom: 16px; padding: 16px 18px; display: grid; grid-template-columns: minmax(190px, .4fr) 1fr; gap: 20px; border: 1px solid #efc8c3; border-radius: 12px; background: #fff8f7; }
.validation-summary.success { border-color: #b8dfd0; background: #f3fbf7; }
.validation-summary strong { color: var(--danger); }
.validation-summary.success strong { color: var(--primary-hover); }
.validation-summary p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.validation-items { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; }
.validation-items button { padding: 5px 8px; border: 1px solid #efd1cd; border-radius: 7px; background: #fff; color: #8f332c; cursor: pointer; font-size: 12px; text-align: left; }
.validation-items span { color: var(--muted); font-size: 12px; }
.apply-page .field.invalid input, .apply-page .field.invalid select, .apply-page .field.invalid textarea, .apply-page .field.invalid .radios { border-color: #d45248; background: #fff8f7; box-shadow: 0 0 0 3px rgba(212,82,72,.09); }
.apply-page .field-error { font-size: 12px; }
.repeatable { padding: 0; border: 0; }
.repeat-item { margin: 0 0 14px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fafbfe; }
.repeat-heading { min-height: 48px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.repeat-heading strong { font-size: 13px; }
.repeat-heading span { flex: 1; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repeat-grid { background: #fff; }
.repeat-actions { display: flex; align-items: center; gap: 10px; }
.repeat-actions span { color: var(--muted); font-size: 12px; }
.tool-card { margin-top: 24px !important; }
.photo-panel { padding: 20px; display: flex; align-items: center; gap: 20px; }
.photo-preview { width: 112px; height: 140px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border: 1px dashed #bdc9db; border-radius: 10px; background: #f2f5fa; color: var(--muted); font-size: 12px; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.passport-attachment-panel { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); align-items: center; gap: 20px; padding: 20px; }
.passport-attachment-preview { display: flex; align-items: center; justify-content: center; width: 100%; height: 190px; overflow: hidden; border: 1px solid var(--line); background: #f2f5fa; color: var(--muted); font-size: 13px; text-align: center; }
.passport-attachment-preview img { display: block; min-width: 0; min-height: 0; width: 100%; height: 100%; object-fit: contain; }
.passport-attachment-panel .photo-copy { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) { .passport-attachment-panel { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px; } }
.photo-copy strong { display: block; margin-bottom: 6px; }
.photo-copy p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.stepper { padding: 18px 20px 6px; display: flex; gap: 0; }
.step { position: relative; flex: 1; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.step:not(:last-child)::after { content: ''; height: 1px; flex: 1; margin: 0 10px; background: var(--line); }
.step b { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: #eef1f6; font-size: 11px; }
.step.active { color: var(--primary-hover); font-weight: 700; }
.step.active b, .step.complete b { background: var(--primary-hover); color: #fff; }
.scheduling-message { padding: 8px 20px !important; }
.apply-page .scheduling-actions { padding: 0 20px 18px; }

.task-drawer {
    position: fixed;
    z-index: 60;
    top: 0;
    right: 0;
    width: min(460px, 92vw);
    height: 100vh;
    padding: 22px;
    display: flex;
    flex-direction: column;
    transform: translateX(102%);
    transition: transform .22s ease;
    background: #fff;
    box-shadow: -18px 0 45px rgba(24, 42, 72, .16);
}
.task-drawer.open { transform: translateX(0); }
.drawer-backdrop { position: fixed; z-index: 55; inset: 0; background: rgba(18, 31, 54, .38); }
.drawer-header, .dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #eef2f7; color: var(--ink); cursor: pointer; font-size: 23px; }
.drawer-status { margin: 20px 0; padding: 14px; display: flex; flex-direction: column; gap: 5px; border-radius: 10px; background: var(--primary-soft); }
.drawer-status span { color: var(--muted); font-size: 12px; }
.drawer-log-heading { margin-bottom: 8px; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.drawer-log-heading strong { color: var(--ink); font-size: 14px; }
.apply-page .logbox { height: auto; min-height: 0; flex: 1; padding: 0; background: #f5f7fa; color: var(--ink); font-family: inherit; }
.log-entry { padding: 11px 12px; display: grid; grid-template-columns: 120px 1fr; gap: 8px; border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.5; }
.log-entry time { color: var(--muted); }
.drawer-open { overflow: hidden; }

.workbench-dialog { width: min(560px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 24px 70px rgba(24, 42, 72, .25); }
.workbench-dialog::backdrop { background: rgba(18, 31, 54, .43); }
.dialog-card { padding: 22px; }
.dialog-card > p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.dialog-card label { display: block; margin: 16px 0 6px; font-size: 13px; font-weight: 600; }
.dialog-card textarea { min-height: 80px; }
.dialog-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 8px; }
.apply-page .toast { z-index: 100; max-width: min(420px, calc(100% - 32px)); padding: 11px 15px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.apply-page .toast.error { background: #9d332c; }
.apply-page .toast.success { background: #075f4b; }
.mobile-action-bar { display: none; }

@keyframes wb-pulse { 50% { opacity: .45; } }

@media (max-width: 1120px) {
    .workbench-header { align-items: flex-start; }
    .header-actions { max-width: 520px; }
    .task-strip { margin-left: 16px; margin-right: 16px; }
}

@media (max-width: 900px) {
    .workbench-header { position: relative; padding: 12px 16px; flex-direction: column; }
    .header-actions { width: 100%; max-width: none; justify-content: flex-start; }
    .workbench-shell { width: calc(100% - 24px); grid-template-columns: 1fr; gap: 14px; }
    .workbench-nav { position: sticky; z-index: 20; top: 0; max-height: none; padding: 10px 12px; display: flex; align-items: center; gap: 12px; }
    .mobile-nav-label { display: block; flex: 0 0 auto; font-size: 12px; font-weight: 700; }
    .mobile-section-select { display: block; min-height: 38px !important; flex: 1; }
    .side-tabs, .tool-links { display: none; }
    .content-heading { min-height: 66px; }
}

@media (max-width: 600px) {
    .apply-page { padding-bottom: 70px; }
    .workbench-header { gap: 10px; }
    .workbench-identity { width: 100%; gap: 10px; align-items: flex-start; }
    .back-link { padding-top: 3px; font-size: 0; }
    .back-link::first-letter { font-size: 20px; }
    .identity-line h1 { font-size: 17px; }
    .header-actions .btn-primary, .header-actions #btnStop { display: none; }
    .header-actions { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
    .header-actions .btn { min-height: 34px; flex: 0 0 auto; padding: 6px 10px; font-size: 12px; }
    .task-strip { margin-top: 10px; padding: 9px 11px; }
    .task-strip-copy { align-items: flex-start; flex-direction: column; gap: 2px; }
    .task-strip .btn { padding: 5px 8px; font-size: 11px; }
    .workbench-shell { width: calc(100% - 20px); margin-top: 10px; }
    .content-heading { padding: 0 4px; align-items: flex-start; }
    .content-heading h2 { font-size: 21px; }
    .completion-pill { padding: 3px 7px; }
    .apply-page .grid { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
    .section-heading { padding: 12px 16px; }
    .validation-summary { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
    .photo-panel { align-items: flex-start; padding: 16px; gap: 14px; }
    .photo-preview { width: 88px; height: 110px; }
    .stepper { padding: 16px 16px 4px; }
    .step { font-size: 0; }
    .step b { font-size: 11px; }
    .scheduling-message { padding-left: 16px !important; padding-right: 16px !important; }
    .mobile-action-bar {
        position: fixed;
        z-index: 35;
        bottom: 0;
        left: 0;
        right: 0;
        min-height: 62px;
        padding: 9px 12px max(9px, env(safe-area-inset-bottom));
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        border-top: 1px solid var(--line);
        background: rgba(255,255,255,.97);
        box-shadow: 0 -7px 22px rgba(24, 42, 72, .08);
    }
    .mobile-action-bar span { color: var(--muted); font-size: 12px; }
    .mobile-action-bar .btn { min-width: 140px; }
    .log-entry { grid-template-columns: 1fr; }
}
.aa-history { margin-top: 8px; font-size: 12px; color: var(--muted); }
.aa-history summary { cursor: pointer; }
.aa-history-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }

.order-progress { display:block; margin-top:5px; color:var(--muted); font-size:12px; }

/* Customer intake and owner worklist. */
.entry-workbench { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 28px; align-items: center; }
.entry-workbench .section-title { margin-bottom: 4px; }
.entry-workbench img { max-width: 100%; border: 1px solid var(--line); border-radius: 12px; }
.order-filters { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin: 20px 0; }
.order-filters .field { min-width: 145px; margin: 0; }
.order-filters .search-field { flex: 1; min-width: 230px; }
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 900px; }
.customer-wrap { max-width: 860px; }
.customer-page .tabs { overflow-x: auto; flex-wrap: nowrap; }
.customer-page .tab { flex-shrink: 0; }
.customer-page .field { min-width: 0; }
.customer-page h1 { font-size: 28px; margin: 8px 0 14px; }
.entry-kicker { color: var(--primary-hover); font-size: 13px; }
.record-list { display: grid; gap: 12px; }
.record-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.record-row p { margin: 6px 0 0; }
.record-row .btn { flex-shrink: 0; }
.draft-preview { margin-bottom: 20px; }
.draft-preview dl { display: grid; grid-template-columns: minmax(100px, 1fr) 2fr; gap: 8px 16px; }
.draft-preview dt { color: var(--muted); }
.draft-preview dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
    .entry-workbench { grid-template-columns: 1fr; gap: 16px; }
    .entry-workbench img { justify-self: center; }
    .order-filters .field, .order-filters .search-field { flex: 1 1 100%; min-width: 0; }
    .customer-page .topbar { padding: 12px 16px; }
    .customer-wrap { padding-left: 12px; padding-right: 12px; }
    .customer-page .card, .customer-page .section { padding: 18px; }
    .draft-preview dl { grid-template-columns: 1fr 1fr; }
}
.draft-preview > p, .draft-preview > dl { margin-left: 16px; margin-right: 16px; }

/* bida visa shared brand and page layouts */
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
button, input, select, textarea { font-family: inherit; }
button { line-height: 1.4; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { color: var(--ink); letter-spacing: -.025em; }
h2 { font-size: 18px; margin: 0 0 12px; }
.muted { margin: 6px 0 14px; line-height: 1.7; }
.icon { width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.brand-logo { width: 168px; height: 53px; display: block; object-fit: contain; }
.btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border-radius: 8px; font-size: 13px; font-weight: 600; line-height: 1.4; text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: #f4f7fc; border-color: #a8b9d5; color: var(--primary); }
.btn-primary, .apply-page .btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, .apply-page .btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-danger:hover { color: var(--danger); border-color: #e5a8a8; background: #fff5f5; }
.btn:disabled { pointer-events: none; }
a[aria-disabled="true"] { color: var(--muted); cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-width: 0; max-width: 100%; min-height: 43px; background: #fff; color: var(--ink); border: 1px solid #ccd5e2; border-radius: 8px; padding: 10px 12px; font-size: 14px; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: #5e7eaf; box-shadow: 0 0 0 3px var(--focus); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; flex: 0 0 auto; }
input:disabled, select:disabled, textarea:disabled { background: #f2f4f8; color: var(--muted); cursor: not-allowed; }
input[readonly] { background: #f7f9fc; color: #556682; }
.field { min-width: 0; font-size: 13px; font-weight: 500; gap: 7px; }
.field input, .field select, .field textarea { font-weight: 400; }
.card { border-radius: 12px; padding: 24px; box-shadow: var(--shadow); min-width: 0; }
.grid { gap: 20px; padding: 24px; }
.section > h3 { padding: 18px 24px; background: #fafbfe; font-size: 16px; }
.section > h3 small { font-size: 11px; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 30px 32px 48px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.page-heading h1 { margin: 3px 0 7px; font-size: 28px; font-weight: 700; line-height: 1.35; }
.page-heading .muted { margin: 0; }
.eyebrow { color: #6b7d99; font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.section-title h2 { margin: 0; }
.count-label { font-size: 12px; margin-left: 8px; border-radius: 6px; padding: 3px 8px; background: #eef2f8; color: #677b99; font-weight: 500; letter-spacing: 0; }
.page-footer { padding-top: 28px; font-size: 11px; color: #98a3b5; text-align: center; letter-spacing: .03em; }
.card-heading-icon { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; color: var(--primary); }
.card-heading-icon h2 { margin: 0; }
.card-heading-icon > .icon { width: 22px; height: 22px; }
.notice:empty, .field-error:empty { display: none; }
.notice { padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow-wrap: anywhere; }
.loading-state { padding: 48px; color: var(--muted); text-align: center; }
.empty-state { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty-state .icon { width: 32px; height: 32px; display: block; margin: 0 auto 12px; color: #93a4bf; }
.empty-state strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 5px; }
.empty-state p { margin: 0; font-size: 13px; }
.toast { z-index: 100; max-width: min(420px, calc(100vw - 32px)); background: var(--primary); box-shadow: 0 8px 32px rgba(8,36,91,.18); }

/* Persistent navigation */
.app-sidebar { width: 216px; position: fixed; inset: 0 auto 0 0; z-index: 40; display: flex; flex-direction: column; background: var(--primary); }
.sidebar-brand { height: 88px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line); }
.sidebar-content { display: flex; flex-direction: column; flex: 1; padding: 28px 14px 20px; }
.nav-label { padding: 0 12px; margin: 0 0 13px; color: #8297b8; font-size: 10px; letter-spacing: .08em; font-weight: 600; }
.app-nav-link { min-height: 46px; display: flex; align-items: center; gap: 12px; margin-bottom: 6px; padding: 12px 16px; border-radius: 8px; color: #b5c3d9; font-size: 13px; }
.app-nav-link:hover { background: #173767; color: #fff; }
.app-nav-link.active { color: #fff; background: #214173; font-weight: 600; }
.sidebar-footer { display: flex; align-items: center; gap: 12px; margin-top: auto; padding: 20px 8px 0; border-top: 1px solid #234273; color: #dce5f3; }
.sidebar-footer strong { font-weight: 500; font-size: 13px; }
.sidebar-footer small { display: block; font-size: 10px; color: #8297b8; margin-top: 2px; }
.sidebar-monogram { width: 34px; height: 34px; background: #274577; border: 1px solid #3e5a85; border-radius: 10px; display: grid; place-items: center; font-size: 24px; line-height: 1; font-weight: 500; }
.app-workspace { margin-left: 216px; min-width: 0; }
.topbar { min-height: 88px; padding: 18px 32px; background: #fff; }
.topbar-title { display: flex; flex-direction: column; gap: 3px; }
.topbar-title .eyebrow { margin: 0; font-size: 9px; }
.topbar-title strong { font-size: 16px; font-weight: 600; }
.mobile-brand { display: none; }

/* Login and order worklist */
.auth-view .app-sidebar { display: none; }
.auth-view .app-workspace { margin-left: 0; }
.auth-view .mobile-brand { display: block; }
.auth-view .topbar { padding-left: max(32px, calc((100vw - 1200px) / 2)); }
.auth-view .topbar-title { margin-left: 12px; margin-right: auto; }
.auth-view .page-footer { margin-top: 20px; }
.login-layout { display: grid; grid-template-columns: 1.2fr 1fr; max-width: 1120px; margin: 36px auto 20px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 48px rgba(24,42,72,.06); overflow: hidden; }
.login-story { position: relative; padding: 46px 44px 260px; overflow: hidden; background: #eef2f8; }
.login-story h1 { font-size: 34px; line-height: 1.4; margin: 18px 0; color: var(--primary); }
.login-story > p:not(.eyebrow) { color: #64748d; font-size: 14px; line-height: 1.9; }
.login-feature-list { display: flex; flex-direction: column; gap: 14px; margin-top: 26px; }
.login-feature-list > div { display: flex; align-items: center; gap: 12px; color: #4c6284; font-size: 13px; }
.login-feature-list .icon { color: #3e5e90; }
.login-layout .auth-card { max-width: none; width: 100%; margin: 0; padding: 56px 42px; align-self: center; border: 0; border-radius: 0; box-shadow: none; }
.auth-card h2, .auth-dialog h2 { font-size: 26px; margin: 10px 0; }
.auth-card > .muted { margin-bottom: 30px; font-size: 13px; }
.auth-card .auth-submit { margin-top: 8px; min-height: 46px; }
.auth-login-form { gap: 20px; }
.auth-code-row { gap: 10px; align-items: flex-end; }
.auth-code-row .btn { min-height: 43px; }
.auth-dialog { border: 1px solid var(--line); box-shadow: 0 24px 80px rgba(8,36,91,.2); }
.auth-dialog .brand-logo { width: 132px; height: 42px; margin-bottom: 18px; }
.auth-dialog .auth-submit { min-height: 44px; }
.auth-wechat { border-top: 1px solid var(--line); margin-top: 24px; }
.auth-notice { font-size: 12px; overflow-wrap: anywhere; }
.login-art { position: absolute; height: 225px; left: 0; bottom: 0; width: 100%; overflow: hidden; }
.orbit { position: absolute; width: 440px; height: 440px; border: 1px solid #d4dfef; border-radius: 50%; left: 110px; top: 40px; }
.orbit-two { width: 560px; height: 560px; top: 5px; left: 55px; }
.art-document { width: 240px; height: 180px; border-radius: 10px; background: #fff; border: 1px solid #dbe3ef; box-shadow: 0 14px 30px rgba(38,62,100,.08); position: absolute; left: 75px; bottom: -18px; transform: rotate(-7deg); padding: 24px; }
.art-top { display: flex; justify-content: space-between; color: var(--primary); font-size: 9px; letter-spacing: .1em; font-weight: 700; }
.art-top span { color: #8997ae; }
.art-line { width: 145px; height: 5px; border-radius: 4px; background: #e2e9f3; margin-top: 18px; }
.art-line.short { width: 80px; margin-top: 7px; }
.art-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.art-grid i { height: 16px; border-radius: 4px; background: #f0f3f8; }
.art-check { position: absolute; right: -15px; top: 66px; width: 44px; height: 44px; display: grid; place-items: center; color: #fff; border-radius: 12px; background: var(--primary); font-size: 22px; box-shadow: 0 7px 16px rgba(8,36,91,.2); }
.orders-card { padding: 0; overflow: hidden; }
.orders-card > .section-title { padding: 24px 24px 0; }
.orders-card .section-title .muted { margin: 4px 0 0; font-size: 12px; }
.order-filters { padding: 0 24px; margin: 20px 0 24px; }
.order-filters .field { min-width: 125px; }
.order-filters .search-field { min-width: 200px; }
.table-scroll { max-width: 100%; }
th { background: #f7f9fc; font-size: 11px; white-space: nowrap; padding: 13px 16px; font-weight: 600; color: #74839a; }
td { padding: 17px 16px; font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcff; }
td .btn { font-size: 12px; min-height: 32px; padding: 6px 10px; }
.order-progress { color: #8995a8; font-size: 11px; }
.badge { padding: 4px 9px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge.awaiting_customer, .status-badge.awaiting_customer { background: #eef2f8; color: #667a99; }
.badge.awaiting_review { background: #fff5df; color: #9b690a; }
.badge.customer_changes { background: #fff0ed; color: #b4513d; }
.badge.approved, .status-badge.approved, .badge.filled { background: #ebf6ef; color: var(--ok); }
.badge.awaiting_signature, .status-badge.awaiting_signature { background: var(--primary-soft); color: var(--primary); }
.badge.cancelled { background: #f0f1f4; color: #7b8595; }
.entry-workbench { grid-template-columns: 44px minmax(0,1fr) 140px; gap: 22px; margin-top: 24px; align-items: start; }
.entry-icon { width: 44px; height: 44px; display: grid; place-items: center; background: var(--primary-soft); border-radius: 10px; color: var(--primary); }
.entry-copy h2 { font-size: 16px; }
.entry-copy > .muted { margin: 5px 0 14px; font-size: 12px; }
.entry-copy .field { margin-bottom: 14px; }
.entry-qr { display: flex; align-items: center; flex-direction: column; gap: 8px; font-size: 12px; color: var(--muted); }
.entry-workbench img { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: 140px; height: 140px; background: #fff; box-shadow: 0 6px 18px rgba(8, 36, 91, .08); }
.entry-status.active { color: var(--ok); background: #ebf6ef; }

/* Administration and account */
.manage-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; padding: 6px; background: #eaf0f7; border: 1px solid var(--line); border-radius: 10px; width: fit-content; max-width: 100%; }
.manage-tab { display: flex; align-items: center; gap: 8px; padding: 10px 17px; border: 0; border-radius: 7px; color: #6b7e9a; background: transparent; cursor: pointer; font-size: 13px; font-weight: 600; }
.manage-tab[aria-selected="true"] { background: #fff; color: var(--primary); box-shadow: 0 2px 6px rgba(24,42,72,.06); }
.management-section { display: grid; gap: 20px; }
.management-section .card > .grid { padding: 4px 0 20px; }
.management-section .table-scroll table { min-width: 650px; }
.management-section .table-card { padding: 0; overflow: hidden; }
.table-card .section-title { padding: 24px; }
.management-section .form-actions { display: flex; justify-content: flex-end; }
.management-section textarea { min-height: 230px; font-family: ui-monospace, monospace; font-size: 12px; }
.management-section .radios { font-size: 12px; }
.management-section .radios label { font-size: 12px; }
.account-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.2fr); gap: 24px; align-items: start; max-width: 1120px; }
.account-profile { padding-bottom: 12px; }
.account-avatar { width: 44px; height: 44px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); border-radius: 12px; }
.account-summary { margin: 20px 0 0; display: block; }
.account-summary-row { display: grid; grid-template-columns: 90px minmax(0,1fr); gap: 16px; padding: 17px 0; border-top: 1px solid var(--line); }
.account-summary-row dt { margin: 0; color: var(--muted); font-size: 12px; }
.account-summary-row dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; font-size: 13px; }
.account-security { display: grid; gap: 20px; }
.account-security .muted { font-size: 13px; }
.account-security .top-actions { margin-top: 20px; }
.account-security .field-hint { margin-top: 14px; }

/* Applicant-facing pages */
.customer-header, .document-brandbar, .workbench-brandbar { display: flex; align-items: center; gap: 20px; padding: 14px 32px; min-height: 78px; border-bottom: 1px solid var(--line); background: #fff; }
.customer-header { padding-left: max(24px, calc((100vw - 1000px) / 2)); padding-right: max(24px, calc((100vw - 1000px) / 2)); }
.customer-header-label { font-size: 12px; color: #7b89a0; padding-left: 20px; border-left: 1px solid var(--line); }
.customer-header #saveState { margin-left: auto; color: #5e7394; font-size: 12px; }
.customer-wrap { max-width: 1000px; padding-top: 32px; }
.customer-wrap > .card { margin-bottom: 24px; }
.customer-entry { padding: 0; overflow: hidden; }
.customer-intro { padding: 32px; border-bottom: 1px solid var(--line); background: #fafbfe; }
.customer-page h1 { font-size: 27px; margin: 10px 0; line-height: 1.4; }
.customer-intro > .muted { font-size: 13px; }
.intake-steps { display: flex; gap: 28px; margin-top: 24px; font-size: 12px; color: #96a2b5; }
.intake-steps span { display: flex; align-items: center; gap: 8px; }
.intake-steps b { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; background: #eaf0f7; font-size: 11px; font-weight: 600; }
.intake-steps .current { color: var(--primary); font-weight: 600; }
.intake-steps .current b { background: var(--primary); color: #fff; }
.customer-entry #intakeForm { padding: 8px 8px 28px; }
.intake-footer { padding: 0 24px; }
.intake-footer .btn { min-width: 160px; margin-top: 12px; }
.resume-card h2 { font-size: 16px; }
.resume-card .card-heading-icon { margin-bottom: 8px; align-items: flex-start; }
.resume-card .card-heading-icon .icon { margin-top: 4px; }
.resume-card .card-heading-icon p { font-size: 12px; margin: 4px 0 0; }
.resume-controls { display: flex; align-items: flex-end; gap: 10px; margin-top: 14px; }
.resume-controls .field { flex: 1; }
.resume-controls .btn { flex-shrink: 0; min-height: 43px; }
.resume-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; font-size: 12px; }
.resume-meta p { margin: 0; }
.customer-form-heading { margin: 30px 0 22px; }
.customer-form-heading .muted { font-size: 13px; }
.customer-page .tabs { background: #fff; padding: 5px 8px 0; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 20px; }
.customer-page .tab { padding: 13px 15px; font-size: 13px; }
.customer-page .section { border-radius: 12px; margin: 0 0 20px; padding: 0; box-shadow: var(--shadow); }
.customer-page .section h3 small { display: block; margin-left: 0; margin-top: 3px; }
.customer-page .field .en { display: block; margin-left: 0; color: #8a97ab; font-size: 11px; font-weight: 400; }
.customer-photo .field { color: var(--muted); }
.customer-submit-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; margin-top: 16px; }
.message-card { padding: 24px; color: #556b8d; border-left: 3px solid var(--primary); }
.record-row { align-items: flex-start; }
.record-row:last-child { border-bottom: 0; }
.result-wrap { max-width: 600px; padding: 24px; margin: 64px auto; }
.result-card { text-align: center; padding: 44px 32px; }
.result-symbol { width: 64px; height: 64px; background: var(--primary-soft); color: var(--primary); border-radius: 50%; display: grid; place-items: center; margin: 0 auto 26px; }
.result-symbol .icon { width: 30px; height: 30px; }
.result-card[data-result="success"] .result-symbol { background: #ebf6ef; color: var(--ok); }
.result-card[data-result="error"] .result-symbol { background: #fff0ed; color: var(--danger); }
.result-card h1 { font-size: 25px; margin: 12px 0; }
.result-card #result { color: var(--muted); font-size: 14px; min-height: 44px; }
.result-card .top-actions { justify-content: center; margin-top: 26px; }

/* Review workspace */
.workbench-brandbar { min-height: 72px; padding: 9px 32px; }
.workbench-brandbar > span { color: #7b89a0; border-left: 1px solid var(--line); padding-left: 20px; font-size: 12px; }
.workbench-account { margin-left: auto; display: flex; align-items: center; gap: 6px; color: #6b7d99; font-size: 12px; }
.workbench-header { align-items: flex-start; padding: 20px 32px; gap: 24px; backdrop-filter: none; background: #fff; }
.workbench-identity { flex: 0 1 390px; align-items: flex-start; }
.workbench-identity > div { min-width: 0; }
.identity-line { flex-wrap: wrap; }
.identity-meta { flex-wrap: wrap; gap: 6px 16px; }
.identity-line h1 { font-size: 20px; }
.header-actions { flex: 1; flex-direction: column; align-items: flex-end; }
.action-group { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.secondary-actions { order: 2; }
.primary-actions { order: 1; }
.secondary-actions .btn { font-size: 12px; padding: 7px 10px; min-height: 34px; }
.workbench-shell { margin-top: 28px; }
.workbench-nav { background: var(--primary); border-color: var(--primary); padding: 20px 10px; top: var(--workbench-offset, 160px); max-height: calc(100vh - var(--workbench-offset, 160px) - 16px); }
.workbench-nav .nav-label { color: #8297b8; padding-left: 10px; }
.workbench-nav .side-tab { color: #c1cee2; min-height: 49px; }
.workbench-nav .side-tab:hover, .workbench-nav .tool-link:hover { background: #173767; }
.workbench-nav .side-tab-group.active > .side-tab { color: #fff; background: #214173; }
.workbench-nav .side-tab small { color: #8297b8; }
.workbench-nav .side-tab i { color: #9daec9; }
.workbench-nav .side-sections { border-color: #2a4876; }
.workbench-nav .side-sections button { color: #9aacc9; }
.workbench-nav .side-sections button:hover { color: #fff; }
.workbench-nav .tool-links { border-color: #294572; }
.workbench-nav .tool-links-title { color: #8297b8; }
.workbench-nav .tool-link { color: #c1cee2; font-size: 12px; }
.workbench-nav .tool-icon { background: #214173; color: #b6c9e6; }
.workbench-nav .tool-icon .icon { width: 16px; height: 16px; }
.workbench-nav .tool-state { color: #8297b8; }
.workbench-nav .tool-state.complete { color: #d4e3d9; }
.content-heading { min-height: 70px; }
.save-state[data-state="saved"], .tool-state.complete, .completion-pill.complete { color: var(--ok); }
.save-state[data-state="saved"]::before, .task-indicator.succeeded { background: var(--ok); }
.completion-pill.complete { background: #ebf6ef; }
.validation-summary.success strong { color: var(--ok); }
.apply-page .toast.success { background: var(--ok); }
.apply-page .section { scroll-margin-top: var(--workbench-offset, 170px); }
.apply-page .field { scroll-margin-top: var(--workbench-offset, 170px); }
.scheduling-actions { flex-wrap: wrap; }
.photo-copy { min-width: 0; }
.task-strip { box-shadow: none; }
.task-drawer { box-shadow: none; }
.task-drawer.open { box-shadow: -18px 0 45px rgba(24, 42, 72, .16); }
.workbench-dialog { max-height: 90vh; overflow-y: auto; border-radius: 12px; }

@media (max-width: 1100px) {
    .app-sidebar { width: 190px; }
    .app-workspace { margin-left: 190px; }
    .wrap { padding: 26px 24px 40px; }
    .topbar { padding: 16px 24px; }
    .account-layout { grid-template-columns: 1fr; }
    .login-story { padding-left: 32px; padding-right: 32px; }
    .login-layout .auth-card { padding: 40px 30px; }
}
@media (max-width: 960px) {
    .app-sidebar { position: static; width: 100%; }
    .sidebar-brand, .sidebar-footer, .sidebar-content > .nav-label { display: none; }
    .sidebar-content { padding: 8px 16px; }
    .sidebar-content nav { display: flex; gap: 8px; }
    .app-nav-link { min-height: 40px; margin: 0; padding: 10px 12px; }
    .app-workspace { margin-left: 0; }
    .topbar { min-height: 76px; }
    .mobile-brand { display: block; }
    .topbar-title { margin-right: auto; }
    .topbar-title .eyebrow { display: none; }
    .brand-logo { width: 144px; height: 46px; }
    .login-layout { margin-top: 18px; }
    .login-story h1 { font-size: 29px; }
}
@media (max-width: 900px) {
    .workbench-header { position: relative; }
    .workbench-identity { flex-basis: auto; width: 100%; }
    .header-actions { align-items: flex-start; }
    .action-group { justify-content: flex-start; }
    .workbench-nav { top: 0; padding: 10px 12px; max-height: none; }
    .workbench-nav > .nav-label { display: none; }
    .workbench-nav .mobile-nav-label { color: #fff; }
    .apply-page .field, .apply-page .section { scroll-margin-top: 78px; }
}
@media (max-width: 640px) {
    body { font-size: 13px; }
    .wrap { padding: 22px 16px 32px; }
    .topbar { padding: 12px 16px; gap: 10px; flex-wrap: wrap; position: relative; }
    .topbar-title { font-size: 12px; }
    .topbar-title strong { font-size: 13px; }
    .topbar .top-actions { width: 100%; padding-top: 10px; border-top: 1px solid var(--line); }
    .topbar .btn { min-height: 32px; padding: 6px 11px; font-size: 12px; }
    .app-nav-link { font-size: 12px; gap: 6px; padding: 9px 10px; }
    .app-nav-link .icon { width: 16px; height: 16px; }
    .card { padding: 20px; }
    .grid { grid-template-columns: 1fr; padding: 20px; gap: 18px; }
    .page-heading { margin-bottom: 20px; }
    .page-heading h1 { font-size: 24px; }
    .page-heading .muted { font-size: 12px; }
    .auth-view .topbar { padding-left: 20px; }
    .auth-view .topbar-title { display: none; }
    .auth-wechat { display: none; }
    .login-layout { grid-template-columns: 1fr; margin: 0; border-radius: 12px; }
    .login-story { padding: 24px; }
    .login-story h1 { font-size: 27px; margin: 12px 0; }
    .login-story > p:not(.eyebrow) { font-size: 12px; margin: 0; }
    .login-feature-list, .login-art { display: none; }
    .login-layout .auth-card { padding: 28px 24px; }
    .auth-card h2 { font-size: 23px; }
    .auth-card > .muted { margin-bottom: 22px; }
    .orders-card { padding: 0; }
    .orders-card > .section-title { padding: 20px 20px 0; }
    .order-filters { padding: 0 20px; }
    .order-filters .field, .order-filters .search-field { min-width: 0; flex: 1 1 100%; }
    .order-filters > .btn { width: 100%; }
    .entry-workbench { grid-template-columns: minmax(0,1fr) 84px; gap: 12px; padding: 20px; }
    .entry-icon { display: none; }
    .entry-copy { grid-column: 1 / -1; }
    .entry-copy .top-actions { gap: 6px; }
    .entry-copy .btn { font-size: 12px; padding: 8px 10px; }
    .entry-qr { grid-column: 1 / -1; align-items: flex-start; }
    .entry-workbench img { width: 96px; height: 96px; }
    .manage-tabs { width: 100%; gap: 4px; }
    .manage-tab { padding: 9px 10px; font-size: 12px; }
    .manage-tab .icon { width: 15px; height: 15px; }
    .table-card .section-title { padding: 20px; }
    .account-layout { gap: 20px; }
    .account-summary-row { gap: 8px; grid-template-columns: 78px minmax(0,1fr); }
    .customer-header, .document-brandbar, .workbench-brandbar { padding: 12px 16px; gap: 12px; flex-wrap: wrap; min-height: 70px; }
    .customer-header-label { padding-left: 12px; font-size: 10px; }
    .customer-header #saveState { width: 100%; font-size: 11px; margin-top: -2px; }
    .customer-page .card { padding: 20px; }
    .customer-page .customer-entry { padding: 0; }
    .customer-intro { padding: 24px 20px; }
    .customer-page h1 { font-size: 23px; }
    .intake-steps { gap: 16px; font-size: 11px; }
    .intake-steps span { gap: 5px; }
    .intake-steps b { width: 21px; height: 21px; }
    .customer-entry #intakeForm { padding: 0 0 22px; }
    .intake-footer { padding: 0 20px; }
    .intake-footer .btn { width: 100%; }
    .resume-controls { flex-wrap: wrap; }
    .resume-controls .field { flex-basis: 100%; }
    .resume-meta { align-items: flex-start; flex-direction: column; gap: 8px; }
    .customer-page .section { padding: 0; }
    .customer-page .section > h3 { padding: 16px 20px; }
    .customer-page .customer-form-heading { margin-top: 28px; }
    .customer-page .tab { padding: 12px 14px; }
    .customer-submit-bar { position: sticky; bottom: 0; z-index: 25; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: block; box-shadow: 0 -5px 22px rgba(24,42,72,.06); }
    .customer-submit-bar > span { display: block; margin-bottom: 8px; font-size: 11px; }
    .customer-submit-bar .top-actions { flex-wrap: wrap; }
    .customer-submit-bar .btn { flex: 1; padding: 9px 10px; }
    .result-wrap { padding: 16px; margin-top: 32px; }
    .result-card { padding: 36px 24px; }
    .workbench-brandbar > span { padding-left: 12px; font-size: 11px; }
    .workbench-account { font-size: 11px; }
    .workbench-header { padding: 16px; }
    .workbench-identity { gap: 10px; }
    .header-actions { overflow: visible; display: flex; flex-wrap: wrap; }
    .action-group { width: 100%; }
    .secondary-actions { flex-wrap: wrap; }
    .header-actions .btn { white-space: normal; }
    .header-actions .btn-primary { display: inline-flex; }
    .header-actions #btnStop { display: inline-flex; }
    .primary-actions .btn:not(.btn-primary) { display: inline-flex; }
    .primary-actions:has(> .btn-primary:not([hidden])) { min-height: 0; }
    .workbench-shell { margin-top: 18px; }
    .content-heading { gap: 10px; }
    .content-heading h2 { font-size: 21px; }
    .completion-pill { white-space: normal; max-width: 120px; text-align: center; }
    .mobile-action-bar { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
    .apply-page .toast, .customer-page .toast { bottom: 90px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.workspace-overview { margin-bottom: 24px; }
.welcome-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.welcome-card h2 { font-size: 26px; margin: 8px 0; }
.service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.service-card { padding: 32px; }
.service-card h2 { margin: 18px 0 12px; font-size: 24px; }
.service-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.service-count { display: block; font-size: 44px; font-weight: 650; margin-top: 22px; color: var(--primary); }
.service-metrics { display: flex; flex-wrap: wrap; gap: 16px; padding: 20px 0; margin: 18px 0 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.service-metrics a, .service-metrics span { color: var(--muted); text-decoration: none; }
.service-metrics b { color: var(--ink); padding-left: 6px; }
.staff-inline-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.staff-inline-nav .app-nav-link { padding: 8px 12px; margin: 0; color: var(--primary); border-radius: 8px; font-size: 13px; }
.staff-inline-nav .app-nav-link.active { background: var(--primary-soft); color: var(--primary); }
.staff-inline-nav .icon { display: none; }
.appointment-summary, .appointment-fields { margin-bottom: 24px; }
.appointment-summary h2, .appointment-fields h2, #appointmentLogs h2 { margin: 0 0 20px; font-size: 19px; }
.appointment-summary .grid { margin-top: 20px; }
.appointment-summary .grid, .appointment-fields .grid { padding: 0; }
.appointment-page .tool-card .grid { padding: 16px 0; }
.appointment-page .tool-card { background: var(--card); padding: 28px; border: 1px solid var(--line); border-radius: 12px; margin: 24px 0; }
.appointment-page .page-heading { gap: 20px; flex-wrap: wrap; }
.appointment-page .page-heading > div { min-width: 0; }
.appointment-page .page-heading h1 { overflow-wrap: anywhere; }
#appointmentMeta { overflow-wrap: anywhere; }
.appointment-section-nav { display: flex; flex-wrap: wrap; gap: 20px; padding: 16px 0; position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.appointment-section-nav a { text-decoration: none; color: var(--primary); font-weight: 600; }
.appointment-section-nav span { color: var(--muted); font-size: 12px; font-weight: 400; padding-left: 6px; }
.source-notice { padding: 12px 16px; border-radius: 8px; background: #fff7e6; color: var(--warn); }
.activity-row { display: flex; justify-content: space-between; gap: 20px; padding: 16px 0; border-top: 1px solid var(--line); }
.activity-row div { min-width: 0; overflow-wrap: anywhere; }
.activity-row p { margin: 6px 0 0; }
.activity-row small { color: var(--muted); flex-shrink: 0; }
.badge.needs_review, .badge.incomplete { background: #fff7e6; color: var(--warn); }
.badge.awaiting_payment, .badge.awaiting_signup, .badge.awaiting_pages { background: var(--primary-soft); color: var(--primary); }
.badge.failed { background: #fff0ef; color: var(--danger); }
.badge.registering, .badge.processing { background: #e6f5ee; color: var(--ok); }
#syncDialog { width: min(800px, calc(100vw - 32px)); }
#syncDialog td { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 720px) {
    .sidebar-content nav { flex-wrap: wrap; }
    .app-nav-link { flex: 0 0 auto; white-space: nowrap; }
    .service-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .service-card { padding: 24px; }
    .welcome-card { display: block; }
    .welcome-card > .badge { margin-top: 12px; }
    .staff-inline-nav { width: 100%; margin: 0; gap: 4px; }
    .staff-inline-nav .app-nav-link { padding: 6px 8px; font-size: 12px; }
    .appointment-page .tool-card { padding: 20px; }
    .appointment-section-nav { gap: 12px; font-size: 13px; }
    .activity-row { flex-direction: column; gap: 6px; }
}
/* Local passport recognition and editable review. */
.passport-card, .passport-intake { margin-bottom: 24px; }
.passport-card h3, .passport-intake h3 { margin-top: 0; }
.passport-intake { padding: 20px; background: var(--bg, #f5f7fb); border-radius: 12px; }
.passport-preview { max-height: 320px; overflow: auto; margin: 16px 0; border: 1px solid #dce3ec; border-radius: 10px; background: #f7f9fc; text-align: center; }
.passport-preview canvas { display: block; width: auto; max-width: 100%; max-height: 310px; margin: auto; }
.passport-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
/* 护照上传/识别分阶段进度:定位卡在哪一步。 */
.passport-trace { margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; }
.passport-trace[hidden] { display: none; }
.passport-trace > summary { padding: 9px 12px; cursor: pointer; color: var(--muted); line-height: 1.5; }
.passport-trace-list { margin: 0; padding: 0 12px 8px; list-style: none; }
.passport-trace-item { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 2px 8px; padding: 6px 0; border-top: 1px dashed var(--line); line-height: 1.5; }
.passport-trace-icon { font-weight: 700; text-align: center; color: var(--muted); }
.passport-trace-time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.passport-trace-detail, .passport-trace-hint { grid-column: 2 / 4; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.passport-trace-hint { color: var(--warn); }
.passport-trace-item.is-running .passport-trace-icon, .passport-trace-item.is-running .passport-trace-label { color: var(--primary); font-weight: 600; }
.passport-trace-item.is-done .passport-trace-icon { color: var(--ok); }
.passport-trace-item.is-failed .passport-trace-icon, .passport-trace-item.is-failed .passport-trace-label { color: var(--danger); }
.passport-trace-item.is-failed .passport-trace-detail { color: var(--danger); }
.passport-trace-footer { padding: 0 12px 10px; }
.passport-trace-footer[hidden] { display: none; }
.passport-dialog .passport-trace { flex: 0 0 auto; margin: 0 28px 12px; }
.passport-warning { padding: 10px 12px; border-radius: 8px; background: #fff5df; color: #795218; font-size: 13px; line-height: 1.6; }
.passport-dialog { width: min(1080px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: 90vh; max-height: 90dvh; overflow: hidden; color: var(--ink); }
.passport-dialog .dialog-card { display: flex; flex-direction: column; max-height: 90vh; max-height: 90dvh; padding: 0; }
.passport-dialog .dialog-heading { flex: 0 0 auto; padding: 24px 28px 20px; border-bottom: 1px solid var(--line); }
.passport-dialog .dialog-heading h2 { font-size: 23px; line-height: 1.4; }
.passport-title-copy { min-width: 0; }
.passport-title-copy .field-hint { margin: 8px 0 0; line-height: 1.7; }
.passport-eyebrow { margin: 0 0 6px; color: var(--primary); font-size: 11px; font-weight: 600; letter-spacing: .08em; }
.passport-review-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.5fr); gap: 28px; padding: 24px 28px; align-items: start; }
.passport-source { position: sticky; top: 0; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #f6f8fb; }
.passport-result-group h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.passport-source summary { cursor: pointer; font-size: 15px; font-weight: 600; line-height: 1.6; }
.passport-source-content { margin-top: 14px; }
.passport-source canvas { display: block; width: 100%; height: auto; border-radius: 6px; background: #fff; }
.passport-source .field-hint { margin: 12px 0 0; line-height: 1.8; }
.passport-review-fields { min-width: 0; }
.passport-review-warnings { margin-bottom: 20px; padding: 12px 14px; border: 1px solid #eddfba; border-radius: 10px; background: #fff9ec; color: #795218; font-size: 12px; line-height: 1.7; }
.passport-review-warnings strong { font-size: 13px; }
.passport-review-warnings ul { margin: 6px 0 0; padding-left: 18px; }
.passport-review-warnings li + li { margin-top: 4px; }
.passport-result-group + .passport-result-group { margin-top: 24px; }
.passport-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.passport-dialog .passport-result { display: flex; flex-direction: column; gap: 8px; margin: 0; border: 1px solid #dce3ec; border-radius: 10px; padding: 12px; min-width: 0; background: #fafbfc; }
.passport-dialog .passport-result.is-selected { border-color: #b7c9dd; background: #fff; }
.passport-dialog .passport-result-conflict { border-color: #e4cd9b; background: #fffaf0; }
.passport-dialog label.passport-result-selection { display: flex; align-items: center; gap: 8px; min-height: 24px; margin: 0; font-size: 13px; line-height: 1.5; cursor: pointer; }
.passport-result-selection input[type="checkbox"] { width: 16px; height: 16px; margin: 0; flex: 0 0 auto; accent-color: var(--primary); }
.passport-result > input, .passport-result > select { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 10px; border: 1px solid #ccd5e2; border-radius: 7px; font-size: 14px; background: #fff; color: var(--ink); }
.passport-result input:focus-visible, .passport-result select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.passport-confidence { color: var(--muted); font-size: 11px; line-height: 1.5; }
.passport-confidence.verified { color: #42654c; }
.passport-existing { color: #795218; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.passport-dialog .passport-review-footer { flex: 0 0 auto; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 0; padding: 16px 28px; border-top: 1px solid var(--line); background: #fff; }
.passport-review-footer .field-error { flex-basis: 100%; margin: 0; font-size: 13px; }
.passport-review-footer .field-error:empty { display: none; }
.passport-selection-summary { margin: 0 auto 0 0; font-size: 13px; color: var(--muted); }
.passport-review-footer .btn { min-height: 44px; }
@media (max-width: 760px) {
    .passport-dialog { width: calc(100vw - 20px); max-width: calc(100vw - 20px); }
    .passport-dialog .dialog-heading { padding: 18px 16px 14px; gap: 10px; }
    .passport-dialog .dialog-heading h2 { font-size: 19px; }
    .passport-dialog .dialog-heading > .btn { padding: 8px 12px; min-height: 40px; flex-shrink: 0; }
    .passport-review-body { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 16px; }
    .passport-source { position: static; padding: 12px; }
    .passport-source summary::after { content: '展开对照'; float: right; color: var(--muted); font-size: 12px; font-weight: 400; }
    .passport-source[open] summary::after { content: '收起'; }
    .passport-source canvas { max-height: 200px; object-fit: contain; }
    .passport-results { gap: 10px; }
    .passport-dialog .passport-result { padding: 10px; }
    .passport-dialog .passport-review-footer { padding: 12px 16px; }
}
@media (max-width: 420px) {
    .passport-results { grid-template-columns: minmax(0, 1fr); }
}
