:root {
    --navy: #14263d;
    --navy-2: #1d3552;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e2e8f0;
    --bg: #f3f6fa;
    --panel: #ffffff;
    --primary: #1f6feb;
    --primary-dark: #1558c0;
    --teal: #0f766e;
    --ok: #15803d;
    --warn: #b45309;
    --danger: #b91c1c;
    --radius: 10px;
    --shadow: 0 8px 28px rgba(15, 35, 60, 0.08);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

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

.hidden {
    display: none !important;
}

h1, h2, h3, p {
    margin: 0;
}

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

/* ---------- 登录 ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at 15% 20%, #24476f 0, transparent 45%),
    radial-gradient(circle at 85% 80%, #0f766e 0, transparent 40%),
    linear-gradient(135deg, #101d2e 0%, #182c44 60%, #14263d 100%);
}

.login-panel {
    width: 420px;
    max-width: 100%;
    background: #fff;
    border-radius: 16px;
    padding: 34px 34px 26px;
    box-shadow: 0 26px 60px rgba(3, 12, 24, 0.45);
}

.login-brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 26px;
}

.login-brand h1 {
    font-size: 20px;
    letter-spacing: 0.5px;
}

.login-brand p {
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(145deg, #1f6feb, #0f766e);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: 1px;
    font-size: 15px;
    flex: none;
}

.brand-mark.small {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 12.5px;
}

.login-form .field {
    margin-bottom: 16px;
}

.field {
    display: block;
}

.field > span {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 600;
}

input, select, textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 13px;
    color: var(--ink);
    background: #fff;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

input[type="checkbox"], input[type="radio"] {
    width: 14px;
    height: 14px;
    padding: 0;
    flex: none;
}

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

.form-error {
    min-height: 18px;
    color: var(--danger);
    font-size: 12px;
    margin: 4px 0 10px;
}

.hint {
    margin-top: 8px;
    color: var(--warn);
}

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

.sidebar {
    width: 236px;
    flex: none;
    background-color: #ffffff;
    background-image: none;
    color: #475569;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid #e2e8f0;
    transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    min-height: 68px;
    border-bottom: 1px solid #eef2f7;
}

.brand-text {
    flex: 1;
    min-width: 0;
}

.sidebar-brand strong {
    display: block;
    color: #0f172a;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.1px;
    line-height: 1.3;
    white-space: nowrap;
}

.sidebar-brand span {
    font-size: 11.5px;
    color: #94a3b8;
    letter-spacing: 1.1px;
    white-space: nowrap;
}

.sidebar-toggle {
    flex: none;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sidebar-toggle:hover {
    background: #e2e8f0;
    color: #334155;
}

.sidebar-toggle svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.22s;
}

.nav {
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-group + .nav-group {
    margin-top: 12px;
}

.nav-standalone {
    margin-bottom: 10px;
}

.nav-group-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px 6px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s;
}

.nav-group-label:hover {
    color: #475569;
}

.group-chevron {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.6;
    transition: transform 0.2s;
}

.nav-group.collapsed .group-chevron {
    transform: rotate(-90deg);
}

.nav-group.collapsed .nav-item {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #475569;
    font-size: 13.5px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    position: relative;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.nav-item.active {
    background: #eff6ff;
    color: #1d4ed8;
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #2563eb;
}

.nav-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    color: inherit;
    opacity: 0.85;
    transition: color 0.15s, opacity 0.15s;
}

.nav-item:hover .nav-icon {
    opacity: 1;
}

.nav-item.active .nav-icon {
    color: #2563eb;
    opacity: 1;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-foot {
    padding: 14px 16px;
    border-top: 1px solid #eef2f7;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-foot .link-btn {
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
    color: #94a3b8;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
}

.sidebar-foot .link-btn:hover {
    color: #2563eb;
    text-decoration: underline;
}

.env-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    font-size: 10.5px;
    font-weight: 600;
    flex: none;
}

.env-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f59e0b;
}

/* ---------- 侧边栏收起态 ---------- */
.sidebar.collapsed {
    width: 66px;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .nav-item > span:not(.nav-icon),
.sidebar.collapsed .sidebar-foot {
    display: none;
}

.sidebar.collapsed .sidebar-brand {
    flex-direction: column;
    gap: 8px;
    padding: 12px 0;
    min-height: 0;
    border-bottom: 1px solid #eef2f7;
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

.sidebar.collapsed .nav {
    padding: 10px 8px;
}

.sidebar.collapsed .nav-group + .nav-group {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eef2f7;
}

.sidebar.collapsed .nav-group.collapsed .nav-item {
    display: flex;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0;
    gap: 0;
}

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

.topbar {
    height: 68px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.page-heading h1 {
    font-size: 17px;
    letter-spacing: 0.3px;
}

.page-heading p {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.userbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-meta {
    text-align: right;
    line-height: 1.3;
    margin-right: 4px;
}

.user-meta strong {
    display: block;
    font-size: 13px;
}

.role-chip {
    display: inline-block;
    margin-top: 2px;
    padding: 1px 7px;
    border-radius: 99px;
    background: #e8f0fe;
    color: var(--primary-dark);
    font-size: 11px;
}

.content {
    padding: 22px 24px 40px;
    flex: 1;
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn.primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn.secondary {
    background: #e7f0ff;
    border-color: #bcd4f5;
    color: var(--primary-dark);
}

.btn.secondary:hover {
    background: #d6e4ff;
    border-color: #8bb5f0;
}

.btn.outline {
    background: #fff;
    border-color: var(--primary);
    color: var(--primary);
}

.btn.outline:hover {
    background: #e7f0ff;
    border-color: var(--primary-dark);
    color: var(--primary-dark);
}

.btn.danger {
    background: #fff;
    border-color: #fecaca;
    color: var(--danger);
}

.btn.danger:hover {
    background: #fef2f2;
    border-color: #fca5a5;
}

.btn.ghost {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}

.btn.ghost:hover {
    background: #f1f5f9;
    color: var(--ink);
}

.btn.small {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 7px;
}

.btn.block {
    width: 100%;
    padding: 10px 14px;
}

.btn.link {
    border: 0;
    background: transparent;
    color: var(--primary);
    padding: 2px 4px;
    font-size: 12px;
}

.btn.link:hover {
    text-decoration: underline;
    background: transparent;
}

.btn.link.danger {
    color: var(--danger);
}

/* ---------- 面板与表格 ---------- */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* 玻璃态变体：只在工作台使用，不影响其他页普通 panel */
.panel.glass {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    box-shadow:
        0 0 0 1px rgba(15, 35, 60, 0.03),
        0 24px 48px -12px rgba(15, 35, 60, 0.10);
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
}
.panel.glass .panel-head {
    border-bottom-color: rgba(15, 35, 60, 0.05);
}

.panel-head h2 {
    font-size: 14px;
    font-weight: 600;
}

.panel-head .sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.panel-body {
    padding: 16px 18px;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.toolbar .field-inline {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar .field-inline span {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.toolbar input, .toolbar select {
    width: auto;
    min-width: 130px;
}

.toolbar .spacer {
    flex: 1;
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    text-align: left;
    font-weight: 600;
    color: #475569;
    background: #f8fafc;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
}

tbody tr:hover {
    background: #f8fbff;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.cell-muted {
    color: var(--muted);
    font-size: 12px;
}

.cell-strong {
    font-weight: 600;
}

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

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

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.pager .actions {
    align-items: center;
}

/* ---------- 标签 ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    background: #f1f5f9;
    color: #475569;
}

.badge.ok {
    background: #e7f6ec;
    color: var(--ok);
}

.badge.warn {
    background: #fef3e2;
    color: var(--warn);
}

.badge.danger {
    background: #fdecec;
    color: var(--danger);
}

.badge.info {
    background: #e8f0fe;
    color: var(--primary-dark);
}

.badge.teal {
    background: #e6f4f1;
    color: var(--teal);
}

/* ---------- 工作台 ---------- */

/* 彩色渐变背景层（玻璃态面板要半透明才有东西可"透"） */
.dashboard-bg {
    position: relative;
}
.dashboard-bg::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(800px 500px at 0% -5%, rgba(31, 111, 235, 0.10), transparent 60%),
        radial-gradient(700px 450px at 100% 10%, rgba(124, 58, 237, 0.07), transparent 60%),
        radial-gradient(600px 400px at 50% 100%, rgba(14, 165, 233, 0.05), transparent 60%);
}
.dashboard-bg > * {
    position: relative;
    z-index: 1;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

/* 玻璃态 stat-card */
.stat-card {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 20px 22px 18px;
    box-shadow:
        0 0 0 1px rgba(15, 35, 60, 0.04),
        0 24px 48px -12px rgba(15, 35, 60, 0.12),
        0 4px 12px -4px rgba(15, 35, 60, 0.06);
    position: relative;
    overflow: hidden;
    isolation: isolate;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.25s ease;
}

.stat-card:hover {
    box-shadow:
        0 0 0 1px rgba(15, 35, 60, 0.06),
        0 32px 56px -14px rgba(15, 35, 60, 0.16),
        0 8px 20px -6px rgba(15, 35, 60, 0.08);
}

/* Cursor 跟随光斑 */
.stat-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
        500px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(31, 111, 235, 0.07),
        transparent 45%
    );
    z-index: -1;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}
.stat-card:hover::before { opacity: 1; }

/* Tone 变体（玻璃态上叠加一层 toned 色雾） */
.stat-card.tone-warn::after,
.stat-card.tone-danger::after,
.stat-card.tone-success::after {
    content: "";
    position: absolute; inset: 0;
    z-index: -2;
    pointer-events: none;
    border-radius: 16px;
}
.stat-card.tone-warn::after   { background: linear-gradient(135deg, rgba(234, 88, 12, 0.08), transparent 55%); }
.stat-card.tone-danger::after { background: linear-gradient(135deg, rgba(225, 29, 72, 0.08), transparent 55%); }
.stat-card.tone-success::after{ background: linear-gradient(135deg, rgba(21, 128, 61, 0.07), transparent 55%); }

/* stat-card 内部布局 */
.stat-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 14px;
    background: rgba(31, 111, 235, 0.1);
    color: var(--primary);
    flex-shrink: 0;
}
.stat-card.tone-warn    .stat-icon { background: rgba(234, 88, 12, 0.10); color: #c2410c; }
.stat-card.tone-danger  .stat-icon { background: rgba(225, 29, 72, 0.10); color: #be123c; }
.stat-card.tone-success .stat-icon { background: rgba(21, 128, 61, 0.10); color: #15803d; }

.stat-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
}

.stat-value {
    font-size: 30px;
    font-weight: 550;
    margin-top: 10px;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: #0f172a;
    line-height: 1.05;
}
.stat-card.tone-warn    .stat-value { color: #c2410c; }
.stat-card.tone-danger  .stat-value { color: #be123c; }
.stat-card.tone-success .stat-value { color: #15803d; }

.stat-foot {
    margin-top: 4px;
    font-size: 12px;
    color: #94a3b8;
    font-weight: 400;
}

/* Sparkline SVG —— 迷你趋势线 */
.stat-spark {
    margin-top: 10px;
    height: 32px;
    display: flex;
    align-items: flex-end;
}
.stat-spark svg {
    width: 100%;
    height: 32px;
    overflow: visible;
}
.stat-spark path.spark-line {
    fill: none;
    stroke: var(--primary);
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.stat-card.tone-warn    .spark-line { stroke: #ea580c; }
.stat-card.tone-danger  .spark-line { stroke: #e11d48; }
.stat-card.tone-success .spark-line { stroke: #15803d; }

.stat-spark path.spark-area {
    fill: url(#spark-gradient);
    opacity: 0.15;
}
.stat-card.tone-warn    .spark-area { fill: rgba(234, 88, 12, 0.25); }
.stat-card.tone-danger  .spark-area { fill: rgba(225, 29, 72, 0.25); }
.stat-card.tone-success .spark-area { fill: rgba(21, 128, 61, 0.25); }

/* 最近品号 / 最近图纸：并排两列 */
.recent-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.recent-grid > .panel {
    min-width: 0;
}

/* ---------- 工作台快捷条（整行横向） ---------- */
.dashboard-quick {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}

.quick-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 160px;
    padding: 22px 16px;
    border-radius: 18px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.36));
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 0 0 1px rgba(15, 35, 60, 0.03),
        0 10px 28px -10px rgba(15, 35, 60, 0.12);
    cursor: pointer;
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.22s ease,
                background 0.18s ease,
                border-color 0.18s ease;
    position: relative;
    overflow: hidden;
}

.quick-tile::before {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(
        400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(31, 111, 235, 0.09),
        transparent 45%
    );
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.quick-tile:hover {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.5));
    border-color: rgba(31, 111, 235, 0.35);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        0 0 0 1px rgba(31, 111, 235, 0.14),
        0 18px 40px -12px rgba(31, 111, 235, 0.22);
}
.quick-tile:hover::before { opacity: 1; }

/* Primary variant：蓝发光边框 + 蓝图标 */
.quick-tile.variant-primary {
    border-color: rgba(31, 111, 235, 0.2);
}
.quick-tile.variant-primary .quick-icon {
    background: linear-gradient(145deg, #eaf2ff 0%, #d3e4ff 100%);
    color: var(--primary);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        0 0 0 1px rgba(31, 111, 235, 0.10),
        0 6px 14px -3px rgba(31, 111, 235, 0.30);
}

/* Secondary variant：中性 */
.quick-tile.variant-secondary .quick-icon {
    background: linear-gradient(145deg, #f4f7fb 0%, #e4eaf2 100%);
    color: #334155;
}

/* Outline variant：更轻 */
.quick-tile.variant-outline .quick-icon {
    background: linear-gradient(145deg, #f8fafc 0%, #edf2f7 100%);
    color: #475569;
}

.quick-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 17px;
    background: linear-gradient(145deg, #ffffff 0%, #eef2f8 100%);
    color: #334155;
    flex-shrink: 0;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        inset 0 -1px 2px rgba(15, 35, 60, 0.06),
        0 4px 10px -2px rgba(15, 35, 60, 0.14);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.quick-icon svg {
    width: 28px;
    height: 28px;
    display: block;
    stroke-width: 2;
}
.quick-tile:hover .quick-icon {
    transform: scale(1.05);
}

.quick-label {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    letter-spacing: 0;
    text-align: center;
}

.quick-desc {
    font-size: 13px;
    font-weight: 400;
    color: #64748b;
    text-align: center;
    line-height: 1.4;
}

/* ---------- 表单 ---------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.form-grid .span-2 {
    grid-column: span 2;
}

.field > span .req {
    color: var(--danger);
    margin-left: 2px;
}

.field small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 4px;
}

/* ---------- 新增 API 客户端 ---------- */
.modal.api-client-form-modal {
    width: 860px;
}

.api-client-form .form-grid {
    gap: 17px 20px;
}

.api-client-form .form-section + .form-section {
    margin-top: 22px;
    padding-top: 19px;
    border-top: 1px solid var(--line);
}

.api-client-form .form-section h3 {
    margin: 0;
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
}

.api-client-form .form-section > p {
    margin: 4px 0 15px;
    color: var(--muted);
    font-size: 12px;
}

.api-client-form .field small {
    line-height: 1.5;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

/* ---------- 物资入库 ---------- */
.material-search {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 8px;
    margin-bottom: 10px;
}

.material-results {
    max-height: 210px;
    overflow: auto;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.material-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border-bottom: 1px solid #eef2f7;
}

.material-result:last-child {
    border-bottom: 0;
}

.material-result strong {
    font-size: 13px;
}

.empty.compact {
    padding: 18px 12px;
}

.inbound-lines {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.inbound-lines input {
    min-width: 120px;
}

.inbound-lines .inbound-line-remark {
    min-width: 160px;
}

.stock-warning-filter {
    white-space: nowrap;
}

.qty-positive {
    color: var(--ok);
    font-weight: 600;
}

.qty-negative {
    color: var(--danger);
    font-weight: 600;
}

/* ---------- 物资领用与签名 ---------- */
.issue-mode-control {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.employee-picker {
    min-width: 0;
}

.employee-picker .material-search {
    margin-bottom: 7px;
}

.employee-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

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

.signature-card {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fbfcfe;
}

.signature-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.signature-card-head strong {
    font-size: 13px;
}

.signature-pad {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 18 / 5;
    border: 1px dashed #94a3b8;
    border-radius: 7px;
    background: #fff;
    cursor: crosshair;
    touch-action: none;
}

.signature-hint {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.signature-preview {
    display: block;
    max-width: 100%;
    max-height: 180px;
    margin: 8px auto;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
}

.shortage-qty {
    color: var(--danger);
    font-weight: 600;
}

@media (max-width: 760px) {
    .signature-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- 详情 ---------- */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 18px;
}

.detail-grid .item {
    min-width: 0;
}

.detail-grid dt {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 3px;
}

.detail-grid dd {
    margin: 0;
    font-size: 13px;
    word-break: break-all;
}

.detail-tabs {
    display: flex;
    gap: 4px;
    margin: 20px 0 12px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    overflow-x: auto;
}

.detail-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: transparent;
    border-radius: 7px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.detail-tab:hover {
    background: #f1f5f9;
    color: #334155;
}

.detail-tab.active {
    background: #eff6ff;
    color: #1d4ed8;
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
}

.detail-tab.active .tab-count {
    background: #dbeafe;
    color: #1d4ed8;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 20px 0 10px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.section-title h3 {
    font-size: 13px;
}

.section-title:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.inline-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.note {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 12px;
    color: #475569;
    margin-top: 10px;
}

.note.warn {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.note.ok {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    background: #f1f5f9;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 12px;
}

/* ---------- 开放接口接入说明 ---------- */
.api-guide {
    color: #334155;
    font-size: 13px;
    line-height: 1.7;
}

.api-guide > .note:first-child {
    margin-top: 0;
}

.api-guide h3 {
    margin: 22px 0 8px;
    color: #0f172a;
    font-size: 14px;
}

.api-guide p {
    margin: 7px 0;
}

.api-guide ol,
.api-guide ul {
    margin: 6px 0 10px;
    padding-left: 22px;
}

.api-guide li + li {
    margin-top: 4px;
}

.api-guide pre {
    margin: 8px 0;
    padding: 11px 13px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.api-guide-table {
    width: 100%;
    margin-top: 8px;
    border-collapse: collapse;
    font-size: 12px;
}

.api-guide-table th,
.api-guide-table td {
    padding: 8px 9px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.api-guide-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
}

.api-guide-muted {
    color: var(--muted);
    font-size: 12px;
}

.api-entities {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 4px;
}

/* ---------- 弹窗 ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 22, 38, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4vh 20px;
    z-index: 100;
    overflow: auto;
}

.modal {
    width: 620px;
    max-width: 100%;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 30px 70px rgba(4, 14, 28, 0.38);
    animation: modal-in 0.16s ease-out;
}

.modal.wide {
    width: 920px;
}

.modal.narrow {
    width: 460px;
}

@keyframes modal-in {
    from {
        transform: translateY(-6px);
        opacity: 0.5;
    }
    to {
        transform: none;
        opacity: 1;
    }
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--line);
}

.modal-head h2 {
    font-size: 15px;
}

.modal-head p {
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
}

.modal-close {
    border: 0;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 2px 6px;
}

.modal-body {
    padding: 18px 20px;
    max-height: 68vh;
    overflow: auto;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--line);
    background: #fbfcfe;
    border-radius: 0 0 12px 12px;
}

/* ---------- 提示 ---------- */
.toast-root {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 9px;
    max-width: 380px;
}

.toast {
    background: #1e293b;
    color: #fff;
    border-radius: 9px;
    padding: 11px 15px;
    font-size: 13px;
    box-shadow: 0 12px 28px rgba(2, 10, 22, 0.35);
    animation: toast-in 0.18s ease-out;
}

.toast.ok {
    background: #14532d;
}

.toast.warn {
    background: #92400e;
}

.toast.danger {
    background: #991b1b;
}

@keyframes toast-in {
    from {
        transform: translateY(8px);
        opacity: 0;
    }
    to {
        transform: none;
        opacity: 1;
    }
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 42px 18px;
    color: var(--muted);
    font-size: 13px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #cbd5e1;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .recent-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-quick {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
    }

    .nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 8px 10px;
    }

    .nav-item {
        width: auto;
        white-space: nowrap;
    }

    .sidebar-foot {
        display: none;
    }

    .topbar {
        height: auto;
        padding: 12px 16px;
        flex-wrap: wrap;
    }

    .content {
        padding: 16px;
    }

    .form-grid, .detail-grid {
        grid-template-columns: 1fr;
    }

    .form-grid .span-2 {
        grid-column: span 1;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .user-meta {
        display: none;
    }
}

/* ---------- 产品结构 ---------- */
.ps-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
    gap: 16px;
    align-items: start;
}

.ps-tree {
    max-height: 640px;
    overflow: auto;
    padding: 8px;
}

.ps-node {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.ps-node:hover {
    background: #f8fbff;
}

.ps-node.selected {
    background: #e8f0fe;
    box-shadow: inset 2px 0 0 var(--primary);
}

.ps-toggle {
    width: 18px;
    height: 18px;
    flex: none;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
}

.ps-toggle.disabled {
    text-align: center;
    cursor: default;
}

.ps-code {
    flex: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--navy-2);
}

.ps-name {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #334155;
}

.ps-qty {
    flex: none;
    font-size: 12px;
    color: var(--muted);
}

.ps-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
    margin-left: auto;
}

.ps-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.ps-summary-badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.ps-detail-head {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.ps-primary {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.ps-root-actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 1100px) {
    .ps-layout {
        grid-template-columns: 1fr;
    }

    .ps-tree {
        max-height: none;
    }
}

/* ---------- 用户与权限（合并页签） ---------- */
.access-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.access-tab {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 13px;
    padding: 7px 20px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.access-tab:hover {
    background: #f1f5f9;
    color: var(--ink);
}

.access-tab.active {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}

/* ---------- 角色权限 ---------- */
.role-admin {
    padding: 0;
    overflow: hidden;
}

.role-admin-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}

.role-admin-head h2 {
    margin: 0 0 4px;
    font-size: 16px;
}

.role-admin-head p {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.role-layout {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    align-items: stretch;
}

.role-side {
    padding: 12px;
    border-right: 1px solid var(--line);
    background: #fafbfd;
}

.role-search {
    width: 100%;
    height: 32px;
    margin-bottom: 10px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: 13px;
}

.role-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 560px;
    overflow: auto;
}

.role-group + .role-group {
    margin-top: 10px;
}

.role-group-label {
    padding: 4px 10px 6px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #94a3b8;
}

.role-group-empty {
    padding: 8px 10px;
    font-size: 12px;
    color: #94a3b8;
}

.role-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
    transition: background .15s ease, border-color .15s ease;
}

.role-item:hover {
    background: #f1f5fb;
}

.role-item.active {
    background: #eaf1ff;
    border-color: #c9d9f5;
}

.role-item-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.role-item-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.role-item-meta {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.role-item .badge {
    flex: none;
}

.role-detail {
    min-width: 0;
    padding: 18px 20px 22px;
}

.role-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.role-detail-title h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 4px;
    font-size: 17px;
}

.role-actions {
    display: flex;
    flex: none;
    gap: 8px;
}

.role-readonly-hint {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f3f6fb;
    color: var(--muted);
    font-size: 12px;
}

.role-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
}

.role-form .field {
    margin: 0;
}

.perm-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 18px 0 8px;
}

.perm-section-head h4 {
    margin: 0;
    font-size: 13px;
}

.perm-groups {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.perm-group {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

.perm-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--line);
    background: #f7f9fc;
}

.perm-group-name {
    font-size: 12px;
    font-weight: 600;
    color: #44546a;
}

.perm-group-name em {
    margin-left: 6px;
    font-style: normal;
    font-weight: 400;
    color: var(--muted);
}

.perm-all {
    display: flex;
    flex: none;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    cursor: pointer;
}

.perm-all input {
    margin: 0;
}

.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0 8px;
    padding: 6px 10px 8px;
}

.perm-item {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    align-items: start;
    column-gap: 7px;
    width: 100%;
    min-width: 0;
    padding: 6px 4px;
    border-radius: 6px;
    cursor: pointer;
}

.perm-item:hover {
    background: #f7f9fc;
}

.perm-item input {
    margin: 2px 0 0;
}

.perm-text {
    display: block;
    min-width: 0;
    line-height: 1.3;
}

.perm-name {
    display: block;
    font-size: 13px;
    word-break: break-word;
}

.perm-text code {
    display: block;
    font-size: 10.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.perm-hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    cursor: pointer;
}

.check-item input {
    margin: 0;
}

.check-item small {
    margin-left: auto;
    font-size: 11px;
}

@media (max-width: 900px) {
    .role-layout {
        grid-template-columns: 1fr;
    }

    .role-side {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .role-list {
        max-height: 220px;
    }

    .role-form {
        grid-template-columns: 1fr;
    }
}

/* ---------- 帮助文档 ---------- */
.help-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.help-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 8px;
}

.help-search {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13px;
    color: var(--ink);
    background: var(--panel);
}

.help-search:focus {
    outline: 2px solid rgba(31, 111, 235, 0.15);
    border-color: var(--primary);
}

.help-doc-list,
.help-outline {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 6px;
}

.help-doc-list {
    max-height: 46vh;
    overflow: auto;
}

.help-outline {
    max-height: 32vh;
    overflow: auto;
    font-size: 12.5px;
}

.help-doc-item,
.help-hit {
    display: block;
    width: 100%;
    padding: 7px 9px;
    border: 0;
    border-radius: 7px;
    background: none;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
}

.help-doc-item:hover,
.help-hit:hover {
    background: #f1f5f9;
}

.help-doc-item.active {
    background: #e8f1ff;
    color: var(--primary-dark);
    font-weight: 600;
}

.help-hit strong {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
}

.help-hit span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.help-empty {
    padding: 10px;
    color: var(--muted);
    font-size: 12.5px;
}

.help-outline-title {
    padding: 6px 9px;
    color: var(--muted);
    font-size: 12px;
}

.help-outline a {
    display: block;
    padding: 4px 9px;
    border-radius: 6px;
    color: var(--ink);
    text-decoration: none;
}

.help-outline a:hover {
    background: #f1f5f9;
    color: var(--primary-dark);
}

.help-main {
    min-width: 0;
}

.help-doc {
    padding: 28px 34px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    line-height: 1.75;
    overflow-wrap: break-word;
}

.help-doc h1 {
    margin: 0 0 14px;
    font-size: 23px;
}

.help-doc h2 {
    margin: 30px 0 12px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 18px;
}

.help-doc h3 {
    margin: 22px 0 8px;
    font-size: 15.5px;
}

.help-doc h4 {
    margin: 16px 0 6px;
    font-size: 14px;
}

.help-doc p {
    margin: 8px 0;
}

.help-doc ul,
.help-doc ol {
    margin: 8px 0;
    padding-left: 24px;
}

.help-doc li {
    margin: 4px 0;
}

.help-doc code {
    padding: 1px 5px;
    border-radius: 4px;
    background: #f1f5f9;
    font-size: 12.5px;
}

.help-doc pre {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    overflow: auto;
}

.help-doc pre code {
    padding: 0;
    background: none;
}

.help-doc table {
    width: 100%;
    margin: 12px 0;
    border-collapse: collapse;
    font-size: 13px;
}

.help-doc th,
.help-doc td {
    padding: 7px 10px;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.help-doc th {
    background: #f8fafc;
}

.help-doc blockquote {
    margin: 12px 0;
    padding: 8px 14px;
    border-left: 3px solid #cbd5e1;
    background: #f8fafc;
    color: var(--muted);
}

.help-doc hr {
    margin: 22px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.help-doc a {
    color: var(--primary);
}

.help-reader {
    max-width: 1200px;
    margin: 0 auto;
}

.help-back {
    margin-bottom: 14px;
    padding: 9px 16px 9px 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.help-back:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.help-back-icon {
    flex: none;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.help-doc .help-image {
    display: block;
    width: 100%;
    height: auto;
    margin: 16px 0 24px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.page-help-doc {
    padding: 4px;
    border: 0;
    box-shadow: none;
}

/* ---------- 帮助中心首页（任务卡片式） ---------- */
.help-home {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.help-hero {
    text-align: center;
    padding: 48px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    color: white;
    margin-bottom: 32px;
}

.help-hero h1 {
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.help-hero p {
    font-size: 16px;
    opacity: 0.9;
    margin: 0 0 24px 0;
}

.help-hero .help-search {
    width: 100%;
    max-width: 500px;
    padding: 14px 20px;
    font-size: 15px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a1a;
}

.help-hero .help-search::placeholder {
    color: #999;
}

.help-section {
    margin-bottom: 40px;
}

.help-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: #1a1a1a;
}

.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.task-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #2563eb;
}

.task-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.task-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #1a1a1a;
}

.task-card p {
    font-size: 13px;
    color: #666;
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.task-time {
    font-size: 12px;
    color: #999;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.faq-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 200ms ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.faq-card:hover {
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.faq-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.faq-content h4 {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 4px 0;
    color: #1a1a1a;
}

.faq-content p {
    font-size: 12px;
    color: #666;
    margin: 0;
}

@media (max-width: 768px) {
    .help-home {
        padding: 16px;
    }

    .help-hero {
        padding: 32px 16px;
    }

    .help-hero h1 {
        font-size: 24px;
    }

    .task-grid {
        grid-template-columns: 1fr;
    }

    .faq-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- 帮助反馈 ---------- */
.help-feedback {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.help-feedback p {
    font-size: 14px;
    color: #666;
    margin: 0 0 12px 0;
}

.help-feedback .btn {
    margin: 0 4px;
}

.help-feedback .text-success {
    color: #10b981;
    font-weight: 500;
}

@media (max-width: 1100px) {
    .help-layout {
        grid-template-columns: 1fr;
    }

    .help-side {
        position: static;
    }

    .help-doc-list {
        max-height: 240px;
    }

    .help-outline {
        display: none;
    }

    .help-doc {
        padding: 20px;
    }
}

/* ---------- 报表中心 ---------- */
.report-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 12px;
}

.report-tab {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    padding: 8px 14px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 14px;
}

.report-tab:hover {
    color: var(--ink);
    background: #f1f5f9;
}

.report-tab.active {
    color: var(--primary);
    border-color: var(--line);
    border-bottom-color: #fff;
    background: #fff;
    font-weight: 600;
    margin-bottom: -1px;
}

.report-hint {
    margin: 0 0 10px;
    font-size: 12px;
}

.report-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 0 14px;
    border-bottom: 1px dashed var(--line);
}

.report-filters .field,
.report-filters .field-inline {
    margin: 0;
}

.report-filters .field-inline {
    display: flex;
    align-items: center;
    gap: 6px;
}

.report-filters .field-inline span {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.report-filters .field-inline input,
.report-filters .field-inline select {
    min-width: 130px;
}

.report-employee-field {
    min-width: 320px;
}

.report-result {
    margin-top: 14px;
}

.report-section {
    margin-top: 18px;
}

.report-section-title {
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 8px;
    font-size: 13px;
}

.report-low-stock td {
    background: #fef2f2;
    color: var(--danger);
}

.report-low-stock td.cell-strong {
    color: var(--danger);
}

.stock-low-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: #fee2e2;
    color: var(--danger);
    font-size: 12px;
    font-weight: 600;
}

.reconcile-head {
    margin: 6px 0 10px;
    font-size: 12px;
    color: var(--muted);
}

.note.ok-note {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.note.danger-note {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

/* ---------- A4 打印 ---------- */
.print-area {
    display: none;
}

@media print {
    @page {
        size: A4;
        margin: 14mm;
    }

    body.printing > *:not(#printArea) {
        display: none !important;
    }

    body.printing #printArea {
        display: block !important;
    }

    .print-area {
        color: #000;
        background: #fff;
        font-size: 12px;
        line-height: 1.5;
    }

    .print-area .print-head {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 16px;
        border-bottom: 2px solid #000;
        padding-bottom: 8px;
        margin-bottom: 12px;
    }

    .print-area .print-head h1 {
        font-size: 20px;
        margin: 0 0 6px;
    }

    .print-area .print-meta {
        font-size: 12px;
    }

    .print-area .print-qr {
        width: 96px;
        height: 96px;
    }

    .print-area table {
        width: 100%;
        border-collapse: collapse;
        table-layout: fixed;
    }

    .print-area th,
    .print-area td {
        border: 1px solid #666;
        padding: 4px 6px;
        word-break: break-all;
    }

    .print-area thead th {
        background: #eee !important;
    }

    .print-area .detail-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px 14px;
    }

    .print-area .detail-grid .item {
        break-inside: avoid;
    }

    .print-area .detail-grid dt {
        font-size: 11px;
        color: #333;
    }

    .print-area .detail-grid dd {
        margin: 0;
    }

    .print-area .section-title {
        margin: 12px 0 6px;
    }

    .print-area .section-title h3 {
        font-size: 14px;
    }

    .print-area .signature-grid {
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
    }

    .print-area .signature-card {
        flex: 0 0 48%;
        border: 1px solid #999;
        padding: 6px;
    }

    .print-area .signature-preview {
        max-height: 110px;
    }

    .print-area .note {
        border: 1px solid #999;
        background: #fff;
    }

    .print-area .badge {
        border: 1px solid #666;
    }

    .print-area .cell-muted,
    .print-area .shortage-qty {
        color: #000;
    }
}
