/* ============ 库存管理系统 · 管理端样式 ============ */
:root {
    --brand: #0f766e;
    --brand-dark: #115e59;
    --brand-soft: #e6f4f2;
    --ink: #1b2430;
    --ink-2: #55637a;
    --ink-3: #8a97ac;
    --line: #e3e9f2;
    --bg: #f4f6fa;
    --card: #ffffff;
    --sidebar: #101a2b;
    --sidebar-2: #17233a;
    --amber: #d97706;
    --danger: #d33c3c;
    --ok: #15803d;
    --radius: 10px;
}

html, body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 228px;
    background: linear-gradient(180deg, var(--sidebar) 0%, #0c1524 100%);
    display: flex;
    flex-direction: column;
    padding: 18px 12px 12px;
    z-index: 30;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 20px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .5px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(15, 118, 110, .35);
}

.brand-title {
    color: #f1f5f9;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
}

.brand-sub {
    color: #64748b;
    font-size: 10px;
    letter-spacing: 1.2px;
    margin-top: 3px;
}

.nav-groups {
    flex: 1;
}

.nav-group {
    margin-bottom: 6px;
}

.nav-label {
    color: #5b6b85;
    font-size: 11px;
    letter-spacing: 1px;
    padding: 10px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: #a9b6cc;
    text-decoration: none;
    font-size: 13.5px;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}

.nav-item:hover {
    background: var(--sidebar-2);
    color: #e6edf7;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(20, 184, 166, .18), rgba(20, 184, 166, .06));
    color: #ffffff;
    box-shadow: inset 2px 0 0 #14b8a6;
}

.nav-ico svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}

.nav-badge {
    margin-left: auto;
    background: #d33c3c;
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 20px;
    line-height: 1.5;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 8px 4px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    margin-top: 10px;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #22314a;
    color: #9fd6cf;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.user-name {
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.2;
}

.user-role {
    color: #6b7c98;
    font-size: 11px;
    margin-top: 2px;
}

.btn-logout {
    background: transparent;
    border: 0;
    padding: 4px;
    cursor: pointer;
    color: #7386a3;
    border-radius: 6px;
}

.btn-logout:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

.btn-logout svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
}

/* ---------- 主区域 ---------- */
.main {
    margin-left: 228px;
    padding: 22px 26px 40px;
    min-height: 100%;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.page-title {
    font-size: 21px;
    font-weight: 650;
    letter-spacing: -.2px;
    margin: 0;
}

.page-desc {
    color: var(--ink-3);
    font-size: 12.5px;
    margin-top: 5px;
}

.page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ---------- 提示条 ---------- */
.flash {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    font-size: 13.5px;
    border: 1px solid transparent;
}

.flash svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    flex: 0 0 auto;
}

.flash-ok {
    background: #ecfdf5;
    border-color: #bbf0d4;
    color: #15633f;
}

.flash-err {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #a02a2a;
}

/* ---------- 卡片 ---------- */
.card-x {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(16, 26, 43, .04);
}

.card-x-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
}

.card-x-title {
    font-weight: 600;
    font-size: 14px;
}

.card-x-body {
    padding: 16px;
}

/* ---------- 指标卡 ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px 12px;
    position: relative;
    overflow: hidden;
}

.stat:before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--brand);
    opacity: .85;
}

.stat.amber:before { background: var(--amber); }
.stat.red:before { background: var(--danger); }
.stat.slate:before { background: #64748b; }

.stat-label {
    color: var(--ink-3);
    font-size: 12px;
    letter-spacing: .3px;
}

.stat-value {
    font-size: 26px;
    font-weight: 680;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.5px;
}

.stat-unit {
    font-size: 12px;
    color: var(--ink-3);
    font-weight: 400;
    margin-left: 4px;
}

.stat-foot {
    color: var(--ink-3);
    font-size: 12px;
    margin-top: 4px;
}

/* ---------- 筛选条 ---------- */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.filters .form-control,
.filters .form-select {
    height: 34px;
    font-size: 13px;
    border-color: var(--line);
    max-width: 200px;
}

.filters .search {
    width: 240px;
    max-width: 240px;
}

/* ---------- 表格 ---------- */
.table-wrap {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-x {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.table-x thead th {
    background: #f8fafd;
    color: var(--ink-2);
    font-weight: 600;
    font-size: 12.5px;
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table-x tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f3f8;
    font-size: 13px;
    vertical-align: middle;
}

.table-x tbody tr:hover {
    background: #fafcff;
}

.table-x tbody tr:last-child td {
    border-bottom: 0;
}

.table-x .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table-x .muted {
    color: var(--ink-3);
}

.table-x .strong {
    font-weight: 600;
}

.table-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 16px;
    border-top: 1px solid var(--line);
    color: var(--ink-3);
    font-size: 12.5px;
    background: #fcfdff;
}

/* ---------- 标签 ---------- */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    line-height: 1.6;
    white-space: nowrap;
}

