/* =========================================================
   子商户管理平台 · UI
   深色侧边栏 + 浅色内容区
   ========================================================= */

:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --text: #111a2e;
    --text-2: #475467;
    --muted: #8a94a6;
    --line: #eaedf3;
    --line-2: #dfe5ee;

    --primary: #3f6bff;
    --primary-2: #5b8cff;
    --primary-dark: #2a51d6;
    --green: #0f9d58;
    --red: #e5484d;
    --amber: #b7791f;

    --sidebar: #0f1726;
    --sidebar-2: #16213a;

    --radius: 16px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 8px 24px rgba(16, 24, 40, .07);
    --shadow-lg: 0 18px 50px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }

/* ================= 侧边栏 ================= */
.topbar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 236px;
    padding: 24px 14px 18px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    border-right: 1px solid rgba(255, 255, 255, .06);
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .3px;
    padding: 0 10px;
}
.brand::before {
    content: "";
    width: 30px; height: 30px;
    flex: 0 0 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, #6b8dff, #3358f4);
    box-shadow: inset 0 0 0 7px rgba(255, 255, 255, .18),
                0 6px 16px rgba(51, 88, 244, .45);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.brand-text small {
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 1px;
    color: #7b8aa3;
    margin-top: 3px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 30px;
    flex: 1;
    overflow-y: auto;
}
.nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 13px;
    border-radius: 10px;
    color: #97a4bb;
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s, color .15s, transform .15s;
}
.nav a::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .45;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active {
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    color: #fff;
    box-shadow: 0 8px 20px rgba(63, 107, 255, .35);
}
.nav a.active::before { opacity: 1; background: #fff; }

.topbar-right {
    margin-top: auto;
    padding: 16px 10px 0;
    border-top: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    color: #8d9bb3;
    font-size: 12.5px;
}
.topbar-right .btn {
    background: rgba(255, 255, 255, .08);
    color: #dfe5f2;
    border: 1px solid rgba(255, 255, 255, .08);
}
.topbar-right .btn:hover { background: rgba(255, 255, 255, .14); }

/* ================= 内容区 ================= */
.wrap {
    margin-left: 236px;
    padding: 30px 34px 70px;
    max-width: 1560px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
}
.page-head h2 {
    margin: 0;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: .2px;
}

/* ================= 统计卡片 ================= */
.cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6b8dff, #3358f4);
}
.card.available::before { background: linear-gradient(90deg, #34d399, #0f9d58); }
.card.assigned::before  { background: linear-gradient(90deg, #60a5fa, #3f6bff); }
.card.risk::before      { background: linear-gradient(90deg, #fb7185, #e5484d); }

.card .label {
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
}
.card .value {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.2;
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.5px;
}
.card.available .value { color: var(--green); }
.card.assigned .value  { color: var(--primary); }
.card.risk .value      { color: var(--red); }
.card .muted { margin-top: 2px; }

/* ================= 面板 ================= */
.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.panel-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
    font-size: 14.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: linear-gradient(180deg, #fcfdff, #fff);
}
.panel-body { padding: 18px 20px 22px; }

/* ================= 表单 ================= */
label {
    display: block;
    font-size: 12.5px;
    color: var(--text-2);
    font-weight: 500;
    margin: 14px 0 6px;
}
input[type=text],
input[type=password],
input[type=number],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    font-size: 13.5px;
    background: #fff;
    color: var(--text);
    outline: none;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus,
input[type=password]:focus,
input[type=number]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(63, 107, 255, .13);
}
textarea {
    min-height: 140px;
    resize: vertical;
    font-family: ui-monospace, Consolas, Menlo, monospace;
    font-size: 13px;
    line-height: 1.7;
}
select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a94a6' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 30px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 15px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: #eef2f9;
    color: var(--text-2);
    white-space: nowrap;
    transition: background .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: #e5ebf6; color: var(--text); text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    color: #fff;
    box-shadow: 0 6px 16px rgba(63, 107, 255, .28);
}
.btn-primary:hover { background: linear-gradient(135deg, #6b8dff, var(--primary-dark)); color: #fff; }

.btn-danger { background: #fdeeed; color: var(--red); }
.btn-danger:hover { background: #fbdcdb; color: var(--red); }

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; margin-top: 20px; padding: 12px; font-size: 15px; border-radius: 11px; }

.inline-form { display: inline; }

/* ================= 表格 ================= */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    vertical-align: middle;
}
th {
    background: #f8fafd;
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: .3px;
}
td { font-size: 13px; color: var(--text-2); }
td strong { color: var(--text); font-weight: 600; }
tbody tr:hover td { background: #f9fbff; }
tbody tr:last-child td { border-bottom: none; }
td.wrap-cell { white-space: normal; max-width: 220px; min-width: 120px; }

.empty {
    padding: 56px 24px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

/* ================= 操作区 ================= */
.row-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.row-actions form {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}
.row-actions input[type=text] {
    width: 116px;
    padding: 5px 9px;
    font-size: 12px;
    border-radius: 8px;
}
.row-actions select {
    width: 150px;
    padding: 5px 26px 5px 9px;
    font-size: 12px;
    border-radius: 8px;
}

/* ================= 徽标 ================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 18px;
    font-weight: 600;
}
.badge::before {
    content: "";
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: .8;
}
.badge-gray  { background: #f1f4f9; color: #6b7688; }
.badge-green { background: #e7f8ef; color: #0b8a4b; }
.badge-blue  { background: #e9f0ff; color: #2f5fd8; }
.badge-red   { background: #fdecec; color: #cf3238; }
.badge-dark  { background: #eceff4; color: #475467; }

/* ================= 提示 ================= */
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid transparent;
}
.alert-ok    { background: #e8f8f0; border-color: #c7eedd; color: #0b7a45; }
.alert-error { background: #fdecec; border-color: #f8d3d2; color: #b52c2c; }
.alert-warn  { background: #fff7e6; border-color: #fbe2b0; color: #96620b; }
.alert a { text-decoration: underline; }

/* ================= 筛选 ================= */
.filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filters > div { min-width: 148px; }
.filters label { margin-top: 0; }
.filters .btn { height: 40px; }

/* ================= 分页 ================= */
.pager {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    align-items: center;
    color: var(--muted);
    font-size: 12.5px;
    border-top: 1px solid var(--line);
}
.pager a {
    padding: 5px 12px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    color: var(--text-2);
    font-weight: 500;
}
.pager a:hover { border-color: var(--primary); color: var(--primary); }
.pager a.current {
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    border-color: transparent;
    color: #fff;
}

/* ================= 通用 ================= */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.muted { color: var(--muted); font-size: 12px; }

/* ================= 登录页 ================= */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 28px;
    background:
        radial-gradient(1000px 600px at 8% 0%, rgba(63, 107, 255, .30), transparent 55%),
        radial-gradient(800px 600px at 95% 100%, rgba(139, 92, 246, .22), transparent 55%),
        #0b1220;
}

.auth-shell {
    display: flex;
    width: 880px;
    max-width: 100%;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(2, 8, 23, .45);
}

.auth-side {
    position: relative;
    width: 46%;
    padding: 42px 38px;
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(420px 300px at 100% 0%, rgba(107, 141, 255, .45), transparent 60%),
        linear-gradient(160deg, #16213a 0%, #0f1726 100%);
}
.auth-side::after {
    content: "";
    position: absolute;
    right: -70px;
    bottom: -90px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: rgba(91, 140, 255, .16);
}
.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 33px;
}
.logo-mark {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: linear-gradient(135deg, #6b8dff, #3358f4);
    box-shadow: 0 10px 24px rgba(51, 88, 244, .50);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .5px;
}
.logo-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .5px;
}
.auth-side h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 1px;
}
.auth-tag {
    margin: 8px 0 0;
    color: #93a3bf;
    font-size: 12.5px;
    letter-spacing: 2px;
}
.auth-points {
    list-style: none;
    padding: 0;
    margin: 36px 0 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.auth-points li {
    position: relative;
    padding-left: 22px;
    color: #c7d2e6;
    font-size: 13px;
}
.auth-points li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6b8dff, #3358f4);
    box-shadow: 0 0 0 4px rgba(91, 140, 255, .14);
}
.auth-foot {
    margin-top: auto;
    padding-top: 30px;
    color: #6b7890;
    font-size: 11.5px;
    letter-spacing: .3px;
}

.auth-main {
    flex: 1;
    padding: 46px 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth-main h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: .3px;
}
.auth-sub {
    color: var(--muted);
    margin: 8px 0 24px;
    font-size: 13px;
}
.auth-hint {
    margin: 18px 0 0;
    text-align: center;
    color: #a3adbd;
    font-size: 11.5px;
}

/* ================= 滚动条 ================= */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb {
    background: #cfd7e5;
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #b6c1d4; background-clip: content-box; }

/* ================= 响应式 ================= */
@media (max-width: 1280px) {
    .cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 960px) {
    .topbar {
        position: static;
        width: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 12px;
        padding: 14px 16px;
        border-right: 0;
    }
    .nav {
        flex-direction: row;
        flex-wrap: wrap;
        margin-top: 0;
        gap: 6px;
        flex: 1;
    }
    .nav a { padding: 7px 11px; }
    .topbar-right {
        margin-top: 0;
        padding: 0;
        border-top: 0;
        flex-direction: row;
        align-items: center;
    }
    .wrap { margin-left: 0; padding: 20px 16px 50px; }
    .cards { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .cards { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 820px) {
    .auth-shell { flex-direction: column; }
    .auth-side { width: 100%; padding: 28px 26px; }
    .auth-side h1 { font-size: 22px; }
    .auth-points, .auth-foot { display: none; }
    .auth-main { padding: 30px 26px 34px; }
}
