:root {
    --bg: #f2f5f8;
    --card: #ffffff;
    --text: #1c2b36;
    --muted: #6b7c8c;
    --line: #e3e9ef;
    --sidebar: #102b3f;
    --sidebar-2: #0b2133;
    --accent: #0f8b8d;
    --accent-2: #0b6f71;
    --blue: #2672d8;
    --orange: #d97706;
    --red: #c2413b;
    --green: #15803d;
    --shadow: 0 6px 20px rgba(16, 43, 63, .06);
    --radius: 10px;
}

* { box-sizing: border-box; }

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

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

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

h1, h2, h3, h4 { margin: 0 0 12px; font-weight: 600; line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

/* ---------- 布局 ---------- */
.app-body { min-height: 100vh; }

.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 238px;
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: #d6e2ea;
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform .22s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-mark {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, #19a7a9, #0b6f71);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; letter-spacing: 1px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; color: #fff; font-weight: 600; }
.brand-text span { font-size: 11px; color: #8faab9; letter-spacing: .6px; }

.nav { flex: 1; overflow-y: auto; padding: 14px 0; }
.nav-group { margin-bottom: 8px; }
.nav-title {
    padding: 8px 22px 6px;
    font-size: 11px;
    color: #6f8a9c;
    letter-spacing: 1.4px;
}
.nav-link {
    display: block;
    padding: 9px 22px 9px 24px;
    color: #c2d2dd;
    font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.active {
    background: rgba(25, 167, 169, .16);
    border-left-color: #21b6b8;
    color: #fff;
    font-weight: 600;
}

.sidebar-foot {
    padding: 14px 18px 18px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sidebar-user .avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(33, 182, 184, .25);
    color: #7fe3e4;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
}
.sidebar-user strong { display: block; color: #fff; font-size: 13px; font-weight: 500; }
.sidebar-user span { font-size: 11px; color: #8faab9; }
.logout-link { font-size: 12px; color: #8faab9; }
.logout-link:hover { color: #fff; }

.main {
    margin-left: 238px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky; top: 0; z-index: 30;
    height: 62px;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 14px;
    padding: 0 26px;
}

.menu-toggle {
    display: none;
    border: 1px solid var(--line);
    background: #fff; color: var(--text);
    width: 36px; height: 36px; border-radius: 8px;
    font-size: 18px; cursor: pointer;
}

.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; gap: 16px; color: var(--muted); font-size: 12.5px; }
.topbar-user { color: var(--text); }

.content { flex: 1; padding: 22px 26px 34px; max-width: 1480px; width: 100%; }

.footer { padding: 14px 26px; color: #97a6b4; font-size: 12px; text-align: center; }

/* ---------- 组件 ---------- */
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin-bottom: 18px;
}
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 14px;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-sub { color: var(--muted); font-size: 12px; }

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

.stat {
    background: var(--card);
    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: 74px; height: 74px; border-radius: 50%;
    background: rgba(15, 139, 141, .07);
}
.stat-label { color: var(--muted); font-size: 12.5px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.4px; }
.stat-foot { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.stat.accent .stat-value { color: var(--accent); }
.stat.blue .stat-value { color: var(--blue); }
.stat.orange .stat-value { color: var(--orange); }
.stat.red .stat-value { color: var(--red); }
.stat.green .stat-value { color: var(--green); }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    line-height: 1.6;
    white-space: nowrap;
}
.badge-gray { background: #eef2f6; color: #5e7183; }
.badge-blue { background: #e8f1fd; color: #1d5fb5; }
.badge-orange { background: #fdf1e3; color: #a85d06; }
.badge-green { background: #e7f6ec; color: #16703a; }
.badge-red { background: #fdeceb; color: #a8322d; }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.btn:hover { border-color: #c8d3de; background: #f8fafc; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn-dark { background: #17384f; border-color: #17384f; color: #fff; }
.btn-dark:hover { background: #0f2a3f; color: #fff; }
.btn-danger { background: #fff; border-color: #ecc6c3; color: var(--red); }
.btn-danger:hover { background: #fdf2f1; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; cursor: not-allowed; }

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

.table-wrap { overflow-x: auto; }
table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th {
    text-align: left;
    padding: 10px 12px;
    color: var(--muted);
    font-weight: 500;
    font-size: 12px;
    background: #f7f9fb;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f6;
    vertical-align: middle;
}
.table tbody tr:hover { background: #fafcfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { white-space: nowrap; text-align: right; }
.table .muted { color: var(--muted); font-size: 12px; }
.table .main-cell { font-weight: 500; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.span-2 { grid-column: span 2; }
.form-field.span-all { grid-column: 1 / -1; }
.form-field label { font-size: 12.5px; color: #46596a; font-weight: 500; }
.form-field label .req { color: var(--red); }
.form-field .hint { font-size: 11.5px; color: var(--muted); }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="tel"],
input[type="search"], select, textarea {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid #d7e0e8;
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 139, 141, .12);
}
textarea { min-height: 74px; resize: vertical; }
select { cursor: pointer; }
input[readonly] { background: #f4f7fa; color: var(--muted); }

/* 可搜索下拉（select[data-search]） */
.search-select { position: relative; }
.search-select-panel {
    display: none;
    position: absolute;
    z-index: 80;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 260px;
    overflow-y: auto;
    padding: 4px;
    background: #fff;
    border: 1px solid #d7e0e8;
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, .14);
}
.search-select-item { padding: 7px 9px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.search-select-item:hover, .search-select-item.active { background: #eef6f6; color: var(--accent); }
.search-select-empty { padding: 8px 9px; font-size: 12.5px; color: var(--muted); }

.filter-bar {
    display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
    margin-bottom: 16px;
}
.filter-bar .form-field { min-width: 150px; }
.filter-bar .form-field.grow { flex: 1; min-width: 200px; }
.filter-bar .btn { margin-bottom: 1px; }

.flash {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13px;
    border: 1px solid transparent;
}
.flash-success { background: #eaf7ef; border-color: #c6ebd4; color: #17643a; }
.flash-error { background: #fdeeee; border-color: #f2cfcc; color: #9f302b; }
.flash-info { background: #eaf2fd; border-color: #cfe0f8; color: #1d548f; }

.empty {
    padding: 38px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}
.empty strong { display: block; color: #4d6173; font-size: 15px; margin-bottom: 4px; }

.pagination { display: flex; gap: 6px; justify-content: flex-end; padding-top: 14px; flex-wrap: wrap; }
.page-link {
    min-width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--muted);
    font-size: 12.5px;
    padding: 0 8px;
    background: #fff;
}
.page-link:hover { border-color: #bccbd8; color: var(--text); }
.page-link.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-gap { color: var(--muted); align-self: center; }

.progress { height: 8px; background: #e9eef3; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, #19a7a9, #0b6f71); border-radius: 999px; }
.progress.sm { height: 6px; }

.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding: 10px 4px 0; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar {
    width: 100%; max-width: 46px;
    background: linear-gradient(180deg, #29b6b8, #0f8b8d);
    border-radius: 6px 6px 2px 2px;
    min-height: 3px;
    transition: height .3s;
}
.bar-label { font-size: 11px; color: var(--muted); }
.bar-value { font-size: 11.5px; color: #3c5568; font-weight: 500; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before {
    content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px;
    width: 2px; background: #e3eaf0;
}
.timeline-item { position: relative; padding: 0 0 18px 0; }
.timeline-item::before {
    content: ""; position: absolute; left: -21px; top: 5px;
    width: 12px; height: 12px; border-radius: 50%;
    background: #fff; border: 2px solid #b8c8d5;
}
.timeline-item.done::before { border-color: var(--green); background: var(--green); }
.timeline-item.active::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px rgba(15, 139, 141, .13); }
.timeline-item .t-title { font-weight: 600; font-size: 13.5px; }
.timeline-item .t-meta { color: var(--muted); font-size: 12px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
    padding: 8px 14px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    font-size: 13px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.detail-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 18px; }
.detail-item .label { color: var(--muted); font-size: 11.5px; }
.detail-item .value { font-weight: 500; margin-top: 2px; }

.qr-box { display: flex; align-items: center; gap: 12px; }
.qr-box .qr-canvas { width: 104px; height: 104px; background: #fff; padding: 4px; border: 1px solid var(--line); border-radius: 6px; }
.qr-box .qr-canvas img, .qr-box .qr-canvas canvas { width: 96px !important; height: 96px !important; }
.qr-note { font-size: 12px; color: var(--muted); max-width: 180px; }

.mine-task-list { display: grid; gap: 12px; }
.mine-task {
    border: 1px solid var(--line); border-radius: 9px; padding: 14px 16px; background: #fff;
    display: flex; align-items: center; gap: 14px; justify-content: space-between;
}
.mine-task .info strong { font-size: 14px; }
.mine-task .info div { color: var(--muted); font-size: 12px; }
.mine-task .numbers { text-align: right; font-size: 12px; color: var(--muted); }

.section-note {
    background: #f7fafb;
    border: 1px dashed #d8e3ea;
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--muted);
    font-size: 12.5px;
    margin-bottom: 14px;
}

/* ---------- 登录 / 安装 ---------- */
.auth-body {
    min-height: 100vh;
    background: radial-gradient(1200px 600px at 15% 10%, #174058 0%, #0d2537 45%, #081a27 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.auth-card {
    width: 100%; max-width: 420px;
    background: #fff;
    border-radius: 14px;
    padding: 32px 30px 26px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-mark {
    width: 54px; height: 54px; margin: 0 auto 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, #19a7a9, #0b6f71);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; letter-spacing: 2px;
}
.auth-brand h1 { font-size: 21px; margin-bottom: 4px; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 12.5px; }
.auth-foot { text-align: center; margin-top: 18px; color: var(--muted); font-size: 12px; }
.auth-note { margin-top: 16px; padding: 10px 12px; background: #f6f9fb; border-radius: 8px; color: var(--muted); font-size: 12px; }

.install-wrap { max-width: 820px; margin: 0 auto; padding: 40px 20px 60px; }
.install-card { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 30px 34px; }
.install-steps { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.install-step { padding: 5px 12px; border-radius: 999px; background: #eef3f7; color: var(--muted); font-size: 12px; }
.install-step.active { background: var(--accent); color: #fff; }

/* ---------- 打印流转卡 ---------- */
.print-body { background: #fff; font-size: 12px; }
.print-card { width: 760px; margin: 0 auto; padding: 22px; }
.print-title { text-align: center; font-size: 20px; font-weight: 700; letter-spacing: 4px; margin-bottom: 12px; }
.print-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 16px; margin-bottom: 12px; }
.print-table { width: 100%; border-collapse: collapse; }
.print-table th, .print-table td { border: 1px solid #333; padding: 5px 7px; font-size: 11.5px; }
.print-table th { background: #f2f2f2; }
.print-sign { display: flex; justify-content: space-between; margin-top: 18px; font-size: 12px; }
.print-actions { text-align: center; margin: 16px 0; }

@media print {
    .no-print { display: none !important; }
    .print-body { background: #fff; }
    .print-card { width: auto; padding: 0; }
}

/* ---------- 页面打印（生产计划等） ---------- */
.print-only { display: none; }
@media print {
    .app-body { background: #fff; }
    .sidebar, .sidebar-mask, .topbar, .footer, .menu-toggle,
    .page-head, .filter-bar, .btn, .btn-row, .pagination, .no-print { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; max-width: none; }
    .print-only { display: block !important; }
    .print-plan-head { margin-bottom: 10px; text-align: center; }
    .print-plan-head h1 { font-size: 18px; margin: 0 0 4px; }
    .print-plan-head div { font-size: 11px; color: #555; }
    .card { box-shadow: none; border: none; padding: 0 0 14px; }
    .card-head { border-bottom: 1px solid #999; }
    .table-wrap { overflow: visible !important; }
    .table th, .table td { border: 1px solid #999; padding: 4px 6px; font-size: 10.5px; }
}

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

@media (max-width: 820px) {
    .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.35); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-mask {
        display: none; position: fixed; inset: 0; background: rgba(8, 20, 30, .45); z-index: 35;
    }
    .sidebar-mask.show { display: block; }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .content { padding: 16px 14px 28px; }
    .topbar { padding: 0 14px; height: 56px; }
    .topbar-date { display: none; }
    .topbar-user { display: none; }
    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
    .form-grid, .form-grid.cols-4 { grid-template-columns: 1fr; }
    .form-field.span-2 { grid-column: span 1; }
    .filter-bar .form-field { min-width: 100%; }
    .detail-list { grid-template-columns: 1fr 1fr; }
    .page-head { align-items: flex-start; }
    .table th, .table td { padding: 8px 9px; }
    .card { padding: 14px; }
    .mine-task { flex-direction: column; align-items: flex-start; }
    .mine-task .numbers { text-align: left; }
}

@media (max-width: 480px) {
    .detail-list { grid-template-columns: 1fr; }
    .stat-value { font-size: 22px; }
    .auth-card { padding: 24px 20px; }
}
