/* 加油站小程序后台样式
   全部静态资源走 /admin/... 由 nginx 直接返回；
   页面里没有内联脚本（CSP 是 script-src 'self'），交互统一在 app.js 里绑定。 */

:root {
    --brand: #2f7dfb;
    --brand-dark: #1f5fd0;
    --brand-soft: #eaf2ff;
    --text: #1f2733;
    --text-sub: #6b7684;
    --line: #e8ecf2;
    --bg: #f4f6fa;
    --up: #f5483b;
    --down: #16a34a;
    --warn: #f59a23;
    --radius: 12px;
    --shadow: 0 2px 10px rgba(31, 39, 51, .06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

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

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

.sidebar {
    width: 216px;
    flex: 0 0 216px;
    background: linear-gradient(180deg, #2f7dfb 0%, #1c4fb8 100%);
    color: #fff;
    padding: 18px 0 24px;
}

.sidebar .brand {
    padding: 0 20px 16px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .5px;
}

.sidebar .brand small {
    display: block;
    font-weight: 400;
    font-size: 12px;
    opacity: .75;
    margin-top: 2px;
}

.sidebar .build-info {
    margin: 18px 20px 0;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, .18);
    font-size: 12px;
    color: rgba(255, 255, 255, .6);
    word-break: break-all;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: rgba(255, 255, 255, .82);
    font-size: 14px;
}

.sidebar nav a:hover { background: rgba(255, 255, 255, .1); text-decoration: none; }

.sidebar nav a.active {
    background: rgba(255, 255, 255, .18);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #fff;
}

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

.topbar {
    height: 58px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
}

.topbar h1 { font-size: 16px; margin: 0; font-weight: 600; }
.topbar .who { color: var(--text-sub); font-size: 13px; display: flex; align-items: center; gap: 14px; }

.content { padding: 20px 22px 40px; }

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

.card > h2 {
    font-size: 15px;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.card > h2 .tip { font-weight: 400; font-size: 12px; color: var(--text-sub); margin-left: 8px; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1100px) {
    .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.stat {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}

.stat b { display: block; font-size: 26px; line-height: 1.2; color: var(--brand); }
.stat span { color: var(--text-sub); font-size: 13px; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: #99a3b0; margin-top: 4px; }

input[type="text"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(47, 125, 251, .12);
}

textarea { min-height: 84px; resize: vertical; }

input[type="color"] {
    width: 52px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.checkline { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.checkline input { width: 16px; height: 16px; }

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    background: var(--brand);
    color: #fff;
    font-family: inherit;
}

.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: #f7f9fc; color: var(--text); }
.btn.danger { background: #fff; color: var(--up); border-color: #ffd9d5; }
.btn.danger:hover { background: #fff5f4; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; padding: 11px; font-size: 15px; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions.end { justify-content: flex-end; }

/* ---------------- 表格 ---------------- */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: var(--text-sub); font-weight: 500; background: #fafbfd; }
tbody tr:hover { background: #fafcff; }
td input[type="text"], td input[type="number"] { padding: 6px 8px; }

.tbl-img { width: 76px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #f4f6fa; }
.thumb-empty { display: inline-block; width: 76px; height: 40px; line-height: 40px; text-align: center; color: #b7c0cc; font-size: 12px; border-radius: 6px; background: #f4f6fa; }

/* 列多的表（比如油价批量改价）用横向滚动，不要硬挤成一团 */
.table-scroll { width: 100%; overflow-x: auto; }
table.wide { min-width: 1000px; }
table.wide th, table.wide td { white-space: nowrap; }

/* 表格里的输入框要有下限宽度，否则价格会被截成一位数字 */
td input[type="text"], td input[type="number"] { min-width: 118px; }
td input[type="number"] { min-width: 96px; }
td select { min-width: 110px; }
/* ---------------- 徽标 / 提示 ---------------- */
.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    background: var(--brand-soft);
    color: var(--brand);
}

.tag.gray { background: #f1f3f6; color: #8b95a3; }
.tag.up { background: #ffefed; color: var(--up); }
.tag.down { background: #e9f8ef; color: var(--down); }
.tag.same { background: #f1f3f6; color: #8b95a3; }

.alert { border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.alert.ok { background: #e9f8ef; color: #17784a; }
.alert.err { background: #fff0ee; color: #b32a1e; }
.alert.info { background: var(--brand-soft); color: var(--brand-dark); }

.empty { color: #a6afbb; text-align: center; padding: 26px 0; font-size: 13px; }

.pager { display: flex; gap: 8px; align-items: center; margin-top: 14px; color: var(--text-sub); font-size: 13px; }
.pager a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

.switch {
    display: inline-block;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    border: none;
    background: #d8dee7;
    position: relative;
    cursor: pointer;
    transition: background .18s;
}

.switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: left .18s;
}

.switch.on { background: var(--brand); }
.switch.on::after { left: 22px; }

/* ---------------- 上传 ---------------- */
.uploader { display: flex; align-items: flex-start; gap: 12px; }
.uploader .preview {
    width: 150px;
    height: 84px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px dashed #cfd7e2;
    background: #fafbfd;
}

.uploader .preview.empty { border-style: dashed; }
.uploader .side { display: flex; flex-direction: column; gap: 8px; }
.uploader .side .hint { font-size: 12px; color: #99a3b0; }
.uploader input[type="file"] { display: none; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #2f7dfb 0%, #6aa8ff 45%, #f4f6fa 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(20, 50, 120, .18);
    padding: 30px 28px 24px;
}

.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-card p.sub { color: var(--text-sub); font-size: 13px; margin: 0 0 22px; }
.login-card .log { text-align: center; color: #a6afbb; font-size: 12px; margin-top: 16px; }

.field-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--text-sub); }
.kv dd { margin: 0; word-break: break-all; }
