:root {
    --bg: #eef2f8;
    --panel: #ffffff;
    --ink: #1a2b42;
    --muted: #6b7c93;
    --line: #dde5f0;
    --primary: #2f6fed;
    --primary-dark: #1e56c9;
    --primary-soft: #e8f0ff;
    --teal: #12a594;
    --teal-soft: #e2f7f3;
    --warn: #b76e00;
    --warn-soft: #fff4dc;
    --danger: #c9302c;
    --danger-soft: #fdeceb;
    --ok: #1f8f5f;
    --ok-soft: #e5f7ee;
    --radius: 14px;
    --shadow: 0 4px 18px rgba(23, 43, 77, .08);
    --shadow-lg: 0 16px 40px rgba(23, 43, 77, .14);
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

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

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

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: .2px; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0; }

code {
    font-family: var(--mono);
    font-size: 12px;
    background: #f1f5fb;
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 1px 5px;
}

/* ---------- 顶栏 ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 28px;
    height: 62px;
    padding: 0 26px;
    background: linear-gradient(120deg, #13263f 0%, #1b3557 60%, #143c52 100%);
    color: #eaf1fb;
    box-shadow: 0 6px 22px rgba(15, 35, 60, .22);
}

.brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .1);
    color: #8fd6ff;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; font-size: 16px; font-weight: 700; }
.brand-text small { font-size: 10px; font-weight: 500; letter-spacing: 1.5px; color: #8fa9c8; text-transform: uppercase; }

.nav { display: flex; gap: 4px; flex: 1; }

.nav a {
    color: #b9cbe4;
    padding: 8px 14px;
    border-radius: 9px;
    font-size: 14px;
    text-decoration: none;
    transition: all .16s ease;
}

.nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav a.active { color: #fff; background: rgba(90, 160, 255, .22); box-shadow: inset 0 0 0 1px rgba(140, 190, 255, .28); }

.topbar-right { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #8fa9c8; }
.db-dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc97; box-shadow: 0 0 8px #3ddc97; }

/* ---------- 布局 ---------- */
.page { max-width: 1320px; margin: 0 auto; padding: 26px 26px 40px; }

