﻿/* ============================================================
   STF 货运管理系统 — Apple风格 SPA 样式
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #0071E3;
    --primary-hover: #0077ED;
    --primary-light: rgba(0,113,227,.08);
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --text-tertiary: #aeaeb2;
    --bg-white: #ffffff;
    --bg-light: #f5f5f7;
    --bg-sidebar: #fbfbfd;
    --border-color: #d2d2d7;
    --border-light: #e8e8ed;
    --success: #30D158;
    --warning: #FF9F0A;
    --danger: #FF3B30;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 20px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Helvetica Neue", sans-serif;
    --sidebar-w: 220px;
    --topbar-h: 52px;
    --tabbar-h: 44px;
    --transition: .2s ease;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-light);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    height: 100vh;
}

a { text-decoration: none; color: var(--primary); transition: opacity var(--transition); }
a:hover { opacity: .7; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ---------- Login Screen ---------- */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 100%);
}
.login-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 380px;
    text-align: center;
    box-shadow: 0 4px 40px rgba(0,0,0,.08);
}
.login-card .logo-icon {
    width: 56px; height: 56px;
    border-radius: 16px;
    background: var(--primary);
    margin: 0 auto 20px;
    display: flex; align-items: center; justify-content: center;
}
.login-card .logo-icon svg { width: 28px; height: 28px; fill: white; }
.login-card h2 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.login-card p { color: var(--text-secondary); font-size: 13px; margin-bottom: 28px; }
.login-card input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 15px;
    outline: none;
    transition: border-color var(--transition);
    margin-bottom: 16px;
}
.login-card input[type="password"]:focus { border-color: var(--primary); }
.login-card .login-btn {
    width: 100%; padding: 12px;
    background: var(--primary); color: white;
    border: none; border-radius: var(--radius-sm);
    font-size: 15px; font-weight: 500;
    cursor: pointer; transition: background var(--transition);
}
.login-card .login-btn:hover { background: var(--primary-hover); }
.login-card .login-msg { font-size: 12px; margin-top: 12px; min-height: 18px; }
.login-card .login-msg.error { color: var(--danger); }
.login-card .login-msg.success { color: var(--success); }

/* ---------- App Shell ---------- */
.app-shell { display: none; height: 100vh; }
.app-shell.active { display: flex; flex-direction: column; }

/* Top Bar */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center;
    padding: 0 20px;
    flex-shrink: 0;
    position: relative; z-index: 10;
}
.topbar-brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 600; font-size: 16px;
    min-width: var(--sidebar-w);
}
.topbar-brand .brand-dot {
    width: 24px; height: 24px; border-radius: 7px;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
}
.topbar-brand .brand-dot svg { width: 14px; height: 14px; fill: white; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.topbar-btn {
    background: none; border: none;
    color: var(--text-secondary);
    cursor: pointer; padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-size: 13px; display: flex; align-items: center; gap: 5px;
}
.topbar-btn:hover { background: var(--bg-light); color: var(--text-primary); }
.topbar-btn.logout { color: var(--danger); }
.topbar-btn.logout:hover { background: rgba(255,59,48,.06); }

/* Tab Bar */
.tabbar {
    height: var(--tabbar-h);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center;
    padding: 0 20px;
    gap: 2px;
    flex-shrink: 0;
    overflow-x: auto;
}
.tabbar::-webkit-scrollbar { display: none; }
.tab-item {
    padding: 0 16px; height: 100%;
    display: flex; align-items: center;
    font-size: 13px; color: var(--text-secondary);
    cursor: pointer; border-bottom: 2px solid transparent;
    transition: all var(--transition);
    white-space: nowrap; user-select: none;
}
.tab-item:hover { color: var(--text-primary); }
.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 500;
}

/* Main Body */
.app-body {
    display: flex; flex: 1; overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
    flex-shrink: 0;
    display: flex; flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.nav-group-title {
    padding: 18px 18px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: .05em;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 18px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    user-select: none;
}
.nav-item:hover { 
    background: rgba(0,0,0,.03); 
    color: var(--text-primary);
}
.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}
.nav-item .nav-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.nav-item .nav-icon svg { width: 16px; height: 16px; }

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-light);
    padding: 24px;
}
.content-area::-webkit-scrollbar { width: 6px; }
.content-area::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 6px; }

