/* 味知源督导巡检 · 全站样式（纯本地、无外部依赖） */
:root {
    --brand: #0f5c4d;
    --brand-dark: #0b4438;
    --brand-light: #e7f2ed;
    --accent: #d97706;
    --text: #22302c;
    --muted: #7a8a83;
    --line: #e3e9e5;
    --bg: #f4f6f3;
    --card: #ffffff;
    --red: #c0392b;
    --amber: #b7791f;
    --blue: #2b6cb0;
    --green: #237a4b;
    --radius: 10px;
    --shadow: 0 2px 10px rgba(18, 45, 38, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: .2px; }
p { margin: 8px 0; }
img { max-width: 100%; height: auto; }
code { background: #f3f5f3; padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 228px; flex: 0 0 228px;
    background: linear-gradient(180deg, #123c32 0%, #0d2e27 100%);
    color: #dfe9e5;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    overflow-y: auto;
}
.brand {
    display: flex; gap: 10px; align-items: center;
    padding: 20px 18px 16px; color: #fff;
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 10px; flex: 0 0 38px;
    background: var(--accent); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; font-size: 15px; font-weight: 600; line-height: 1.3; }
.brand-text small { font-weight: 400; font-size: 11px; color: #9dbbb1; margin-top: 3px; letter-spacing: .5px; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    color: #cfded8; padding: 9px 12px; border-radius: 8px;
    font-size: 14px; white-space: nowrap;
}
.nav-item:hover { background: rgba(255, 255, 255, .08); text-decoration: none; color: #fff; }
.nav-item.active { background: rgba(217, 119, 6, .22); color: #fff; font-weight: 600; border-left: 3px solid var(--accent); padding-left: 9px; }
.nav-mobile { margin-top: 8px; border-top: 1px dashed rgba(255,255,255,.15); padding-top: 14px; color: #f0c98a; }
.sidebar-foot { margin-top: auto; padding: 16px 18px 20px; font-size: 12px; color: #9dbbb1; }
.who { display: flex; flex-direction: column; margin-bottom: 8px; }
.who strong { color: #fff; font-size: 14px; }
.who span { font-size: 11px; color: #9dbbb1; }
.link-btn { background: none; border: 0; color: #ffcf8a; padding: 0; cursor: pointer; font-size: 12px; }
.link-btn:hover { text-decoration: underline; }

.main { flex: 1; min-width: 0; }
.main-inner { max-width: 1240px; margin: 0 auto; padding: 26px 30px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 通用组件 ---------- */
.panel {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
    margin-bottom: 18px;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h2 { font-size: 17px; }
.panel-head h3 { font-size: 15px; }
.panel-sub { color: var(--muted); font-size: 12px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px;
    min-width: 0;
}
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 26px; font-weight: 700; color: var(--brand); line-height: 1.2; }
.kpi .value small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 3px; }
.kpi .hint { font-size: 12px; color: var(--muted); }
.kpi.warn .value { color: var(--red); }

.quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.quick-link {
    border: 1px solid var(--line); border-radius: 9px; padding: 14px 16px;
    background: #fbfcfb; color: var(--text); display: flex; flex-direction: column; gap: 2px;
}
.quick-link:hover { border-color: var(--brand); text-decoration: none; background: var(--brand-light); }
.quick-link strong { color: var(--brand); font-size: 14px; }
.quick-link span { font-size: 12px; color: var(--muted); }

.btn {
    display: inline-block; border: 1px solid transparent; border-radius: 8px;
    padding: 8px 15px; font-size: 13px; cursor: pointer; background: #eef1ef; color: var(--text);
    line-height: 1.5; text-align: center; font-family: inherit;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn-danger { background: #fbebea; color: var(--red); border-color: #f3d4d1; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { display: block; width: 100%; padding: 11px 16px; font-size: 15px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.flash { border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; border: 1px solid transparent; }
.flash-success { background: #e8f6ee; color: #1d6b43; border-color: #c6e7d4; }
.flash-error { background: #fceceb; color: #a5322a; border-color: #f3cdc9; }
.flash-warn { background: #fff7e8; color: #925c0b; border-color: #f2deb4; }
.flash-info { background: #eaf2f9; color: #2b5d85; border-color: #cfe2f2; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.badge-green { background: #e6f5ea; color: var(--green); }
.badge-red { background: #fdecea; color: var(--red); }
.badge-amber { background: #fff4e0; color: var(--amber); }
.badge-blue { background: #eaf1fa; color: var(--blue); }
.badge-gray { background: #eff2f0; color: #65766e; }

.level { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 700; font-size: 13px; }
.level-a { background: #e6f5ea; color: #1d7a3d; }
.level-b { background: #eaf1fa; color: #2c5f9e; }
.level-c { background: #fff3e0; color: #a4680c; }
.level-d { background: #fdeaea; color: #b03232; }
.level-none { background: #f0f2f0; color: #8a9a92; }

.score { font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.score-empty { color: #a7b3ad; font-size: 12px; }

/* ---------- 表格 ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
.table th, .table td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { background: #f6f8f6; color: #5f7069; font-weight: 600; font-size: 12px; white-space: nowrap; }
.table tr:hover td { background: #fbfcfb; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table.compact th, .table.compact td { padding: 7px 8px; font-size: 12px; }
.table .nowrap { white-space: nowrap; }
.table .actions { white-space: nowrap; }
.table .actions a, .table .actions button { margin-right: 6px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 0 2px; }
.pager-info { color: var(--muted); font-size: 12px; }

.empty-block { text-align: center; color: var(--muted); padding: 36px 16px; border: 1px dashed var(--line); border-radius: 9px; background: #fbfcfb; }
.empty-block p { margin: 0 0 4px; font-size: 14px; }
.empty-block span { font-size: 12px; color: #9aa8a1; }
.empty-state { text-align: center; padding: 48px 20px; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: 12px; color: #5f7069; }
.field input[type=text], .field input[type=tel], .field input[type=password], .field input[type=date],
.field input[type=number], .field input[type=url], .field select, .field textarea {
    width: 100%; border: 1px solid #d8e0db; border-radius: 8px; padding: 9px 11px;
    font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
.field textarea { min-height: 70px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 92, 77, .1); }
.field-check { flex-direction: row; align-items: center; gap: 8px; }
.field-check > span { order: 2; font-size: 13px; color: var(--text); }
.field-check input { order: 1; width: 16px; height: 16px; }
.field-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field-row .field { flex: 1 1 160px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.form-section { font-size: 15px; margin: 18px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 12px; }
.required-mark { color: var(--red); }

/* ---------- 工作台 ---------- */
.todo-list { display: flex; flex-direction: column; gap: 10px; }
.todo-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfb; flex-wrap: wrap; }
.todo-item .meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.todo-item .meta strong { font-size: 14px; }
.todo-item .meta span { color: var(--muted); font-size: 12px; }

/* ---------- 门店二维码 ---------- */
.qr-box { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.qr-canvas { width: 220px; height: 220px; background: #fff; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.qr-meta { flex: 1 1 260px; min-width: 0; }
.qr-url { word-break: break-all; font-size: 12px; background: #f5f7f5; padding: 8px 10px; border-radius: 6px; }

/* ---------- 模板编辑器 ---------- */
.tpl-group { border: 1px solid var(--line); border-radius: 9px; padding: 14px; margin-bottom: 14px; background: #fbfcfb; }
.tpl-group-head { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.tpl-group-head .field { margin-bottom: 0; }
.tpl-items { display: flex; flex-direction: column; gap: 10px; }
.tpl-item { border: 1px solid #e6ece7; border-radius: 8px; padding: 12px; background: #fff; }
.tpl-item-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 12px; }
.tpl-item-grid .field { margin-bottom: 0; }
.tpl-item .wide { grid-column: 1 / -1; }
.tpl-item-foot { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: #5f7069; }
.tpl-item-foot label { display: inline-flex; gap: 4px; align-items: center; }
.tpl-item-foot input[type=checkbox] { width: 15px; height: 15px; }
.tpl-delete { margin-left: auto; color: var(--red); background: none; border: 0; cursor: pointer; font-size: 12px; }
.tpl-group-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- 安装 ---------- */
.auth-body { background: linear-gradient(160deg, #0f3b31 0%, #123c32 45%, #1c4a3d 100%); min-height: 100vh; padding: 40px 16px; }
.auth-wrap { max-width: 460px; margin: 0 auto; }
.auth-brand { display: flex; gap: 12px; align-items: center; color: #fff; margin-bottom: 18px; }
.auth-brand strong { display: block; font-size: 17px; }
.auth-brand small { color: #a9c2b9; font-size: 12px; }
.auth-card { background: #fff; border-radius: 14px; padding: 28px 26px; box-shadow: 0 16px 40px rgba(0, 0, 0, .22); }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.auth-card .field { margin-bottom: 14px; }
.auth-note { color: #93a29a; font-size: 12px; margin-top: 16px; line-height: 1.7; }
.auth-foot { text-align: center; color: #a9c2b9; font-size: 12px; margin-top: 18px; }
.auth-wide { max-width: 100%; }
.auth-wrap:has(.auth-wide) { max-width: 760px; }

.install-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin-bottom: 18px; }
.install-check { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; }
.install-check > span { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 18px; margin-top: 2px; }
.install-check.ok > span { background: #e6f5ea; color: #1d7a3d; }
.install-check.bad > span { background: #fdeaea; color: var(--red); }
.install-check div { display: flex; flex-direction: column; min-width: 0; }
.install-check strong { font-weight: 600; font-size: 12px; }
.install-check small { color: var(--muted); font-size: 11px; }

/* ---------- 明细/时间线 ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 18px; }
.detail-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.detail-item .k { color: var(--muted); font-size: 12px; }
.detail-item .v { font-size: 14px; word-break: break-word; }
.timeline { display: flex; flex-direction: column; gap: 0; margin: 6px 0; }
.timeline-item { display: flex; gap: 12px; padding-bottom: 14px; position: relative; }
.timeline-item::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline-item:last-child::before { display: none; }
.dot { width: 15px; height: 15px; border-radius: 50%; background: var(--brand-light); border: 2px solid var(--brand); flex: 0 0 15px; margin-top: 3px; }
.timeline-body { min-width: 0; }
.timeline-body strong { font-size: 13px; }
.timeline-body p { margin: 2px 0; font-size: 12px; color: var(--muted); }

.photo-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-grid a { display: block; width: 88px; height: 88px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }

.bar-track { background: #e9eeea; border-radius: 4px; height: 8px; overflow: hidden; min-width: 70px; }
.bar-fill { height: 8px; background: var(--brand); border-radius: 4px; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filter-bar .field { margin-bottom: 0; min-width: 150px; flex: 0 1 190px; }

.section-title { font-size: 16px; margin: 22px 0 10px; }
.muted { color: var(--muted); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .layout { display: block; }
    .sidebar { position: static; width: auto; height: auto; flex: none; padding-bottom: 8px; }
    .brand { padding: 14px 14px 8px; }
    .nav { flex-direction: row; flex-wrap: wrap; gap: 6px; padding: 6px 10px 10px; overflow-x: auto; }
    .nav-item { font-size: 13px; padding: 6px 10px; background: rgba(255,255,255,.06); }
    .nav-item.active { border-left: 0; padding-left: 10px; }
    .nav-mobile { border-top: 0; padding-top: 6px; margin-top: 0; }
    .sidebar-foot { margin-top: 0; padding: 8px 14px 12px; display: flex; align-items: center; gap: 14px; justify-content: space-between; flex-wrap: wrap; }
    .who { margin-bottom: 0; }
    .main-inner { padding: 18px 14px 40px; }
    .page-head h1 { font-size: 19px; }
}

@media (max-width: 480px) {
    .kpi .value { font-size: 23px; }
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi { padding: 12px 13px; }
    .panel { padding: 15px; }
    .auth-body { padding: 22px 12px; }
    .auth-card { padding: 22px 18px; }
    .table { min-width: 560px; }
    .qr-canvas { width: 190px; height: 190px; }
    .photo-grid a { width: 74px; height: 74px; }
}