.footer {
    text-align: center;
    color: #8697ad;
    font-size: 12px;
    padding: 22px 0 30px;
}
.footer-links { display: inline-flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-left: 14px; }
.footer-links a { color: #39506f; }
.footer-links a:hover { color: #2f6fed; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 16px; }
.section-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
}

.card + .card { margin-top: 18px; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-head h2 { font-size: 18px; }
.card-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: #eef3fa;
    color: var(--ink);
    text-decoration: none;
    transition: transform .12s ease, box-shadow .16s ease, background .16s ease;
    white-space: nowrap;
    font-family: inherit;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, #3b7dff, #245fd6); color: #fff; box-shadow: 0 6px 16px rgba(47, 111, 237, .28); }
.btn.primary:hover { background: linear-gradient(135deg, #4b89ff, #2c68df); }
.btn.teal { background: linear-gradient(135deg, #16b8a6, #0d8d7e); color: #fff; box-shadow: 0 6px 16px rgba(18, 165, 148, .25); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { background: #f5f8fd; color: var(--ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: #f3c9c7; }
.btn.danger:hover { background: #fbdcdb; }
.btn.sm { padding: 5px 12px; font-size: 12px; border-radius: 8px; }
.btn.lg { padding: 13px 30px; font-size: 15px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- 提示 ---------- */
.flash {
    border-radius: 11px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid transparent;
}
.flash-ok { background: var(--ok-soft); color: #12714a; border-color: #bde6d3; }
.flash-err { background: var(--danger-soft); color: var(--danger); border-color: #f2c7c5; }
.flash-warn { background: var(--warn-soft); color: var(--warn); border-color: #f0dcae; }

.empty {
    border: 1px dashed #c9d6e8;
    border-radius: 12px;
    padding: 34px;
    text-align: center;
    color: var(--muted);
    background: #f8fbff;
}

/* ---------- 工作台 ---------- */
.hero {
    background: linear-gradient(125deg, #16304d 0%, #1c4670 55%, #0f5a63 100%);
    color: #eaf3ff;
    border-radius: 18px;
    padding: 30px 34px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.hero::after {
    content: "";
    position: absolute;
    right: -60px;
    top: -80px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(92, 180, 255, .28), transparent 65%);
}
.hero h1 { font-size: 28px; color: #fff; }
.hero p { color: #b8cee6; max-width: 720px; margin-top: 8px; font-size: 13.5px; }
.hero .hero-tags { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hero .tag { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); padding: 4px 12px; border-radius: 99px; font-size: 12px; color: #d7e7f7; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 20px; }
.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 24px; letter-spacing: .5px; color: var(--ink); }
.stat span { font-size: 12px; color: var(--muted); }

.mode-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 8px; }
.mode-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    color: inherit;
    text-decoration: none;
}
.mode-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #bcd3f5; text-decoration: none; }
.mode-card .mode-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 18px; color: #fff;
    background: linear-gradient(135deg, #4b89ff, #2462d8);
}
.mode-card:nth-child(2) .mode-icon { background: linear-gradient(135deg, #16b8a6, #0b8a7c); }
.mode-card:nth-child(3) .mode-icon { background: linear-gradient(135deg, #f5a623, #e07d0a); }
.mode-card:nth-child(4) .mode-icon { background: linear-gradient(135deg, #a06bff, #7c45e0); }
.mode-card h3 { font-size: 16px; }
.mode-card p { font-size: 12.5px; color: var(--muted); flex: 1; }
.mode-card .go { font-size: 12px; color: var(--primary); font-weight: 600; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.table th {
    text-align: left;
    font-weight: 600;
    font-size: 12.5px;
    color: #4e6178;
    background: #f5f8fd;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
table.table td { padding: 11px 14px; border-bottom: 1px solid #edf2f9; vertical-align: middle; }
table.table tr:last-child td { border-bottom: none; }
table.table tbody tr:hover { background: #fafcff; }
table.table .num { text-align: right; font-variant-numeric: tabular-nums; }
table.table .center { text-align: center; }
table.table .muted { color: var(--muted); font-size: 12px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 600;
    background: #eef3fa;
    color: #52657d;
}
.badge.blue { background: var(--primary-soft); color: var(--primary-dark); }
.badge.green { background: var(--teal-soft); color: #0b7c6f; }
.badge.orange { background: var(--warn-soft); color: var(--warn); }
.badge.red { background: var(--danger-soft); color: var(--danger); }

.color-dot { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-right: 7px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.08); }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: #41546b; }
.field-body { display: flex; flex-direction: column; gap: 5px; }
.field .hint { color: var(--muted); font-size: 11.5px; line-height: 1.5; }

input[type=text], input[type=number], input[type=search], input[type=file], select, textarea {
    width: 100%;
    border: 1px solid #ccd9ea;
    border-radius: 9px;
    padding: 8px 11px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
    transition: border .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #7fb0ff;
    box-shadow: 0 0 0 3px rgba(47, 111, 237, .14);
}
input[type=color] { width: 46px; height: 34px; padding: 2px; border: 1px solid #ccd9ea; border-radius: 8px; background: #fff; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }
textarea { min-height: 80px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7c93'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

.inline { display: inline-flex; align-items: center; gap: 6px; }
.inline input[type=number] { width: 78px; }

.filter-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar input[type=search] { max-width: 300px; }

/* ---------- 分栏 / 作业编辑 ---------- */
.job-layout { display: grid; grid-template-columns: 1fr; gap: 18px; }

.mode-tabs { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 99px;
    border: 1px solid var(--line);
    background: #f4f7fc;
    color: #52657d;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.chip.active { background: var(--primary-soft); border-color: #b7d0fb; color: var(--primary-dark); }
.chip:hover { text-decoration: none; border-color: #b7d0fb; }

.tip-box {
    background: #f4f8ff;
    border: 1px solid #d9e6fb;
    border-radius: 11px;
    padding: 11px 15px;
    font-size: 12.5px;
    color: #46607f;
    margin-bottom: 14px;
}

.table-compact input[type=number] { width: 72px; padding: 5px 8px; font-size: 12.5px; }
.table-compact td { padding: 7px 10px; }

/* ---------- 报表 ---------- */
.report-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
}
.report-head .meta { color: var(--muted); font-size: 12px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(180deg, #fbfdff, #f4f8fe);
    padding: 14px 16px;
}
.kpi b { display: block; font-size: 22px; }
.kpi span { font-size: 11.5px; color: var(--muted); }

.bar { height: 7px; border-radius: 99px; background: #e6edf7; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #5a9bff, #2f6fed); border-radius: 99px; }

.warn-list { margin-top: 14px; }
.warn-list li { color: var(--warn); font-size: 12.5px; }

/* ---------- 装柜方案 ---------- */
.plan-layout { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.plan-side { position: sticky; top: 78px; }
.plan-menu { list-style: none; padding: 0; margin: 0; max-height: 560px; overflow: auto; }
.plan-menu li a {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 9px;
    font-size: 13px;
    color: #41546b;
    text-decoration: none;
}
.plan-menu li a:hover { background: #f4f8fe; text-decoration: none; }
.plan-menu li a.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.plan-menu .grp { font-size: 11.5px; font-weight: 700; color: #8497ad; padding: 10px 12px 4px; letter-spacing: .5px; }

.viewer-card { padding: 16px; }
.viewer-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.viewer-toolbar .spacer { flex: 1; }
.canvas-holder {
    position: relative;
    background: radial-gradient(circle at 50% 35%, #22364f, #101b2a 78%);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #0c1521;
}
.canvas-holder canvas { display: block; width: 100%; height: 520px; cursor: grab; }
.canvas-holder canvas:active { cursor: grabbing; }
.canvas-hint {
    position: absolute;
    left: 12px;
    bottom: 10px;
    font-size: 11px;
    color: #8ba4c0;
    background: rgba(10, 20, 32, .6);
    padding: 3px 9px;
    border-radius: 7px;
    pointer-events: none;
}

.angle-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.angle-presets button {
    border: 1px solid var(--line);
    background: #f6f9fe;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    color: #50657d;
    font-family: inherit;
}
.angle-presets button:hover { background: var(--primary-soft); border-color: #b7d0fb; }
.angle-presets button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.table tbody tr.active td { background: var(--primary-soft); }

.step-slider { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.step-slider input[type=range] { flex: 1; accent-color: var(--primary); }
.step-slider .val { font-size: 12px; color: var(--muted); min-width: 108px; text-align: right; }

.step-info { margin-top: 14px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.step-info .box { background: #f5f9ff; border: 1px solid #e0eafa; border-radius: 10px; padding: 9px 12px; }
.step-info .box span { display: block; font-size: 11px; color: var(--muted); }
.step-info .box b { font-size: 14px; }
.step-current { border: 1px solid #ffe08a; background: #fffbe8; border-radius: 10px; padding: 10px 14px; margin-top: 12px; font-size: 13px; }

.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 6px 0; border-bottom: 1px dashed #e8eef6; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.chk { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }

.mini-chart { display: flex; align-items: center; gap: 10px; }
.mini-chart .bar { flex: 1; }

/* ---------- 详情页 ---------- */
.detail-grid { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.preview-box {
    background: #f7fafd;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 190px;
}
.preview-box svg { max-width: 100%; }

.orient-table th { font-size: 11.5px; }
.orient-table td { font-size: 12px; }
.orient-table input[type=number] { width: 62px; }

.section-block { margin-top: 22px; }
.section-title { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 14px; margin-bottom: 10px; color: #2c3e57; }
.section-title::before { content: ""; width: 4px; height: 16px; border-radius: 3px; background: linear-gradient(180deg, #4b89ff, #245fd6); }

/* ---------- 安装页 ---------- */
.install-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(140deg, #0f2338, #163a54 55%, #0d4a4d);
    padding: 30px;
}
.install-wrap { width: 100%; max-width: 640px; }
.install-card { background: rgba(255, 255, 255, .97); border-radius: 20px; padding: 34px 36px; box-shadow: 0 30px 70px rgba(0, 0, 0, .35); }
.install-head { display: flex; gap: 16px; align-items: center; margin-bottom: 22px; }
.install-head h1 { font-size: 24px; }
.install-head p { color: var(--muted); font-size: 13px; }
.install-head .brand-mark { width: 52px; height: 52px; background: var(--primary-soft); color: var(--primary); }
.install-info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.install-info div { background: #f5f8fd; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.install-info span { font-size: 11px; color: var(--muted); }
.install-info b { font-size: 12.5px; }
.install-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.install-tip { font-size: 12px; color: var(--muted); margin-top: 16px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
    .stats-grid, .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .mode-grid { grid-template-columns: repeat(2, 1fr); }
    .plan-layout, .detail-grid { grid-template-columns: 1fr; }
    .plan-side { position: static; }
    .step-info { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
    .topbar { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
    .nav { order: 3; width: 100%; overflow-x: auto; }
    .page { padding: 18px 14px 30px; }
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid, .mode-grid { grid-template-columns: 1fr; }
    .card { padding: 16px; }
    .canvas-holder canvas { height: 380px; }
}

/* ---------- 打印 ---------- */
@media print {
    body { background: #fff; }
    .no-print, .topbar, .footer { display: none !important; }
    .page { max-width: none; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }
    .table-wrap { border-color: #ccc; }
    table.table th { background: #eee; }
    .report-head { border-color: #ccc; }
    a { color: #000; text-decoration: none; }
}
