/* ============================================================
   鲜冷物流 BMS · 设计系统
   纯 HTML5 + CSS（无框架依赖）。类名前缀统一，避免任何冲突。
   ============================================================ */

:root {
    /* 品牌色（取自 logo：鲸鱼 #02489D / 叶绿 #8DC73D / 深绿 #039145） */
    --brand:        #02489d;
    --brand-hover:  #013c82;
    --brand-soft:   #e8f0f9;
    --accent:       #8dc73d;

    /* 侧栏（深蓝，呼应 logo） */
    --nav-bg:       #0b2545;
    --nav-fg:       #9db2cc;
    --nav-fg-hi:    #eef4fb;
    --nav-active:   rgba(2,72,157,.55);
    --nav-border:   rgba(255,255,255,.08);

    /* 中性色 */
    --bg:           #f4f6f9;
    --surface:      #ffffff;
    --border:       #e3e8ef;
    --border-soft:  #eef1f6;
    --text:         #0f1b2d;
    --text-2:       #5a6879;
    --text-3:       #91a0b3;

    /* 语义色 */
    --ok:           #039145;  --ok-bg:     #e3f5e9;
    --warn:         #8a5300;  --warn-bg:   #fbf0dc;
    --danger:       #a32d2d;  --danger-bg: #fcebeb;
    --info:         #02489d;  --info-bg:   #e8f0f9;

    /* 尺寸 */
    --nav-w:        212px;
    --topbar-h:     52px;
    --r-sm:         6px;
    --r:            10px;
    --r-lg:         14px;
    --shadow:       0 1px 2px rgba(13,27,45,.05);
    --shadow-lg:    0 8px 28px rgba(13,27,45,.10);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   应用外壳
   ============================================================ */
.app-shell {
    display: grid;
    grid-template-columns: var(--nav-w) 1fr;
    height: 100vh;
}

/* ---------- 侧栏 ---------- */
.sidebar {
    background: var(--nav-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px 15px;
    border-bottom: 1px solid var(--nav-border);
    flex: none;
}
.brand-logo {
    flex: none;
    width: 32px; height: 32px;
    border-radius: 8px;
    background: #fff;
    padding: 3px;
    object-fit: contain;
}
.brand-name {
    font-size: 13.5px; font-weight: 600; color: #fff;
    line-height: 1.25;
}
.brand-name small {
    display: block;
    font-size: 10.5px; font-weight: 400;
    color: var(--nav-fg);
    letter-spacing: .2px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 6px 10px 18px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.14) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.14); border-radius: 3px;
}

.nav-group {
    padding: 14px 8px 5px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .8px;
    color: #5e706b;
    text-transform: uppercase;
    user-select: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    margin-bottom: 1px;
    border-radius: var(--r-sm);
    color: var(--nav-fg);
    font-size: 13px;
    text-decoration: none;
    transition: background .12s, color .12s;
}
.nav-link:hover {
    background: rgba(255,255,255,.055);
    color: var(--nav-fg-hi);
    text-decoration: none;
}
.nav-link.is-active {
    background: var(--nav-active);
    color: #fff;
    font-weight: 500;
}
.nav-link.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    width: 3px; height: 18px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}
.nav-link { position: relative; }
.nav-dot {
    flex: none;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: .4;
}
.nav-link.is-active .nav-dot { opacity: 1; background: var(--accent); }

.sidebar-foot {
    flex: none;
    padding: 11px 18px;
    border-top: 1px solid var(--nav-border);
    font-size: 11px;
    color: #5e706b;
}

/* ---------- 主区 ---------- */
.workspace {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    flex: none;
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    gap: 16px;
}
.topbar h1 {
    font-size: 14.5px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}
.topbar-meta { display: flex; align-items: center; gap: 10px; }
.user-chip {
    font-size: 12px;
    color: var(--text-2);
    background: var(--bg);
    border: 1px solid var(--border-soft);
    padding: 3px 10px;
    border-radius: 20px;
}

.page {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px 48px;
}