/* Page Container */
.page { display: none; animation: fadeIn .25s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.page-header h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.page-header-actions { display: flex; gap: 10px; }

/* ---------- Cards & Panels ---------- */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 600; font-size: 15px;
}
.card-body { padding: 20px; }

/* Stat Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    padding: 20px;
}
.stat-card .stat-label {
    font-size: 12px; color: var(--text-secondary);
    margin-bottom: 6px;
}
.stat-card .stat-value {
    font-size: 28px; font-weight: 700;
    letter-spacing: -.02em;
}
.stat-card .stat-sub {
    font-size: 12px; color: var(--text-tertiary);
    margin-top: 4px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary { background: var(--bg-white); color: var(--text-primary); border-color: var(--border-color); }
.btn-secondary:hover { border-color: var(--text-secondary); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-ghost { background: transparent; color: var(--primary); padding: 6px 12px; }
.btn-ghost:hover { background: var(--primary-light); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

/* ---------- Form Elements ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-group label .required { color: var(--danger); margin-left: 2px; }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition);
    background: var(--bg-white);
    color: var(--text-primary);
}
.form-control:focus { border-color: var(--primary); }
.form-control::placeholder { color: var(--text-tertiary); }
select.form-control { cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2386868b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    padding-right: 32px;
}
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.checkbox-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; cursor: pointer; color: var(--text-secondary);
}
.checkbox-label input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border-light); }
.data-table {
    width: 100%; border-collapse: collapse;
    font-size: 13px;
}
.data-table thead th {
    background: var(--bg-light);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
    position: sticky; top: 0;
}
.data-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(0,113,227,.03); }
.data-table .cell-center { text-align: center; }
.data-table .cell-right { text-align: right; }

/* Status badges */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-pending { background: rgba(255,159,10,.1); color: var(--warning); }
-badge-inbound { background: rgba(0,113,227,.1); color: var(--primary); }
.badge-shipped { background: rgba(48,209,88,.1); color: var(--success); }
.badge-delivered { background: rgba(48,209,88,.15); color: #1a8a3a; }
.badge-exception { background: rgba(255,59,48,.1); color: var(--danger); }
.badge-neutral { background: var(--bg-light); color: var(--text-secondary); }

/* Toolbar */
.toolbar {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 16px; flex-wrap: wrap;
}
.toolbar .search-input {
    width: 240px; max-width: 100%;
    padding: 8px 12px 8px 34px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px; outline: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat 10px center;
    background-size: 16px;
    transition: border-color var(--transition);
}
.toolbar .search-input:focus { border-color: var(--primary); }
.toolbar .filter-select {
    padding: 8px 28px 8px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px; outline: none;
    appearance: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2386868b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 10px center;
    cursor: pointer;
}
.toolbar-spacer { flex: 1; }

/* ---------- Quote Module Specific ---------- */
.quote-layout { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
.quote-form-panel { position: sticky; top: 0; }
.quote-result-panel { min-height: 400px; }

.quote-country-search { position: relative; }
.quote-country-results {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 240px; overflow-y: auto;
    z-index: 50; display: none; box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
.quote-country-results.show { display: block; }
.country-result-item {
    padding: 10px 14px; cursor: pointer;
    font-size: 13px; color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    transition: background .15s;
}
.country-result-item:last-child { border-bottom: none; }
.country-result-item:hover { background: var(--bg-light); }

.result-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    padding: 20px 24px;
    margin-bottom: 14px;
    transition: box-shadow .2s;
}
.result-card:hover { box-shadow: 0 2px 16px rgba(0,0,0,.06); }
.result-card .rc-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.result-card .rc-channel {
    font-size: 17px; font-weight: 700;
    color: var(--text-primary);
}
.result-card .rc-price { font-size: 24px; font-weight: 700; color: var(--primary); }
.result-card .rc-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    font-size: 12px; color: var(--text-secondary);
}
.result-card .rc-detail-item span { color: var(--text-primary); font-weight: 500; }

/* Empty state */
.empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--text-tertiary);
}
.empty-state .empty-icon {
    font-size: 48px; margin-bottom: 12px; opacity: .4;
}
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state p { font-size: 13px; }

