:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8faff;
    --ink: #182033;
    --muted: #697386;
    --muted-2: #98a2b3;
    --line: #e8ebf2;
    --blue: #3367e8;
    --blue-dark: #2352ca;
    --blue-soft: #edf3ff;
    --green: #138a5b;
    --green-soft: #eaf8f1;
    --orange: #d76b18;
    --orange-soft: #fff3e8;
    --red: #d14646;
    --red-soft: #fff0f0;
    --purple: #7652d9;
    --purple-soft: #f2edff;
    --shadow: 0 12px 34px rgba(35, 49, 82, .07);
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html.session-hint .boot-screen { display: none !important; }
html.session-hint #appShell[hidden] { display: block !important; }
body { margin: 0; min-width: 320px; background: var(--bg); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-shell { min-height: 100vh; }
.topbar { height: 76px; padding: 0 max(24px, calc((100vw - 1540px) / 2)); display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: white; background: linear-gradient(145deg, #4b91ee, #3475dc); box-shadow: 0 8px 18px rgba(51,103,232,.24); }
.brand-mark svg { width: 27px; height: 27px; fill: currentColor; stroke: none; }
.brand strong { display: block; font-size: 17px; letter-spacing: -.2px; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.language-picker { height: 38px; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; color: #59657d; border: 1px solid var(--line); border-radius: 10px; background: white; }
.language-picker:focus-within { color: var(--blue); border-color: #adc2f5; box-shadow: 0 0 0 3px rgba(51,103,232,.08); }
.language-icon { font-size: 11px; font-weight: 800; }
.language-picker select { max-width: 92px; color: #34415b; border: 0; outline: 0; background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.current-user { min-width: 84px; padding: 5px 10px; border-left: 1px solid var(--line); }
.current-user strong, .current-user small { display: block; }
.current-user strong { max-width: 120px; color: #303b52; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.current-user small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.admin-nav-button { min-height: 38px; padding: 0 12px; font-size: 12px; }
.mobile-admin-actions { display: none; gap: 8px; margin: -14px 0 18px; }
.mobile-admin-actions .secondary-button { min-height: 36px; padding: 0 12px; font-size: 11px; }
.primary-button, .secondary-button, .icon-button { border: 0; border-radius: 10px; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 650; transition: .2s ease; }
.primary-button { padding: 0 18px; color: white; background: var(--blue); box-shadow: 0 7px 16px rgba(51,103,232,.2); }
.primary-button:hover { background: var(--blue-dark); transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; transform: none; cursor: not-allowed; }
.secondary-button { padding: 0 17px; color: #44506a; background: white; border: 1px solid #dfe3ec; }
.secondary-button:hover { border-color: #bbc5d6; background: #fafbfe; }
.icon-button { width: 42px; padding: 0; color: #5e6980; background: transparent; border: 1px solid var(--line); }
.icon-button:hover { color: var(--blue); border-color: #cdd9f6; background: var(--blue-soft); }
.icon-button.loading svg { animation: spin .8s linear infinite; }
main { max-width: 1540px; margin: 0 auto; padding: 42px 24px 70px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: 1.4px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 3vw, 38px); letter-spacing: -1.1px; }
.subheading { margin-bottom: 0; color: var(--muted); }
.sync-card { min-width: 286px; display: flex; align-items: center; gap: 12px; padding: 14px 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.75); }
.live-dot { width: 9px; height: 9px; border-radius: 99px; background: #25b779; box-shadow: 0 0 0 5px rgba(37,183,121,.12); }
.sync-card strong, .sync-card small { display: block; }
.sync-card strong { font-size: 13px; }
.sync-card small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 3px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; display: flex; align-items: center; gap: 7px; padding: 9px 12px; color: var(--muted); background: transparent; border: 0; border-radius: 9px; font-size: 13px; font-weight: 650; }
.tab span { min-width: 20px; padding: 2px 6px; border-radius: 99px; color: #7c869a; background: #e9edf4; font-size: 10px; }
.tab svg { width: 15px; height: 15px; }
.tab:hover { color: var(--ink); background: rgba(255,255,255,.8); }
.tab.active { color: var(--blue); background: white; box-shadow: 0 4px 16px rgba(42,55,83,.07); }
.tab.active span { color: white; background: var(--blue); }
.tab-alert-dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px rgba(209,70,70,.1); }
.updated-tab.has-updates .tab-alert-dot { display: inline-block; }
.updated-tab.has-updates:not(.active) { color: #b33d3d; }
.archive-tab { margin-left: 3px; border-left: 1px solid #dde2eb; border-radius: 0 9px 9px 0; }
.toolbar-filters { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; }
.remark-filter { height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; background: white; font-size: 11px; font-weight: 700; }
.remark-filter:focus-within { border-color: #adc2f5; box-shadow: 0 0 0 3px rgba(51,103,232,.08); }
.remark-filter select { min-width: 76px; color: #34415b; border: 0; outline: 0; background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.search-box { width: 270px; flex: 0 0 270px; height: 42px; display: flex; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--muted-2); }
.search-box:focus-within { border-color: #adc2f5; box-shadow: 0 0 0 3px rgba(51,103,232,.08); }
.search-box svg { width: 17px; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.bulk-archive-bar { min-height: 48px; display: flex; align-items: center; gap: 16px; margin-bottom: 12px; padding: 8px 12px 8px 16px; color: #526078; border: 1px solid #d8e3f8; border-radius: 12px; background: #f5f8ff; font-size: 12px; }
.bulk-archive-bar[hidden] { display: none; }
.bulk-select-all { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.bulk-select-all input, .shipment-select input { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; }
.bulk-selected-summary { margin-right: auto; }
.bulk-selected-summary strong { color: var(--blue); }
.bulk-archive-bar .secondary-button { min-height: 34px; padding: 0 14px; font-size: 11px; }
.bulk-archive-bar .secondary-button:disabled { color: #a9b1c0; background: #eef1f6; cursor: not-allowed; }
.unread-bulk-bar { border-color: #f1d2d2; background: #fff8f8; }
.unread-bulk-bar .bulk-selected-summary strong { color: var(--red); }
.shipments-panel { border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.66); box-shadow: var(--shadow); overflow: hidden; }
.list-header, .shipment-row { display: grid; grid-template-columns: minmax(132px,.72fr) minmax(210px,1.2fr) minmax(290px,1.85fr) minmax(95px,.55fr) minmax(180px,1fr) 42px; gap: 22px; align-items: center; }
.list-header { min-height: 48px; padding: 0 22px; color: #8a94a7; background: #fafbfe; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 750; letter-spacing: .25px; }
.shipment-row { min-height: 134px; padding: 22px; background: white; border-bottom: 1px solid var(--line); transition: .18s ease; }
.shipment-row:last-child { border-bottom: 0; }
.shipment-row:hover { position: relative; z-index: 1; background: #fdfdff; box-shadow: 0 7px 22px rgba(39,56,92,.06); }
.shipment-row.unread { box-shadow: inset 3px 0 0 #e25b5b; }
.shipment-row.grouped { border-left: 3px solid #b8c8ef; }
.shipment-row.group-start { margin-top: 5px; border-top: 1px solid #dce4f6; border-radius: 7px 0 0 0; }
.shipment-row.group-end { margin-bottom: 5px; border-radius: 0 0 0 7px; }
.status-cell { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 14px; }
.shipment-select { flex: 0 0 16px; width: 16px; height: 16px; display: inline-flex; }
.status-icon { flex: 0 0 39px; width: 39px; height: 39px; display: grid; place-items: center; border-radius: 11px; }
.status-icon svg { width: 21px; height: 21px; }
.status-IN_TRANSIT .status-icon { color: var(--blue); background: var(--blue-soft); }
.status-READY_FOR_PICKUP .status-icon { color: var(--orange); background: var(--orange-soft); }
.status-DELIVERED .status-icon { color: var(--green); background: var(--green-soft); }
.status-FAILED .status-icon { color: var(--red); background: var(--red-soft); }
.tracking-number-line { display: flex; align-items: center; gap: 9px; }
.unread-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px rgba(209,70,70,.1); }
.tracking-cell a { display: block; color: #234cc8; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; line-height: 1.35; }
.tracking-remark { display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.remark-edit-trigger { min-width: 0; display: inline-flex; align-items: center; gap: 6px; padding: 3px 5px; color: #7553ba; border: 0; border-radius: 6px; background: transparent; font-size: 14px; font-weight: 700; line-height: 1.4; text-align: left; overflow-wrap: anywhere; }
.remark-edit-trigger:hover, .remark-edit-trigger:focus-visible { color: #54349c; background: #f3effc; outline: none; }
.remark-edit-icon { flex: 0 0 auto; opacity: .55; font-size: 12px; }
.group-badge { display: inline-flex; margin-top: 8px; padding: 3px 7px; color: #5f72a3; border-radius: 99px; background: #edf2fd; font-size: 9px; font-weight: 700; }
.carrier-cell { color: #3b4660; font-size: 13px; font-weight: 750; }
.event-cell time { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.event-cell p { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 3; -webkit-box-orient: vertical; margin: 0; line-height: 1.55; font-size: 13px; }
.event-cell .location { display: block; margin-top: 6px; color: #8390a4; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-label { display: inline-flex; margin-bottom: 6px; padding: 2px 7px; color: #b33d3d; border-radius: 99px; background: var(--red-soft); font-size: 9px; font-weight: 800; }
.event-detail-trigger { margin: -10px; padding: 10px; border-radius: 9px; cursor: pointer; transition: color .16s ease, background .16s ease, box-shadow .16s ease; }
.event-detail-trigger:hover { color: #234cc8; background: var(--blue-soft); }
.event-detail-trigger:focus-visible { outline: none; color: #234cc8; background: var(--blue-soft); box-shadow: 0 0 0 3px rgba(51,103,232,.14); }
.info-cell a { color: #234cc8; font-weight: 650; text-decoration: none; }
.info-cell .category { display: inline-block; margin-top: 8px; padding: 3px 7px; border-radius: 5px; color: var(--purple); background: var(--purple-soft); font-size: 10px; }
.time-cell { color: var(--muted); font-size: 11px; line-height: 1.8; }
.time-cell strong { color: #353e53; font-weight: 500; }
.time-cell span { display: block; }
.subscription-note { display: block; margin-top: 3px; color: var(--orange); line-height: 1.25; }
.row-menu { position: relative; }
.menu-button { width: 36px; height: 36px; border: 0; border-radius: 8px; color: #8791a4; background: transparent; font-size: 20px; }
.menu-button:hover { color: var(--blue); background: var(--blue-soft); }
.row-actions { display: none; position: absolute; right: 0; top: 38px; z-index: 5; width: 128px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: 0 12px 30px rgba(28,39,66,.14); }
.row-menu.open .row-actions { display: block; }
.row-menu.open-up .row-actions { top: auto; bottom: 38px; }
.row-actions button { width: 100%; padding: 9px 10px; text-align: left; color: #44506a; border: 0; border-radius: 7px; background: transparent; font-size: 12px; }
.row-actions button:hover { color: var(--blue); background: var(--blue-soft); }
.empty-state { padding: 76px 20px 82px; text-align: center; background: white; }
.empty-icon { width: 62px; height: 62px; margin: 0 auto 17px; display: grid; place-items: center; color: #9ca9bf; border-radius: 18px; background: #f0f3f8; }
.empty-icon svg { width: 34px; height: 34px; }
.empty-state h2 { margin-bottom: 8px; font-size: 18px; }
.empty-state p { margin-bottom: 22px; color: var(--muted); font-size: 13px; }
.shipment-pagination { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 18px; color: var(--muted); border-top: 1px solid var(--line); background: #fafbfe; font-size: 11px; }
.shipment-pagination[hidden] { display: none; }
.shipment-pagination > div { display: flex; align-items: center; gap: 9px; }
.shipment-pagination strong { min-width: 58px; color: #46516a; text-align: center; }
.shipment-pagination .secondary-button { min-height: 34px; padding: 0 13px; font-size: 11px; }
.shipment-pagination .secondary-button:disabled { color: #a9b1c0; background: #f5f6f8; cursor: not-allowed; }
.skeleton { height: 134px; padding: 22px; display: flex; gap: 26px; align-items: center; background: white; border-bottom: 1px solid var(--line); }
.skeleton::before, .skeleton::after { content: ""; display: block; border-radius: 9px; background: linear-gradient(90deg,#eef1f6 25%,#f7f8fb 50%,#eef1f6 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton::before { width: 39px; height: 39px; }
.skeleton::after { width: 72%; height: 55px; }

.modal { width: min(680px, calc(100vw - 32px)); padding: 0; color: var(--ink); border: 0; border-radius: 18px; box-shadow: 0 30px 80px rgba(20,30,55,.25); overflow: hidden; }
.import-modal { width: min(900px, calc(100vw - 32px)); }
.remark-modal { width: min(480px, calc(100vw - 32px)); }
.modal::backdrop, .detail-drawer::backdrop { background: rgba(20,28,45,.46); backdrop-filter: blur(3px); }
.modal-header { padding: 24px 26px 18px; display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 22px; }
.close-button { width: 35px; height: 35px; border: 0; border-radius: 9px; color: var(--muted); background: #f3f5f9; font-size: 24px; line-height: 1; }
.close-button:hover { color: var(--ink); }
.modal-body { max-height: 68vh; overflow-y: auto; padding: 22px 26px; }
.modal-footer { min-height: 70px; padding: 13px 26px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-top: 1px solid var(--line); background: #fafbfe; }
.modal-footer > span { color: var(--muted); font-size: 12px; }
.modal-footer > div { display: flex; gap: 10px; }
.modal-footer.end { justify-content: flex-end; }
.field-label { display: block; margin-bottom: 9px; color: #3e4860; font-size: 12px; font-weight: 700; }
.field-label em { margin-left: 4px; color: var(--red); font-style: normal; font-size: 10px; }
.import-guide { display: flex; align-items: center; gap: 11px; margin-bottom: 19px; padding: 13px 14px; border: 1px solid #dae4fb; border-radius: 11px; background: var(--blue-soft); }
.import-guide > span, .preview-heading > div > span { flex: 0 0 auto; width: 23px; height: 23px; display: grid; place-items: center; color: white; border-radius: 50%; background: var(--blue); font-size: 11px; font-weight: 800; }
.import-guide strong, .import-guide small { display: block; }
.import-guide strong { font-size: 12px; }
.import-guide small { margin-top: 3px; color: #64728d; font-size: 11px; }
.source-import-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.source-import-button { min-height: 76px; padding: 12px 14px; text-align: left; color: #34405a; border: 1px solid #dfe5f0; border-radius: 11px; background: white; transition: .18s ease; }
.source-import-button:hover, .source-import-button.active { color: var(--blue); border-color: #9fb8ef; background: var(--blue-soft); box-shadow: 0 5px 14px rgba(51,103,232,.08); }
.source-import-button:disabled { opacity: .55; cursor: wait; }
.source-import-button strong, .source-import-button small { display: block; }
.source-import-button strong { font-size: 13px; }
.source-import-button small { margin-top: 6px; color: var(--muted); font-size: 10px; }
.import-file-status { margin-top: 10px; padding: 9px 11px; color: var(--muted); border-radius: 8px; background: #f5f7fb; font-size: 11px; }
.import-file-status.success { color: var(--green); background: var(--green-soft); }
.import-file-status.error { color: var(--red); background: var(--red-soft); }
.manual-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; color: var(--muted-2); font-size: 10px; }
.manual-divider::before, .manual-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.field-heading { display: flex; align-items: center; justify-content: space-between; }
.file-trigger { display: flex; align-items: center; gap: 5px; margin-bottom: 8px; color: var(--blue); font-size: 12px; font-weight: 650; cursor: pointer; }
.file-trigger svg { width: 15px; }
textarea, .form-grid input { width: 100%; color: var(--ink); border: 1px solid #dfe4ed; border-radius: 10px; outline: 0; background: white; }
textarea { padding: 13px 14px; resize: vertical; line-height: 1.55; font-size: 13px; }
textarea:focus, .form-grid input:focus { border-color: #9eb7f1; box-shadow: 0 0 0 3px rgba(51,103,232,.08); }
.field-help { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 23px 0 10px; }
.preview-heading > div { display: flex; align-items: center; gap: 8px; }
.preview-heading strong { font-size: 12px; }
.preview-heading small { color: var(--muted); font-size: 11px; }
.preview-heading small.valid { color: var(--green); }
.preview-heading small.invalid { color: var(--red); }
.invalid-import-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; padding: 10px 12px; color: #813c3c; border: 1px solid #f0c8c8; border-radius: 10px; background: var(--red-soft); }
.invalid-import-toolbar[hidden] { display: none; }
.invalid-import-toolbar strong, .invalid-import-toolbar small { display: block; }
.invalid-import-toolbar strong { font-size: 12px; }
.invalid-import-toolbar small { margin-top: 3px; color: #a06464; font-size: 10px; }
.invalid-import-toolbar button { flex: 0 0 auto; padding: 7px 11px; color: #a53f3f; border: 1px solid #e7b8b8; border-radius: 8px; background: white; font-size: 10px; font-weight: 700; }
.invalid-import-toolbar button:hover { background: #fff8f8; }
.import-preview { max-height: 292px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfe; }
.preview-empty { padding: 35px 15px; color: var(--muted-2); text-align: center; font-size: 12px; }
.import-preview-header, .import-preview-row { display: grid; grid-template-columns: 38px minmax(155px, 1.15fr) minmax(150px, 1fr) 116px minmax(105px, .8fr) 30px; gap: 9px; align-items: center; }
.import-preview-header { position: sticky; top: 0; z-index: 1; min-height: 34px; padding: 0 11px; color: #8993a6; border-bottom: 1px solid var(--line); background: #f5f7fb; font-size: 10px; font-weight: 700; }
.import-preview-row { min-height: 58px; padding: 8px 11px; border-bottom: 1px solid var(--line); background: white; }
.import-preview-row:last-child { border-bottom: 0; }
.import-preview-row.invalid { background: #fffafa; }
.import-pagination { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 2px 0; color: var(--muted); font-size: 11px; }
.import-pagination[hidden] { display: none; }
.import-pagination > div { display: flex; align-items: center; gap: 8px; }
.import-pagination strong { min-width: 44px; color: #46516a; text-align: center; font-size: 11px; }
.import-pagination button { min-width: 62px; padding: 7px 10px; color: #345dc3; border: 1px solid #d5def1; border-radius: 8px; background: white; font-size: 10px; font-weight: 700; }
.import-pagination button:hover:not(:disabled) { border-color: #9db3e5; background: #f4f7ff; }
.import-pagination button:disabled { color: #a9b1c0; background: #f5f6f8; cursor: not-allowed; }
.preview-index { color: #98a2b3; text-align: center; font-size: 10px; }
.preview-number { min-width: 0; color: #27344d; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.preview-number small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; font-weight: 500; }
.preview-remark input, .preview-carrier select { width: 100%; height: 35px; padding: 0 9px; color: var(--ink); border: 1px solid #dfe4ed; border-radius: 8px; outline: 0; background: white; font-size: 11px; }
.preview-remark input:focus, .preview-carrier select:focus { border-color: #9eb7f1; box-shadow: 0 0 0 3px rgba(51,103,232,.07); }
.preview-remark input.error, .preview-carrier select.error { border-color: #e5a2a2; background: #fffafa; }
.preview-status { color: var(--green); font-size: 10px; line-height: 1.3; }
.preview-status.error { color: var(--red); }
.preview-remove { width: 28px; height: 28px; padding: 0; color: #98a2b3; border: 0; border-radius: 7px; background: transparent; font-size: 17px; }
.preview-remove:hover { color: var(--red); background: var(--red-soft); }
.mobile-field-label { display: none; }
.optional-fields { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.optional-fields summary { color: #536079; font-size: 12px; font-weight: 650; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 15px; }
.form-grid label { color: var(--muted); font-size: 11px; }
.form-grid input { height: 39px; margin-top: 6px; padding: 0 10px; font-size: 12px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-bottom: 20px; }
.result-stat { padding: 15px; border-radius: 12px; background: #f6f8fc; }
.result-stat strong { display: block; font-size: 25px; }
.result-stat span { color: var(--muted); font-size: 11px; }
.result-stat.success strong { color: var(--green); }
.result-stat.warning strong { color: var(--orange); }
.result-stat.error strong { color: var(--red); }
.result-section { margin-top: 17px; padding: 14px 15px; border-radius: 11px; background: var(--orange-soft); }
.result-section.error { background: var(--red-soft); }
.result-section h3 { margin: 0 0 9px; font-size: 13px; }
.result-section ul { margin: 0; padding-left: 19px; color: #6b4a2b; font-size: 12px; line-height: 1.7; }
.result-section.error ul { color: #773d3d; }

.detail-drawer { width: min(520px, 100vw); height: 100vh; max-height: 100vh; margin: 0 0 0 auto; padding: 0; border: 0; color: var(--ink); background: white; box-shadow: -20px 0 60px rgba(25,37,62,.2); }
.detail-header { position: sticky; top: 0; z-index: 2; padding: 25px; color: white; background: linear-gradient(145deg,#397bec,#2d5cd2); }
.detail-header .close-button { float: right; color: white; background: rgba(255,255,255,.15); }
.detail-header p { margin-bottom: 6px; opacity: .78; font-size: 11px; letter-spacing: 1px; }
.detail-header h2 { margin: 0; padding-right: 45px; font-size: 20px; overflow-wrap: anywhere; }
.detail-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.detail-summary div { padding: 11px 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; background: rgba(255,255,255,.1); }
.detail-summary small, .detail-summary strong { display: block; }
.detail-summary small { margin-bottom: 5px; opacity: .7; font-size: 10px; }
.detail-summary strong { font-size: 12px; }
.detail-remark-trigger { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0; color: white; border: 0; background: transparent; text-align: left; }
.detail-remark-trigger strong { min-width: 0; overflow-wrap: anywhere; }
.detail-remark-trigger span { flex: 0 0 auto; padding: 3px 7px; border-radius: 99px; background: rgba(255,255,255,.14); opacity: .8; font-size: 9px; }
.detail-remark-trigger:hover span, .detail-remark-trigger:focus-visible span { background: rgba(255,255,255,.25); opacity: 1; }
.detail-remark-trigger:focus-visible { outline: 2px solid rgba(255,255,255,.75); outline-offset: 4px; }
.remark-tracking-number { margin: 0 0 17px; color: #516078; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.remark-modal textarea { width: 100%; resize: vertical; min-height: 105px; padding: 12px 13px; color: var(--ink); border: 1px solid #dce2ed; border-radius: 10px; background: white; outline: none; font: inherit; line-height: 1.5; }
.remark-modal textarea:focus { border-color: #9eb7f1; box-shadow: 0 0 0 3px rgba(68,111,226,.1); }
.detail-body { padding: 25px; }
.detail-body h3 { margin: 0 0 20px; font-size: 14px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 9px; }
.timeline li { position: relative; padding: 0 0 24px 27px; border-left: 1px solid #dce3ef; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 2px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid white; background: #9facbf; box-shadow: 0 0 0 2px #dce3ef; }
.timeline li:first-child::before { background: var(--blue); box-shadow: 0 0 0 3px #dce8ff; }
.timeline li.unread-event::before { background: var(--red); box-shadow: 0 0 0 3px #ffe1e1; }
.timeline li.unread-event p { color: #27324a; font-weight: 700; }
.timeline-new { display: inline-flex; margin-left: 7px; padding: 2px 6px; color: #b33d3d; border-radius: 99px; background: var(--red-soft); font-size: 9px; font-weight: 800; }
.timeline time { color: var(--muted); font-size: 11px; }
.timeline p { margin: 6px 0; line-height: 1.5; font-size: 13px; }
.timeline small { color: #8994a8; font-size: 10px; }
.timeline-empty { padding: 30px; color: var(--muted); text-align: center; border-radius: 12px; background: #f7f9fc; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 100; max-width: calc(100vw - 32px); padding: 12px 18px; color: white; border-radius: 10px; background: #263249; box-shadow: 0 12px 30px rgba(15,25,45,.22); opacity: 0; transform: translate(-50%, 15px); pointer-events: none; transition: .25s ease; font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b93838; }

.boot-screen { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; background: radial-gradient(circle at 50% 0,#e8f0ff 0,transparent 42%),var(--bg); }
.boot-content { display: grid; justify-items: center; gap: 14px; color: var(--muted); }
.boot-content p { margin: 0; font-size: 12px; font-weight: 650; }
.boot-mark { width: 54px; height: 54px; display: grid; place-items: center; color: white; border-radius: 16px; background: linear-gradient(145deg,#4b91ee,#3475dc); box-shadow: 0 10px 24px rgba(51,103,232,.25); }
.boot-mark svg { width: 34px; height: 34px; fill: currentColor; stroke: none; }
.boot-spinner { width: 22px; height: 22px; border: 2px solid #dbe4f7; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; background: radial-gradient(circle at 50% 0,#e8f0ff 0,transparent 42%),var(--bg); }
.login-card { position: relative; width: min(430px,100%); padding: 38px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,255,255,.94); box-shadow: 0 24px 70px rgba(37,53,88,.12); }
.login-language-picker { position: absolute; top: 20px; right: 20px; }
.login-mark { width: 54px; height: 54px; margin-bottom: 24px; display: grid; place-items: center; color: white; border-radius: 16px; background: linear-gradient(145deg,#4b91ee,#3475dc); box-shadow: 0 10px 24px rgba(51,103,232,.25); }
.login-mark svg { width: 34px; height: 34px; fill: currentColor; stroke: none; }
.login-card h1 { margin-bottom: 8px; font-size: 28px; }
.login-help { margin-bottom: 25px; color: var(--muted); font-size: 13px; }
.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 7px; color: #46516a; font-size: 12px; font-weight: 700; }
.login-form input, .standalone-input, .admin-create-form input, .admin-create-form select, .user-role-select, .audit-filters input, .audit-filters select { width: 100%; height: 42px; padding: 0 12px; color: var(--ink); border: 1px solid #dfe4ed; border-radius: 10px; outline: 0; background: white; }
.login-form input:focus, .standalone-input:focus, .admin-create-form input:focus, .admin-create-form select:focus, .user-role-select:focus, .audit-filters input:focus, .audit-filters select:focus { border-color: #9eb7f1; box-shadow: 0 0 0 3px rgba(51,103,232,.08); }
.login-form .primary-button { width: 100%; margin-top: 3px; }
.login-error { margin: -3px 0 0; padding: 10px 12px; color: #a83c3c; border-radius: 9px; background: var(--red-soft); font-size: 12px; }

.admin-modal { width: min(980px,calc(100vw - 32px)); }
.audit-modal { width: min(1120px,calc(100vw - 32px)); }
.small-modal { width: min(470px,calc(100vw - 32px)); }
.admin-create-form { display: grid; grid-template-columns: 1.1fr 1fr 1fr 140px 120px; gap: 10px; align-items: end; margin-bottom: 22px; padding: 15px; border: 1px solid #dce5f6; border-radius: 12px; background: var(--blue-soft); }
.admin-create-form > div { align-self: center; }
.admin-create-form strong, .admin-create-form small { display: block; }
.admin-create-form strong { font-size: 13px; }
.admin-create-form small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.admin-create-form label, .audit-filters label { color: var(--muted); font-size: 10px; font-weight: 700; }
.admin-create-form input, .admin-create-form select, .audit-filters input, .audit-filters select { height: 38px; margin-top: 5px; font-size: 12px; }
.admin-create-form .primary-button { min-height: 38px; }
.admin-list { display: grid; gap: 9px; }
.admin-empty { padding: 34px 15px; color: var(--muted); text-align: center; border: 1px dashed #d8deea; border-radius: 11px; font-size: 12px; }
.user-row { display: grid; grid-template-columns: minmax(130px,1fr) 132px 90px minmax(150px,1fr) 190px; gap: 12px; align-items: center; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.user-identity strong, .user-identity small { display: block; }
.user-identity strong { font-size: 13px; }
.user-identity small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.user-role-select { height: 36px; font-size: 11px; }
.user-status { display: inline-flex; justify-self: start; padding: 4px 8px; color: var(--green); border-radius: 99px; background: var(--green-soft); font-size: 10px; font-weight: 750; }
.user-status.disabled { color: var(--red); background: var(--red-soft); }
.user-status.locked { color: var(--orange); background: var(--orange-soft); }
.user-times { color: var(--muted); font-size: 10px; line-height: 1.65; }
.user-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.user-actions button { min-height: 32px; padding: 0 9px; border: 1px solid #dfe4ed; border-radius: 8px; color: #46516a; background: white; font-size: 10px; font-weight: 700; }
.user-actions button:hover { color: var(--blue); border-color: #b9c9ed; background: var(--blue-soft); }
.user-actions button.danger { color: var(--red); }
.user-actions button:disabled, .user-role-select:disabled { opacity: .5; cursor: not-allowed; }
.audit-filters { display: grid; grid-template-columns: 1fr 1fr 1.35fr 90px; gap: 10px; align-items: end; margin-bottom: 16px; }
.audit-filters .secondary-button { min-height: 38px; }
.audit-list { display: grid; gap: 8px; }
.audit-row { display: grid; grid-template-columns: 145px 120px 1fr 130px; gap: 14px; align-items: start; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.audit-meta strong, .audit-meta small { display: block; }
.audit-meta strong { font-size: 12px; }
.audit-meta small, .audit-target small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.audit-action { display: inline-flex; justify-self: start; padding: 4px 8px; color: #315fc9; border-radius: 99px; background: var(--blue-soft); font-size: 10px; font-weight: 750; }
.audit-target { min-width: 0; font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.audit-change summary { color: #536079; font-size: 10px; font-weight: 700; cursor: pointer; }
.audit-change pre { max-height: 160px; margin: 8px 0 0; padding: 9px; overflow: auto; color: #49546b; border-radius: 7px; background: #f6f8fc; white-space: pre-wrap; word-break: break-word; font: 9px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace; }
.audit-pagination { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; color: var(--muted); font-size: 11px; }
.audit-pagination > div { display: flex; align-items: center; gap: 9px; }
.audit-pagination .secondary-button { min-height: 34px; padding: 0 11px; font-size: 10px; }
.readonly-remark { display: inline-block; padding: 3px 5px; color: #7553ba; font-size: 14px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.detail-remark-readonly { display: block; overflow-wrap: anywhere; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1100px) {
    .admin-nav-button { display: none; }
    .mobile-admin-actions:not([hidden]) { display: flex; }
    .list-header { display: none; }
    .shipment-row { grid-template-columns: 135px minmax(180px,1fr) minmax(240px,1.5fr) 85px 42px; gap: 16px; }
    .status-cell { grid-column: 1; grid-row: 1; }
    .tracking-cell { grid-column: 2; grid-row: 1; }
    .event-cell { grid-column: 3; grid-row: 1; }
    .carrier-cell { grid-column: 4; grid-row: 1; }
    .row-menu { grid-column: 5; grid-row: 1; }
    .time-cell { grid-column: 2 / 5; grid-row: 2; display: flex; gap: 18px; padding-top: 4px; border-top: 1px solid var(--line); }
    .toolbar { align-items: stretch; flex-direction: column; gap: 10px; }
    .toolbar-filters { width: 100%; }
    .search-box { width: auto; flex: 1 1 auto; }
}

@media (max-width: 720px) {
    .topbar { height: 66px; padding: 0 16px; }
    .brand > span:last-child { display: none; }
    .brand small { display: none; }
    .brand-mark { width: 38px; height: 38px; }
    .top-actions > #refreshBtn { display: none; }
    .top-actions .language-picker { padding: 0 7px; }
    .top-actions .language-icon { display: none; }
    .top-actions .language-picker select { max-width: 78px; }
    #openImportBtn { width: 40px; min-height: 40px; padding: 0; gap: 0; font-size: 0; }
    #openImportBtn svg { width: 18px; height: 18px; }
    .current-user { min-width: 0; max-width: 92px; padding: 4px 7px; }
    .current-user strong { max-width: 78px; }
    #logoutBtn { display: inline-flex; width: 38px; min-height: 38px; }
    .primary-button { min-height: 40px; padding: 0 14px; }
    main { padding: 26px 14px 50px; }
    .page-heading { align-items: stretch; flex-direction: column; margin-bottom: 24px; }
    h1 { font-size: 29px; }
    .sync-card { min-width: 0; }
    .tabs { margin: 0 -14px; padding: 3px 14px 6px; }
    .archive-tab { border-left: 0; }
    .toolbar-filters { align-items: stretch; flex-direction: column; }
    .remark-filter, .search-box { width: 100%; flex-basis: 42px; }
    .bulk-archive-bar { flex-wrap: wrap; gap: 10px 14px; padding: 11px 13px; }
    .bulk-selected-summary { order: 3; width: 100%; }
    .bulk-archive-bar .secondary-button { margin-left: auto; }
    .shipments-panel { border-radius: 13px; border: 0; background: transparent; box-shadow: none; overflow: visible; }
    .shipments-list { display: grid; gap: 11px; }
    .shipment-row { position: relative; min-height: 0; padding: 17px; display: grid; grid-template-columns: 1fr 38px; gap: 15px 10px; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 7px 22px rgba(37,52,82,.05); }
    .status-cell { grid-column: 1; grid-row: 1; }
    .status-icon { width: 34px; height: 34px; flex-basis: 34px; }
    .tracking-cell { grid-column: 1 / -1; grid-row: 2; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
    .tracking-cell a { font-size: 15px; }
    .event-cell { grid-column: 1 / -1; grid-row: 3; padding-top: 3px; }
    .event-cell p { -webkit-line-clamp: 4; }
    .carrier-cell { grid-column: 1 / -1; grid-row: 4; }
    .time-cell { grid-column: 1 / -1; grid-row: 5; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
    .row-menu { grid-column: 2; grid-row: 1; }
    .row-actions { right: 0; }
    .skeleton { height: 220px; border-radius: 13px; border: 1px solid var(--line); }
    .empty-state { border-radius: 13px; }
    .shipment-pagination { align-items: flex-start; flex-direction: column; margin-top: 11px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 7px 22px rgba(37,52,82,.05); }
    .shipment-pagination > div { width: 100%; justify-content: space-between; }
    .modal { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; }
    .modal-body { max-height: 65vh; padding: 19px 18px; }
    .modal-header { padding: 21px 18px 16px; }
    .modal-footer { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
    .modal-footer > span { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .source-import-grid { grid-template-columns: 1fr; }
    .import-preview { max-height: 330px; border: 0; background: transparent; }
    .import-preview-header { display: none; }
    .import-preview-row { position: relative; grid-template-columns: 1fr 112px 28px; gap: 9px; margin-bottom: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; }
    .import-pagination { align-items: flex-start; flex-direction: column; }
    .preview-index { position: absolute; left: 7px; top: 7px; width: 18px; height: 18px; display: grid; place-items: center; color: white; border-radius: 50%; background: #a3adbf; }
    .preview-number { grid-column: 1 / 3; padding-left: 20px; }
    .preview-remark { grid-column: 1; }
    .preview-carrier { grid-column: 2; }
    .preview-status { grid-column: 1 / 3; }
    .preview-remove { grid-column: 3; grid-row: 1; }
    .mobile-field-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 9px; font-weight: 600; }
    .result-stats { gap: 7px; }
    .result-stat { padding: 12px 9px; }
    .result-stat strong { font-size: 21px; }
    .detail-drawer { width: 100vw; }
    .login-card { padding: 74px 22px 28px; }
    .login-language-picker { top: 18px; right: 18px; }
    .admin-create-form { grid-template-columns: 1fr; }
    .user-row { grid-template-columns: 1fr 110px; }
    .user-status, .user-times { grid-column: 1; }
    .user-actions { grid-column: 1 / -1; justify-content: flex-start; }
    .audit-filters { grid-template-columns: 1fr; }
    .audit-row { grid-template-columns: 1fr 110px; }
    .audit-target, .audit-change { grid-column: 1 / -1; }
    .audit-pagination { align-items: flex-start; flex-direction: column; }
}