/* ============================================================
   页头
   ============================================================ */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.page-head h2 {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 3px;
    letter-spacing: -.2px;
}
.page-head p {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-2);
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   卡片 / 网格
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    overflow: hidden;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-soft);
}
.card-head h3 {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
}
.card-head .hint {
    font-size: 11.5px;
    color: var(--text-3);
}
.card-body { padding: 16px; }
.card-body.tight { padding: 10px 12px; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

@media (max-width: 1180px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- 指标卡 ---------- */
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    padding: 15px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-label {
    font-size: 12px;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 6px;
}
.stat-value {
    font-size: 23px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -.4px;
    font-variant-numeric: tabular-nums;
}
.stat-value small {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-3);
    letter-spacing: 0;
}
.stat-sub { font-size: 11.5px; color: var(--text-3); }

/* ============================================================
   表格
   ============================================================ */
.table-wrap { overflow-x: auto; }

table.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
table.tbl thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: left;
    font-weight: 600;
    font-size: 11.5px;
    color: var(--text-2);
    background: #fafbfa;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.tbl tbody td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: #fafcfb; }
table.tbl .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
table.tbl .mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
}
table.tbl .muted { color: var(--text-3); }

/* 定义列表：详情页用 */
.dl {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 9px 14px;
    font-size: 12.5px;
}
.dl dt { color: var(--text-2); }
.dl dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ============================================================
   徽章 / 提示
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 20px;
    background: #eef1f0;
    color: var(--text-2);
    white-space: nowrap;
}
.badge-ok     { background: var(--ok-bg);     color: var(--ok); }
.badge-warn   { background: var(--warn-bg);   color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info   { background: var(--info-bg);   color: var(--info); }

.alert {
    display: flex;
    gap: 9px;
    padding: 11px 14px;
    border-radius: var(--r-sm);
    font-size: 12.5px;
    margin-bottom: 14px;
    border: 1px solid transparent;
}
.alert-info   { background: var(--info-bg);   color: var(--info);   border-color: #cfe3f5; }
.alert-warn   { background: var(--warn-bg);   color: var(--warn);   border-color: #f0dcb8; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: #f6cfcf; }
.alert-ok     { background: var(--ok-bg);     color: var(--ok);     border-color: #c5e8dc; }

.empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-3);
    font-size: 12.5px;
    line-height: 2;
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1;
    padding: 8px 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { background: #f7f9f8; text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

.btn-danger { color: var(--danger); border-color: #f0cfcf; }
.btn-danger:hover { background: var(--danger-bg); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-link {
    border: none; background: none; color: var(--brand);
    padding: 2px 4px;
}
.btn-link:hover { background: none; text-decoration: underline; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   表单
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 14px 18px;
}
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 820px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: span 1; }
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
}
.field .req { color: var(--danger); margin-left: 2px; }
.field .tip { font-size: 11px; color: var(--text-3); }
.field .err { font-size: 11.5px; color: var(--danger); }

input[type=text], input[type=password], input[type=number],
input[type=date], input[type=month], input[type=email], input[type=tel],
select, textarea {
    font-family: inherit;
    font-size: 12.5px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 8px 11px;
    width: 100%;
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15,110,86,.1);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:disabled, select:disabled, textarea:disabled {
    background: #f7f9f8; color: var(--text-3); cursor: not-allowed;
}
textarea { resize: vertical; min-height: 68px; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%235c6b66' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.filter-bar {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-soft);
    background: #fcfdfc;
}
.filter-bar .field { min-width: 140px; }

/* ============================================================
   登录页
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1000px 500px at 50% -10%, #e7f3ef 0%, transparent 65%),
        var(--bg);
}
.auth-card {
    width: 100%;
    max-width: 348px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 30px 28px 26px;
}
.auth-logo {
    display: block;
    width: 196px;
    height: auto;
    margin: 0 auto 20px;
}
.auth-card .btn { width: 100%; padding: 10px; margin-top: 4px; }

/* ============================================================
   其它
   ============================================================ */
.steps {
    counter-reset: s;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 12.5px;
}
.steps li {
    counter-increment: s;
    display: flex;
    gap: 10px;
    padding: 7px 0;
    color: var(--text-2);
}
.steps li::before {
    content: counter(s);
    flex: none;
    width: 19px; height: 19px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 11px;
    font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    margin-top: 1px;
}
.steps li a { font-weight: 500; }

.section-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--text-3);
    margin: 20px 0 9px;
}
.section-title:first-child { margin-top: 0; }

.hint-inline { font-size: 11.5px; color: var(--text-3); }
.text-muted { color: var(--text-3); }

/* 空状态里的图标位 */
.placeholder-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 15px;
    margin-bottom: 8px;
}