/* ---------- Modal / Dialog ---------- */
.modal-mask {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.35);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none; align-items: center; justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 90%; max-width: 720px;
    max-height: 85vh;
    display: flex; flex-direction: column;
    box-shadow: 0 8px 60px rgba(0,0,0,.15);
    animation: modalIn .25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(12px); } to { opacity: 1; transform: none; } }
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
    width: 28px; height: 28px; border: none; background: var(--bg-light);
    border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); font-size: 16px; transition: all .2s;
}
.modal-close:hover { background: var(--border-color); color: var(--text-primary); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex; justify-content: flex-end; gap: 10px;
    flex-shrink: 0;
}

/* Modal full size for order form */
.modal.order-modal { max-width: 900px; }

/* ---------- Toast ---------- */
.toast-container {
    position: fixed; top: 16px; right: 16px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    background: var(--text-primary);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
    animation: toastIn .3s ease;
    display: flex; align-items: center; gap: 8px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ---------- Dashboard specific ---------- */
.dashboard-hero {
    text-align: center; padding: 36px 20px;
    background: var(--bg-white); border-radius: var(--radius-lg);
    margin-bottom: 24px;
    border: 1px solid var(--border-light);
}
.dashboard-hero h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.dashboard-hero p { color: var(--text-secondary); font-size: 13px; }
.quick-actions {
    display: flex; gap: 12px; justify-content: center; margin-top: 20px; flex-wrap: wrap;
}
.quick-action-card {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 20px 24px; border-radius: var(--radius);
    border: 1px solid var(--border-light);
    cursor: pointer; transition: all .2s;
    background: var(--bg-white); min-width: 110px;
}
.quick-action-card:hover { border-color: var(--primary); box-shadow: 0 2px 12px rgba(0,113,227,.1); transform: translateY(-2px); }
.quick-action-card .qa-icon {
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.quick-action-card .qa-text { font-size: 12px; font-weight: 500; color: var(--text-primary); }

/* ---------- Order List with customer tree ---------- */
.split-view {
    display: grid; grid-template-columns: 240px 1fr; gap: 0;
    border: 1px solid var(--border-light); border-radius: var(--radius);
    background: var(--bg-white); overflow: hidden;
    height: calc(100vh - 180px);
}
.customer-tree {
    border-right: 1px solid var(--border-light);
    overflow-y: auto; background: var(--bg-sidebar);
}
.customer-tree-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600; font-size: 13px;
    display: flex; align-items: center; justify-content: space-between;
}
.customer-tree-list { list-style: none; }
.customer-tree-item {
    padding: 10px 14px;
    cursor: pointer; font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    transition: background .15s;
    display: flex; align-items: center; justify-content: space-between;
}
.customer-tree-item:hover { background: var(--bg-light); }
.customer-tree-item.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.customer-tree-item .ct-count {
    font-size: 11px; background: var(--bg-light);
    padding: 1px 8px; border-radius: 10px; color: var(--text-tertiary);
}
.order-list-panel { overflow: auto; display: flex; flex-direction: column; }
.order-toolbar {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0; background: var(--bg-white);
}

/* Pagination */
.pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    font-size: 12px; color: var(--text-secondary);
    flex-shrink: 0;
}
.pagination-btns { display: flex; gap: 4px; }
.pagination button {
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    border-radius: 4px;
    cursor: pointer; font-size: 12px;
}
.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Responsive tweaks ---------- */
@media (max-width: 1024px) {
    .quote-layout { grid-template-columns: 1fr; }
    .split-view { grid-template-columns: 1fr; height: auto; }
    .customer-tree { display: none; }
    .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .sidebar { display: none; } /* Mobile: hide sidebar, use tabs only */
}

