/* Shared presentation only. Page scripts retain control of visibility and CRUD. */
:root {
    --zhen-font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --zhen-text-xs: 12px;
    --zhen-text-sm: 14px;
    --zhen-text-md: 16px;
    --zhen-text-lg: 20px;
    --zhen-text-xl: 24px;
    --zhen-text-2xl: 32px;
    --zhen-text-3xl: 40px;
    --zhen-sidebar: 260px;
    --zhen-radius: 16px;
    --zhen-control-radius: 10px;
    --zhen-control-height: 44px;
    --zhen-gap: 16px;
    --zhen-page-padding: 24px;
}

body.zhen-ui {
    --zhen-bg: #08111f;
    --zhen-surface: #101c2d;
    --zhen-surface-soft: #142338;
    --zhen-border: #293b51;
    --zhen-text: #edf3fb;
    --zhen-muted: #a0b0c4;
    --zhen-accent: #5eead4;
    --zhen-blue: #8ab4ff;
    --zhen-danger: #ff91a3;
    --zhen-shadow: 0 8px 28px rgb(0 0 0 / 12%);
    color-scheme: dark;
    margin: 0;
    background: var(--zhen-bg) !important;
    color: var(--zhen-text);
    font-family: var(--zhen-font);
    font-size: var(--zhen-text-sm);
    line-height: 1.5;
}

html[data-theme="light"] body.zhen-workspace,
html.theme-light body.zhen-workspace,
body.zhen-workspace.light,
body.zhen-workspace.schedule-theme-light,
body.zhen-workspace:has(.light-mode) {
    --zhen-bg: #f3f6fa;
    --zhen-surface: #ffffff;
    --zhen-surface-soft: #edf2f7;
    --zhen-border: #d5dfea;
    --zhen-text: #1b2a3e;
    --zhen-muted: #586a80;
    --zhen-accent: #087e70;
    --zhen-blue: #3869b3;
    --zhen-danger: #be2946;
    --zhen-shadow: 0 8px 28px rgb(27 42 62 / 6%);
    color-scheme: light;
}

body.zhen-ui,
body.zhen-ui :is(.sp-shell, .ec-shell, .ck-shell, .tpl-shell, .hub-shell) {
    --bg: var(--zhen-bg);
    --bg2: var(--zhen-bg);
    --panel: var(--zhen-surface);
    --panel2: var(--zhen-surface-soft);
    --panel-2: var(--zhen-surface-soft);
    --side: var(--zhen-surface);
    --card: var(--zhen-surface);
    --card2: var(--zhen-surface-soft);
    --line: var(--zhen-border);
    --border: var(--zhen-border);
    --text: var(--zhen-text);
    --muted: var(--zhen-muted);
    --nav: var(--zhen-muted);
    --hover: var(--zhen-surface-soft);
    --input: var(--zhen-bg);
    --accent: var(--zhen-accent);
    --cyan: var(--zhen-accent);
    --blue: var(--zhen-blue);
    --danger: var(--zhen-danger);
    --shadow: var(--zhen-shadow);
    --hub-bg: var(--zhen-bg);
    --hub-bg-2: var(--zhen-bg);
    --hub-panel: var(--zhen-surface);
    --hub-panel-2: var(--zhen-surface-soft);
    --hub-text: var(--zhen-text);
    --hub-muted: var(--zhen-muted);
    --hub-line: var(--zhen-border);
    --hub-line-strong: var(--zhen-muted);
    --hub-cyan: var(--zhen-accent);
    --hub-shadow: var(--zhen-shadow);
    --fs-xs: var(--zhen-text-xs);
    --fs-sm: var(--zhen-text-sm);
    --fs-md: var(--zhen-text-md);
    --fs-lg: var(--zhen-text-xl);
    --fs-xl: var(--zhen-text-2xl);
}