.tag-draft { background: #fff7e6; color: #a25c07; border: 1px solid #fadfae; }
.tag-done { background: #e9f9f0; color: #14663c; border: 1px solid #b9e8cb; }
.tag-void { background: #f1f3f7; color: #6b7789; border: 1px solid #dde2ea; }
.tag-warn { background: #fdeded; color: #a52a2a; border: 1px solid #f6c5c5; }
.tag-info { background: #e9f2ff; color: #1b4f9c; border: 1px solid #c7dcfa; }
.tag-teal { background: var(--brand-soft); color: var(--brand-dark); border: 1px solid #b9e3de; }

/* ---------- 按钮 ---------- */
.btn-brand {
    background: var(--brand);
    border: 1px solid var(--brand);
    color: #fff;
    font-size: 13px;
    padding: 7px 14px;
    border-radius: 8px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

.btn-ghost {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink-2);
    font-size: 13px;
    padding: 7px 14px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-ghost:hover { border-color: #c9d3e2; color: var(--ink); background: #fbfcfe; }

.btn-mini {
    font-size: 12.5px;
    padding: 4px 10px;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    text-decoration: none;
    display: inline-block;
    line-height: 1.7;
}

.btn-mini:hover { color: var(--ink); border-color: #c9d3e2; }
.btn-mini.danger { color: var(--danger); border-color: #f3cfcf; }
.btn-mini.danger:hover { background: #fdf2f2; }
.btn-mini.primary { color: var(--brand-dark); border-color: #b9e3de; background: var(--brand-soft); }
.btn-mini.primary:hover { background: #d5efeb; }

.btn-link-x {
    color: var(--brand-dark);
    text-decoration: none;
    font-size: 13px;
}

.btn-link-x:hover { text-decoration: underline; }

/* ---------- 表单 ---------- */
.form-label {
    font-size: 12.5px;
    color: var(--ink-2);
    font-weight: 500;
    margin-bottom: 5px;
}

.form-control, .form-select {
    font-size: 13.5px;
    border-color: var(--line);
    border-radius: 8px;
    padding: 7px 11px;
    color: var(--ink);
    box-shadow: none;
}

.form-control:focus, .form-select:focus {
    border-color: #7fd1c8;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .1);
}

.form-control::placeholder { color: #b1bdcf; }

.req::after { content: " *"; color: var(--danger); }

.form-actions {
    display: flex;
    gap: 8px;
    padding-top: 4px;
}

/* ---------- 分页 ---------- */
.pager {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pager a, .pager span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink-2);
    text-decoration: none;
    font-size: 12.5px;
    background: #fff;
}

.pager a:hover { border-color: #c9d3e2; color: var(--ink); }
.pager .on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .off { color: #c3ccda; }

/* ---------- 空状态 ---------- */
.empty {
    padding: 46px 20px;
    text-align: center;
    color: var(--ink-3);
}

.empty svg {
    width: 42px;
    height: 42px;
    stroke: #cbd5e3;
    fill: none;
    stroke-width: 1.5;
    margin-bottom: 10px;
}

.empty p { margin: 0; font-size: 13px; }

/* ---------- 登录页 ---------- */
.auth-body {
    background: #0e1626;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.auth-panel {
    width: 100%;
    max-width: 920px;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    box-shadow: 0 24px 60px rgba(3, 10, 24, .45);
}

.auth-side {
    background: radial-gradient(120% 120% at 0% 0%, #17324f 0%, #0e1a2c 55%, #0a1424 100%);
    color: #dbe6f3;
    padding: 40px 38px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.auth-side:after {
    content: "";
    position: absolute;
    right: -60px;
    top: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(20, 184, 166, .35), transparent 68%);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
}

.auth-headline {
    font-size: 30px;
    line-height: 1.35;
    font-weight: 680;
    letter-spacing: -.6px;
    margin: 26px 0 14px;
}

.auth-sub {
    color: #93a7c1;
    font-size: 13.5px;
    line-height: 1.9;
    max-width: 330px;
}

.auth-points {
    margin-top: 30px;
    display: grid;
    gap: 10px;
}

.auth-point {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: #b8cae0;
}

.auth-point i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #14b8a6;
    display: inline-block;
}

.auth-foot {
    color: #5e7191;
    font-size: 11.5px;
    margin-top: 26px;
}

.auth-form {
    padding: 44px 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-form h2 {
    font-size: 20px;
    font-weight: 650;
    margin-bottom: 4px;
}

.auth-form .hint {
    color: var(--ink-3);
    font-size: 12.5px;
    margin-bottom: 22px;
}

.auth-form .form-control {
    height: 42px;
    font-size: 14px;
}

.auth-form .btn-brand {
    width: 100%;
    justify-content: center;
    height: 42px;
    font-size: 14px;
    margin-top: 8px;
}

.auth-accounts {
    margin-top: 22px;
    border-top: 1px dashed var(--line);
    padding-top: 14px;
    color: var(--ink-3);
    font-size: 12px;
    line-height: 1.9;
}

.auth-accounts code {
    color: var(--brand-dark);
    background: var(--brand-soft);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11.5px;
}

/* ---------- 详情页 ---------- */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 20px;
    padding: 16px;
}

.detail-item .k {
    color: var(--ink-3);
    font-size: 12px;
    margin-bottom: 3px;
}

.detail-item .v {
    font-size: 13.5px;
    font-weight: 500;
    word-break: break-all;
}

.two-col {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 14px;
}

/* ---------- 条形图（纯 CSS 报表） ---------- */
.bars { display: grid; gap: 10px; padding: 16px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 76px; align-items: center; gap: 10px; }
.bar-name { font-size: 12.5px; color: var(--ink-2); text-align: right; }
.bar-track { height: 12px; background: #f1f5f9; border-radius: 8px; position: relative; overflow: hidden; }
.bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 8px; background: linear-gradient(90deg, #14b8a6, #0f766e); }
.bar-fill.out { background: linear-gradient(90deg, #f0a04b, #d97706); }
.bar-val { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-3); padding: 0 16px 14px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .sidebar { position: static; width: 100%; height: auto; }
    .main { margin-left: 0; padding: 16px; }
    .auth-panel { grid-template-columns: 1fr; }
    .auth-side { display: none; }
}
