/* NewEra 交付台 — 沿用工作台的设计 token，字体走系统栈（本站无自托管字体文件） */

:root {
    --bg-base: #09090b;
    --bg-raised: #111113;
    --bg-card: rgba(255, 255, 255, 0.025);
    --bg-card-hover: rgba(255, 255, 255, 0.05);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(255, 255, 255, 0.14);
    --border-accent: rgba(196, 163, 90, 0.3);
    --text-1: #e8e8ec;
    --text-2: #8b8b8e;
    --text-3: #4e4e52;
    --accent: #c4a35a;
    --accent-dim: rgba(196, 163, 90, 0.1);
    --success: #34d399;
    --success-dim: rgba(52, 211, 153, 0.1);
    --warning: #fbbf24;
    --warning-dim: rgba(251, 191, 36, 0.1);
    --error: #f87171;
    --error-dim: rgba(248, 113, 113, 0.1);
    --info: #60a5fa;
    --info-dim: rgba(96, 165, 250, 0.1);
    --radius: 14px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --blur: 24px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-1);
    background: var(--bg-base);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* === Header === */
.header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(9, 9, 11, 0.88);
    backdrop-filter: blur(var(--blur));
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1180px; margin: 0 auto; padding: 13px 24px;
    display: flex; align-items: center; gap: 16px;
}
.brand {
    font-size: 14px; font-weight: 600; letter-spacing: 0.06em;
    color: var(--text-1); white-space: nowrap;
}
.brand small { color: var(--text-3); font-weight: 400; margin-left: 8px; letter-spacing: 0.02em; }
.header-nav { display: flex; gap: 2px; margin-left: 14px; flex-wrap: wrap; }
.nav-btn {
    position: relative; padding: 7px 13px; background: transparent; border: none;
    border-radius: var(--radius-xs); color: var(--text-2);
    letter-spacing: 0.03em; cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.nav-btn:hover { color: var(--text-1); background: var(--bg-card-hover); }
.nav-btn.active { background: rgba(255,255,255,0.06); color: var(--accent); }
.nav-badge {
    display: inline-block; min-width: 17px; padding: 0 5px; margin-left: 6px;
    background: var(--error); color: #fff; font-size: 11px; font-weight: 600;
    line-height: 17px; border-radius: 9px; text-align: center;
}
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.user-chip img { width: 24px; height: 24px; border-radius: 50%; background: var(--bg-card); }

/* === Layout === */
.page { max-width: 1180px; margin: 0 auto; padding: 26px 24px 80px; }
.view { display: none; }
.view.active { display: block; }
.view-head {
    display: flex; align-items: flex-end; gap: 14px;
    margin-bottom: 18px; flex-wrap: wrap;
}
.view-title { font-size: 17px; font-weight: 600; letter-spacing: 0.03em; }
.view-sub { color: var(--text-3); font-size: 12px; }
.view-head .spacer { margin-left: auto; }

/* === Buttons === */
.btn {
    padding: 8px 15px; background: var(--bg-card); color: var(--text-1);
    border: 1px solid var(--border); border-radius: var(--radius-xs);
    cursor: pointer; letter-spacing: 0.03em; transition: var(--transition);
    white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--bg-card-hover); border-color: var(--border-hover); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
    background: var(--accent); color: #14110a; border-color: var(--accent); font-weight: 600;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.btn-danger { color: var(--error); border-color: rgba(248,113,113,0.28); }
.btn-danger:hover:not(:disabled) { background: var(--error-dim); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { color: var(--text-1); background: var(--bg-card-hover); }

/* === Cards === */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px;
}
.card + .card { margin-top: 14px; }
.card-head {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-title { font-size: 14px; font-weight: 600; letter-spacing: 0.03em; }
.card-head .spacer { margin-left: auto; }

.grid-skus {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 14px;
}

/* === Forms === */
.field { margin-bottom: 14px; }
.field label {
    display: block; margin-bottom: 6px; color: var(--text-2);
    font-size: 12px; letter-spacing: 0.04em;
}
.input, .textarea, .select {
    width: 100%; padding: 8px 11px; background: rgba(0,0,0,0.28);
    border: 1px solid var(--border); border-radius: var(--radius-xs);
    color: var(--text-1); outline: none; transition: border-color 0.15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--border-accent); }
.textarea { min-height: 74px; resize: vertical; line-height: 1.6; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }
.hint { color: var(--text-3); font-size: 11.5px; margin-top: 5px; }

/* === Tables === */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table th {
    color: var(--text-3); font-weight: 500; font-size: 11.5px;
    letter-spacing: 0.06em; text-transform: uppercase;
}
.table tbody tr:hover { background: rgba(255,255,255,0.014); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* === Badges === */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: 11px; letter-spacing: 0.04em; white-space: nowrap;
    border: 1px solid transparent;
}
.badge-pending { background: var(--warning-dim); color: var(--warning); border-color: rgba(251,191,36,0.28); }
.badge-active  { background: var(--success-dim); color: var(--success); border-color: rgba(52,211,153,0.28); }
.badge-error   { background: var(--error-dim); color: var(--error); border-color: rgba(248,113,113,0.28); }
.badge-info    { background: var(--info-dim); color: var(--info); border-color: rgba(96,165,250,0.28); }
.badge-muted   { background: var(--bg-card); color: var(--text-2); border-color: var(--border); }
.badge-accent  { background: var(--accent-dim); color: var(--accent); border-color: var(--border-accent); }

/* === Thumbnails === */
.thumbs { display: flex; gap: 5px; flex-wrap: wrap; }
.thumb {
    width: 56px; height: 74px; object-fit: cover; border-radius: var(--radius-xs);
    background: var(--bg-raised); border: 1px solid var(--border);
}
.thumb-lg { width: 100%; height: auto; aspect-ratio: 3/4; }

/* === SKU picker === */
.pick-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
    gap: 10px; max-height: 340px; overflow-y: auto; padding: 3px;
}
.pick-card {
    position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 7px; cursor: pointer; background: var(--bg-card); transition: var(--transition);
}
.pick-card:hover { border-color: var(--border-hover); }
.pick-card.on { border-color: var(--accent); background: var(--accent-dim); }
.pick-card img {
    width: 100%; aspect-ratio: 3/4; object-fit: cover;
    border-radius: var(--radius-xs); background: var(--bg-raised); display: block;
}
.pick-card .pick-label {
    margin-top: 6px; font-size: 11.5px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.pick-card .pick-meta { font-size: 10.5px; color: var(--text-3); }
.pick-card .pick-tick {
    position: absolute; top: 10px; right: 10px; width: 18px; height: 18px;
    border-radius: 50%; background: var(--accent); color: #14110a;
    font-size: 12px; font-weight: 700; display: none;
    align-items: center; justify-content: center; line-height: 18px; text-align: center;
}
.pick-card.on .pick-tick { display: block; }

/* === 图种行 === */
.item-row {
    display: flex; align-items: flex-start; gap: 14px; padding: 13px 0;
    border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.item-row:last-child { border-bottom: none; }
.item-row .item-main { flex: 1 1 250px; min-width: 0; }
.item-row .item-name { font-weight: 500; letter-spacing: 0.02em; }
.item-row .item-desc { color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.item-row .item-refs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.item-row.off { opacity: 0.42; }
.item-row.off .item-refs { display: none; }

.stepper { display: flex; align-items: center; gap: 0; }
.stepper button {
    width: 27px; height: 27px; background: var(--bg-card); color: var(--text-1);
    border: 1px solid var(--border); cursor: pointer; line-height: 1;
}
.stepper button:first-child { border-radius: var(--radius-xs) 0 0 var(--radius-xs); }
.stepper button:last-child { border-radius: 0 var(--radius-xs) var(--radius-xs) 0; }
.stepper button:hover { background: var(--bg-card-hover); }
.stepper input {
    width: 46px; height: 27px; text-align: center; background: rgba(0,0,0,0.28);
    border: 1px solid var(--border); border-left: none; border-right: none;
    color: var(--text-1); outline: none; font-variant-numeric: tabular-nums;
}
.item-calc {
    flex: 0 0 172px; text-align: right; font-variant-numeric: tabular-nums;
    color: var(--text-2); font-size: 12px;
}
.item-calc strong { color: var(--text-1); font-size: 13px; }

.ref-chip {
    padding: 4px 10px; background: var(--bg-card); border: 1px dashed var(--border);
    border-radius: var(--radius-xs); color: var(--text-2); cursor: pointer;
    font-size: 11.5px; transition: var(--transition);
}
.ref-chip:hover { border-color: var(--border-hover); color: var(--text-1); }
.ref-chip.set {
    border-style: solid; border-color: var(--border-accent);
    color: var(--accent); background: var(--accent-dim);
}

/* === 统计台 === */
.summary-bar {
    position: sticky; bottom: 0; z-index: 50; margin-top: 18px;
    background: rgba(17,17,19,0.94); backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 15px 18px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
.summary-stat { display: flex; flex-direction: column; gap: 1px; }
.summary-stat .k { color: var(--text-3); font-size: 11px; letter-spacing: 0.05em; }
.summary-stat .v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-stat .v.money { color: var(--accent); }

/* === 事件流水 === */
.timeline { border-left: 1px solid var(--border); padding-left: 15px; margin-top: 12px; }
.timeline-item { position: relative; padding-bottom: 12px; }
.timeline-item::before {
    content: ''; position: absolute; left: -20px; top: 6px; width: 7px; height: 7px;
    border-radius: 50%; background: var(--text-3);
}
.timeline-item:first-child::before { background: var(--accent); }
.timeline-meta { color: var(--text-3); font-size: 11.5px; }

/* === Modal === */
.modal-mask {
    position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.66);
    backdrop-filter: blur(3px); display: flex; align-items: center;
    justify-content: center; padding: 22px;
}
.modal {
    width: 100%; max-width: 620px; max-height: 88vh; overflow-y: auto;
    background: var(--bg-raised); border: 1px solid var(--border-hover);
    border-radius: var(--radius); padding: 22px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.modal-lg { max-width: 880px; }
.modal-head {
    display: flex; align-items: center; margin-bottom: 16px; gap: 10px;
}
.modal-title { font-size: 15px; font-weight: 600; letter-spacing: 0.03em; }
.modal-foot {
    display: flex; gap: 9px; justify-content: flex-end; margin-top: 20px;
    padding-top: 15px; border-top: 1px solid var(--border);
}

/* === Toast === */
#toast-host {
    position: fixed; top: 18px; right: 18px; z-index: 500;
    display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast {
    padding: 11px 15px; border-radius: var(--radius-sm);
    background: var(--bg-raised); border: 1px solid var(--border-hover);
    box-shadow: 0 8px 28px rgba(0,0,0,0.45); animation: slide-in 0.18s ease-out;
}
.toast.ok { border-left: 3px solid var(--success); }
.toast.err { border-left: 3px solid var(--error); }
.toast.warn { border-left: 3px solid var(--warning); }
@keyframes slide-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* === Progress === */
.progress {
    height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px;
    overflow: hidden; margin-top: 10px;
}
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width 0.15s; }

/* === Empty / notice === */
.empty {
    padding: 46px 20px; text-align: center; color: var(--text-3);
    border: 1px dashed var(--border); border-radius: var(--radius);
}
.notice {
    padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px;
    background: var(--warning-dim); border: 1px solid rgba(251,191,36,0.26);
    color: var(--warning); font-size: 12px;
}
.notice.info { background: var(--info-dim); border-color: rgba(96,165,250,0.26); color: var(--info); }

.money { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

@media (max-width: 720px) {
    .header-inner { padding: 11px 14px; flex-wrap: wrap; }
    .page { padding: 18px 14px 70px; }
    .item-calc { flex: 1 1 100%; text-align: left; }
    .summary-bar { gap: 14px; }
}