.zhen-ui *, .zhen-public * { box-sizing: border-box; }
.zhen-ui :is(button, input, select, textarea) { font-family: var(--zhen-font); }
.zhen-ui .workspace-sidebar-toggle[hidden] { display: none !important; }
.zhen-ui :is(button, summary, select) { cursor: pointer; }
.zhen-ui :is(button, input, select, textarea):disabled { cursor: not-allowed; opacity: .6; }
.zhen-ui :is(a, button, input, select, textarea, summary):focus-visible,
.zhen-public :is(a, button, input):focus-visible {
    outline: 3px solid #38bdae;
    outline-offset: 3px;
}
.zhen-ui :is(p, h1, h2, h3, td) { overflow-wrap: anywhere; }
.zhen-ui :is(h1, h2, h3) { line-height: 1.25; letter-spacing: -.025em; }
.zhen-ui :is(.muted, .sub, .auth-sub, .hub-muted) { color: var(--zhen-muted); }

body.zhen-workspace :is(.sp-shell, .ec-shell, .ck-shell, .tpl-shell, .hub-shell) {
    background: var(--zhen-bg) !important;
    color: var(--zhen-text) !important;
    font-family: var(--zhen-font);
    font-size: var(--zhen-text-sm);
}
body.zhen-workspace :is(.sp-main, .ec-main, .ck-main, .tpl-main, .hub-content, .content) {
    padding: var(--zhen-page-padding) var(--zhen-page-padding) 64px !important;
    min-width: 0;
}
body.zhen-workspace :is(.hero h1, .ec-hero h1, .tpl-hero h1, .lh-hero-line h2, .section-title h2, .ck-main .hero h2) {
    font-size: var(--zhen-text-2xl) !important;
    line-height: 1.2;
}
body.zhen-workspace :is(.top h1, .topbar h1, .hub-top-left h1) { font-size: var(--zhen-text-xl); }
body.zhen-workspace :is(.panel h2, .panel h3, .section h3, .tpl-panel h2, .tpl-card h3, .side-panel h3) {
    font-size: var(--zhen-text-lg);
}
body.zhen-workspace :is(.card, .panel, .chart, .overall-card, .focus-card, .add-panel, .chart-card, .goal-card, .hub-stat, .hub-page-card, .page-library, .tpl-panel, .tpl-card, .ec-card, .ec-panel) {
    border: 1px solid var(--zhen-border) !important;
    border-radius: var(--zhen-radius) !important;
    background: var(--zhen-surface) !important;
    color: var(--zhen-text);
    box-shadow: var(--zhen-shadow) !important;
    min-width: 0;
}
body.zhen-workspace :is(.card, .panel, .overall-card, .focus-card, .add-panel, .chart-card, .goal-card, .hub-stat, .hub-page-card, .tpl-panel, .tpl-card) {
    padding: 20px !important;
}
body.zhen-workspace :is(.stats article, .sp-main > .hero) {
    padding: 20px !important;
    border: 1px solid var(--zhen-border) !important;
    border-radius: var(--zhen-radius) !important;
    background: var(--zhen-surface) !important;
    box-shadow: var(--zhen-shadow) !important;
}
body.zhen-workspace :is(.modal-card, .hub-modal-card, .dialog) {
    background: var(--zhen-surface);
    color: var(--zhen-text);
    border: 1px solid var(--zhen-border);
    border-radius: var(--zhen-radius);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
}
body.zhen-workspace :is(.grid, .grid2, .overview-grid, .charts, .lh-overview-grid, .hub-page-grid, .tpl-grid, .tpl-list, .ck-grid) { gap: var(--zhen-gap); }
body.zhen-workspace :is(.sidebar, .sp-sidebar, .hub-sidebar, .side) {
    background: var(--zhen-surface) !important;
    border-right: 1px solid var(--zhen-border);
    box-shadow: none;
    padding: 24px 16px;
}
body.zhen-workspace :is(.sp-header, .topbar, .hub-topbar) {
    min-height: 88px;
    height: auto;
    background: var(--zhen-surface) !important;
    border-bottom: 1px solid var(--zhen-border) !important;
    box-shadow: none !important;
    gap: 16px;
    flex-wrap: wrap;
}
body.zhen-workspace :is(.sp-side-nav button, .sp-side-nav-link, .sidebar .nav, .hub-nav button, .side .nav a) {
    min-height: 44px;
    border-radius: var(--zhen-control-radius);
    font-size: var(--zhen-text-sm);
    font-weight: 600;
    line-height: 1.4 !important;
    color: var(--zhen-muted);
}
body.zhen-workspace :is(.sp-side-nav button.active, .sp-side-nav-link.active, .sidebar .nav.active, .hub-nav button.active, .side .nav a.on) {
    background: var(--zhen-surface-soft) !important;
    color: var(--zhen-accent) !important;
    box-shadow: inset 3px 0 var(--zhen-accent) !important;
}
body.zhen-workspace :is(.sp-side-brand strong, .hub-brand b, .sidebar .brand b) { font-size: var(--zhen-text-md); color: var(--zhen-text); }
body.zhen-workspace :is(.sp-side-brand small, .hub-brand small, .sidebar .brand small, .sp-side-label, .hub-side-label, .side-label) { font-size: var(--zhen-text-xs); color: var(--zhen-muted); }

