/* ==========================================================================
   天恩尚品 运营后台 · 设计系统
   风格：工业建材 + 品牌红（#E5123A）
   原则：深灰做骨架，红色只做重点强调（主按钮/价格/选中/待办）
   ========================================================================== */

:root {
    --brand:        #E5123A;
    --brand-dark:   #C10E31;
    --brand-light:  #FFF1F4;
    --brand-border: #FFD6DE;

    --ink:      #1F2226;
    --slate:    #2A2E35;
    --slate-2:  #343941;
    --text:     #303133;
    --text-2:   #6B7280;
    --text-3:   #9CA3AF;
    --line:     #E5E7EB;
    --line-2:   #EEF0F2;
    --bg:       #F5F6F8;
    --white:    #FFFFFF;

    --ok:    #12805C;
    --ok-bg: #E8F5EF;
    --warn:    #D97706;
    --warn-bg: #FEF3E2;
    --danger:    #A8071A;
    --danger-bg: #FDECEE;
    --info:    #1D4ED8;
    --info-bg: #EAF0FE;

    --radius:   10px;
    --radius-s: 6px;
    --shadow:   0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --sidebar-w: 224px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--slate);
    color: #C9CED6;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar__brand {
    height: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    flex: 0 0 auto;
}

.sidebar__logo {
    width: 26px; height: 26px;
    border-radius: 6px;
    background: var(--brand);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 14px;
    letter-spacing: -.5px;
}

.sidebar__name { color: #fff; font-weight: 600; font-size: 15px; letter-spacing: .5px; }
.sidebar__sub  { color: #7A8290; font-size: 11px; margin-left: auto; }

.sidebar__nav { overflow-y: auto; padding: 10px 0 24px; flex: 1 1 auto; }

.nav-group { padding: 14px 18px 6px; font-size: 11px; color: #6C7480; letter-spacing: 1px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 18px;
    color: #C9CED6;
    font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
}

.nav-item:hover { background: rgba(255, 255, 255, .05); color: #fff; }

.nav-item.is-active {
    background: rgba(229, 18, 58, .14);
    border-left-color: var(--brand);
    color: #fff;
    font-weight: 600;
}

.nav-item__ico { width: 16px; text-align: center; opacity: .85; font-size: 14px; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 20;
}

.topbar__title { font-size: 16px; font-weight: 600; color: var(--ink); }
.topbar__crumb { color: var(--text-3); font-size: 13px; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.userbox { display: flex; align-items: center; gap: 8px; }
.userbox__avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--slate); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
}
.userbox__name { font-size: 13px; color: var(--text); }
.userbox__role {
    font-size: 11px; color: var(--brand);
    background: var(--brand-light);
    border: 1px solid var(--brand-border);
    padding: 1px 7px; border-radius: 20px;
}

.content { padding: 20px 24px 40px; flex: 1 1 auto; }

/* ---------- 卡片 ---------- */
.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.card__head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-2);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card__title { font-weight: 600; color: var(--ink); font-size: 14.5px; }
.card__desc { color: var(--text-3); font-size: 12.5px; }
.card__actions { margin-left: auto; display: flex; gap: 8px; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }

/* ---------- 统计卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }

.stat {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px 18px; box-shadow: var(--shadow);
    position: relative; overflow: hidden;
}
.stat::after {
    content: ''; position: absolute; right: -18px; top: -18px;
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--brand-light);
}
.stat__label { color: var(--text-2); font-size: 12.5px; position: relative; }
.stat__value {
    font-size: 26px; font-weight: 700; color: var(--ink);
    margin-top: 6px; letter-spacing: -.5px;
    font-variant-numeric: tabular-nums; position: relative;
}
.stat__value--brand { color: var(--brand); }
.stat__foot { margin-top: 6px; font-size: 12px; color: var(--text-3); position: relative; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 14px;
    border-radius: var(--radius-s);
    border: 1px solid var(--line);
    background: #fff; color: var(--text);
    font-size: 13.5px; cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.btn:hover { border-color: #D3D7DD; background: #FAFBFC; }

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

.btn--ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn--ghost:hover { background: var(--brand-light); }

.btn--danger { color: var(--danger); border-color: #F3C6CB; background: #fff; }
.btn--danger:hover { background: var(--danger-bg); }

.btn--sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn--block { width: 100%; }
.btn--lg { height: 42px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.form-row { margin-bottom: 16px; }
.form-row--2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row--3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.label { display: block; font-size: 13px; color: var(--text); margin-bottom: 6px; font-weight: 500; }
.label__req { color: var(--brand); margin-left: 2px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 5px; line-height: 1.6; }

.input, .select, .textarea {
    width: 100%; height: 36px; padding: 0 11px;
    border: 1px solid var(--line); border-radius: var(--radius-s);
    background: #fff; color: var(--text); font-size: 13.5px;
    font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 80px; }
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(229, 18, 58, .08);
}
.input::placeholder { color: #B9BEC6; }

.input-group { display: flex; }
.input-group .input { border-radius: var(--radius-s) 0 0 var(--radius-s); }
.input-group .btn  { border-radius: 0 var(--radius-s) var(--radius-s) 0; border-left: 0; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }

table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tb th {
    background: #FAFBFC; color: var(--text-2); font-weight: 600;
    text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line);
    white-space: nowrap; font-size: 12.5px;
}
table.tb td {
    padding: 12px 14px; border-bottom: 1px solid var(--line-2); color: var(--text);
    vertical-align: middle;
}
table.tb tbody tr:hover { background: #FAFBFC; }
table.tb tbody tr:last-child td { border-bottom: 0; }
table.tb .num { font-variant-numeric: tabular-nums; }
table.tb .right { text-align: right; }
table.tb .center { text-align: center; }
table.tb .muted { color: var(--text-3); }
table.tb .strong { font-weight: 600; color: var(--ink); }

.tb-spec { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* 可编辑单元格（库存录入） */
.cell-input {
    width: 92px; height: 30px; padding: 0 8px;
    border: 1px solid var(--line); border-radius: var(--radius-s);
    font-size: 13px; text-align: right;
    font-variant-numeric: tabular-nums;
}
.cell-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(229,18,58,.08); }