/* ---------- Print styles ---------- */
@media print {
    .sidebar, .topbar, .tabbar, .toolbar, .pagination, .page-header-actions { display: none !important; }
    .content-area { padding: 0; }
    body { overflow: visible; }
    .card, .table-wrap { border: 1px solid #ccc !important; }
}

/* ---------- Utility ---------- */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-secondary); }
.font-mono { font-family: "SF Mono", "Consolas", monospace; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.hidden { display: none !important; }

/* ========== 通用 Modal 弹窗样式 ========== */
.stf-modal-box {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(0,0,0,.22);
    width: 92%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: stfModalIn .18s ease;
}
@keyframes stfModalIn {
    from { opacity:0; transform: scale(.95) translateY(12px); }
    to   { opacity:1; transform: scale(1) translateY(0); }
}
.stf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px 0;
}
.stf-modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}
.stf-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
}
.stf-modal-close:hover { background: var(--bg-light); color: var(--text-primary); }
.stf-modal-body {
    padding: 16px 24px;
}
.stf-modal-body .form-group {
    margin-bottom: 14px;
}
.stf-modal-body .form-group:last-child {
    margin-bottom: 0;
}
.stf-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 24px 20px;
    border-top: 1px solid var(--border-light);
}
.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
}
.btn-danger:hover { background: #e0342a; }

/* ==================== 面单生成样式 ==================== */
/* A4 整页（默认）：210×297mm */
.lbl-content.lbl-size-a4 .lbl-page { width: 210mm; min-height: 297mm; padding: 15mm; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.1); box-sizing: border-box; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #1f2937; position: relative; }
.lbl-content.lbl-size-a4 { display: flex; flex-direction: column; gap: 12px; align-items: center; }
/* A5 半页：148×210mm */
.lbl-content.lbl-size-a5 .lbl-page { width: 148mm; min-height: 210mm; padding: 10mm; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.1); box-sizing: border-box; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #1f2937; }
.lbl-content.lbl-size-a5 { display: flex; flex-direction: column; gap: 12px; align-items: center; }
/* 100×100mm 不干胶标签 */
.lbl-content.lbl-size-label100 { display: flex; justify-content: center; align-items: flex-start; padding-top: 20px; }
.lbl-content .lbl-label100 { width: 100mm; height: 100mm; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.1); box-sizing: border-box; padding: 4mm; display: flex; flex-direction: column; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #000; }
/* A4 多运单合打：5 个小面单上下排列 */
.lbl-content.lbl-size-a4-multi .lbl-page { width: 210mm; height: 55mm; padding: 6mm 10mm; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.08); box-sizing: border-box; display: flex; align-items: center; gap: 8mm; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #1f2937; border-bottom: 2px dashed #999; }
.lbl-content.lbl-size-a4-multi { display: flex; flex-direction: column; gap: 6px; align-items: center; }
/* 分页符：除第一个外每个 .lbl-page 加 page-break-before */
.lbl-page-break { page-break-before: always; }

/* 通用面单块样式 */
.lbl-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 8px; border-bottom: 3px solid #0066cc; margin-bottom: 12px; }
.lbl-stf { font-size: 22px; font-weight: 700; color: #0066cc; letter-spacing: 1px; }
.lbl-stf-en { font-size: 9px; color: #6b7280; letter-spacing: 1.5px; margin-top: 1px; }
.lbl-channel-tag { display: inline-block; padding: 4px 12px; background: #0066cc; color: #fff; font-size: 13px; font-weight: 600; border-radius: 3px; }
.lbl-date { font-size: 11px; color: #6b7280; margin-top: 4px; text-align: right; }
.lbl-trackingno { font-size: 14px; margin-bottom: 6px; color: #1f2937; }
.lbl-trackingno strong { font-size: 16px; color: #0066cc; }
.lbl-barcode-lg { text-align: center; padding: 8px 0; background: #fff; border: 1px solid #e5e7eb; margin-bottom: 14px; }
.lbl-section { margin-bottom: 12px; padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 3px; background: #fafbfc; }
.lbl-section.lbl-to { border-color: #0066cc; background: #f0f7ff; }
.lbl-section-title { font-size: 11px; font-weight: 600; color: #0066cc; letter-spacing: 0.5px; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px dashed #d1d5db; }
.lbl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 12px; line-height: 1.7; }
.lbl-span2 { grid-column: 1 / -1; }
.lbl-k { color: #9ca3af; font-size: 11px; margin-right: 4px; }
.lbl-items { width: 100%; border-collapse: collapse; font-size: 11px; }
.lbl-items th { background: #f3f4f6; padding: 4px 6px; text-align: left; font-weight: 500; color: #4b5563; border-bottom: 1px solid #e5e7eb; }
.lbl-items td { padding: 3px 6px; border-bottom: 1px solid #f3f4f6; }
.lbl-item-row { font-size: 12px; padding: 4px 0; }
.lbl-item-row .lbl-k { font-weight: 500; }
.lbl-footer { display: flex; gap: 0; margin-top: 16px; border: 1px solid #0066cc; border-radius: 3px; overflow: hidden; }
.lbl-foot-item { flex: 1; padding: 8px 10px; text-align: center; border-right: 1px solid #e5e7eb; background: #fafbfc; }
.lbl-foot-item:last-child { border-right: none; }
.lbl-foot-item span { display: block; font-size: 10px; color: #9ca3af; margin-bottom: 2px; }
.lbl-foot-item strong { font-size: 13px; color: #1f2937; }
.lbl-foot-item.lbl-sign { flex: 1.4; }
.lbl-sign-box { height: 22px; background: #fff; border: 1px solid #e5e7eb; border-radius: 2px; }

/* 100×100 标签的紧凑布局 */
.lbl-label100 .lbl-row { display: flex; justify-content: space-between; align-items: center; font-size: 10px; }
.lbl-label100 .lbl-row-top { margin-bottom: 4px; font-size: 9px; }
.lbl-label100 .lbl-row-bottom { margin-top: 4px; font-size: 9px; padding-top: 4px; border-top: 1px solid #000; }
.lbl-label100 .lbl-channel-logo { background: #0066cc; color: #fff; font-weight: 700; padding: 2px 6px; font-size: 11px; border-radius: 2px; }
.lbl-label100 .lbl-barcode { text-align: center; flex: 1; display: flex; align-items: center; justify-content: center; }
.lbl-label100 .lbl-barcode svg { max-height: 40px; }
.lbl-label100 .lbl-rcv { margin-top: 2px; line-height: 1.35; }
.lbl-label100 .lbl-rcv-name { font-size: 13px; font-weight: 700; margin-bottom: 1px; }
.lbl-label100 .lbl-rcv-addr { font-size: 10px; }
.lbl-label100 .lbl-rcv-country { font-size: 12px; font-weight: 700; margin: 2px 0; }
.lbl-label100 .lbl-rcv-phone { font-size: 10px; }
.lbl-label100 .lbl-orderno { font-family: monospace; font-size: 9px; }

/* 多运单合打专用：小面单里的元素 */
.lbl-content.lbl-size-a4-multi .lbl-barcode-lg { flex-shrink: 0; width: 50mm; padding: 0; border: none; margin: 0; text-align: center; }
.lbl-content.lbl-size-a4-multi .lbl-barcode-lg svg { max-width: 100%; height: 30mm; }
.lbl-content.lbl-size-a4-multi .lbl-section { flex: 1; margin: 0; padding: 4px 6px; border: none; background: transparent; }
.lbl-content.lbl-size-a4-multi .lbl-header { display: none; }
.lbl-content.lbl-size-a4-multi .lbl-trackingno { font-size: 12px; margin-bottom: 4px; }
.lbl-content.lbl-size-a4-multi .lbl-section-title { font-size: 9px; margin-bottom: 2px; }
.lbl-content.lbl-size-a4-multi .lbl-grid { font-size: 10px; line-height: 1.4; gap: 1px 6px; }
.lbl-content.lbl-size-a4-multi .lbl-to { background: #f9fafb; }

/* ===== 打印专用 CSS（@media print） ===== */
@media print {
    /* 隐藏所有 UI */
    .stf-modal-mask { background: #fff !important; position: static !important; }
    .stf-modal-header, .stf-modal-footer, .topbar, .tabbar, .sidebar, .nav, .page-header { display: none !important; }
    .stf-modal-box { box-shadow: none !important; max-width: 100% !important; max-height: 100% !important; border: none !important; }
    /* 面单内容全屏显示 */
    #labelContent { background: #fff !important; padding: 0 !important; overflow: visible !important; }
    .lbl-content { background: #fff !important; padding: 0 !important; gap: 0 !important; }
    .lbl-page { box-shadow: none !important; page-break-after: always; border: none !important; }
    .lbl-page:last-child { page-break-after: auto; }
    /* 100×100 标签 */
    @page { size: auto; margin: 5mm; }
    .lbl-label100 { box-shadow: none !important; page-break-after: always; }
    /* 按钮和控件隐藏 */
    .btn, .form-input, .lbl-size-btn { display: none !important; }
    /* 打印时不显示 picker 等 */
    #lblPickerModal, .picker-list, .modal-footer { display: none !important; }
    body.lbl-printing .stf-modal-mask { display: block !important; }
    body.lbl-printing #labelContent { display: block !important; }
}