/* Only known controls are styled: hidden inputs, switches and preview links keep their behavior. */
body.zhen-ui :is(.btn, .hub-btn, .tpl-btn, .ec-btn, .auth-submit, .submit, button.primary, button.secondary, .logout-btn, .theme-btn, .user-chip) {
    min-height: var(--zhen-control-height) !important;
    height: auto;
    padding: 10px 16px;
    border-radius: var(--zhen-control-radius) !important;
    font-size: var(--zhen-text-sm) !important;
    font-weight: 600;
    line-height: 1.4;
    white-space: normal;
    text-align: center;
}
body.zhen-ui :is(.btn, .hub-btn, .tpl-btn, .ec-btn) { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
body.zhen-ui :is(.btn, .hub-btn, .tpl-btn, .ec-btn, button.secondary, .user-chip, .theme-btn) {
    border: 1px solid var(--zhen-border);
    background: var(--zhen-surface-soft);
    color: var(--zhen-text);
}
body.zhen-ui :is(.btn.primary, .hub-btn.primary, .tpl-btn.primary, .ec-btn.primary, button.primary, .auth-submit, .submit),
body.zhen-admin button.btn:not(.secondary):not(.danger) {
    background: #5eead4 !important;
    color: #082b27 !important;
    border: 1px solid #5eead4 !important;
    box-shadow: none;
}
body.zhen-ui :is(.btn.danger, .hub-btn.danger, .tpl-btn.danger, .ec-btn.danger, .danger-btn, .logout-btn) {
    background: var(--zhen-surface-soft) !important;
    color: var(--zhen-danger) !important;
    border: 1px solid var(--zhen-danger);
}
body.zhen-ui :is(.btn, .hub-btn, .tpl-btn, .ec-btn, .auth-submit, .submit, button.primary, button.secondary):hover {
    filter: brightness(1.08);
    transform: none;
}
body.zhen-ui :is(.field, .form, .form-grid, .formgrid, .tpl-form, .tpl-item, .hub-field, .hub-content, .form-wrap, .header-tools, .zhen-admin) :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea),
body.zhen-ui .input {
    min-height: var(--zhen-control-height) !important;
    border-radius: var(--zhen-control-radius);
    border-color: var(--zhen-border);
    background-color: var(--zhen-bg);
    color: var(--zhen-text);
    font-size: var(--zhen-text-sm) !important;
    line-height: 1.5;
    max-width: 100%;
    min-width: 0;
    color-scheme: inherit;
}
body.zhen-ui :is(.field label, .form label, .form-grid label, .formgrid label, .tpl-form label, .hub-field label) {
    font-size: var(--zhen-text-xs);
    color: var(--zhen-muted);
    line-height: 1.5;
}
body.zhen-ui textarea { resize: vertical; }
body.zhen-auth .field input:not([type="checkbox"]),
body.zhen-workspace :is(.field, .formgrid, .form-grid, .tpl-form, .hub-field) :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select) {
    height: var(--zhen-control-height);
    padding-top: 10px;
    padding-bottom: 10px;
}
body.zhen-admin :is(input:not([type="hidden"]):not([type="checkbox"]), select, textarea) {
    min-height: var(--zhen-control-height);
    font: inherit;
    border-radius: var(--zhen-control-radius);
}
body.zhen-workspace :is(.search, .hub-search, .library-search) { min-height: var(--zhen-control-height); height: auto; }
body.zhen-workspace :is(.search, .hub-search, .library-search) input { min-height: 0 !important; background: transparent !important; }
body.zhen-ui :is(.badge, .pill, .hub-chip, .tpl-pill, .ec-pill) { font-size: var(--zhen-text-xs); line-height: 1.4; }
body.zhen-ui :is(.flash, .hub-flash, .hub-error, .alert) { border-radius: var(--zhen-control-radius); font-size: var(--zhen-text-sm); padding: 14px 16px; }
body.zhen-ui .table { font-size: var(--zhen-text-sm); }
body.zhen-ui .table :is(th, td) { padding: 14px 16px; border-bottom-color: var(--zhen-border); }
body.zhen-ui .table th { color: var(--zhen-muted); font-size: var(--zhen-text-xs); font-weight: 600; }
body.zhen-ui .table-wrap { width: 100%; overflow-x: auto; }
body.zhen-ui .table-wrap .table { min-width: 620px; }
body.zhen-ui nav[role="navigation"] { margin-top: 20px; font-size: var(--zhen-text-sm); }
body.zhen-ui nav[role="navigation"] svg { width: 20px; height: 20px; vertical-align: middle; }
body.zhen-ui nav[role="navigation"] a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 8px; color: var(--zhen-accent); }