/* ---------- 徽标 ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    height: 22px; padding: 0 8px; border-radius: 4px;
    font-size: 12px; line-height: 1; white-space: nowrap;
    background: #F3F4F6; color: var(--text-2); border: 1px solid transparent;
}
.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); }
.badge--brand  { background: var(--brand-light); color: var(--brand); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- 搜索条 ---------- */
.filterbar {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap;
}
.filterbar .input, .filterbar .select { width: auto; min-width: 150px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 8px; padding: 14px 18px; }
.pager__info { color: var(--text-3); font-size: 12.5px; margin-right: auto; }
.pager__btn {
    min-width: 30px; height: 30px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: var(--radius-s);
    font-size: 13px; background: #fff;
}
.pager__btn.is-active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pager__btn.is-disabled { opacity: .45; pointer-events: none; }

/* ---------- 提示 ---------- */
.alert {
    padding: 11px 14px; border-radius: var(--radius-s); font-size: 13px;
    margin-bottom: 16px; line-height: 1.7; border: 1px solid transparent;
}
.alert--danger { background: var(--danger-bg); color: var(--danger); border-color: #F3C6CB; }
.alert--warn   { background: var(--warn-bg);   color: var(--warn);   border-color: #F5DFBB; }
.alert--ok     { background: var(--ok-bg);     color: var(--ok);     border-color: #BEE3D5; }
.alert--info   { background: var(--info-bg);   color: var(--info);   border-color: #C9D8FB; }

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty__ico { font-size: 30px; opacity: .45; margin-bottom: 10px; }

/* ---------- 登录页 ---------- */
.login {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--slate);
    background-image:
        radial-gradient(1100px 460px at 12% -8%, rgba(229, 18, 58, .16), transparent 62%),
        radial-gradient(760px 380px at 104% 108%, rgba(255, 255, 255, .06), transparent 60%);
    padding: 24px;
}

.login__card {
    width: 100%; max-width: 396px;
    background: #fff; border-radius: 14px; padding: 34px 32px 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .28);
}
.login__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login__logo {
    width: 34px; height: 34px; border-radius: 8px; background: var(--brand);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 17px;
}
.login__title { font-size: 19px; font-weight: 700; color: var(--ink); letter-spacing: .5px; }
.login__sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.login__foot { margin-top: 20px; text-align: center; color: var(--text-3); font-size: 12px; }

/* ---------- 安装向导 ---------- */
.install { min-height: 100vh; background: var(--bg); padding: 40px 20px 60px; }
.install__wrap { max-width: 820px; margin: 0 auto; }
.install__head { text-align: center; margin-bottom: 26px; }
.install__logo {
    width: 46px; height: 46px; border-radius: 12px; background: var(--brand);
    color: #fff; font-weight: 800; font-size: 22px;
    display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.install__title { font-size: 22px; font-weight: 700; color: var(--ink); }
.install__desc { color: var(--text-2); font-size: 13.5px; margin-top: 6px; }

.install__steps { display: flex; gap: 8px; margin: 22px 0; }
.install__step {
    flex: 1; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px 14px; font-size: 12.5px; color: var(--text-2);
}
.install__step b { display: block; color: var(--ink); font-size: 13.5px; margin-bottom: 3px; }

.form-row--3 .label { font-size: 12.5px; }
.section-title {
    font-size: 12px; color: var(--text-3); letter-spacing: 1px;
    margin: 22px 0 12px; font-weight: 600;
}
.section-title:first-child { margin-top: 0; }

.logbox {
    background: #1E2228; color: #C8F5D8; border-radius: var(--radius-s);
    padding: 14px 16px; font-family: ui-monospace, Consolas, "Courier New", monospace;
    font-size: 12.5px; line-height: 1.9; white-space: pre-wrap; margin: 0;
    max-height: 340px; overflow: auto;
}

/* ---------- 工具类 ---------- */
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; } .mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--text-3); }
.text-brand { color: var(--brand); }
.fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; }
.nowrap { white-space: nowrap; }
.w-100 { width: 100%; }

@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
    :root { --sidebar-w: 0px; }
    .sidebar { display: none; }
    .stats { grid-template-columns: 1fr; }
    .form-row--2, .form-row--3 { grid-template-columns: 1fr; }
}
