*, *::before, *::after { box-sizing: border-box; }
:root {
    --accent: #2563eb;
    --bg: #f6f7fb;
    --panel: #ffffff;
    --line: #e6e8ef;
    --text: #111827;
    --muted: #6b7280;
    --green: #059669;
    --amber: #b45309;
    --red: #dc2626;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
    --sidebar-bg: #0f172a;
    --sidebar-text: #b6c2d9;
    --sidebar-strong: #ffffff;
    --sidebar-muted: #7c8aa5;
    --sidebar-chip: rgba(255, 255, 255, .08);
    --sidebar-hover: rgba(255, 255, 255, .06);
    --sidebar-active: rgba(255, 255, 255, .1);
    --sidebar-line: rgba(255, 255, 255, .08);
    --heading-font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}
html, body { margin: 0; padding: 0; }
body {
    font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
h1, h2 { font-family: var(--heading-font); }
.muted { color: var(--muted); }

.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 248px;
    flex: 0 0 248px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 20px; }
.brand strong { display: block; color: var(--sidebar-strong); font-size: 15px; line-height: 1.4; }
.brand small { color: var(--sidebar-muted); font-size: 11px; letter-spacing: .04em; }
.brand-mark {
    width: 30px; height: 30px; border-radius: 9px; flex: 0 0 30px;
    background: linear-gradient(135deg, var(--accent), #22d3ee);
    box-shadow: 0 6px 18px rgba(37, 99, 235, .35);
}
.brand-mark.big { width: 46px; height: 46px; flex-basis: 46px; border-radius: 13px; }
.nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 9px; color: var(--sidebar-text); font-size: 13.5px;
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-strong); }
.nav-item.active { background: var(--sidebar-active); color: var(--sidebar-strong); }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: #475569; flex: 0 0 6px; }
.nav-item.active .dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .22); }
.nav-count {
    margin-left: auto; background: var(--sidebar-chip); color: var(--sidebar-text);
    font-size: 11px; padding: 1px 7px; border-radius: 20px;
}
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--sidebar-line); }
.tenant { color: var(--sidebar-muted); font-size: 11.5px; margin-bottom: 10px; padding: 0 4px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 58px; background: rgba(255, 255, 255, .86); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line); display: flex; align-items: center;
    justify-content: space-between; padding: 0 26px; position: sticky; top: 0; z-index: 5;
}
.crumb { color: var(--muted); font-size: 12.5px; }
.who { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.avatar {
    width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
    background: color-mix(in srgb, var(--accent) 14%, white); color: var(--accent);
    font-weight: 600; font-size: 12px; border: 1px solid color-mix(in srgb, var(--accent) 24%, white);
}
.content { padding: 24px 26px 10px; flex: 1; }
.foot { padding: 16px 26px 24px; color: #9aa3b2; font-size: 11.5px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 2px; font-size: 21px; letter-spacing: -.01em; }
.page-head p { margin: 0; font-size: 12.5px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px 16px 13px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px;
    transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.card-label { color: var(--muted); font-size: 12.5px; }
.card-value { font-size: 27px; line-height: 1.25; letter-spacing: -.02em; }
.card-foot { color: var(--accent); font-size: 11.5px; margin-top: 4px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 14.5px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0; }
.kv > div { padding: 13px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.kv span { color: var(--muted); font-size: 12.5px; }
.kv strong { font-size: 12.5px; font-weight: 600; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
    text-align: left; padding: 11px 14px; color: var(--muted); font-weight: 500;
    font-size: 11.5px; letter-spacing: .02em; background: #fafbfe; border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid #f0f1f6; vertical-align: middle; }
tbody tr:hover { background: #fbfcff; }
tbody tr:last-child td { border-bottom: none; }
td.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.col-id { width: 56px; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-time { white-space: nowrap; color: var(--muted); font-size: 12px; }
.col-op { width: 120px; white-space: nowrap; }
.col-op form { display: inline; }
.link { color: var(--accent); background: none; border: 0; padding: 0 4px; cursor: pointer; font-size: 13px; }
.link.danger { color: var(--red); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; line-height: 1.6; white-space: nowrap; }
.badge-green { background: #ecfdf5; color: var(--green); }
.badge-amber { background: #fffbeb; color: var(--amber); }
.badge-red { background: #fef2f2; color: var(--red); }
.badge-gray { background: #f3f4f6; color: #4b5563; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line);
    background: #fff; color: var(--text); cursor: pointer; font-size: 13px;
    transition: border-color .15s ease, background .15s ease;
}
.btn:hover { border-color: #cfd5e3; background: #fbfcff; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); border-color: transparent; }
.btn-ghost { background: transparent; border-color: var(--sidebar-line); color: var(--sidebar-text); }
.btn-ghost:hover { background: var(--sidebar-hover); border-color: var(--sidebar-muted); }
.btn-block { width: 100%; }

.search { display: flex; gap: 6px; }
.search input {
    height: 34px; border: 1px solid var(--line); border-radius: 9px; padding: 0 11px;
    background: #fff; width: 190px; outline: none;
}
.search input:focus, .field input:focus, .field select:focus, .field textarea:focus {
    border-color: color-mix(in srgb, var(--accent) 55%, #cbd5e1);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.form { padding: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; color: #374151; }
.field-label em { color: var(--red); font-style: normal; }
.field input, .field select, .field textarea {
    border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
    background: #fff; outline: none; width: 100%;
}
.field textarea { resize: vertical; min-height: 74px; }
.field .hint { color: var(--muted); font-size: 11.5px; }
.form-actions { display: flex; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; }
.flash-ok { background: #ecfdf5; color: #047857; border: 1px solid #d1fae5; }
.flash-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fee2e2; }

.login-body {
    min-height: 100vh; display: grid; place-items: center;
    background:
        radial-gradient(900px 500px at 12% 8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
        radial-gradient(700px 500px at 88% 92%, rgba(34, 211, 238, .12), transparent 60%),
        #f6f7fb;
    padding: 24px;
}
.login-wrap {
    display: grid; grid-template-columns: 1.1fr .9fr; gap: 30px; align-items: center;
    width: min(920px, 100%);
}
.login-hero h1 { font-size: 27px; margin: 14px 0 8px; letter-spacing: -.02em; }
.login-hero p { color: var(--muted); margin: 0 0 18px; font-size: 13.5px; max-width: 440px; }
.hero-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.hero-list li { position: relative; padding-left: 18px; color: #374151; font-size: 13px; }
.hero-list li::before {
    content: ""; position: absolute; left: 0; top: 8px; width: 7px; height: 7px;
    border-radius: 2px; background: var(--accent); opacity: .75;
}
.login-card {
    background: #fff; border: 1px solid var(--line); border-radius: 18px;
    padding: 26px; box-shadow: 0 24px 60px rgba(15, 23, 42, .1);
    display: flex; flex-direction: column; gap: 14px;
}
.login-card h2 { margin: 0; font-size: 19px; }
.login-card p { margin: 0; }
.login-card .btn { margin-top: 4px; }

@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: column; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar-foot { display: none; }
    .login-wrap { grid-template-columns: 1fr; }
    .login-hero { display: none; }
    .content { padding: 18px 14px; }
    .topbar { padding: 0 14px; }
    .search input { width: 130px; }
    .dash-grid { grid-template-columns: 1fr; }
    .detail-row { grid-template-columns: 110px 1fr; }
}

/* v2 additions */
.small { font-size: 11.5px; }
.btn-quiet { background: transparent; color: var(--muted); }
.search select.filter-select {
    height: 34px; border: 1px solid var(--line); border-radius: 9px; padding: 0 9px;
    background: #fff; color: var(--text); outline: none; max-width: 150px;
}
.search select.filter-select:focus { border-color: color-mix(in srgb, var(--accent) 55%, #cbd5e1); }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.dash-grid .panel { display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.todo-list, .recent-list { list-style: none; margin: 0; padding: 4px 0; }
.todo-list li a, .recent-list li a {
    display: flex; align-items: center; gap: 10px; padding: 10px 18px;
    border-bottom: 1px solid #f2f3f8; font-size: 13px;
}
.todo-list li:last-child a, .recent-list li:last-child a { border-bottom: none; }
.todo-list li a:hover, .recent-list li a:hover { background: #fbfcff; }
.todo-count {
    margin-left: auto; min-width: 26px; text-align: center; background: #fff7ed; color: #b45309;
    border-radius: 20px; padding: 1px 8px; font-size: 11.5px;
}
.recent-label { color: var(--accent); font-size: 11.5px; background: color-mix(in srgb, var(--accent) 8%, white); padding: 1px 8px; border-radius: 20px; white-space: nowrap; }
.recent-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-time { color: #9aa3b2; font-size: 11.5px; }
.empty-block { padding: 26px 18px; color: var(--muted); font-size: 12.5px; text-align: center; }

.pager { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px 4px; }
.pager-actions { display: flex; gap: 8px; }

.detail { padding: 6px 20px; }
.detail-row { display: grid; grid-template-columns: 160px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid #f2f3f8; }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--muted); font-size: 12.5px; }
.detail-value { font-size: 13.5px; word-break: break-word; }
.detail-value .pre { white-space: normal; line-height: 1.7; }

.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: #fca5a5; background: #fffafa; }
.error-text { color: var(--red); font-size: 11.5px; }
.form-actions { position: sticky; bottom: 0; background: #fff; z-index: 2; }

/* v3 domain features */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.metric {
    background: linear-gradient(180deg, #fff, #fbfcff); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 2px; border-left: 3px solid var(--accent);
}
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { font-size: 23px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric small { color: #9aa3b2; font-size: 11px; }
.insight { padding: 14px 18px; margin-bottom: 18px; border-left: 3px solid color-mix(in srgb, var(--accent) 60%, white); }
.insight strong { font-size: 12.5px; color: var(--accent); }
.insight p { margin: 4px 0 0; color: #475569; font-size: 12.8px; }

.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.board-col {
    flex: 0 0 268px; background: #f1f3f9; border: 1px solid var(--line);
    border-radius: 14px; padding: 10px; min-height: 160px;
}
.board-col header { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; }
.board-col header em { font-style: normal; color: var(--muted); font-size: 11.5px; }
.board-card {
    background: #fff; border: 1px solid var(--line); border-radius: 11px;
    padding: 10px 11px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.board-title { display: block; font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.board-title:hover { color: var(--accent); }
.board-meta { color: var(--muted); font-size: 11.5px; margin-bottom: 8px; }
.board-card select {
    width: 100%; height: 30px; border: 1px solid var(--line); border-radius: 8px;
    background: #fbfcff; font-size: 12px; padding: 0 8px; color: #374151;
}
.board-empty { color: #9aa3b2; font-size: 12px; text-align: center; padding: 18px 0; }

.cal-month { font-size: 13px; font-weight: 600; padding: 0 4px; }
.cal-panel { overflow: hidden; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); background: #fafbfe; border-bottom: 1px solid var(--line); }
.cal-week div { padding: 9px 12px; font-size: 11.5px; color: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell {
    min-height: 104px; border-right: 1px solid #f0f1f6; border-bottom: 1px solid #f0f1f6;
    padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; font-size: 11.5px;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.muted-cell { background: #fcfcfe; }
.cal-cell.today { background: color-mix(in srgb, var(--accent) 5%, white); }
.cal-day { color: #6b7280; font-size: 11px; font-variant-numeric: tabular-nums; }
.cal-cell.today .cal-day { color: var(--accent); font-weight: 700; }
.cal-item {
    display: block; background: color-mix(in srgb, var(--accent) 8%, white);
    color: color-mix(in srgb, var(--accent) 80%, black); border-radius: 6px;
    padding: 3px 6px; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-item:hover { background: color-mix(in srgb, var(--accent) 16%, white); }
.cal-more { color: var(--muted); font-size: 10.5px; }

@media (max-width: 760px) {
    .cal-cell { min-height: 76px; padding: 4px; }
    .cal-item { font-size: 10px; }
    .board-col { flex-basis: 220px; }
}

/* v4 今日提醒 */
.reminders { margin-bottom: 18px; }
.reminder-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.reminder-block { padding: 12px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.reminder-block:last-child { border-right: none; }
.reminder-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.reminder-head span { font-size: 12px; color: var(--muted); }
.reminder-head em {
    font-style: normal; min-width: 24px; text-align: center; border-radius: 20px;
    padding: 1px 8px; font-size: 11px; background: #fff7ed; color: var(--amber);
}
.reminder-block ul { list-style: none; margin: 0; padding: 0; }
.reminder-block li a {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 5px 0; font-size: 12.4px; border-bottom: 1px dashed var(--line);
}
.reminder-block li:last-child a { border-bottom: none; }
.reminder-block li a:hover .r-title { color: var(--accent); }
.r-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-meta { color: var(--muted); font-size: 11px; white-space: nowrap; }
.reminder-empty { color: var(--muted); font-size: 12px; padding: 6px 0; }

/* v4 每个系统独立主题 */
.theme-petcare {
    --accent: #0d9488; --bg: #fbf8f2; --panel: #fffdf9; --line: #ece3d4; --text: #1f2937; --muted: #7c7365; --radius: 18px;
    --sidebar-bg: #134e4a; --sidebar-text: #c7e7e2; --sidebar-strong: #ffffff; --sidebar-muted: #8fc7bf;
    --sidebar-chip: rgba(255, 255, 255, .12); --sidebar-hover: rgba(255, 255, 255, .08); --sidebar-active: rgba(255, 255, 255, .16); --sidebar-line: rgba(255, 255, 255, .12);
}
.theme-petcare .card { border-bottom: 3px solid #f4d7b0; }

.theme-homecare {
    --accent: #ea580c; --bg: #fff8f3; --panel: #ffffff; --line: #f3e2d5; --text: #2b211b; --muted: #8a7566; --radius: 16px;
    --sidebar-bg: #7c2d12; --sidebar-text: #fbd7c2; --sidebar-strong: #ffffff; --sidebar-muted: #d19b7e;
    --sidebar-chip: rgba(255, 255, 255, .14); --sidebar-hover: rgba(255, 255, 255, .09); --sidebar-active: rgba(255, 255, 255, .18); --sidebar-line: rgba(255, 255, 255, .14);
}

.theme-garage {
    --accent: #1d4ed8; --bg: #f2f5f9; --panel: #ffffff; --line: #dde3ec; --text: #111827; --muted: #64748b; --radius: 8px;
    --sidebar-bg: #111827; --sidebar-text: #c3ccdb; --sidebar-strong: #ffffff; --sidebar-muted: #6b7788;
    --sidebar-chip: rgba(255, 255, 255, .1); --sidebar-hover: rgba(255, 255, 255, .06); --sidebar-active: rgba(255, 255, 255, .12); --sidebar-line: rgba(255, 255, 255, .1);
}
.theme-garage .page-head h1 { letter-spacing: -.02em; }
.theme-garage thead th { background: #eef2f8; }
.theme-garage .card-value { font-variant-numeric: tabular-nums; }

.theme-clinical {
    --accent: #0284c7; --bg: #f7fbfd; --panel: #ffffff; --line: #e0eef5; --text: #0f2a3a; --muted: #5f7f90; --radius: 10px;
    --sidebar-bg: #eef8fd; --sidebar-text: #075985; --sidebar-strong: #0c4a6e; --sidebar-muted: #5b93ad;
    --sidebar-chip: rgba(2, 132, 199, .12); --sidebar-hover: rgba(2, 132, 199, .08); --sidebar-active: rgba(2, 132, 199, .16); --sidebar-line: #d6eaf4;
}
.theme-clinical .brand-mark { box-shadow: 0 6px 16px rgba(2, 132, 199, .25); }
.theme-clinical .nav-item .dot { background: #bae6fd; }

.theme-studio {
    --accent: #db2777; --bg: #0f0d18; --panel: #191627; --line: #2a2540; --text: #ece9ff; --muted: #9c96b8; --radius: 14px;
    --sidebar-bg: #0a0812; --sidebar-text: #b9b2d6; --sidebar-strong: #ffffff; --sidebar-muted: #6f678f;
    --sidebar-chip: rgba(219, 39, 119, .18); --sidebar-hover: rgba(255, 255, 255, .05); --sidebar-active: rgba(219, 39, 119, .18); --sidebar-line: rgba(255, 255, 255, .08);
}
.theme-studio .topbar { background: rgba(15, 13, 24, .88); border-color: #2a2540; }
.theme-studio thead th { background: #1f1b30; border-color: #2a2540; color: #9c96b8; }
.theme-studio tbody td { border-color: #241f36; }
.theme-studio tbody tr:hover { background: #1f1b30; }
.theme-studio .field input, .theme-studio .field select, .theme-studio .field textarea,
.theme-studio .search input, .theme-studio .search select { background: #120f1d; border-color: #2a2540; color: #ece9ff; }
.theme-studio .btn { background: #191627; border-color: #2a2540; color: #ece9ff; }
.theme-studio .btn:hover { background: #221d34; }
.theme-studio .flash-ok { background: #0d2a24; color: #6ee7b7; border-color: #134e4a; }
.theme-studio .flash-error { background: #2a0f16; color: #fda4af; border-color: #4c1d2a; }
.theme-studio .cal-week { background: #1f1b30; }
.theme-studio .cal-cell.muted-cell { background: #120f1d; }
.theme-studio .cal-item { background: rgba(219, 39, 119, .2); color: #f9a8d4; }
.theme-studio .login-body { background: radial-gradient(900px 500px at 12% 8%, rgba(219, 39, 119, .2), transparent 60%), #0f0d18; }
.theme-studio .login-card { background: #191627; }
.theme-studio .login-hero p { color: #9c96b8; }
.theme-studio .empty-block, .theme-studio .reminder-empty { color: #9c96b8; }

.theme-farm {
    --accent: #16a34a; --bg: #f5faf3; --panel: #ffffff; --line: #dfead9; --text: #17251b; --muted: #6b7d6c; --radius: 20px;
    --sidebar-bg: #14532d; --sidebar-text: #cde8d4; --sidebar-strong: #ffffff; --sidebar-muted: #82b08d;
    --sidebar-chip: rgba(255, 255, 255, .12); --sidebar-hover: rgba(255, 255, 255, .08); --sidebar-active: rgba(255, 255, 255, .15); --sidebar-line: rgba(255, 255, 255, .12);
}
.theme-farm .card { border-radius: 20px; }

.theme-logistics {
    --accent: #0f766e; --bg: #f4f7f9; --panel: #ffffff; --line: #dfe7ec; --text: #12232b; --muted: #5f7681; --radius: 8px;
    --sidebar-bg: #0b1f2a; --sidebar-text: #b8cbd4; --sidebar-strong: #ffffff; --sidebar-muted: #6f8791;
    --sidebar-chip: rgba(15, 118, 110, .28); --sidebar-hover: rgba(255, 255, 255, .05); --sidebar-active: rgba(15, 118, 110, .32); --sidebar-line: rgba(255, 255, 255, .08);
}
.theme-logistics tbody td { padding: 9px 13px; }
.theme-logistics .card-value { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

.theme-edu {
    --accent: #2563eb; --bg: #f7f9ff; --panel: #ffffff; --line: #e3e9f8; --text: #182036; --muted: #65708c; --radius: 16px;
    --sidebar-bg: #1e3a8a; --sidebar-text: #cdd9f7; --sidebar-strong: #ffffff; --sidebar-muted: #8ba3d9;
    --sidebar-chip: rgba(255, 255, 255, .14); --sidebar-hover: rgba(255, 255, 255, .08); --sidebar-active: rgba(255, 255, 255, .16); --sidebar-line: rgba(255, 255, 255, .14);
}
.theme-edu { font-size: 14.5px; }
.theme-edu .page-head h1 { font-size: 22px; }

.theme-energy {
    --accent: #ca8a04; --bg: #f7f7f3; --panel: #ffffff; --line: #e7e6db; --text: #1c1f1a; --muted: #77796b; --radius: 6px;
    --sidebar-bg: #111827; --sidebar-text: #c7c9bd; --sidebar-strong: #ffffff; --sidebar-muted: #7c7f70;
    --sidebar-chip: rgba(202, 138, 4, .22); --sidebar-hover: rgba(255, 255, 255, .05); --sidebar-active: rgba(202, 138, 4, .22); --sidebar-line: rgba(255, 255, 255, .08);
}
.theme-energy .field-label, .theme-energy thead th { text-transform: uppercase; letter-spacing: .06em; font-size: 10.8px; }
.theme-energy .metric { border-left-width: 4px; }

.theme-property {
    --accent: #0891b2; --bg: #f6fafb; --panel: #ffffff; --line: #e0edf1; --text: #102a33; --muted: #5f7c86; --radius: 12px;
    --sidebar-bg: #164e63; --sidebar-text: #c5e4ee; --sidebar-strong: #ffffff; --sidebar-muted: #7fb0c1;
    --sidebar-chip: rgba(255, 255, 255, .13); --sidebar-hover: rgba(255, 255, 255, .08); --sidebar-active: rgba(255, 255, 255, .16); --sidebar-line: rgba(255, 255, 255, .13);
}

.theme-build {
    --accent: #b45309; --bg: #faf7f2; --panel: #ffffff; --line: #ebe2d5; --text: #211d19; --muted: #7f7467; --radius: 6px;
    --sidebar-bg: #1c1917; --sidebar-text: #d6cec5; --sidebar-strong: #ffffff; --sidebar-muted: #8a8077;
    --sidebar-chip: rgba(245, 158, 11, .2); --sidebar-hover: rgba(255, 255, 255, .05); --sidebar-active: rgba(245, 158, 11, .22); --sidebar-line: rgba(255, 255, 255, .08);
}
.theme-build .sidebar { border-top: 4px solid #f59e0b; }
.theme-build .page-head h1 { text-transform: uppercase; letter-spacing: .02em; font-weight: 800; }

.theme-finance {
    --accent: #475569; --bg: #f5f6f8; --panel: #ffffff; --line: #e2e5ea; --text: #14181f; --muted: #6b7280; --radius: 6px;
    --sidebar-bg: #1f2937; --sidebar-text: #c7ced9; --sidebar-strong: #ffffff; --sidebar-muted: #7c8697;
    --sidebar-chip: rgba(255, 255, 255, .1); --sidebar-hover: rgba(255, 255, 255, .05); --sidebar-active: rgba(255, 255, 255, .12); --sidebar-line: rgba(255, 255, 255, .08);
}
.theme-finance tbody td { padding: 8px 12px; font-size: 12.6px; }
.theme-finance thead th { padding: 8px 12px; }
.theme-finance .card-value, .theme-finance .metric strong { font-variant-numeric: tabular-nums; }

.theme-beauty {
    --accent: #be185d; --bg: #fdf6f7; --panel: #ffffff; --line: #f3dfe5; --text: #2a1218; --muted: #8d6670; --radius: 18px;
    --sidebar-bg: #fff1f4; --sidebar-text: #9d174d; --sidebar-strong: #500724; --sidebar-muted: #b06b81;
    --sidebar-chip: rgba(190, 24, 93, .1); --sidebar-hover: rgba(190, 24, 93, .06); --sidebar-active: rgba(190, 24, 93, .12); --sidebar-line: #f6d7e0;
}
.theme-beauty h1, .theme-beauty h2, .theme-beauty .brand strong {
    font-family: Georgia, "Songti SC", "STSong", "SimSun", serif; letter-spacing: .01em;
}
.theme-beauty .nav-item .dot { background: #f9a8d4; }

.theme-restaurant {
    --accent: #dc2626; --bg: #fff8f5; --panel: #ffffff; --line: #f2ded7; --text: #2a1714; --muted: #8b6a63; --radius: 14px;
    --sidebar-bg: #450a0a; --sidebar-text: #f3cfc9; --sidebar-strong: #ffffff; --sidebar-muted: #b9796f;
    --sidebar-chip: rgba(255, 255, 255, .13); --sidebar-hover: rgba(255, 255, 255, .07); --sidebar-active: rgba(255, 255, 255, .16); --sidebar-line: rgba(255, 255, 255, .13);
}
.theme-restaurant .card { border-top: 3px solid #fca5a5; }

.theme-elderly {
    --accent: #7e22ce; --bg: #faf8ff; --panel: #ffffff; --line: #e9e1f5; --text: #241b33; --muted: #75688c; --radius: 16px;
    --sidebar-bg: #3b0764; --sidebar-text: #e2d3f5; --sidebar-strong: #ffffff; --sidebar-muted: #a78bc7;
    --sidebar-chip: rgba(255, 255, 255, .14); --sidebar-hover: rgba(255, 255, 255, .08); --sidebar-active: rgba(255, 255, 255, .17); --sidebar-line: rgba(255, 255, 255, .13);
}
.theme-elderly { font-size: 15px; }
.theme-elderly .nav-item { font-size: 14.5px; padding: 11px 12px; }
.theme-elderly .field-label { font-size: 13px; }

/* v5 行业处理台、资料来源与业务单据 */
.brand-mark { display: inline-grid; place-items: center; color: #fff; font-weight: 800; line-height: 1; }
.brand-mark > span { transform: translateY(-1px); }
.brand-mark.big > span { font-size: 21px; }
.scene-eyebrow { display: block; margin-bottom: 4px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.scene-head h1 { font-size: 24px; }
.btn, .search input, .search select.filter-select, .field input, .field select, .field textarea { background: var(--panel); color: var(--text); }
.btn:hover { background: color-mix(in srgb, var(--accent) 4%, var(--panel)); }
.btn-primary, .btn-primary:hover { background: var(--accent); color: #fff; }
.field-label { color: var(--text); }
.form-actions { background: var(--panel); padding-bottom: 4px; }
.metric { background: var(--panel); }
.board-col { background: color-mix(in srgb, var(--accent) 4%, var(--bg)); }
.board-card, .board-card select { background: var(--panel); color: var(--text); }
.todo-list li a, .recent-list li a, .detail-row { border-color: var(--line); }
.todo-list li a:hover, .recent-list li a:hover { background: color-mix(in srgb, var(--accent) 4%, var(--panel)); }
.theme-studio .metric, .theme-studio .board-card, .theme-studio .form-actions { background: #191627; }
.theme-studio .board-col { background: #120f1d; }
.theme-studio .board-card select { background: #120f1d; color: #ece9ff; }
.theme-studio .login-hero p, .theme-studio .hero-list li { color: #c4bed9; }
.theme-studio .login-card .field-label { color: #ece9ff; }
.theme-studio .btn-primary { background: #be185d; border-color: #be185d; }
.theme-studio .btn-primary:hover { background: #db2777; }
.theme-studio .insight p { color: #c4bed9; }
.theme-studio .recent-label { background: #2a1730; }
.theme-studio .badge-gray { background: #29243a; color: #c4bed9; }

.workflow-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; padding: 0; margin: 0 0 16px; list-style: none; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.workflow-strip li { position: relative; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 10px 16px; background: var(--panel); }
.workflow-strip li span { color: var(--accent); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.workflow-strip li strong { font-size: 12.5px; font-weight: 600; }
.workbench-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.work-queue { min-width: 0; overflow: hidden; }
.work-queue .panel-head { min-height: 70px; }
.work-queue .panel-head h2 { margin-bottom: 2px; }
.work-queue .panel-head p { margin: 0; color: var(--muted); font-size: 11.5px; }
.queue-count { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 12%, var(--panel)); color: var(--accent); font-weight: 800; }
.queue-list { padding: 0 16px; }
.queue-item { min-width: 0; padding: 15px 0; border-bottom: 1px solid var(--line); }
.queue-item:last-child { border-bottom: 0; }
.queue-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.queue-title { min-width: 0; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.queue-title:hover { color: var(--accent); }
.queue-id { color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.queue-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 12px 0; }
.queue-meta div { min-width: 0; }
.queue-meta dt { color: var(--muted); font-size: 10.5px; }
.queue-meta dd { margin: 2px 0 0; font-size: 12.5px; overflow-wrap: anywhere; }
.queue-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.queue-actions .btn { height: 30px; font-size: 12px; }
.workbench-note { margin-top: 14px; padding: 12px 16px; border-left: 3px solid var(--accent); color: var(--muted); background: color-mix(in srgb, var(--accent) 5%, var(--panel)); font-size: 12px; }


.print-body { min-height: 100vh; padding: 24px; background: #e5e7eb; color: #111827; }
.print-toolbar { display: flex; justify-content: center; gap: 8px; margin: 0 auto 16px; }
.document-sheet { width: min(900px, 100%); min-height: 700px; margin: 0 auto; padding: 44px 48px; background: #fff; color: #111827; box-shadow: 0 10px 35px rgba(0, 0, 0, .12); }
.document-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding-bottom: 18px; border-bottom: 3px solid #111827; }
.document-org { font-size: 12px; letter-spacing: .12em; }
.document-header h1 { margin: 5px 0 0; font-size: 27px; letter-spacing: .12em; }
.document-no { font-family: Consolas, monospace; font-size: 12px; }
.document-meta { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0 22px; color: #4b5563; font-size: 11px; }
.document-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid #9ca3af; border-left: 1px solid #9ca3af; }
.document-field { display: grid; grid-template-columns: 115px 1fr; min-height: 52px; border-right: 1px solid #9ca3af; border-bottom: 1px solid #9ca3af; }
.document-field > span { padding: 12px; background: #f3f4f6; color: #4b5563; font-size: 12px; }
.document-field > strong { padding: 12px; font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.document-field-wide { grid-column: 1 / -1; }
.document-note { margin-top: 24px; padding: 14px 16px; border: 1px solid #d1d5db; }
.document-note strong { font-size: 12px; }
.document-note p { margin: 5px 0 0; color: #4b5563; font-size: 12px; }
.document-footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 70px; font-size: 12px; }

/* 行业差异化：形状、密度、导航和工作台层级 */
.theme-petcare .nav-item { border-radius: 14px 5px 14px 5px; }
.theme-petcare .workflow-strip li:first-child { background: #ecfdf5; color: #134e4a; }
.theme-homecare .scene-head { padding: 18px 20px; border-left: 5px solid #ea580c; background: #fff; border-radius: 0 16px 16px 0; }
.theme-homecare .queue-item { border-left: 2px solid #fed7aa; padding-left: 12px; }
.theme-garage .content { max-width: 1540px; width: 100%; margin: 0 auto; }
.theme-garage .workflow-strip { border-radius: 3px; }
.theme-garage .queue-title, .theme-garage .document-no { font-family: Consolas, "Microsoft YaHei", monospace; }
.theme-clinical .panel, .theme-clinical .card { box-shadow: none; }
.theme-clinical .workflow-strip li span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: #e0f2fe; }
.theme-studio .scene-head { padding: 22px; border: 1px solid #33264a; background: linear-gradient(120deg, rgba(219, 39, 119, .16), transparent 65%); }
.theme-studio .work-queue { box-shadow: none; }
.theme-farm .workflow-strip { border-radius: 24px; }
.theme-farm .queue-item:nth-child(odd) { background: color-mix(in srgb, #16a34a 4%, transparent); }
.theme-logistics .workbench-grid { grid-template-columns: 1.2fr .8fr; }
.theme-logistics .queue-item-head { border-left: 3px solid var(--accent); padding-left: 10px; }
.theme-edu .workflow-strip li { flex-direction: column; align-items: flex-start; gap: 2px; }
.theme-energy .workflow-strip, .theme-energy .work-queue { border-radius: 0; border-top: 3px solid #ca8a04; }
.theme-energy .queue-meta dd { font-variant-numeric: tabular-nums; }
.theme-property .work-queue:first-child { border-top: 4px solid #06b6d4; }
.theme-property .work-queue:last-child { border-top: 4px solid #f59e0b; }
.theme-build .work-queue { border: 2px solid #292524; box-shadow: 4px 4px 0 #f59e0b; }
.theme-build .workflow-strip li { background: #fffbeb; }
.theme-finance .content { max-width: 1400px; width: 100%; margin: 0 auto; }
.theme-finance .queue-list { padding: 0 12px; }
.theme-finance .queue-item { padding: 11px 0; }
.theme-finance .document-sheet { font-variant-numeric: tabular-nums; }
.theme-beauty .scene-head { padding: 20px 24px; border-bottom: 1px solid #f9a8d4; background: linear-gradient(90deg, #fff1f4, transparent); }
.theme-beauty .queue-title { font-family: Georgia, "Songti SC", serif; font-size: 16px; }
.theme-restaurant .work-queue:first-child { background: #fff7ed; }
.theme-restaurant .queue-count { border-radius: 5px; }
.theme-elderly .queue-title { font-size: 16px; }
.theme-elderly .queue-meta dt { font-size: 12px; }
.theme-elderly .queue-meta dd { font-size: 14px; }
.theme-elderly .queue-actions .btn { height: 38px; font-size: 14px; }

@media (max-width: 900px) {
    .sidebar { padding: 12px 10px; }
    .brand { padding-bottom: 10px; }
    .nav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
    .nav-item { flex: 0 0 auto; white-space: nowrap; }
    .nav-count { display: none; }
    .workbench-grid, .theme-logistics .workbench-grid { grid-template-columns: 1fr; }
    .workflow-strip { display: flex; overflow-x: auto; }
    .workflow-strip li { flex: 0 0 150px; }
    .page-actions, .search { max-width: 100%; flex-wrap: wrap; }
    .document-sheet { padding: 28px 22px; }
}
@media (max-width: 560px) {
    .queue-meta { grid-template-columns: 1fr 1fr; }
    .print-body { padding: 10px; }
    .document-header, .document-meta, .document-footer { align-items: flex-start; flex-direction: column; }
    .document-fields { grid-template-columns: 1fr; }
    .document-field-wide { grid-column: auto; }
    .document-field { grid-template-columns: 95px 1fr; }
    .document-footer { margin-top: 40px; }
}
@media print {
    @page { size: A4; margin: 12mm; }
    .no-print { display: none !important; }
    .print-body { padding: 0; background: #fff; }
    .document-sheet { width: 100%; min-height: 0; padding: 0; box-shadow: none; }
    .document-header h1 { font-size: 23px; }
    .document-footer { margin-top: 45px; }
}