/* One workspace geometry, including the existing compact sidebar state. */
@media (min-width: 651px) {
    body.zhen-workspace.workspace-sidebar-visible :is(.sidebar, .sp-sidebar, .hub-sidebar) { width: var(--zhen-sidebar) !important; }
    body.zhen-workspace.workspace-sidebar-visible :is(.sp-main, .ec-main, .ck-main, .tpl-main, .hub-main) { margin-left: var(--zhen-sidebar) !important; }
    body.zhen-workspace[data-sidebar-module="daily"].workspace-sidebar-visible main { margin-left: var(--zhen-sidebar); width: calc(100% - var(--zhen-sidebar)); }
    body.zhen-workspace.workspace-sidebar-visible .sp-header { padding-left: calc(var(--zhen-sidebar) + var(--zhen-page-padding)) !important; }
    body.zhen-workspace.workspace-sidebar-visible .sp-header::after { left: var(--zhen-sidebar) !important; }
    body.zhen-workspace.workspace-sidebar-hidden :is(.ec-main, .ck-main, .tpl-main) { margin-left: 72px !important; }
    body.zhen-workspace.workspace-sidebar-hidden .hub-nav button { font-size: 0 !important; }
}

body.zhen-admin .shell { grid-template-columns: var(--zhen-sidebar) minmax(0, 1fr); }
body.zhen-admin .side { position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
body.zhen-admin .main { padding: 0; }
body.zhen-admin .top { padding: 20px 24px; min-height: 88px; margin: 0; border-bottom: 1px solid var(--zhen-border); background: var(--zhen-surface); }
body.zhen-admin .main > .flash { margin: 16px 24px 0; }
body.zhen-admin .nav { display: block; }
body.zhen-admin .stat { font-size: var(--zhen-text-2xl); }
body.zhen-admin .brand { font-size: var(--zhen-text-lg); }
body.zhen-admin .content > .card + .card { margin-top: 16px; }
body.zhen-admin .card > form > :is(label, input, textarea) { margin-bottom: 8px; }

/* Checklist pages use the same tokens, including their legacy ec-* components. */
body.zhen-ui.zhen-checklists,
body.zhen-ui.zhen-checklists :is(.sp-shell, .ck-shell, .tpl-shell) {
    --ec-bg: var(--zhen-bg);
    --ec-panel: var(--zhen-surface);
    --ec-panel2: var(--zhen-surface-soft);
    --ec-line: var(--zhen-border);
    --ec-text: var(--zhen-text);
    --ec-muted: var(--zhen-muted);
    --ec-cyan: var(--zhen-accent);
    --ec-blue: var(--zhen-blue);
    --ec-red: var(--zhen-danger);
    --ec-shadow: var(--zhen-shadow);
    font-family: var(--zhen-font);
}
body.zhen-ui.zhen-checklists .ec-content { max-width: none; padding: 0; }
body.zhen-ui.zhen-checklists .sp-header .brand strong { font-size: var(--zhen-text-xl); }
body.zhen-ui.zhen-checklists .container > .flash { margin-left: var(--zhen-sidebar); margin-right: var(--zhen-page-padding); }
body.zhen-ui.zhen-checklists.workspace-sidebar-hidden .container > .flash { margin-left: 72px; }
body.zhen-ui.zhen-checklists .ck-main .hero { display: block; }
body.zhen-ui.zhen-checklists .ck-main .stats { min-width: 0; }
body.zhen-ui.zhen-checklists .ck-grid > * { min-width: 0; }
body.zhen-ui.zhen-checklists :is(.ec-form, .tpl-form, .form) > label { min-width: 0; }
body.zhen-ui.zhen-checklists :is(.ec-hero h2, .tpl-hero h1, .ck-main .hero h2) {
    font-size: var(--zhen-text-2xl) !important;
    line-height: 1.2;
}
body.zhen-ui.zhen-checklists :is(.ec-panel h3, .ec-card-head h3, .tpl-panel h2, .tpl-card h3, .tpl-library-head h2, .section-head h3, .side-panel h3, #itemEditModal h3) {
    font-size: var(--zhen-text-lg) !important;
    color: var(--zhen-text) !important;
}
body.zhen-ui.zhen-checklists :is(.ec-hero p, .ec-note, .tpl-hero p, .tpl-panel p, .tpl-card p, .tpl-card-items div, .tpl-empty, .item-title, .item-desc, .comment p, .comment b, .list-small div, .ck-main .muted) {
    font-size: var(--zhen-text-sm);
    line-height: 1.6;
}
body.zhen-ui.zhen-checklists :is(.ec-note, .ec-meta, .ec-foot, .ec-stat span, .tpl-hero p, .tpl-panel p, .tpl-card p, .tpl-card-items small, .tpl-empty, .item-desc, .item-meta, .comment small, .stat small, .muted) {
    color: var(--zhen-muted) !important;
}
body.zhen-ui.zhen-checklists :is(.tpl-eyebrow, .eyebrow) { color: var(--zhen-accent); }
body.zhen-ui.zhen-checklists :is(.ec-stat b, .ck-main .stat b) { font-size: var(--zhen-text-2xl); line-height: 1.2; color: var(--zhen-text) !important; }
body.zhen-ui.zhen-checklists :is(.sp-shell, .ck-shell) :is(.ec-stat, .ec-panel, .ec-card, .tpl-panel, .tpl-card, .panel, .stat, .cat-box, .item) {
    background: var(--zhen-surface) !important;
    color: var(--zhen-text) !important;
    border: 1px solid var(--zhen-border) !important;
    border-radius: var(--zhen-radius);
    box-shadow: var(--zhen-shadow) !important;
}
body.zhen-ui.zhen-checklists :is(.ec-stat, .ec-panel, .ec-card) { padding: 20px; }
body.zhen-ui.zhen-checklists :is(.ec-create, .ec-stats, .ec-list, .tpl-grid, .tpl-list, .ck-grid, .category-grid) { gap: var(--zhen-gap); }
body.zhen-ui.zhen-checklists :is(.ec-form, .tpl-form, .form) { gap: 16px; }
body.zhen-ui.zhen-checklists :is(.ec-form, .tpl-form, .tpl-item, .form) :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea),
body.zhen-ui.zhen-checklists :is(#eventSearch, #eventFilter) {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    min-height: var(--zhen-control-height) !important;
    padding: 10px 12px;
    border: 1px solid var(--zhen-border) !important;
    border-radius: var(--zhen-control-radius);
    background: var(--zhen-bg) !important;
    color: var(--zhen-text) !important;
    font-family: var(--zhen-font);
    font-size: var(--zhen-text-sm) !important;
    line-height: 1.5;
    color-scheme: inherit;
}
body.zhen-ui.zhen-checklists :is(.ec-form, .tpl-form, .form) label { font-size: var(--zhen-text-xs); color: var(--zhen-muted); }
body.zhen-ui.zhen-checklists :is(.ec-form, .tpl-form, .form) textarea { min-height: 96px !important; }
body.zhen-ui.zhen-checklists :is(.ec-btn, .tpl-btn, .btn) { min-height: var(--zhen-control-height); }
body.zhen-ui.zhen-checklists #categoryPreview { height: auto !important; min-height: var(--zhen-control-height); background: var(--zhen-surface-soft) !important; color: var(--zhen-muted) !important; border-color: var(--zhen-border) !important; }
body.zhen-ui.zhen-checklists .tpl-card-items div { background: var(--zhen-surface-soft) !important; color: var(--zhen-text); }
body.zhen-ui.zhen-checklists :is(.cat-bar, .ec-progress) { background: var(--zhen-border); }
body.zhen-ui.zhen-checklists .ring::after { background: var(--zhen-surface); }
body.zhen-ui.zhen-checklists .ring b { font-size: var(--zhen-text-xl); color: var(--zhen-text); }
body.zhen-ui.zhen-checklists :is(.hero-row, .readiness, .section-head, .ec-panel-head, .tpl-library-head) { flex-wrap: wrap; gap: 16px; }
body.zhen-ui.zhen-checklists .ck-main .stats { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 12px; }
body.zhen-ui.zhen-checklists #itemEditModal > .panel { max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--zhen-surface) !important; color: var(--zhen-text); }
@media (max-width: 1000px) {
    body.zhen-ui.zhen-checklists .ec-create { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 650px) {
    body.zhen-ui.zhen-checklists .container > .flash,
    body.zhen-ui.zhen-checklists.workspace-sidebar-hidden .container > .flash { margin-left: var(--zhen-page-padding); }
    body.zhen-ui.zhen-checklists :is(.ec-hero h2, .tpl-hero h1, .ck-main .hero h2) { font-size: var(--zhen-text-xl) !important; }
    body.zhen-ui.zhen-checklists :is(.ec-form, .ec-stats, .ec-list, .tpl-form, .form) { grid-template-columns: minmax(0, 1fr); }
    body.zhen-ui.zhen-checklists .ec-hero { align-items: flex-start; flex-direction: column; }
    body.zhen-ui.zhen-checklists :is(#eventSearch, #eventFilter) { width: 100% !important; }
}

/* Authentication uses the same two-column card in all three modules. */
body.zhen-auth { min-height: 100dvh; padding: 32px 24px !important; display: grid; place-items: center; overflow-y: auto; overflow-x: clip; }
body.zhen-auth .container { padding: 0 !important; width: 100%; }
body.zhen-auth :is(.auth-shell, .scene) { width: 100%; min-height: 0; padding: 0; background: none; overflow: clip; }
body.zhen-auth :is(.auth, .auth-frame, .login-card) {
    width: min(1080px, 100%);
    min-height: 620px;
    margin: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--zhen-border);
    border-radius: 20px;
    background: var(--zhen-surface);
    box-shadow: var(--zhen-shadow);
    overflow: hidden;
}
body.zhen-auth :is(.auth-panel, .form-wrap, .login-card > .panel) { padding: 40px; min-height: 0; order: 2; background: var(--zhen-surface); }
body.zhen-auth :is(.auth-visual, .visual) { padding: 40px; min-height: 0; order: 1; background: var(--zhen-surface-soft); border: 0; }
body.zhen-auth :is(.auth-panel-inner, .panel-inner, .form-wrap > .card) { width: 100%; max-width: 400px; padding: 0; margin: auto; border: 0; border-radius: 0; background: none; box-shadow: none; }
body.zhen-auth :is(.auth-copy h1, .visual h1) { font-size: clamp(32px, 3.2vw, 44px); line-height: 1.12; }
body.zhen-auth :is(.auth-panel h2, .card h2, .panel h2) { font-size: var(--zhen-text-xl); }
body.zhen-auth :is(.sub, .auth-sub, .auth-copy p, .visual p) { font-size: var(--zhen-text-sm); line-height: 1.7; color: var(--zhen-muted); }
body.zhen-auth :is(.auth-meta, .security, .security-note, .back, .link, .error, .form-row) { font-size: var(--zhen-text-xs); }
body.zhen-auth .field { margin-bottom: 16px; }
body.zhen-auth :is(.auth-submit, .submit, button.primary) { width: 100%; }
body.zhen-auth :is(.orbit, .scene > .grid) { pointer-events: none; }

body.zhen-landing header { min-height: 88px; background: var(--zhen-surface); border-color: var(--zhen-border); }
body.zhen-landing :is(.copy, .card) { background: var(--zhen-surface); border-color: var(--zhen-border); border-radius: var(--zhen-radius); box-shadow: var(--zhen-shadow); }
body.zhen-landing .hero { width: min(1080px, 100%); gap: 24px; }
body.zhen-landing :is(.card-label, .feature span, footer) { font-size: var(--zhen-text-xs); color: var(--zhen-muted); }
body.zhen-landing .feature b { font-size: var(--zhen-text-sm); }

/* Public LinkHub keeps the saved font, background, colors, columns and button style. */
body.zhen-public { line-height: 1.5; }
body.zhen-public .link { min-height: var(--zhen-control-height); }
body.zhen-public-password .card { border-radius: var(--zhen-radius); padding: 32px; }
body.zhen-public-password :is(.field, .btn) { min-height: var(--zhen-control-height); font-size: var(--zhen-text-sm); border-radius: var(--zhen-control-radius); }
body.zhen-public-password :is(.sub, .error) { font-size: var(--zhen-text-sm); }

@media (max-width: 1000px) {
    body.zhen-workspace :is(.form-grid, .formgrid) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.zhen-workspace :is(.overview-grid, .ck-grid) { grid-template-columns: minmax(0, 1fr); }
    body.zhen-workspace :is(.top-right, .hub-top-right, .header-tools, .library-tools) { flex-wrap: wrap; max-width: 100%; }
    body.zhen-workspace .week-board { grid-template-columns: repeat(7, minmax(150px, 1fr)); overflow-x: auto; padding-bottom: 8px; }
}
@media (max-width: 820px) {
    body.zhen-auth { padding: 24px 16px !important; }
    body.zhen-auth :is(.auth, .auth-frame, .login-card) { grid-template-columns: minmax(0, 1fr); width: min(480px, 100%); min-height: 0; }
    body.zhen-auth :is(.auth-visual, .visual) { display: none; }
    body.zhen-auth :is(.auth-panel, .form-wrap, .login-card > .panel) { padding: 32px 24px; min-height: 0; }
    body.zhen-admin .shell { display: block; }
    body.zhen-admin .side { position: static; height: auto; min-height: 0; }
    body.zhen-admin .nav { display: flex; flex-wrap: wrap; gap: 8px; }
    body.zhen-admin .side .brand { margin-bottom: 12px; }
    body.zhen-admin .side-bottom { margin-top: 12px; }
}
@media (max-width: 650px) {
    :root { --zhen-page-padding: 16px; }
    body.zhen-workspace :is(.sp-main, .ec-main, .ck-main, .tpl-main, .hub-main) { margin-left: 0 !important; }
    body.zhen-workspace :is(.form-grid, .formgrid, .tpl-form, .row) { grid-template-columns: minmax(0, 1fr); }
    body.zhen-workspace :is(.form-grid, .formgrid) > :is(.wide, .wide2, .full) { grid-column: 1 / -1; }
    body.zhen-workspace :is(.topbar, .hub-topbar, .sp-header) { padding: 16px !important; }
    body.zhen-workspace :is(.hero h1, .ec-hero h1, .tpl-hero h1, .lh-hero-line h2, .section-title h2, .ck-main .hero h2) { font-size: var(--zhen-text-xl) !important; }
    body.zhen-workspace :is(.search, .hub-search, .library-search) { width: 100%; max-width: 100%; }
    body.zhen-workspace :is(.top-right, .hub-top-right, .header-tools, .library-tools) { width: 100%; }
    body.zhen-workspace .overall-card { flex-wrap: wrap; gap: 20px; }
    body.zhen-workspace .task-row { flex-wrap: wrap; }
    body.zhen-workspace .task-info { flex-basis: calc(100% - 48px); }
    body.zhen-admin .top { padding: 16px; flex-wrap: wrap; }
    body.zhen-landing :is(.copy, .card) { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    .zhen-ui *, .zhen-ui *::before, .zhen-ui *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media print {
    body.zhen-ui { --zhen-bg: #fff; --zhen-surface: #fff; --zhen-text: #111; --zhen-muted: #444; --zhen-border: #ccc; }
    body.zhen-workspace :is(.sidebar, .sp-sidebar, .hub-sidebar, .side, .workspace-sidebar-toggle) { display: none !important; }
    body.zhen-workspace :is(.sp-main, .ec-main, .ck-main, .tpl-main, .hub-main) { margin-left: 0 !important; }
}

/* Daily Tracker and Schedule Planner card palettes. */
body.zhen-workspace[data-sidebar-module="daily"] :is(.overall-card,.focus-card,.add-panel,.chart-card,.goal-card,.day-card,.task-row,.habit-summary>div),
body.zhen-workspace[data-sidebar-module="schedule"] .sp-shell :is(.card,.panel,.chart,.stats article,.hero,.schedule-card,.done-detail-card){
    --card-accent:#38bdf8;
    background:linear-gradient(125deg,color-mix(in srgb,var(--card-accent) 18%,var(--zhen-surface)),var(--zhen-surface))!important;
    border-color:color-mix(in srgb,var(--card-accent) 38%,var(--zhen-border))!important;
}
body.zhen-workspace[data-sidebar-module="daily"] :is(.chart-card,.goal-card,.day-card,.task-row):nth-child(3n+2),
body.zhen-workspace[data-sidebar-module="schedule"] .sp-shell :is(.card,.panel,.chart,.stats article,.schedule-card,.done-detail-card):nth-child(3n+2){--card-accent:#a78bfa}
body.zhen-workspace[data-sidebar-module="daily"] :is(.chart-card,.goal-card,.day-card,.task-row):nth-child(3n),
body.zhen-workspace[data-sidebar-module="schedule"] .sp-shell :is(.card,.panel,.chart,.stats article,.schedule-card,.done-detail-card):nth-child(3n){--card-accent:#2dd4bf}
body.zhen-workspace[data-sidebar-module="schedule"] .sp-header{position:fixed;inset:0 0 auto;z-index:40}
body.zhen-workspace[data-sidebar-module="schedule"] .sp-header ~ main{margin-top:var(--schedule-header-height,88px)}
