:root {
    --space-page-x: 24px;
    --space-page-y: 24px;
    --space-card: 16px;
    --space-field-gap: 12px;
    --space-section: 18px;
    --control-min-height: 40px;
    --nav-item-min-height: 44px;
    --font-page-title: 24px;
    --font-panel-title: 16px;
    --font-section-title: 15px;
    --font-body: 14px;
    --font-label: 14px;
    --font-hint: 12px;
    --font-nav: 14px;
    --font-tab: 13px;
    --color-text-primary: #172033;
    --color-text-secondary: #334155;
    --color-text-muted: #64748b;
    --color-text-label: #4b5563;
    --color-bg-page: #eef2f6;
    --color-bg-grid: rgba(203, 213, 225, 0.22);
    --color-bg-surface: #ffffff;
    --color-bg-subtle: #f8fafc;
    --color-bg-muted: #f1f5f9;
    --color-border: #dbe3ee;
    --color-border-input: #cbd5e1;
    --color-border-strong: #ccd5e1;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-link: #2563eb;
    --color-link-hover: #1d4ed8;
    --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    max-width: 100%;
    overflow-x: clip;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    font-size: var(--font-body);
    color: var(--color-text-primary);
    background:
        linear-gradient(90deg, var(--color-bg-grid) 1px, transparent 1px),
        linear-gradient(var(--color-bg-grid) 1px, transparent 1px),
        var(--color-bg-page);
    background-size: 32px 32px;
}

html {
    max-width: 100%;
    overflow-x: clip;
}

#app {
    max-width: 100%;
    overflow-x: clip;
}

body.modal-open {
    overflow: hidden;
}

button,
input,
select {
    font: inherit;
}

button {
    min-height: var(--control-min-height);
    padding: 0 16px;
    border: 0;
    border-radius: 6px;
    color: #ffffff;
    background: var(--color-primary);
    cursor: pointer;
    font-size: var(--font-body);
}

button:hover {
    background: var(--color-primary-hover);
}

button:disabled {
    cursor: not-allowed;
    background: #9ca3af;
}

button.secondary,
button.tab,
button.nav-item {
    color: #2b3a55;
    background: transparent;
}

button.secondary {
    border: 1px solid var(--color-border-strong);
    background: var(--color-bg-surface);
}

button.link-like,
.link-like {
    min-height: auto;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    color: #2563eb;
    cursor: pointer;
    font-size: inherit;
    font-weight: 600;
    line-height: inherit;
    text-decoration: none;
    box-shadow: none;
}

button.link-like:hover,
.link-like:hover {
    background: none;
    color: #1d4ed8;
    text-decoration: underline;
}

button.link-like:focus-visible,
.link-like:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
    background: none;
}

button.link-like:active,
.link-like:active {
    background: none;
    color: #1e40af;
}

input:not([type="checkbox"]):not([type="radio"]),
select {
    width: 100%;
    min-height: var(--control-min-height);
    padding: 8px 10px;
    border: 1px solid var(--color-border-input);
    border-radius: 6px;
    background: var(--color-bg-surface);
    font-size: var(--font-body);
    color: var(--color-text-primary);
}

input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    accent-color: var(--color-primary);
}

label {
    display: grid;
    gap: 6px;
    color: var(--color-text-label);
    font-size: var(--font-label);
}

.check-label {
    display: flex;
    gap: 8px;
    align-items: center;
    min-height: auto;
    margin: 0;
    font-size: var(--font-body);
    color: var(--color-text-secondary);
}

.check-label input[type="checkbox"],
.check-label input[type="radio"] {
    width: 16px;
    height: 16px;
    min-height: 16px;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.media-frame {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8fafc;
}

.media-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-frame img.image-load-failed {
    display: none;
}

.media-frame .media-fallback {
    display: none;
    padding: 8px;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.media-frame.is-empty .media-fallback,
.media-frame.has-error .media-fallback,
.media-frame.is-error .media-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.topbar-main {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.mobile-my-menu-toggle,
.mobile-bottom-nav,
.mobile-workspace-steps,
.mobile-my-sheet {
    display: none;
}

.mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 220;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid #dbe3ee;
    backdrop-filter: blur(10px);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.mobile-bottom-nav.has-admin {
    /* 工作台 / 社区 / 项目 / 颜色库 / 管理 / 我的 —— 六项单行 */
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    padding-left: 4px;
    padding-right: 4px;
}

.mobile-bottom-nav.has-admin .mobile-bottom-label {
    font-size: 10px;
}

.mobile-bottom-nav.has-admin .mobile-bottom-item {
    min-width: 0;
    padding: 4px 0;
}

.mobile-bottom-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 52px;
    padding: 4px 2px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #334155;
    font-size: 12px;
    line-height: 1.2;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    line-height: 0;
    flex-shrink: 0;
}

.mobile-bottom-icon svg {
    width: 22px;
    height: 22px;
}

.mobile-bottom-label {
    font-size: 11px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.mobile-bottom-item.active {
    color: #2563eb;
    background: #eff6ff;
}

.mobile-bottom-admin:not(.hidden) {
    color: #7c3aed;
}

.mobile-bottom-admin.active {
    color: #6d28d9;
    background: #f5f3ff;
}

.mobile-workspace-steps {
    gap: 8px;
    margin: 8px 0 12px;
}

.mobile-step-tab {
    min-height: 42px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    font-size: 13px;
}

.mobile-step-tab.active {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
}

.mobile-my-sheet {
    position: fixed;
    inset: 0;
    z-index: 320;
}

.mobile-my-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.mobile-my-sheet-card {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    display: grid;
    gap: 10px;
    max-height: min(72vh, 520px);
    padding: 14px;
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    background: #fff;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-my-sheet-groups {
    display: grid;
    gap: 8px;
}

.mobile-my-sheet-group-label {
    margin: 4px 0 0;
    padding: 0 2px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mobile-my-sheet-group-label:first-child {
    margin-top: 0;
}

.mobile-my-sheet-head {
    display: grid;
    gap: 4px;
    padding-bottom: 10px;
    border-bottom: 1px solid #edf1f7;
}

.mobile-my-sheet-head strong {
    font-size: 16px;
    color: #0f172a;
}

.mobile-my-sheet-role {
    font-size: 13px;
    color: #64748b;
}

.mobile-my-action {
    min-height: 46px;
}

.mobile-my-action-danger {
    color: #b91c1c;
}

.auth-screen {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 580px) minmax(420px, 480px);
    gap: 52px;
    align-items: center;
    width: min(1160px, calc(100% - 96px));
    margin: 0 auto;
    padding: 56px 0;
}

.auth-brand {
    position: relative;
    min-height: 520px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    padding: 54px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background:
        linear-gradient(rgba(248, 250, 252, 0.88), rgba(248, 250, 252, 0.88)),
        linear-gradient(90deg, rgba(148, 163, 184, 0.16) 1px, transparent 1px),
        linear-gradient(rgba(148, 163, 184, 0.16) 1px, transparent 1px);
    background-size: auto, 24px 24px, 24px 24px;
    text-align: left;
}

.auth-brand h1 {
    margin: 0 0 14px;
    max-width: 560px;
    font-size: 42px;
    line-height: 1.15;
}

.auth-brand p {
    max-width: 520px;
    color: #4b5563;
    line-height: 1.7;
}

.auth-brand .status {
    display: inline-flex;
    margin-top: 18px;
}

.auth-brand::after {
    content: "";
    width: 240px;
    height: 168px;
    margin-top: 34px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background:
        radial-gradient(circle at 12px 12px, #2563eb 0 7px, transparent 8px),
        radial-gradient(circle at 36px 12px, #f97316 0 7px, transparent 8px),
        radial-gradient(circle at 60px 12px, #16a34a 0 7px, transparent 8px),
        radial-gradient(circle at 84px 12px, #facc15 0 7px, transparent 8px),
        radial-gradient(circle at 108px 12px, #ef4444 0 7px, transparent 8px),
        radial-gradient(circle at 132px 12px, #ffffff 0 7px, transparent 8px),
        radial-gradient(circle at 12px 36px, #ffffff 0 7px, transparent 8px),
        radial-gradient(circle at 36px 36px, #0f172a 0 7px, transparent 8px),
        radial-gradient(circle at 60px 36px, #2563eb 0 7px, transparent 8px),
        radial-gradient(circle at 84px 36px, #facc15 0 7px, transparent 8px),
        radial-gradient(circle at 108px 36px, #16a34a 0 7px, transparent 8px),
        radial-gradient(circle at 132px 36px, #ef4444 0 7px, transparent 8px),
        repeating-linear-gradient(90deg, #f8fafc 0 23px, #e2e8f0 23px 24px),
        repeating-linear-gradient(0deg, transparent 0 23px, #e2e8f0 23px 24px);
    background-color: #ffffff;
    background-size: 144px 48px, 144px 48px, 144px 48px, 144px 48px, 144px 48px, 144px 48px, 144px 48px, 144px 48px, 144px 48px, 144px 48px, 144px 48px, 144px 48px, 24px 24px, 24px 24px;
    background-repeat: repeat;
    box-shadow: 0 14px 30px rgba(20, 31, 52, 0.10);
}

.eyebrow {
    margin: 0 0 10px;
    color: #64748b;
    font-size: 13px;
    text-transform: uppercase;
}

.auth-card,
.panel {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-surface);
}

.auth-card {
    width: 100%;
    min-height: 360px;
    padding: 38px;
    align-self: center;
    box-shadow: 0 18px 42px rgba(20, 31, 52, 0.10);
}

.auth-panel-title {
    margin: 0 0 18px;
    font-size: 22px;
    line-height: 1.2;
    color: #0f172a;
}

.auth-wizard-head {
    margin-bottom: 4px;
}

.auth-wizard-head .auth-panel-title {
    margin-bottom: 6px;
}

.auth-panel-subtitle {
    margin: 0 0 20px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

.auth-form-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-top: 4px;
}

.auth-register-hint {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.auth-field-block {
    display: grid;
    gap: 6px;
    color: #4b5563;
    font-size: 14px;
}

.captcha-field {
    display: grid;
    gap: 6px;
    color: #4b5563;
    font-size: 14px;
}

.captcha-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.captcha-input-wrap input {
    flex: 1;
    min-width: 0;
}

.captcha-image {
    width: 132px;
    height: 44px;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f1f5f9;
    cursor: pointer;
    object-fit: cover;
}

.captcha-image:hover {
    border-color: #94a3b8;
}

@media (max-width: 420px) {
    .captcha-image {
        width: 108px;
        height: 40px;
    }
}

.auth-primary-btn,
button.auth-primary-btn {
    width: 100%;
    min-height: 44px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #ffffff;
    font-weight: 600;
}

.auth-primary-btn:hover:not(:disabled),
button.auth-primary-btn:hover:not(:disabled) {
    background: #1d4ed8;
}

.auth-primary-btn-inline {
    width: auto;
}

.auth-wizard-steps {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 18px;
}

.auth-wizard-step {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 13px;
    white-space: nowrap;
}

.auth-wizard-step.is-active,
.auth-wizard-step.is-complete {
    color: #1d4ed8;
}

.auth-wizard-step-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 12px;
    font-weight: 600;
}

.auth-wizard-step.is-active .auth-wizard-step-dot,
.auth-wizard-step.is-complete .auth-wizard-step-dot {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
}

.auth-wizard-step-track {
    flex: 1;
    min-width: 24px;
    height: 2px;
    border-radius: 1px;
    background: #e2e8f0;
}

.auth-wizard-step-track-fill {
    display: block;
    width: 50%;
    height: 100%;
    border-radius: 1px;
    background: #2563eb;
}

.auth-step-card {
    display: grid;
    gap: 14px;
}

.auth-step-hint {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.auth-field-label {
    margin: 0;
    color: #334155;
    font-size: 14px;
    font-weight: 600;
}

.register-security-section {
    display: grid;
    gap: 12px;
}

.register-security-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.register-security-card {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.register-security-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.register-security-card-inner {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #ffffff;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.register-security-card input:checked + .register-security-card-inner {
    border-color: #93c5fd;
    background: #eff6ff;
}

.register-security-card-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #f8fafc;
}

.register-security-card-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #64748b;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.register-security-card-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.register-security-card-text strong {
    font-size: 13px;
    color: #0f172a;
}

.register-security-card-text small {
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
}

.register-security-detail {
    display: grid;
    gap: 12px;
}

.auth-btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.auth-switch-row {
    margin: 16px 0 0;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

.auth-switch-row .link-like {
    font-weight: 600;
}

.register-panel-head {
    margin-bottom: 4px;
}

.register-back-btn {
    padding: 0;
    min-height: auto;
    margin-bottom: 8px;
    font-size: 13px;
}

.register-step-indicator {
    margin: -10px 0 16px;
    color: #94a3b8;
    font-size: 13px;
}

.register-step-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.auth-register-benefits {
    margin: 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #edf1f7;
    color: #475569;
    font-size: 13px;
    line-height: 1.55;
}

.register-security-mode {
    margin: 0;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    display: grid;
    gap: 10px;
}

.register-security-mode legend {
    padding: 0 4px;
    color: #334155;
    font-size: 14px;
    font-weight: 600;
}

.register-mode-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #475569;
    font-size: 14px;
    cursor: pointer;
}

.register-mode-option input {
    width: auto;
    min-height: auto;
    margin: 0;
}

.register-security-field {
    margin: 0 0 0 24px;
}

.auth-card input:focus,
.auth-card select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.tab.active,
.nav-item.active {
    color: #ffffff;
    background: #2563eb;
}

.form {
    display: grid;
    gap: 18px;
}

.auth-card input {
    min-height: 42px;
}

.auth-card button[type="submit"] {
    min-height: 44px;
}

.form-register {
    gap: 14px;
}

.register-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.register-step-actions {
    margin: -4px 0 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #edf1f7;
    color: #475569;
    font-size: 13px;
    line-height: 1.55;
}

.password-field-label {
    display: grid;
    gap: 8px;
}

.password-input-wrap {
    position: relative;
    display: block;
}

.password-input-wrap input {
    width: 100%;
    padding-right: 42px;
}

/* 隐藏浏览器自带密码显示按钮，避免与自定义眼睛图标重复 */
.password-input-wrap input::-ms-reveal,
.password-input-wrap input::-ms-clear {
    display: none;
}

.password-eye-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.password-eye-btn:hover {
    color: #2563eb;
    background: #f1f5f9;
}

.password-eye-btn .eye-icon {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.password-eye-btn .eye-icon.hidden {
    display: none;
}

.forgot-security-question {
    margin: 8px 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.92rem;
}

.password-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.password-toggle-btn {
    min-height: 42px;
    min-width: 64px;
    padding: 0 12px;
    white-space: nowrap;
}

.auth-legal-check {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.auth-legal-check input[type="checkbox"] {
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 2px 0 0;
    padding: 0;
    flex-shrink: 0;
}

.auth-legal-check > span {
    flex: 1;
    min-width: 0;
}

.auth-legal-check a {
    color: #2563eb;
    text-decoration: none;
}

.auth-legal-check a:hover {
    text-decoration: underline;
}

.auth-legal-dialog {
    width: min(480px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 0;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
}

.auth-legal-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
}

.auth-legal-dialog-body {
    display: grid;
    gap: 12px;
    padding: 22px;
}

.auth-legal-dialog-body h3 {
    margin: 0;
    font-size: 18px;
}

.auth-legal-dialog-body p {
    margin: 0;
    color: #475569;
    font-size: 14px;
    line-height: 1.6;
}

.auth-legal-dialog-close {
    justify-self: start;
    margin-top: 4px;
}

.message,
.hint {
    min-height: 22px;
    margin-top: 12px;
    color: #64748b;
    font-size: 14px;
}

.message.error {
    color: #b91c1c;
}

.message.ok {
    color: #15803d;
}

.status {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    color: #166534;
    background: #dcfce7;
    font-size: 14px;
}

.status.error {
    color: #991b1b;
    background: #fee2e2;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 22px;
    border-right: 1px solid #dbe3ee;
    background: #ffffff;
}

.sidebar-brand {
    display: grid;
    gap: 8px;
    padding-bottom: 18px;
    border-bottom: 1px solid #edf1f7;
}

.sidebar-brand strong {
    font-size: 20px;
}

.sidebar-brand span {
    color: #64748b;
    font-size: 13px;
    word-break: break-word;
}

.nav-menu {
    display: grid;
    gap: 8px;
}

.nav-item {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
    min-height: var(--nav-item-min-height);
    font-size: var(--font-nav);
}

.sidebar .secondary {
    margin-top: auto;
}

.content {
    min-width: 0;
    padding: var(--space-page-y) var(--space-page-x);
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: var(--space-section);
    align-items: center;
    margin-bottom: var(--space-section);
}

.topbar h2 {
    margin: 0;
    font-size: var(--font-page-title);
    color: var(--color-text-primary);
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.section-grid {
    display: grid;
    gap: 18px;
}

.workspace-layout {
    grid-template-columns: minmax(300px, 36%) minmax(0, 64%);
    align-items: stretch;
    gap: 14px;
}

.workspace-intro {
    grid-column: 1 / -1;
    margin-bottom: 10px;
}

.workspace-intro-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 12px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #f8fafc;
}

.workspace-intro-current {
    flex: 0 0 auto;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.workspace-intro-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.workspace-flow-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.workspace-flow-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px 4px 6px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #94a3b8;
    font-size: 12.5px;
    line-height: 1;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.workspace-flow-chip em {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    font-style: normal;
    font-size: 11px;
    font-weight: 600;
}

.workspace-flow-chip.is-active {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}

.workspace-flow-chip.is-active em {
    background: #2563eb;
    color: #ffffff;
}

.workspace-flow-status-inline {
    flex: 1 1 180px;
    min-width: 0;
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
}

.workspace-blank-entry {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
    padding: 14px 16px;
    border: 1px solid #c7d7f5;
    border-radius: 10px;
    background: linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
}

.workspace-blank-entry-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.workspace-blank-entry-copy strong {
    color: #1e3a8a;
    font-size: 15px;
}

.workspace-blank-entry-copy .hint {
    margin: 0;
}

.workspace-blank-entry > button {
    flex-shrink: 0;
}

.blank-project-dialog {
    width: min(520px, calc(100vw - 32px));
}

.blank-project-size-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.blank-project-form .setting-field-hint {
    margin: 0;
}

#blankFillColorWrap select {
    width: 100%;
}

.project-card-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 11px;
    font-weight: 700;
}

.project-card-badge.is-image {
    background: #e2e8f0;
    color: #475569;
}

.project-card-badge.is-community {
    background: #ede9fe;
    color: #6d28d9;
}

.workspace-flow-status,
.generate-flow-status {
    margin: 0;
    color: #475569;
    font-size: 14px;
    line-height: 1.6;
}

.generate-flow-status {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e40af;
}

.flow-step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 999px;
    background: #2563eb;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
}

.pattern-actions {
    display: grid;
    gap: 8px;
    justify-items: start;
}

.pattern-action-message {
    width: 100%;
    margin: 0;
}

.pattern-action-message.error {
    padding: 8px 10px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
}

.pattern-post-save-actions {
    padding: 14px;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    background: #f0fdf4;
}

.pattern-post-save-title {
    margin: 0 0 10px;
    color: #166534;
    font-size: 14px;
    font-weight: 600;
}

.pattern-post-save-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.workspace-upload-panel,
.workspace-generate-panel {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.workspace-upload-panel .upload-form-compact {
    grid-template-columns: 1fr;
    gap: 6px;
}

.workspace-upload-panel .upload-form-compact button {
    width: 100%;
    min-height: 36px;
}

.workspace-upload-panel .upload-form-compact .file-name {
    min-height: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workspace-upload-panel .upload-drop-zone {
    padding: 10px;
}

.workspace-upload-panel .upload-hint {
    margin: 4px 0 0;
    text-align: center;
    font-size: 11px;
}

.upload-sample-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e2e8f0;
}

.upload-sample-btn {
    min-height: 32px;
    padding: 4px 12px;
    font-size: 12px;
}

.upload-sample-hint {
    margin: 0;
    font-size: 12px;
    color: #64748b;
}

.workspace-upload-panel .upload-sample-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
}

.workspace-upload-panel .upload-sample-btn {
    width: 100%;
    min-height: 34px;
}

.workspace-upload-panel .upload-sample-hint {
    text-align: center;
    font-size: 11px;
}

.workspace-upload-panel .upload-message:empty {
    display: none;
    min-height: 0;
    margin: 0;
}

.workspace-upload-panel .upload-message:not(:empty) {
    margin-top: 6px;
    min-height: 0;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.workspace-upload-panel .upload-message.ok {
    background: #f0fdf4;
}

.workspace-upload-panel .upload-message.error {
    background: #fef2f2;
}

.workspace-upload-panel .compact-head {
    margin-top: 0;
    margin-bottom: 0;
    align-items: flex-start;
}

.workspace-upload-panel .compact-head h3 {
    margin: 0;
    padding-top: 2px;
}

.workspace-upload-panel .compact-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.workspace-upload-panel .compact-toolbar button {
    white-space: nowrap;
    min-height: 32px;
    padding: 5px 10px;
    font-size: 13px;
}

.workspace-library-section {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    margin-top: 0;
    padding-top: 10px;
    border-top: 1px solid #edf1f7;
    container-type: inline-size;
    container-name: workspace-library;
}

.workspace-library-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.workspace-library-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}

.workspace-library-title h3 {
    margin: 0;
    white-space: nowrap;
}

.workspace-library-count {
    color: #64748b;
    font-size: 12px;
}

.workspace-library-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-start;
    width: 100%;
}

.workspace-library-actions button {
    flex: 1 1 0;
    min-width: 0;
    white-space: nowrap;
}

.workspace-library-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.workspace-library-filters input,
.workspace-library-filters select {
    min-height: 32px;
    padding: 5px 8px;
    font-size: 13px;
}

@container workspace-library (max-width: 420px) {
    .workspace-library-filters {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .workspace-library-filters input {
        width: 100%;
        min-height: 38px;
        font-size: 14px;
    }

    .workspace-library-filter-toolbar {
        width: 100%;
        justify-content: stretch;
        flex-wrap: nowrap;
        gap: 6px;
    }

    .workspace-library-filter-toolbar select {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
    }

    .workspace-library-filter-toggle,
    button.workspace-library-filter-toggle {
        flex: 0 1 auto;
        min-width: 0;
    }
}

.workspace-library-filter-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.workspace-library-filter-toolbar select {
    width: auto;
    min-width: 108px;
    max-width: 140px;
}

.workspace-library-filter-toggle,
button.workspace-library-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid #dbe3ee;
    border-radius: 6px;
    background: #ffffff;
    color: #475569;
    font-size: 12px;
    white-space: nowrap;
}

.workspace-library-filter-toggle:hover:not(:disabled),
button.workspace-library-filter-toggle:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

.workspace-library-filter-toggle[aria-pressed="true"],
button.workspace-library-filter-toggle[aria-pressed="true"] {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

.workspace-library-filter-toggle:disabled,
button.workspace-library-filter-toggle:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: #f8fafc;
}

.workspace-library-filter-toggle-check {
    width: 14px;
    height: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #ffffff;
    flex-shrink: 0;
}

.workspace-library-filter-toggle[aria-pressed="true"] .workspace-library-filter-toggle-check {
    border-color: #2563eb;
    background: #2563eb;
    box-shadow: inset 0 0 0 2px #ffffff;
}

.workspace-library-selected-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #2563eb;
    color: #ffffff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

.workspace-library-selected-only {
    min-height: 32px;
    padding: 0 8px;
    border: 1px solid #dbe3ee;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-size: 12px;
    white-space: nowrap;
}

.workspace-library-filter-hint {
    margin: 0;
}

.workspace-library-empty {
    grid-column: 1 / -1;
    padding: 16px 10px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}

.workspace-file-scroll {
    min-height: 160px;
    max-height: min(520px, 62vh);
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #fbfdff;
}

.workspace-file-scroll .file-library {
    margin-top: 0;
}

@media (min-width: 901px) {
    .workspace-upload-panel {
        height: 100%;
    }

    .workspace-library-section {
        flex: 1 1 auto;
    }

    .workspace-upload-panel .workspace-file-scroll {
        flex: 1 1 auto;
        min-height: 240px;
        max-height: none;
    }
}

.workspace-generate-panel .settings-section {
    margin-bottom: 0;
}

.panel.workspace-generate-panel,
.panel.workspace-upload-panel {
    padding: 16px;
}

.panel.workspace-generate-panel > h3,
.panel.workspace-upload-panel > h3 {
    margin-bottom: 10px;
}

.workspace-generate-panel .settings-grid {
    gap: 8px;
    margin-bottom: 8px;
}

.workspace-generate-panel .settings-section-title {
    margin: 8px 0 4px;
}

.workspace-generate-panel label {
    gap: 4px;
    font-size: 13px;
}

.workspace-generate-panel input,
.workspace-generate-panel select {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 13px;
}

.workspace-generate-panel .settings-inline-hint {
    margin: -4px 0 8px;
}

.workspace-generate-panel .pattern-actions {
    gap: 6px;
    margin-top: 8px;
}

.workspace-generate-panel .pattern-actions button:first-child {
    min-height: 36px;
}

.workspace-generate-panel .settings-project {
    grid-template-columns: 1fr;
}

.workspace-generate-panel .settings-size {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workspace-generate-panel .settings-palette {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-section-title {
    margin: 14px 0 8px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

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

.settings-section-title-inset {
    margin: 0 0 10px;
    text-transform: none;
    letter-spacing: normal;
    font-size: 13px;
    color: #475569;
}

.workspace-generate-panel .pattern-result canvas {
    max-height: min(700px, 72vh);
}

.panel {
    padding: 20px;
}

.panel h3 {
    margin: 0 0 16px;
}

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

.panel-head-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.admin-create-user-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--border, #d7dde5);
    background: var(--panel-soft, rgba(0, 0, 0, 0.02));
}

.admin-create-user-form label {
    display: grid;
    gap: 6px;
    font-size: 13px;
}

.admin-create-user-actions {
    display: flex;
    gap: 8px;
    align-items: end;
}

.admin-table-input {
    width: 100%;
    min-width: 0;
    margin-top: 4px;
}

.toolbar,
.upload-form {
    display: grid;
    gap: 12px;
    align-items: center;
}

.toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
}

.upload-form {
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.file-input {
    display: none;
}

.file-name {
    min-height: 38px;
    display: block;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #475569;
    overflow: hidden;
    line-height: 1.35;
    overflow-wrap: anywhere;
    white-space: normal;
}

.compact-head {
    margin-top: 18px;
}

.compact-toolbar {
    grid-template-columns: repeat(3, auto);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.bead-size-inline {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: -4px 0 14px;
    color: #64748b;
    font-size: 13px;
}

.bead-size-inline label {
    display: block;
    flex: 0 0 auto;
    color: inherit;
    font-size: inherit;
}

.bead-size-select {
    width: auto;
    min-width: 148px;
    min-height: 32px;
    padding: 5px 28px 5px 10px;
    border-radius: 6px;
    font-size: 13px;
}

.upload-result {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    margin-top: 16px;
    padding: 12px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
}

.upload-result img {
    width: 132px;
    height: 100px;
    object-fit: cover;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #ffffff;
}

#uploadInfo {
    display: grid;
    gap: 5px;
    min-width: 0;
}

#uploadInfo strong {
    overflow: hidden;
    color: #0f172a;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#uploadInfo span {
    color: #475569;
    font-size: 13px;
}

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

.file-card {
    position: relative;
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.file-card:hover {
    border-color: #93c5fd;
}

.file-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    min-height: 22px;
}

.file-current-badge {
    flex-shrink: 0;
    display: none;
    align-items: center;
    width: fit-content;
    padding: 2px 8px;
    border: 1px solid #1d4ed8;
    border-radius: 999px;
    color: #ffffff;
    background: #2563eb;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.file-card.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

.file-card.active .file-current-badge {
    display: inline-flex;
}

.file-check {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    width: fit-content;
    min-height: auto;
    color: #334155;
    font-size: 12px;
    cursor: pointer;
}

.file-check input {
    width: auto;
    min-height: auto;
}

.file-card-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid #edf1f7;
    border-radius: 6px;
}

.file-card strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-card span:not(.file-current-badge) {
    color: #64748b;
    font-size: 12px;
}

.file-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.file-actions button {
    min-height: 30px;
    padding: 0 8px;
    font-size: 12px;
}

.admin-list {
    display: grid;
    gap: 10px;
}

.admin-shell {
    display: grid;
    gap: 14px;
}

.admin-tabs {
    display: grid;
    gap: 8px;
    padding: 8px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
}

.admin-tab-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.admin-tab-group-title {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    min-width: 64px;
}

.admin-tab {
    min-height: 34px;
    padding: 0 14px;
    color: #334155;
    border: 1px solid transparent;
    background: transparent;
}

.admin-tab.active {
    color: #ffffff;
    background: #2563eb;
}

.admin-panel {
    display: none;
}

.admin-panel.active {
    display: block;
}

.admin-filter-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px);
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #f8fafc;
}

.admin-filter-bar:has(> input:only-child) {
    grid-template-columns: minmax(220px, 1fr);
}

.admin-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
}

.admin-list-toolbar .admin-filter-bar {
    flex: 1 1 360px;
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(120px, 150px) minmax(110px, 130px);
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.admin-list-toolbar .admin-filter-bar:has(> input:only-child) {
    grid-template-columns: minmax(160px, 1fr);
}

.admin-list-toolbar .admin-filter-select {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 13px;
}

.admin-list-toolbar .admin-filter-keyword {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 13px;
}

.admin-bulk-bar {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.admin-bulk-check,
.admin-row-check {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    margin: 0;
    width: auto;
    color: #64748b;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.admin-bulk-check input[type="checkbox"],
.admin-row-check input[type="checkbox"] {
    width: 15px;
    height: 15px;
    min-width: 15px;
    min-height: 0;
    max-width: 15px;
    padding: 0;
    margin: 0;
    flex: 0 0 15px;
    accent-color: #2563eb;
    cursor: pointer;
}

.admin-bulk-count {
    min-width: 52px;
    color: #94a3b8;
    font-size: 12px;
    white-space: nowrap;
}

.admin-bulk-delete-btn {
    min-height: 32px;
    padding: 0 12px;
    font-size: 13px;
}

.admin-row-check-disabled {
    display: inline-block;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.admin-filter-keyword,
.admin-filter-select {
    width: 100%;
}

.admin-pager {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 8px 2px 0;
    color: #64748b;
    font-size: 13px;
}

.admin-pager > div {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-pager button {
    min-height: 32px;
    padding: 0 10px;
}

.admin-table-scroll {
    overflow-x: auto;
    margin-bottom: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

table.admin-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
    table-layout: fixed;
}

table.admin-table tr {
    display: table-row;
}

table.admin-table th,
table.admin-table td {
    display: table-cell;
}

.admin-table th,
.admin-table td {
    padding: 9px 10px;
    vertical-align: middle;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    overflow: hidden;
}

.admin-table th.admin-table-cell.check,
.admin-table td.admin-table-cell.check {
    text-align: center;
    padding-left: 8px;
    padding-right: 8px;
}

.admin-table th.admin-table-cell.actions,
.admin-table td.admin-table-cell.actions {
    text-align: right;
    padding-right: 12px;
}

.admin-table thead th {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

.admin-table tbody tr:hover {
    background: #f1f5f9;
}

.admin-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.admin-table tbody tr:nth-child(even):hover {
    background: #f1f5f9;
}

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

.admin-table tbody tr.is-inactive {
    background: #fafbfc;
}

.admin-table tbody tr.is-pending {
    background: transparent;
}

.admin-table-cell {
    min-width: 0;
    font-size: 13px;
    color: #475569;
    line-height: 1.4;
}

.admin-table-head .admin-table-cell span {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

.admin-table-cell.user,
.admin-table-cell.size,
.admin-table-cell.type,
.admin-table-cell.file,
.admin-table-cell.date,
.admin-table-cell.stats,
.admin-table-cell.role,
.admin-table-cell.perm {
    white-space: nowrap;
    text-overflow: ellipsis;
}

.admin-table-cell.status {
    white-space: nowrap;
    color: #64748b;
    background: transparent !important;
}

.admin-table-cell.status .admin-status-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-table-cell.main strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-table-cell.main span {
    display: block;
    margin-top: 1px;
    font-size: 12px;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-table-cell.token {
    white-space: nowrap;
}

.admin-table-token {
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: calc(100% - 36px);
    vertical-align: middle;
}

.admin-table-ellipsis {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-table-hint {
    color: #94a3b8;
    font-size: 12px;
    white-space: nowrap;
}

.admin-table-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
    max-width: 100%;
}

.admin-table-actions button {
    min-height: 32px;
    padding: 0 8px;
    font-size: 12px;
}

.admin-table-actions button:not(.secondary):not(.admin-danger-btn) {
    color: #2b3a55;
    background: #ffffff;
    border: 1px solid #ccd5e1;
}

.admin-table-actions button:not(.secondary):not(.admin-danger-btn):hover {
    background: #f8fafc;
}

.admin-table-select {
    width: 100%;
    min-height: 34px;
    padding: 4px 8px;
    font-size: 12px;
}

@media (max-width: 900px) and ((hover: none) or (pointer: coarse)), (max-width: 767px), ((max-height: 520px) and (max-width: 1100px) and ((hover: none) or (pointer: coarse))) {
    .admin-table-actions {
        gap: 6px;
    }

    .admin-table-actions button,
    .admin-table-select {
        min-height: 44px;
    }
}

.admin-table-thumb .admin-visual-thumb,
.admin-table-thumb .media-frame.admin-visual-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
}

.admin-table-empty {
    padding: 36px 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    border-bottom: 0;
}

.admin-row:not(tr) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
}

.admin-row > div {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.admin-row span {
    color: #64748b;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.admin-row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-meta-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.admin-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    color: #475569;
    background: #f1f5f9;
    font-size: 12px;
    line-height: 1.5;
}

.admin-pill.strong {
    color: #1d4ed8;
    background: #dbeafe;
}

.admin-config-value {
    width: 100%;
}

#adminActionMessage {
    min-height: 0;
    margin: 0;
}

.admin-detail {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
}

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

    .admin-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .admin-row-actions {
        justify-content: flex-start;
    }

    .admin-pager {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-config-toolbar-actions button {
        flex: 1 1 calc(50% - 4px);
    }

    .admin-config-layout {
        grid-template-columns: 1fr;
    }

    .admin-config-sidebar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .settings-quick-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-quick-actions button {
        width: 100%;
    }
}

.pattern-result {
    display: grid;
    gap: 14px;
    margin-top: 16px;
    min-width: 0;
    max-width: 100%;
}

.preview-toolbar {
    display: grid;
    grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 10px 12px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #f8fafc;
    min-width: 0;
    max-width: 100%;
}

.preview-toolbar-title {
    display: grid;
    gap: 2px;
    padding-top: 4px;
}

.preview-toolbar-title strong {
    color: #0f172a;
    font-size: 16px;
}

.preview-toolbar-title span {
    color: #64748b;
    font-size: 12px;
}

.preview-toolbar-main {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
}

.workspace-generate-panel .pattern-result {
    gap: 10px;
    margin-top: 10px;
}

.preview-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
    min-width: 0;
}

.preview-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.preview-actions button {
    min-height: 34px;
    border-radius: 8px;
    white-space: nowrap;
}

.preview-grid-step-label,
.editor-grid-step-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #475569;
    font-size: 13px;
}

.preview-grid-step-label select,
.editor-grid-step-label select {
    min-height: 32px;
    min-width: 92px;
    padding: 4px 28px 4px 10px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
}

.pattern-result canvas {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 520px;
    object-fit: contain;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
}

.pattern-preview-canvas-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

#patternSummary,
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #fbfdff;
    color: #334155;
}

.summary-metric {
    display: grid;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid #e8eef5;
    border-radius: 8px;
    background: #ffffff;
}

.summary-metric-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #94a3b8;
}

.summary-metric strong {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
}

.summary-metric.is-saved {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.summary-metric.is-saved strong {
    color: #166534;
}

.summary-metric.is-draft {
    border-color: #fde68a;
    background: #fffbeb;
}

.summary-metric.is-draft strong {
    color: #92400e;
}

#projectView.view.active {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 108px);
}

#projectView .project-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    align-content: start;
    width: 100%;
    min-width: 0;
}

#projectView .project-card {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 18px;
    gap: 10px;
    align-items: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

#projectView .project-card.project-recycle-card {
    grid-template-columns: 20px 48px minmax(0, 1fr);
    grid-template-areas:
        "check thumb body"
        "actions actions actions";
    align-items: start;
    cursor: default;
    padding: 10px;
}

#projectView .project-card.project-recycle-card .project-recycle-check {
    grid-area: check;
    min-height: 48px;
}

#projectView .project-card.project-recycle-card .project-card-thumb-wrap {
    grid-area: thumb;
}

#projectView .project-card.project-recycle-card .project-recycle-body {
    grid-area: body;
}

#projectView .project-card.project-recycle-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 14px rgba(20, 31, 52, 0.06);
    background: #fafbfd;
}

#projectView .project-recycle-body {
    gap: 5px;
    min-width: 0;
}

#projectView .project-card.project-recycle-card .project-recycle-actions {
    grid-area: actions;
    display: flex;
    flex-direction: row;
    gap: 6px;
    width: 100%;
    justify-content: stretch;
    padding-top: 0;
}

#projectView .project-card.project-recycle-card .project-recycle-actions button {
    flex: 1;
    min-width: 0;
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
    white-space: nowrap;
}

.project-view-tabs {
    display: flex;
    width: 100%;
    gap: 4px;
    margin-bottom: 14px;
    padding: 4px;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    box-sizing: border-box;
}

button.project-view-tab,
.project-view-tab {
    flex: 1;
    min-height: 36px;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

button.project-view-tab:hover:not(.active),
.project-view-tab:hover:not(.active) {
    background: #e8eef5;
    color: #1e293b;
}

button.project-view-tab.active,
.project-view-tab.active {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.28);
}

button.project-view-tab.active:hover,
.project-view-tab.active:hover {
    background: #1d4ed8;
    color: #fff;
}

#projectView .project-list-panel > #projectRecyclePanel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

#projectView .project-recycle-grid {
    gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(min(460px, 100%), 1fr));
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    scrollbar-width: thin;
}

.project-recycle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.project-recycle-batch {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin: 0 0 8px;
    padding: 0 2px;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.project-recycle-batch-left {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.project-recycle-batch-left .project-batch-select-all {
    font-weight: 500;
    color: #334155;
}

.project-batch-count {
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}

.project-recycle-batch-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
}

.project-recycle-batch-all {
    width: auto;
    padding: 0;
    border: 0;
    margin: 0;
}

.project-recycle-batch .project-batch-restore,
.project-recycle-batch .project-batch-delete,
.project-recycle-batch .project-batch-clear {
    flex: 1;
    min-height: 28px;
    min-width: 0;
    padding: 0 10px;
    border-radius: 6px;
    background: #ffffff;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-recycle-batch .project-batch-restore:not(:disabled) {
    border: 1px solid #bfdbfe;
    background: #ffffff;
    color: #2563eb;
    box-shadow: none;
}

.project-recycle-batch .project-batch-restore:not(:disabled):hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.project-recycle-batch .project-batch-delete:not(:disabled) {
    border: 1px solid #fecaca;
    background: #ffffff;
    color: #dc2626;
}

.project-recycle-batch .project-batch-delete:not(:disabled):hover {
    background: #fef2f2;
    border-color: #fca5a5;
}

.project-recycle-batch .project-batch-clear:not(:disabled) {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
}

.project-recycle-batch .project-batch-clear:not(:disabled):hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: #475569;
}

.project-recycle-batch .project-batch-restore:disabled,
.project-recycle-batch .project-batch-delete:disabled,
.project-recycle-batch .project-batch-clear:disabled {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #b0bcc9;
    box-shadow: none;
    cursor: not-allowed;
}

.project-recycle-hint {
    margin: 0 0 10px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.project-recycle-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    color: #94a3b8;
    font-size: 11px;
    line-height: 1.4;
}

.project-recycle-actions .danger-btn {
    background: #fff5f5;
}

.project-recycle-actions .danger-btn:hover {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}

#projectView .project-card-thumb-wrap {
    width: 52px;
}

#projectView .project-card-thumb {
    width: 52px;
    height: 52px;
    aspect-ratio: 1 / 1;
    border: 1px solid #edf1f7;
    border-radius: 8px;
}

#projectView .project-card-body {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding-right: 0;
}

#projectView .project-card-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
}

#projectView .project-card-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

#projectView .project-card-metric {
    font-size: 12px;
    color: #64748b;
}

#projectView .project-card-updated {
    color: #94a3b8;
    font-size: 11px;
}

#projectView .project-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.project-detail-preview,
.project-detail-side {
    min-width: 0;
}

.upload-preview-frame {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 4 / 3;
    border: 1px solid #edf1f7;
    border-radius: 8px;
}

.current-source-thumb {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border: 1px solid #edf1f7;
    border-radius: 6px;
}

.project-detail-media {
    width: 100%;
    min-height: 240px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
}

.project-detail-media canvas,
.project-detail-media img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.source-preview .media-frame {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid #edf1f7;
    border-radius: 8px;
}

.source-preview figcaption {
    margin-top: 6px;
    color: #64748b;
    font-size: 13px;
    text-align: center;
}

.project-detail-preview-hint {
    margin: 8px 0 0;
}

.project-detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.source-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.source-preview img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #f8fafc;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.color-item,
.list-row {
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #fbfdff;
}

.color-item {
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
}

.color-swatch {
    width: 36px;
    height: 36px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.inline-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 14px;
}

.empty-state p {
    color: #64748b;
    line-height: 1.8;
}

.view.editor-view.active,
.view.editor-view:not(.hidden) {
    display: flex !important;
    flex-direction: column;
}

.editor-view {
    display: none;
    flex-direction: column;
    flex: 1;
    gap: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    padding: 0 !important;
    background: transparent;
}

.editor-view:not(.hidden) {
    display: flex;
}

.editor-view.active {
    display: flex;
}

.app-shell.editor-focus {
    grid-template-columns: 1fr;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
}

html:has(.app-shell.editor-focus:not(.hidden)),
html:has(.app-shell.editor-focus:not(.hidden)) body,
html:has(.app-shell.editor-focus:not(.hidden)) #app {
    overflow: hidden;
    height: 100%;
}

.app-shell.editor-focus .sidebar {
    display: none;
}

.app-shell.editor-focus .content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    padding: 0 !important;
    background: #ffffff;
}

.app-shell.editor-focus .topbar,
.app-shell.editor-focus #onboardingBanner {
    display: none;
}

.app-shell.editor-focus .mobile-bottom-nav {
    display: none !important;
}

.app-shell.editor-focus .editor-view:not(.hidden) {
    flex: 1;
    min-height: 0;
    height: 100%;
    background: #ffffff;
}

/* 竖屏 CSS 模拟横屏（全局，不依赖 touch 媒体查询） */
html.mobile-simulated-landscape-root,
html:has(.mobile-simulated-landscape) {
    overflow: hidden !important;
    height: 100%;
}

html.mobile-simulated-landscape-root body,
html:has(.mobile-simulated-landscape) body {
    overflow: hidden !important;
    height: 100%;
}

.editor-view.mobile-simulated-landscape {
    position: fixed !important;
    inset: 0 !important;
    z-index: 10000 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #ffffff;
    display: flex !important;
    flex-direction: column;
}

.editor-view.mobile-simulated-landscape .editor-main {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100dvh;
    height: 100dvw;
    max-width: 100dvh;
    max-height: 100dvw;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center center;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    background: inherit;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.editor-view.mobile-simulated-landscape .editor-body {
    grid-template-columns: 72px minmax(0, 1fr) minmax(220px, 30%);
    grid-template-rows: minmax(0, 1fr);
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.editor-view.mobile-simulated-landscape .editor-body:has(.editor-panel.collapsed) {
    grid-template-columns: 72px minmax(0, 1fr) 44px;
}

.editor-view.mobile-simulated-landscape.editor-panel-open .editor-body {
    grid-template-columns: 72px minmax(0, 1fr) minmax(220px, 30%);
}

.editor-view.mobile-simulated-landscape.editor-panel-open .editor-body:has(.editor-panel.collapsed) {
    grid-template-columns: 72px minmax(0, 1fr) 44px;
}

.editor-view.mobile-simulated-landscape .editor-tools,
.editor-view.mobile-simulated-landscape .editor-canvas-wrap,
.editor-view.mobile-simulated-landscape .editor-panel {
    grid-row: 1;
    min-height: 0;
    min-width: 0;
}

.editor-view.mobile-simulated-landscape .editor-canvas-wrap {
    overflow: hidden;
    touch-action: none;
}

.editor-view.mobile-simulated-landscape .editor-canvas {
    touch-action: none;
}

.editor-view.mobile-simulated-landscape .editor-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    flex-shrink: 0;
}

.editor-view.mobile-simulated-landscape .editor-toolbar-groups {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
    width: auto;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: none;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}

.editor-view.mobile-simulated-landscape .editor-toolbar-groups > .toolbar-group,
.editor-view.mobile-simulated-landscape .editor-toolbar-groups > .toolbar-group:first-child,
.editor-view.mobile-simulated-landscape .editor-toolbar-groups > .toolbar-group-view,
.editor-view.mobile-simulated-landscape .editor-toolbar-groups > .toolbar-group:has(#editorSaveButton),
.editor-view.mobile-simulated-landscape .editor-toolbar-groups > .toolbar-group:has(#editorExportButton) {
    order: unset;
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    display: inline-flex;
    gap: 4px;
}

.editor-view.mobile-simulated-landscape .toolbar-group-status {
    flex: 0 0 auto;
    margin-left: auto;
    display: inline-flex;
}

.editor-view.mobile-simulated-landscape .editor-toolbar button,
.editor-view.mobile-simulated-landscape .editor-panel button,
.editor-view.mobile-simulated-landscape .palette-color,
.editor-view.mobile-simulated-landscape .legend-item {
    touch-action: none;
    pointer-events: auto;
}

.editor-view.mobile-simulated-landscape .editor-toolbar button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
}

.editor-view.mobile-simulated-landscape .editor-tools {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: none;
    padding: 4px 2px;
    gap: 4px;
    border-bottom: 0;
    border-right: 1px solid #dbe3ee;
    touch-action: none;
}

.editor-view.mobile-simulated-landscape .editor-tool-button {
    min-height: 36px;
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2px 1px;
    gap: 1px;
    touch-action: manipulation;
    pointer-events: auto;
}

.editor-view.mobile-simulated-landscape .editor-tool-button .tool-label {
    display: block;
    font-size: 10px;
    line-height: 1.15;
    text-align: center;
}

.editor-view.mobile-simulated-landscape .editor-tool-button[data-tool="replace"] {
    grid-column: auto;
    flex-direction: column;
    min-height: 36px;
}

.editor-view.mobile-simulated-landscape .editor-panel {
    display: flex;
    flex-direction: column;
    width: auto;
    height: 100%;
    max-height: 100% !important;
    min-height: 0;
    overflow: hidden;
    align-self: stretch;
    border-top: 0;
    border-left: 1px solid #dbe3ee;
    touch-action: none;
}

.editor-view.mobile-simulated-landscape .editor-panel:not(.collapsed) .editor-panel-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: none;
    overscroll-behavior: contain;
    padding: 10px;
    gap: 10px;
}

.editor-view.mobile-simulated-landscape .editor-color-panel {
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    display: grid;
    gap: 8px;
    overflow: visible;
}

.editor-view.mobile-simulated-landscape .editor-color-panel h4 {
    margin: 0;
    font-size: 12px;
}

.editor-view.mobile-simulated-landscape .editor-current-color {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 6px;
}

.editor-view.mobile-simulated-landscape .editor-palette-search {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 12px;
}

.editor-view.mobile-simulated-landscape .editor-palette-list {
    max-height: 200px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: none;
    overscroll-behavior: contain;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 6px;
}

.editor-view.mobile-simulated-landscape .editor-panel-block-legend {
    flex: 0 0 auto;
    min-height: 0;
    display: grid;
    gap: 8px;
    overflow: visible;
}

.editor-view.mobile-simulated-landscape .editor-panel-block-legend h4 {
    margin: 0;
    flex-shrink: 0;
    font-size: 12px;
}

.editor-view.mobile-simulated-landscape .editor-legend-list {
    max-height: 200px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: none;
    overscroll-behavior: contain;
}

.editor-view.mobile-simulated-landscape .editor-panel-block-meta {
    display: grid;
}

.editor-view.mobile-simulated-landscape .editor-panel-block:has(#editorShowGrid) {
    flex: 0 0 auto;
    gap: 4px;
}

.editor-view.mobile-simulated-landscape .editor-panel-block:has(#editorShowGrid) h4 {
    margin: 0;
    font-size: 12px;
}

.editor-view.mobile-simulated-landscape .editor-panel-block:has(#editorShowGrid) .check-label {
    font-size: 11px;
}

.editor-view.mobile-simulated-landscape .editor-panel.collapsed {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
}

.editor-view.mobile-simulated-landscape .editor-panel.collapsed .editor-panel-body {
    display: none !important;
}

.editor-view.mobile-simulated-landscape .editor-panel-head {
    padding: 6px 8px;
    flex-shrink: 0;
}

.editor-view.mobile-simulated-landscape .editor-panel.collapsed .editor-panel-head {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 4px;
    gap: 6px;
}

.editor-view.mobile-simulated-landscape .editor-panel.collapsed .editor-panel-head h3 {
    display: none;
}

.editor-view.mobile-simulated-landscape .editor-panel.collapsed .editor-panel-toggle {
    width: 100%;
    padding: 0 4px;
    font-size: 11px;
}

.editor-view.mobile-simulated-landscape .editor-palette-list .palette-color {
    padding: 4px 2px;
    font-size: 10px;
}

.editor-view.mobile-simulated-landscape .editor-palette-list .palette-color .color-swatch {
    width: 24px;
    height: 24px;
}

/* 开工页竖屏 CSS 模拟横屏：旋转 workspace，顶/底横条与平板布局一致 */
.assembly-view.mobile-simulated-landscape {
    position: fixed !important;
    inset: 0 !important;
    z-index: 10000 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #020617;
    display: flex !important;
    flex-direction: column;
}

.assembly-view.mobile-simulated-landscape .assembly-workspace {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100dvh;
    height: 100dvw;
    max-width: 100dvh;
    max-height: 100dvw;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center center;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    background: #020617;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.assembly-view.mobile-simulated-landscape .assembly-stage {
    flex: 1;
    min-height: 0;
}

.assembly-view.mobile-simulated-landscape .assembly-topbar,
.assembly-view.mobile-simulated-landscape .assembly-dock {
    flex-shrink: 0;
}

/* 模拟横屏：图例在旋转 workspace 内 dock 上方；关闭时禁用过渡避免闪回默认 grid */
.assembly-view.mobile-simulated-landscape .assembly-workspace .assembly-legend-drawer {
    transition: none !important;
}

.assembly-view.mobile-simulated-landscape .assembly-workspace .assembly-legend-drawer:not(.is-open) .assembly-legend-list {
    display: none !important;
}

.assembly-view.mobile-simulated-landscape .assembly-workspace .assembly-legend-drawer.is-open {
    flex-shrink: 0;
    position: relative;
    width: 100%;
    max-height: min(42dvw, 168px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 6px 8px 8px;
    border-radius: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.98);
    touch-action: none;
    pointer-events: auto;
    transform: none;
    box-shadow: none;
}

.assembly-view.mobile-simulated-landscape .assembly-workspace .assembly-legend-drawer.is-open .assembly-legend-hint {
    display: none;
}

/* 2 行 × 多列（与平板一致）；列方向延伸，沿条带上下滑由 JS 映射 scrollLeft */
.assembly-view.mobile-simulated-landscape .assembly-workspace .assembly-legend-drawer.is-open .assembly-legend-list {
    display: grid !important;
    grid-auto-flow: column;
    grid-template-columns: none !important;
    grid-template-rows: repeat(2, 50px);
    grid-auto-columns: 112px;
    gap: 6px;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-height: 140px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    touch-action: none;
    -webkit-overflow-scrolling: touch;
    padding: 0 2px 2px;
}

.assembly-view.mobile-simulated-landscape .assembly-workspace .assembly-legend-drawer.is-open .assembly-legend-item {
    display: grid !important;
    grid-template-columns: 32px minmax(0, 1fr) !important;
    align-items: center;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    max-width: 112px;
    box-sizing: border-box;
    overflow: hidden;
    padding: 5px 6px;
    gap: 6px;
    flex: unset;
    text-align: left;
    touch-action: none;
}

.assembly-view.mobile-simulated-landscape .assembly-workspace .assembly-legend-drawer.is-open .assembly-legend-swatch-wrap {
    width: 32px;
    height: 32px;
    max-width: none;
    max-height: none;
    margin: 0;
    flex-shrink: 0;
}

.assembly-view.mobile-simulated-landscape .assembly-workspace .assembly-legend-drawer.is-open .assembly-legend-badge {
    font-size: 11px;
}

.assembly-view.mobile-simulated-landscape .assembly-workspace .assembly-legend-drawer.is-open .assembly-legend-text {
    font-size: 10px;
    gap: 1px;
    line-height: 1.25;
    text-align: left;
    min-width: 0;
}

.assembly-view.mobile-simulated-landscape .assembly-workspace .assembly-legend-drawer.is-open .assembly-legend-text strong {
    font-size: 11px;
    font-weight: 600;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assembly-view.mobile-simulated-landscape .assembly-workspace .assembly-legend-drawer.is-open .assembly-legend-text span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 9px;
    color: #94a3b8;
}

.assembly-view:not(.is-mobile-layout) .assembly-landscape-btn,
.assembly-view:not(.is-mobile-layout) .mobile-landscape-btn,
.editor-view:not(.is-mobile-layout) .editor-landscape-tool,
.editor-view:not(.is-mobile-layout) .mobile-landscape-btn,
.editor-view.is-tablet-layout .editor-landscape-tool,
.editor-view.is-tablet-layout .mobile-landscape-btn {
    display: none !important;
}

.editor-view.is-mobile-layout:not(.is-tablet-layout) .toolbar-group-view .editor-landscape-tool:not(.hidden) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 0 8px;
    white-space: nowrap;
}

/* 横屏色号图例：全宽固定底栏 + 平板/桌面式多列网格（纵向滑动） */
.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout) .assembly-legend-drawer.is-legend-panel.is-open {
    position: fixed;
    z-index: 10001;
    left: calc(6px + env(safe-area-inset-left, 0px));
    right: calc(6px + env(safe-area-inset-right, 0px));
    top: auto;
    width: auto;
    max-height: none;
    min-height: 0;
    margin: 0;
    padding: 8px 10px 10px;
    border-radius: 12px 12px 0 0;
    background: rgba(15, 23, 42, 0.98);
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: none;
    transform: none;
    box-shadow: 0 -10px 36px rgba(2, 6, 23, 0.5);
    touch-action: pan-x;
    pointer-events: auto;
}

/* 物理横屏：贴在 dock 上方 */
.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout):not(.mobile-simulated-landscape) .assembly-legend-drawer.is-legend-panel.is-open {
    bottom: calc(var(--assembly-dock-h, 52px) + 6px + env(safe-area-inset-bottom, 0px));
}

/* 横屏底栏不显示 hint，高度留给色块网格 */
.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout) .assembly-legend-drawer.is-legend-panel.is-open .assembly-legend-hint {
    display: none;
}

/* 对齐平板 workspace-pattern-legend：多列网格 + 纵向滑动 */
.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout) .assembly-legend-drawer.is-legend-panel.is-open .assembly-legend-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, 112px) !important;
    gap: 6px;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 180px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    padding: 0 2px 2px;
}

/* 色块左 + 文字右（与平板 color-item 一致），禁止竖排卡片 */
.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout) .assembly-legend-drawer.is-legend-panel.is-open .assembly-legend-item {
    display: grid !important;
    grid-template-columns: 32px minmax(0, 1fr) !important;
    align-items: center;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 5px 6px;
    gap: 6px;
    flex: unset;
    text-align: left;
    touch-action: pan-y;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout) .assembly-legend-drawer.is-legend-panel.is-open .assembly-legend-swatch-wrap {
    width: 32px;
    height: 32px;
    max-width: none;
    max-height: none;
    margin: 0;
    flex-shrink: 0;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout) .assembly-legend-drawer.is-legend-panel.is-open .assembly-legend-badge {
    font-size: 11px;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout) .assembly-legend-drawer.is-legend-panel.is-open .assembly-legend-text {
    font-size: 10px;
    gap: 1px;
    line-height: 1.25;
    text-align: left;
    min-width: 0;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout) .assembly-legend-drawer.is-legend-panel.is-open .assembly-legend-text strong {
    font-size: 11px;
    font-weight: 600;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout) .assembly-legend-drawer.is-legend-panel.is-open .assembly-legend-text span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 9px;
    color: #94a3b8;
}

/* 开工页横屏/平板布局：顶底横条（物理横屏或模拟横屏内） */
.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-topbar {
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    padding: calc(4px + env(safe-area-inset-top, 0px)) 8px 4px;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-topbar-center {
    flex-direction: row;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-top-title {
    font-size: 12px;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-progress-text {
    font-size: 10px;
    white-space: nowrap;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-topbar-actions {
    gap: 4px;
    flex-wrap: nowrap;
    width: auto;
    flex-shrink: 0;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-topbar-chip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 32px;
    padding: 0 8px;
    font-size: 11px;
    white-space: nowrap;
    line-height: 1.2;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-landscape-btn:not(.hidden),
.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .mobile-landscape-btn:not(.hidden) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-dock-row-primary {
    display: flex !important;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-dock-modes {
    display: inline-flex;
    flex-shrink: 0;
    gap: 4px;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-dock-more-group {
    display: contents;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-dock-extras {
    display: inline-flex;
    flex: 1 1 auto;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-wrap: nowrap;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-dock-actions {
    display: inline-flex;
    flex-shrink: 0;
    gap: 6px;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-mode-btn,
.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-dock-action {
    width: auto;
    min-height: 36px;
    padding: 0 8px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}

.assembly-view.is-mobile-layout:is(.landscape-mode-on, .is-landscape-layout, .mobile-simulated-landscape) .assembly-dock-extras .assembly-display-select {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 4px;
    font-size: 11px;
}

.editor-mobile-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #fde68a;
    background: #fffbeb;
    color: #92400e;
    font-size: 13px;
    line-height: 1.5;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    padding: 6px 12px;
    margin: 0;
    border-bottom: 1px solid #cbd5e1;
    background: #ffffff;
}

.editor-main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
    background: #ffffff;
}

.editor-main > .editor-toolbar {
    flex-shrink: 0;
}

.editor-toolbar-groups {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    min-width: 0;
    flex: 0 1 auto;
    overflow-x: auto;
    scrollbar-width: thin;
}

.toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    flex-shrink: 0;
}

.toolbar-group-status {
    margin-left: auto;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 3px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.editor-live-context {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 12px;
    white-space: nowrap;
}

.editor-live-context:empty {
    display: none;
}

.editor-live-context.is-select {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.toolbar-group-view button {
    min-width: 38px;
    padding: 0 10px;
}

.toolbar-history-hint {
    min-width: 36px;
    padding: 0 6px;
    color: #64748b;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    text-align: center;
    line-height: 34px;
    user-select: none;
}

.editor-toolbar button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
    white-space: nowrap;
    border-radius: 6px;
}

.toolbar-group:has(#editorUndoButton) button {
    min-width: 96px;
    padding: 0 8px;
}

.editor-toolbar-save {
    min-width: 104px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.18);
}

.editor-toolbar-accent {
    color: #1d4ed8;
    border-color: #93c5fd;
    background: #eff6ff;
    font-weight: 600;
}

.editor-toolbar-accent:hover {
    background: #dbeafe;
    color: #1e40af;
}

.editor-live-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 4px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.editor-live-status .status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 12px;
}

.editor-live-status .status-chip-save {
    min-width: 52px;
}

.editor-live-status .status-chip-tool {
    min-width: 48px;
}

.editor-live-status .status-chip-coord {
    gap: 6px;
    min-width: 118px;
    justify-content: flex-end;
    padding: 0 10px;
}

.editor-live-status .status-chip-label {
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
}

.editor-live-status .status-chip-value {
    min-width: 64px;
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    letter-spacing: 0.02em;
}

.editor-live-status .status-chip-value.is-empty {
    color: #94a3b8;
    font-weight: 500;
}

.editor-live-status.dirty .status-chip-save {
    border-color: #fbbf24;
    background: #fffbeb;
    color: #92400e;
}

.editor-message {
    margin: 0 !important;
    min-height: 0;
    padding: 6px 12px;
    flex-shrink: 0;
    border-bottom: 1px solid #edf1f7;
}

.editor-message:not([hidden]) {
    margin-top: 0 !important;
}

.editor-message[hidden] {
    display: none !important;
}

.editor-body {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) 320px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    background: #f8fafc;
}

.editor-body:has(.editor-panel.collapsed) {
    grid-template-columns: 88px minmax(0, 1fr) 48px;
}

.editor-view.editor-readonly .editor-tools {
    pointer-events: none;
    opacity: 0.45;
}

.editor-view.editor-readonly .editor-canvas {
    pointer-events: none;
}

.editor-tools {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 6px 6px;
    border-right: 1px solid #dbe3ee;
    background: #f8fafc;
    overflow: hidden;
    flex-shrink: 0;
}

.editor-tool-button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-height: 54px;
    padding: 8px 4px 6px;
    font-size: 12px;
    color: #334155;
    background: #ffffff;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
}

.editor-tool-button .tool-icon {
    font-size: 17px;
    line-height: 1;
}

.editor-tool-button .tool-label {
    line-height: 1.2;
    white-space: nowrap;
}

.editor-tool-button .tool-shortcut {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dbe3ee;
    border-radius: 4px;
    background: #f8fafc;
    color: #64748b;
    font-size: 10px;
    font-family: inherit;
    line-height: 1;
}

.editor-tool-button.active {
    color: #ffffff;
    background: #2563eb;
    border-color: #2563eb;
}

.editor-tool-button.active .tool-shortcut {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.editor-key-hint {
    display: inline-flex;
    gap: 2px;
    align-items: center;
    margin-left: 6px;
    color: inherit;
    font-size: 9px;
    font-family: inherit;
    line-height: 1.2;
    font-weight: 500;
    opacity: 0.9;
    vertical-align: middle;
}

.editor-key-hint kbd {
    min-width: 14px;
    padding: 1px 4px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.16);
    color: inherit;
    font: inherit;
    text-align: center;
}

.editor-key-hint span {
    color: currentColor;
    opacity: 0.72;
}

button.secondary .editor-key-hint kbd {
    border-color: #dbe3ee;
    background: #ffffff;
    color: #64748b;
}

.editor-toolbar-save .editor-key-hint kbd {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.editor-selection-bar {
    position: absolute;
    z-index: 12;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(6px);
    pointer-events: auto;
    max-width: calc(100% - 16px);
}

.editor-selection-bar.hidden {
    display: none;
}

.editor-selection-bar-modes,
.editor-selection-bar-nudge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.editor-selection-bar-divider {
    width: 1px;
    height: 22px;
    background: #e2e8f0;
    flex-shrink: 0;
}

.editor-selection-bar-btn {
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid #dbe3ee;
    border-radius: 7px;
    background: #ffffff;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.editor-selection-bar-btn.icon {
    min-width: 30px;
    padding: 0;
    font-size: 14px;
    line-height: 1;
}

.editor-selection-bar-btn.active {
    color: #ffffff;
    background: #2563eb;
    border-color: #2563eb;
}

.editor-selection-bar-btn.danger {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fff1f2;
}

.editor-canvas-wrap {
    position: relative;
    overflow: hidden;
    touch-action: none;
    background: #cbd5e1;
    min-height: 0;
    height: 100%;
    margin: 0;
    padding: 0;
}

.editor-canvas-wrap.is-mirrored {
    box-shadow: inset 0 0 0 2px rgba(13, 148, 136, 0.42);
}

.editor-mobile-zoom-fab {
    display: none;
}

.editor-mobile-zoom-label {
    min-width: 42px;
    padding: 0 4px;
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
    line-height: 34px;
    user-select: none;
}

.editor-mobile-zoom-fab button {
    min-width: 36px;
    min-height: 34px;
    padding: 0 8px;
}

.editor-canvas {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    cursor: crosshair;
}

.editor-mobile-readonly {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 40%, rgba(15, 23, 42, 0.35) 100%);
    pointer-events: none;
}

.editor-mobile-readonly-card {
    width: min(100%, 420px);
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    pointer-events: auto;
}

.editor-mobile-readonly-card p {
    margin: 8px 0 12px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.6;
}

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

.editor-mobile-readonly-actions .editor-action-primary {
    flex: 1 1 calc(50% - 4px);
    min-height: 40px;
    font-weight: 600;
}

.editor-mobile-readonly-actions .editor-action-primary.secondary {
    color: #1d4ed8;
    border: 1px solid #93c5fd;
    background: #eff6ff;
}

.editor-canvas.tool-move {
    cursor: grab;
}

.editor-canvas.tool-select {
    cursor: crosshair;
}

.editor-canvas.tool-select.is-dragging-selection {
    cursor: grabbing;
}

.editor-canvas.tool-eyedropper {
    cursor: cell;
}

.editor-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: 1px solid #dbe3ee;
    background: #ffffff;
    overflow: hidden;
    min-height: 0;
}

.editor-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid #edf1f7;
    background: #f8fafc;
    flex-shrink: 0;
}

.editor-panel-head h3 {
    margin: 0;
    font-size: 15px;
    color: #334155;
}

.editor-panel-toggle {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
}

.editor-panel-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    overflow: auto;
    min-height: 0;
}

.editor-panel.collapsed {
    width: 48px;
    min-width: 48px;
}

.editor-panel.collapsed .editor-panel-head h3,
.editor-panel.collapsed .editor-panel-body {
    display: none;
}

.editor-panel.collapsed .editor-panel-head {
    flex-direction: column;
    padding: 12px 8px;
}

.editor-panel-block {
    display: grid;
    gap: 8px;
}

.editor-panel-block h4 {
    margin: 0;
    font-size: 14px;
    color: #475569;
}

.editor-info {
    display: grid;
    gap: 4px;
    font-size: 13px;
    color: #334155;
}

.editor-current-color {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.editor-current-color-highlight .color-swatch.is-active {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
    outline: 2px solid #2563eb;
}

.editor-palette-search-label {
    display: block;
}

.editor-palette-search {
    width: 100%;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid #dbe3ee;
    border-radius: 6px;
    font-size: 13px;
}

.editor-recent-colors {
    display: grid;
    gap: 6px;
}

.editor-recent-label {
    font-size: 12px;
    color: #64748b;
}

.editor-recent-colors-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.editor-recent-colors-list .palette-color {
    display: grid;
    gap: 4px;
    justify-items: center;
    min-width: 52px;
    width: auto;
    min-height: 38px;
    height: auto;
    grid-template-columns: 1fr;
    padding: 6px;
    border: 1px solid #dbe3ee;
    border-radius: 6px;
    background: #fbfdff;
    color: #334155;
    font-size: 11px;
}

.editor-recent-colors-list .palette-color:hover {
    background: #f1f5f9;
    color: #334155;
}

.editor-recent-colors-list .palette-color.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
    background: #eff6ff;
}

.editor-recent-colors-list .palette-color .color-swatch {
    width: 28px;
    height: 28px;
}

.editor-palette-empty {
    margin: 0;
    padding: 12px 8px;
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
}

.editor-palette-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    grid-auto-rows: min-content;
    gap: 8px;
    max-height: 220px;
    overflow: auto;
    align-items: start;
}

.editor-palette-list .palette-color {
    display: grid;
    gap: 4px;
    justify-items: center;
    min-height: unset;
    height: auto;
    width: 100%;
    padding: 6px 4px;
    border: 1px solid #dbe3ee;
    border-radius: 6px;
    background: #fbfdff;
    color: #334155;
    font-size: 11px;
    line-height: 1.25;
}

.editor-palette-list .palette-color:hover {
    background: #f1f5f9;
    color: #334155;
}

.editor-palette-list .palette-color.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
    background: #eff6ff;
}

.editor-palette-list .palette-color .color-swatch {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.editor-palette-list .palette-color > span:last-child {
    display: block;
    width: 100%;
    text-align: center;
    word-break: break-all;
}

.editor-legend-list {
    display: grid;
    grid-auto-rows: min-content;
    gap: 8px;
    max-height: 260px;
    overflow: auto;
}

.editor-legend-list .legend-item {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    min-height: unset;
    height: auto;
    width: 100%;
    padding: 8px;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #fbfdff;
    text-align: left;
    color: #334155;
    line-height: 1.45;
}

.editor-legend-list .legend-item:hover {
    background: #f1f5f9;
    color: #334155;
}

.editor-legend-list .legend-item span:last-child {
    min-width: 0;
    word-break: break-word;
    font-size: 12px;
}

.editor-legend-list .legend-item .color-swatch {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.editor-legend-list .legend-item.active {
    border-color: #f59e0b;
    background: #fffbeb;
}

@media (max-width: 900px) and ((hover: none) or (pointer: coarse)), (max-width: 767px), ((max-height: 520px) and (max-width: 1100px) and ((hover: none) or (pointer: coarse))) {
    .auth-screen,
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-shell {
        display: flex;
        flex-direction: column;
        min-height: 100dvh;
    }

    .content {
        order: 1;
        flex: 1;
        min-width: 0;
        min-height: 0;
        padding: 16px;
        padding-bottom: calc(126px + env(safe-area-inset-bottom, 0px));
    }

    .sidebar {
        display: none;
    }

    .sidebar-brand,
    .sidebar-logout {
        display: none;
    }

    .mobile-bottom-nav:not(.hidden) {
        display: grid;
    }

    .mobile-my-sheet:not(.hidden) {
        display: block;
    }

    .mobile-bottom-item {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* 手机端颜色库：锁定视口，工具栏固定，仅色块区滚动（仅 mobile-palette-layout，避免泄漏到其他页面） */
    .app-shell.mobile-palette-layout {
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
    }

    .app-shell.mobile-palette-layout .content {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
        flex: 1;
        padding: 8px 10px calc(68px + env(safe-area-inset-bottom, 0px));
    }

    .app-shell.mobile-palette-layout .topbar,
    .app-shell.mobile-palette-layout #onboardingBanner {
        display: none;
    }

    #paletteView.view.active {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #paletteView .panel {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        margin-bottom: 0;
        padding: 8px 10px 4px;
    }

    #paletteView .panel-head {
        flex-shrink: 0;
        margin-bottom: 8px;
        gap: 6px;
    }

    #paletteView .palette-mobile-toolbar {
        display: flex;
        flex-direction: column;
        gap: 4px;
        flex-shrink: 0;
    }

    #paletteView #paletteMineTools:not(.hidden) {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #paletteView .panel-head h3 {
        display: none;
    }

    #paletteView .palette-tabs {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    #paletteView .palette-tab {
        min-height: 36px;
        border-radius: 10px;
        font-size: 13px;
        text-align: center;
    }

    #paletteView .palette-tab-panel:not(.hidden) {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        gap: 8px;
    }

    #paletteView .palette-mobile-toolbar,
    #paletteView .palette-main-header,
    #paletteView .palette-sidebar,
    #paletteView #paletteQuickColors,
    #paletteView #myPaletteQuickColors,
    #paletteView #addColorPanel,
    #paletteView .palette-reorder-hint,
    #paletteView #myPaletteEmptyState,
    #paletteView #paletteMineLoginHint {
        flex-shrink: 0;
    }

    #paletteView .palette-colors-scroll {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 2px;
        margin: 0 -2px;
    }

    #paletteView .palette-browse-bar {
        margin-bottom: 0;
        padding: 6px;
        gap: 4px;
        box-shadow: none;
        border: 0;
        background: transparent;
    }

    #paletteView .palette-field-label {
        display: none;
    }

    #paletteView .palette-field {
        gap: 0;
    }

    #paletteView .palette-browse-primary {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
        gap: 6px;
        align-items: center;
    }

    #paletteView .palette-select,
    #paletteView .palette-search-input {
        min-height: 36px;
        font-size: 13px;
    }

    #paletteView .palette-search-input {
        padding: 0 10px 0 34px;
        background-position: 11px center;
        -webkit-appearance: none;
        appearance: none;
    }

    #paletteView .palette-search-input::-webkit-search-decoration,
    #paletteView .palette-search-input::-webkit-search-cancel-button {
        -webkit-appearance: none;
        appearance: none;
        display: none;
    }

    #paletteView .palette-bar-action {
        align-self: center;
        min-height: 36px;
        min-width: 36px;
        padding: 0 8px;
        font-size: 11px;
    }

    #paletteView .palette-filter-drawer > summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 32px;
        padding: 0 10px;
        border: 1px solid #dbe3ee;
        border-radius: 8px;
        background: #f8fafc;
        color: #64748b;
        font-size: 12px;
        font-weight: 500;
        cursor: pointer;
        list-style: none;
    }

    #paletteView .palette-filter-drawer > summary::-webkit-details-marker {
        display: none;
    }

    #paletteView .palette-filter-drawer > summary::after {
        content: "▾";
        font-size: 11px;
        color: #94a3b8;
        transition: transform 0.15s ease;
    }

    #paletteView .palette-filter-drawer[open] > summary::after {
        transform: rotate(180deg);
    }

    #paletteView .palette-filter-drawer:not([open]) > .palette-browse-filters,
    #paletteView .palette-filter-drawer:not([open]) > .palette-main-filters {
        display: none !important;
    }

    #paletteView .palette-filter-drawer[open] > .palette-browse-filters,
    #paletteView .palette-filter-drawer[open] > .palette-main-filters {
        margin-top: 6px;
        padding-top: 0;
        border-top: 0;
        grid-template-columns: 1fr;
        gap: 0;
    }

    #paletteView .palette-summary {
        display: none;
    }

    #paletteView .palette-main-title {
        display: none;
    }

    #paletteView .palette-reorder-hint {
        display: none !important;
    }

    #paletteView .palette-page-message {
        position: sticky;
        top: 0;
        z-index: 30;
        margin: 0 0 10px;
        padding: 10px 12px;
        border-radius: 10px;
        background: #ffffff;
        box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
        min-height: 0;
    }

    #paletteView .palette-page-message:empty {
        display: none;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    #paletteView .palette-filter-drawer .palette-filter-label {
        display: none;
    }

    #paletteView .palette-family-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    #paletteView .palette-family-chips::-webkit-scrollbar {
        display: none;
    }

    #paletteView .palette-family-chip {
        flex-shrink: 0;
    }

    #paletteView .palette-summary {
        margin: 0;
        font-size: 11px;
        line-height: 1.3;
    }

    #paletteView .palette-quick-colors {
        display: flex;
        align-items: stretch;
        gap: 8px;
        margin-bottom: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    #paletteView .palette-quick-colors::-webkit-scrollbar {
        display: none;
    }

    #paletteView .palette-quick-section {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }

    #paletteView .palette-quick-section h4 {
        margin: 0;
        font-size: 11px;
        white-space: nowrap;
        color: #94a3b8;
    }

    #paletteView .palette-quick-list {
        flex-wrap: nowrap;
    }

    #paletteView .palette-quick-chip {
        min-height: 30px;
        padding: 2px 8px 2px 2px;
        font-size: 11px;
        flex-shrink: 0;
    }

    #paletteView .palette-quick-chip .color-swatch {
        width: 20px;
        height: 20px;
    }

    #paletteView .palette-mine-layout {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        gap: 8px;
        overflow: hidden;
    }

    #paletteView .palette-sidebar {
        padding: 6px 8px;
        gap: 6px;
    }

    #paletteView .palette-sidebar-head {
        display: none;
    }

    #paletteView .palette-sidebar-actions {
        display: flex;
        gap: 8px;
    }

    #paletteView .palette-sidebar-actions button {
        flex: 1;
        min-height: 34px;
        font-size: 12px;
        padding: 0 8px;
    }

    #paletteView .palette-sidebar-list {
        display: flex;
        gap: 8px;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    #paletteView .palette-sidebar-list::-webkit-scrollbar {
        display: none;
    }

    #paletteView .palette-sidebar-item {
        flex: 0 0 auto;
        min-width: 132px;
        max-width: 168px;
        padding: 10px;
    }

    #paletteView .palette-sidebar-item span:last-child {
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    #paletteView .palette-main {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #paletteView .palette-main-detail:not(.hidden) {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        gap: 8px;
    }

    #paletteView .palette-main-header {
        padding: 6px 8px;
        gap: 6px;
    }

    #paletteView .palette-main-title h4 {
        font-size: 15px;
        margin-bottom: 2px;
    }

    #paletteView .palette-main-title .hint {
        font-size: 11px;
        margin: 0;
    }

    #paletteView .palette-main-filters {
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
    }

    #paletteView .palette-add-panel {
        padding: 10px;
    }

    #paletteView .palette-add-form {
        grid-template-columns: 1fr 1fr;
    }

    #paletteView .palette-add-actions {
        grid-column: 1 / -1;
    }

    /* 手机端颜色库：紧凑色块网格，点击卡片查看详情（限定颜色库页） */
    .app-shell.mobile-palette-layout #paletteView .palette-color-grid-browse,
    .app-shell.mobile-palette-layout #paletteView .palette-color-grid-manage {
        grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
        gap: 5px;
        align-content: start;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-color-card {
        padding: 4px;
        gap: 2px;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-color-card-main {
        grid-template-columns: 1fr;
        gap: 2px;
        text-align: center;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-color-card-main .color-swatch {
        width: 100%;
        height: 40px;
        margin: 0 auto;
        border-radius: 6px;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-color-card-main > span:last-child {
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 10px;
        line-height: 1.25;
        word-break: break-all;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-color-card-actions {
        display: none;
    }

    .app-shell.mobile-palette-layout #paletteView .color-card-manage {
        padding: 4px;
        gap: 2px;
    }

    .app-shell.mobile-palette-layout #paletteView .color-card-manage.color-card-reorderable {
        padding-top: 18px;
    }

    .app-shell.mobile-palette-layout #paletteView .color-card-manage .color-swatch {
        height: 40px;
    }

    .app-shell.mobile-palette-layout #paletteView .color-card-name,
    .app-shell.mobile-palette-layout #paletteView .color-card-info code {
        display: none;
    }

    .app-shell.mobile-palette-layout #paletteView .color-card-info {
        text-align: center;
    }

    .app-shell.mobile-palette-layout #paletteView .color-card-info strong {
        font-size: 10px;
        line-height: 1.2;
        word-break: break-all;
    }

    .app-shell.mobile-palette-layout #paletteView .color-card-actions,
    .app-shell.mobile-palette-layout #paletteView .color-drag-handle {
        display: none;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-mine-layout {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-sidebar {
        width: 100%;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        gap: 8px;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-sidebar-list {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(120px, 1fr);
        gap: 8px;
        width: 100%;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-sidebar-item {
        flex: unset;
        min-width: 0;
        max-width: none;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-main {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-main-detail:not(.hidden) {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        gap: 6px;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-main-header {
        flex-shrink: 0;
        padding: 0;
        gap: 6px;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-main-toolbar {
        display: flex;
        flex-direction: column;
        gap: 6px;
        align-items: stretch;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-main-toolbar .palette-search-input {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        min-height: 34px;
        height: 34px;
        padding: 0 10px 0 34px;
        font-size: 13px;
        background-position: 11px center;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-toolbar-row {
        display: flex;
        flex-wrap: nowrap;
        align-items: flex-start;
        gap: 6px;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-toolbar-scroll {
        display: block;
        flex: 1 1 0;
        min-width: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-toolbar-scroll::-webkit-scrollbar {
        display: none;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-toolbar-primary {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        width: max-content;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-toolbar-primary button {
        flex: 0 0 auto;
        min-height: 32px;
        padding: 0 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-toolbar-more-trigger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        min-height: 32px;
        padding: 0 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-toolbar-secondary {
        display: none;
        position: absolute;
        top: calc(100% + 4px);
        right: 0;
        z-index: 30;
        min-width: 220px;
        padding: 8px;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        background: #ffffff;
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-toolbar-row.is-more-open .palette-toolbar-secondary {
        display: flex;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-toolbar-row {
        position: relative;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-toolbar-secondary .button-like,
    .app-shell.mobile-palette-layout #paletteView .palette-toolbar-secondary button {
        min-height: 32px;
        font-size: 12px;
        padding: 0 8px;
        text-align: center;
        width: 100%;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-main-filters {
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
        gap: 4px;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-main-filters .palette-filter-label {
        display: none;
    }

    .app-shell.mobile-palette-layout #paletteView .palette-colors-scroll {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }

    .mobile-workspace-steps:not(.hidden) {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .workspace-intro-bar {
        margin-bottom: 4px;
    }

    .workspace-blank-entry {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 8px;
    }

    .workspace-blank-entry > button {
        width: 100%;
    }

    #workspaceView[data-mobile-step="upload"] .workspace-generate-panel {
        display: none;
    }

    #workspaceView[data-mobile-step="generate"] .workspace-upload-panel {
        display: none;
    }

    #workspaceView[data-mobile-step="generate"] #patternResult {
        display: none;
    }

    #workspaceView[data-mobile-step="preview"] .workspace-upload-panel {
        display: none;
    }

    #workspaceView[data-mobile-step="preview"] #patternForm {
        display: none;
    }

    .workspace-layout,
    .project-detail-grid {
        grid-template-columns: 1fr;
    }

    .workspace-layout {
        gap: 14px;
    }

    .pattern-post-save-buttons {
        display: grid;
        grid-template-columns: 1fr;
    }

    .workspace-upload-panel {
        order: 1;
    }

    .workspace-generate-panel {
        order: 2;
    }

    .workspace-file-scroll {
        max-height: none;
    }

    .workspace-generate-panel .settings-size,
    .workspace-generate-panel .settings-palette {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .auth-screen {
        min-height: auto;
        margin: 24px auto;
        width: min(680px, calc(100% - 48px));
        padding: 0;
    }

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

    .auth-brand {
        min-height: 360px;
        padding: 34px;
    }

    .topbar {
        align-items: center;
        gap: 12px;
        margin-bottom: 14px;
    }

    .topbar-main .eyebrow {
        display: none;
    }

    .topbar h2 {
        font-size: 22px;
        line-height: 1.2;
    }

    .panel-head,
    .preview-toolbar,
    .upload-result {
        align-items: stretch;
        flex-direction: column;
        grid-template-columns: 1fr;
    }

    .preview-toolbar,
    .preview-options {
        align-items: stretch;
    }

    .preview-toolbar-main,
    .preview-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .preview-actions {
        flex-shrink: 1;
        width: 100%;
    }

    .preview-rotation-toolbar {
        grid-template-columns: 1fr;
    }

    .image-rotation-buttons {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .preview-options {
        gap: 10px;
    }

    .preview-actions button {
        width: 100%;
    }

    .workspace-upload-panel .compact-toolbar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .workspace-library-head {
        flex-direction: column;
        align-items: stretch;
    }

    .workspace-library-actions {
        justify-content: flex-start;
    }

    .workspace-library-filters {
        grid-template-columns: 1fr;
    }

    .workspace-library-filter-toolbar {
        justify-content: stretch;
    }

    .workspace-library-filter-toolbar select {
        flex: 1;
        min-width: 0;
        max-width: none;
    }

    .workspace-library-filter-toggle,
    button.workspace-library-filter-toggle {
        flex: 1;
        justify-content: center;
    }

    .file-library {
        grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    }

    .file-actions {
        grid-template-columns: 1fr;
    }

    #patternSummary {
        grid-template-columns: 1fr;
    }

    .color-grid:not([class*="palette-color-grid"]) {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    /* 手机端：预览工具栏紧凑排列 */
    .preview-toolbar {
        display: block;
        padding: 8px 10px;
    }

    .preview-toolbar-title {
        display: none;
    }

    .preview-toolbar-main {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 8px;
        flex-direction: row;
    }

    .preview-options {
        display: contents;
        gap: 6px 8px;
    }

    .preview-options .check-label {
        min-height: 28px;
        font-size: 12px;
    }

    .preview-grid-step-label {
        font-size: 12px;
        white-space: nowrap;
    }

    .preview-actions {
        display: flex;
        flex: 1 1 100%;
        flex-direction: row;
        gap: 6px;
        width: 100%;
    }

    .preview-actions button {
        flex: 1 1 0;
        min-width: 0;
        width: auto;
        min-height: 34px;
        font-size: 12px;
    }

    .preview-rotation-toolbar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 8px;
        padding: 8px 10px;
    }

    .preview-rotation-title span {
        display: none;
    }

    .image-rotation-buttons {
        flex: 1 1 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* 手机端：颜色图例折叠 + 紧凑网格 */
    #patternResult .pattern-legend-fold {
        border: 1px solid #edf1f7;
        border-radius: 8px;
        background: #fbfdff;
    }

    #patternResult .pattern-legend-fold-title {
        padding: 8px 10px;
        margin: 0;
        font-size: 13px;
    }

    #patternResult .workspace-pattern-legend {
        grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
        gap: 5px;
        max-height: 132px;
        overflow-y: auto;
        padding: 0 8px 8px;
    }

    #patternResult .workspace-pattern-legend .color-item {
        padding: 4px 5px;
        gap: 4px;
        grid-template-columns: 20px minmax(0, 1fr);
        font-size: 10px;
        line-height: 1.2;
    }

    #patternResult .workspace-pattern-legend .color-swatch {
        width: 20px;
        height: 20px;
    }

    #patternResult .pattern-preview-canvas-wrap canvas,
    #patternResult #patternPreview {
        max-height: min(280px, 38vh);
    }

    #patternResult .pattern-result {
        gap: 8px;
        margin-top: 8px;
    }

    #patternSummary.summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        padding: 8px;
    }

    .workspace-library-title h3 {
        white-space: nowrap;
        writing-mode: horizontal-tb;
    }

    .workspace-library-head {
        flex-direction: column;
        align-items: stretch;
    }

    .workspace-library-actions {
        width: 100%;
    }

    .workspace-library-actions button {
        flex: 1 1 0;
        min-width: 0;
    }

    #paletteView .palette-toolbar {
        grid-template-columns: 1fr;
    }

    #projectView .project-card.project-recycle-card {
        grid-template-columns: 20px 48px minmax(0, 1fr);
        grid-template-areas:
            "check thumb body"
            "actions actions actions";
        align-items: start;
    }

    #projectView .project-card.project-recycle-card .project-recycle-check {
        grid-area: check;
        min-height: 48px;
    }

    #projectView .project-card.project-recycle-card .project-card-thumb-wrap {
        grid-area: thumb;
    }

    #projectView .project-card.project-recycle-card .project-recycle-body {
        grid-area: body;
    }

    #projectView .project-card.project-recycle-card .project-recycle-actions {
        grid-area: actions;
        flex-direction: row;
        width: 100%;
        justify-content: stretch;
        padding-top: 0;
    }

    #projectView .project-card.project-recycle-card .project-recycle-actions button {
        flex: 1;
        min-width: 0;
    }

    .register-security-cards {
        grid-template-columns: 1fr;
    }

    .project-list-create-actions button {
        width: 100%;
    }

    .editor-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) auto;
    }

    .editor-view.is-mobile-layout:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) auto;
    }

    .editor-view.is-mobile-layout:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-canvas-wrap {
        min-height: 160px;
    }

    .app-shell.editor-focus .content {
        padding-bottom: 0;
    }

    .editor-key-hint,
    .editor-tool-button .tool-shortcut {
        display: none !important;
    }

    .editor-view.is-mobile-layout:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-tools {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px;
        padding: 6px 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-right: 0;
        border-bottom: 1px solid #dbe3ee;
    }

    .editor-view.is-mobile-layout:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-tool-button {
        flex: 0 0 52px;
        width: 52px;
        min-width: 52px;
        min-height: 44px;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 4px 2px;
        gap: 2px;
    }

    .editor-view.is-mobile-layout:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-tool-button .tool-label {
        font-size: 10px;
        line-height: 1.1;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .editor-view.is-mobile-layout:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-tool-button[data-tool="replace"] {
        flex: 0 0 56px;
        width: 56px;
        min-width: 56px;
        flex-direction: column;
        justify-content: center;
        grid-column: auto;
    }

    .editor-tools {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        padding: 8px;
        border-right: 0;
        border-bottom: 1px solid #dbe3ee;
    }

    .editor-tool-button {
        flex: none;
        min-width: 0;
        min-height: 42px;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 4px;
        gap: 2px;
    }

    .editor-tool-button .tool-label {
        font-size: 11px;
    }

    .editor-tool-button[data-tool="replace"] {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: center;
        min-height: 36px;
        gap: 6px;
    }

    .editor-view.is-mobile-layout:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-panel {
        border-left: 0;
        border-top: 1px solid #dbe3ee;
        max-height: 30vh;
    }

    .editor-view.is-mobile-layout.mobile-immersive-mode:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-panel {
        max-height: 40px;
        overflow: hidden;
    }

    .editor-view.is-mobile-layout.mobile-immersive-mode:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-panel .editor-panel-body {
        display: none;
    }

    .editor-panel.collapsed {
        width: auto;
        min-width: 0;
        max-height: none;
    }

    .editor-panel.collapsed .editor-panel-head h3 {
        display: block;
    }

    .editor-mobile-zoom-fab {
        position: absolute;
        right: 10px;
        bottom: 10px;
        z-index: 12;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 4px;
        border: 1px solid #dbe3ee;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
    }

    .editor-view.is-mobile-layout:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 8px 10px;
    }

    .editor-view.is-mobile-layout:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-toolbar-groups {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        gap: 6px;
        overflow: visible;
        align-items: stretch;
    }

    .editor-view.is-mobile-layout:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-toolbar-groups > .toolbar-group:first-child {
        flex: 0 0 auto;
        order: 1;
    }

    .editor-view.is-mobile-layout:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-toolbar-groups > .toolbar-group-view {
        flex: 1 1 0;
        order: 2;
        justify-content: center;
        min-width: 0;
    }

    .editor-view.is-mobile-layout:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-toolbar-groups > .toolbar-group:has(#editorSaveButton) {
        flex: 1 1 100%;
        order: 3;
        display: grid;
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr) auto;
        gap: 4px;
    }

    .editor-view.is-mobile-layout:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-toolbar-groups > .toolbar-group:has(#editorExportButton) {
        flex: 1 1 100%;
        order: 4;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px;
    }

    .editor-view.is-mobile-layout.mobile-immersive-mode:not(.is-landscape-layout):not(.mobile-simulated-landscape) .editor-toolbar-groups > .toolbar-group:has(#editorExportButton) {
        display: none;
    }

    .toolbar-group:has(#editorUndoButton) button {
        min-width: 0;
        padding: 0 6px;
        font-size: 12px;
    }

    .editor-toolbar-save {
        min-width: 0;
        padding: 0 8px;
    }

    .editor-toolbar-groups .toolbar-group button,
    .toolbar-group-status button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .editor-view.is-mobile-layout:not(.is-landscape-layout):not(.mobile-simulated-landscape) .toolbar-group-status {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .editor-view.is-mobile-layout.mobile-immersive-mode:not(.is-landscape-layout):not(.mobile-simulated-landscape) .toolbar-group-status {
        display: none;
    }

    .editor-live-context {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 11px;
    }

    .editor-live-status {
        flex: 0 0 auto;
        justify-content: flex-end;
    }

    .editor-live-status .status-chip-coord {
        min-width: 96px;
    }

    .editor-selection-bar {
        left: 8px !important;
        right: 8px;
        bottom: 56px !important;
        top: auto !important;
        width: auto;
        justify-content: center;
        flex-wrap: wrap;
    }

    .editor-selection-bar-nudge {
        display: none;
    }

    .mobile-landscape-btn.is-active {
        color: #1d4ed8;
        border-color: #2563eb;
        background: #eff6ff;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-toolbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 6px 10px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        flex-shrink: 0;
    }

    .editor-view.is-mobile-layout.is-landscape-layout:not(.mobile-simulated-landscape) .editor-toolbar-groups {
        display: flex;
        flex: 1 1 auto;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        min-width: 0;
        width: auto;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
    }

    .editor-view.is-mobile-layout.mobile-simulated-landscape .editor-toolbar-groups {
        display: flex;
        flex: 1 1 auto;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        min-width: 0;
        width: auto;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: none;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-toolbar-groups > .toolbar-group,
    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-toolbar-groups > .toolbar-group:first-child,
    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-toolbar-groups > .toolbar-group-view,
    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-toolbar-groups > .toolbar-group:has(#editorSaveButton),
    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-toolbar-groups > .toolbar-group:has(#editorExportButton) {
        order: unset;
        flex: 0 0 auto;
        width: auto;
        min-width: 0;
        display: inline-flex;
        gap: 4px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .toolbar-group-status {
        flex: 0 0 auto;
        width: auto;
        margin-left: auto;
        display: inline-flex;
        flex-wrap: nowrap;
        gap: 6px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-toolbar button,
    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-panel button,
    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .palette-color,
    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .legend-item {
        touch-action: none;
        pointer-events: auto;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-toolbar button {
        min-height: 34px;
        padding: 0 10px;
        font-size: 13px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) #editorExportButton,
    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) #editorShareButton {
        display: inline-flex;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-live-context {
        max-width: 88px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .editor-view.is-mobile-layout.is-landscape-layout .editor-mobile-hint,
    .assembly-view.is-mobile-layout.is-landscape-layout .assembly-mobile-hint,
    .editor-view.is-mobile-layout.mobile-immersive-mode .editor-mobile-hint,
    .assembly-view.is-mobile-layout.mobile-immersive-mode .assembly-mobile-hint {
        display: none;
    }

    .editor-view.is-mobile-layout.is-landscape-layout .editor-body {
        grid-template-columns: 72px minmax(0, 1fr) minmax(220px, 30%);
        grid-template-rows: minmax(0, 1fr);
        overflow: hidden;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-body:has(.editor-panel.collapsed) {
        grid-template-columns: 72px minmax(0, 1fr) 44px;
    }

    .editor-view.is-mobile-layout.is-landscape-layout.editor-panel-open .editor-body {
        grid-template-columns: 72px minmax(0, 1fr) minmax(220px, 30%);
    }

    .editor-view.is-mobile-layout.is-landscape-layout.editor-panel-open .editor-body:has(.editor-panel.collapsed) {
        grid-template-columns: 72px minmax(0, 1fr) 44px;
    }

    .editor-view.is-mobile-layout.is-landscape-layout .editor-tools,
    .editor-view.is-mobile-layout.is-landscape-layout .editor-canvas-wrap,
    .editor-view.is-mobile-layout.is-landscape-layout .editor-panel {
        grid-row: 1;
        min-height: 0;
        min-width: 0;
    }

    .editor-view.is-mobile-layout.is-landscape-layout .editor-canvas-wrap {
        overflow: hidden;
        touch-action: none;
    }

    .editor-view.is-mobile-layout.is-landscape-layout .editor-canvas {
        touch-action: none;
    }

    .editor-view.is-mobile-layout.is-landscape-layout:not(.mobile-simulated-landscape) .editor-tools {
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        max-height: none;
        padding: 4px 2px;
        gap: 4px;
        border-bottom: 0;
        border-right: 1px solid #dbe3ee;
        touch-action: none;
    }

    .editor-view.is-mobile-layout.is-landscape-layout .editor-tool-button {
        min-height: 38px;
        width: 100%;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 2px;
        touch-action: manipulation;
        pointer-events: auto;
    }

    .editor-view.is-mobile-layout.is-landscape-layout .editor-tool-button[data-tool="replace"] {
        grid-column: auto;
        flex-direction: column;
        min-height: 38px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-panel {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        align-self: stretch;
        max-height: none !important;
        height: 100%;
        min-height: 0;
        border-top: 0;
        border-left: 1px solid #dbe3ee;
        touch-action: none;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-panel.collapsed {
        width: 44px;
        min-width: 44px;
        max-width: 44px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-panel.collapsed .editor-panel-body {
        display: none !important;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-panel-head {
        flex-shrink: 0;
        padding: 6px 8px;
    }

    .editor-view.is-mobile-layout.is-landscape-layout:not(.mobile-simulated-landscape) .editor-panel:not(.collapsed) .editor-panel-body {
        display: flex;
        flex-direction: column;
        flex: 1 1 0;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: none;
        overscroll-behavior: contain;
        padding: 10px;
        gap: 10px;
    }

    .editor-view.is-mobile-layout.mobile-simulated-landscape .editor-panel:not(.collapsed) .editor-panel-body {
        display: flex;
        flex-direction: column;
        flex: 1 1 0;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: none;
        overscroll-behavior: contain;
        padding: 10px;
        gap: 10px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-color-panel {
        flex: 0 0 auto;
        min-height: 0;
        max-height: none;
        display: grid;
        gap: 8px;
        overflow: visible;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-color-panel h4 {
        margin: 0;
        font-size: 12px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-current-color {
        grid-template-columns: 28px minmax(0, 1fr);
        gap: 6px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-palette-search {
        min-height: 28px;
        padding: 4px 8px;
        font-size: 12px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-palette-list {
        max-height: 200px;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: none;
        overscroll-behavior: contain;
        grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
        gap: 6px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-palette-list .palette-color {
        padding: 4px 2px;
        font-size: 10px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-palette-list .palette-color .color-swatch {
        width: 24px;
        height: 24px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-panel-block-legend {
        flex: 0 0 auto;
        min-height: 0;
        display: grid;
        gap: 8px;
        overflow: visible;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-panel-block-legend h4 {
        margin: 0;
        flex-shrink: 0;
        font-size: 12px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-legend-list {
        max-height: 200px;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: none;
        overscroll-behavior: contain;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-panel-block-meta {
        display: grid;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-panel-block:has(#editorShowGrid) {
        flex: 0 0 auto;
        gap: 4px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-panel-block:has(#editorShowGrid) h4 {
        margin: 0;
        font-size: 12px;
    }

    .editor-view.is-mobile-layout:is(.is-landscape-layout, .mobile-simulated-landscape) .editor-panel-block:has(#editorShowGrid) .check-label {
        font-size: 11px;
    }

    .editor-view.is-mobile-layout.is-landscape-layout .editor-mobile-zoom-fab {
        bottom: 8px;
        right: 8px;
    }

    .assembly-view.is-mobile-layout.is-landscape-layout .assembly-topbar,
    .assembly-view.is-mobile-layout.mobile-immersive-mode .assembly-topbar {
        padding: 4px 10px;
    }

    .assembly-view.is-mobile-layout.is-landscape-layout .assembly-topbar-actions,
    .assembly-view.is-mobile-layout.mobile-immersive-mode .assembly-topbar-actions {
        width: auto;
        flex-wrap: nowrap;
    }

    .assembly-view.is-phone-dock .assembly-dock-row-primary {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        align-items: stretch;
    }

    .assembly-view.is-phone-dock .assembly-dock-modes {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .assembly-view.is-phone-dock .assembly-dock-more-group .assembly-dock-actions {
        display: grid;
        grid-column: 1 / -1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .assembly-view.is-phone-dock .assembly-mode-btn {
        width: 100%;
        min-height: 44px;
        display: inline-flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 2px;
        padding: 0 6px;
        font-size: 11px;
        line-height: 1.2;
        white-space: nowrap;
        letter-spacing: 0;
    }

    .assembly-view.is-phone-dock .assembly-more-toggle {
        grid-column: 1 / -1;
        font-size: 11px;
        letter-spacing: 0;
    }

    .assembly-view.is-phone-dock .assembly-dock-extras {
        grid-column: 1 / -1;
        display: flex;
        flex-wrap: wrap;
        justify-content: stretch;
        gap: 6px;
    }

    .assembly-view.is-phone-dock .assembly-dock-extras .assembly-mode-btn,
    .assembly-view.is-phone-dock .assembly-dock-extras .assembly-dock-action,
    .assembly-view.is-phone-dock .assembly-dock-extras .assembly-display-select {
        flex: 1 1 calc(50% - 3px);
        min-height: 44px;
    }

    .assembly-view.is-phone-dock .assembly-dock-mark-inline,
    .assembly-view.is-phone-dock .assembly-lock-inline {
        grid-column: 1 / -1;
    }

    .assembly-view.is-mobile-layout.is-landscape-layout .assembly-dock-more-group,
    .assembly-view.is-mobile-layout.mobile-simulated-landscape .assembly-dock-more-group {
        display: contents;
    }

    .assembly-view.is-mobile-layout.is-landscape-layout .assembly-more-toggle,
    .assembly-view.is-mobile-layout.mobile-simulated-landscape .assembly-more-toggle,
    .assembly-view.is-mobile-layout.landscape-mode-on .assembly-more-toggle {
        display: none;
    }

    .assembly-view.is-mobile-layout:is(.is-landscape-layout, .landscape-mode-on) .assembly-dock-mark-inline,
    .assembly-view.is-mobile-layout.mobile-immersive-mode .assembly-dock-mark-inline {
        flex-basis: auto;
        order: 0;
    }

    .assembly-landscape-btn.is-active,
    .assembly-view .mobile-landscape-btn.is-active {
        color: #93c5fd;
        border-color: #2563eb;
        background: rgba(37, 99, 235, 0.25);
    }

    .assembly-view.is-mobile-layout .assembly-landscape-btn,
    .assembly-view.is-mobile-layout .mobile-landscape-btn:not(.hidden) {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* 手机竖屏开工页：单行顶栏 + 底部方案 A（横屏/平板走下方 landscape 规则，等同桌面） */
    .assembly-view.is-phone-dock .assembly-topbar {
        flex-wrap: nowrap;
        align-items: center;
        gap: 4px;
        padding: calc(4px + env(safe-area-inset-top, 0px)) 8px 4px 8px;
    }

    .assembly-view.is-phone-dock .assembly-back-btn {
        flex-shrink: 0;
        min-height: 34px;
        padding: 0 8px;
        font-size: 12px;
    }

    .assembly-view.is-phone-dock .assembly-topbar-center {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 4px;
    }

    .assembly-view.is-phone-dock .assembly-top-title {
        font-size: 11px;
        line-height: 1.15;
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .assembly-view.is-phone-dock .assembly-progress-text {
        flex-shrink: 0;
        font-size: 9px;
        line-height: 1.1;
        color: #64748b;
        white-space: nowrap;
    }

    .assembly-view.is-phone-dock .assembly-progress-text::before {
        content: "·";
        margin-right: 3px;
        color: #475569;
    }

    .assembly-view.is-phone-dock .assembly-topbar-actions {
        width: auto;
        flex: 0 0 auto;
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 4px;
    }

    .assembly-view.is-phone-dock .assembly-topbar-chip-btn {
        flex-shrink: 0;
        min-width: auto;
        width: auto;
        min-height: 34px;
        height: auto;
        padding: 0 7px;
        font-size: 11px;
        line-height: 1.2;
        white-space: nowrap;
    }

    .assembly-view.is-phone-dock .assembly-topbar-actions .assembly-sync-status {
        margin-left: 0;
        width: 8px;
        height: 8px;
        min-width: 8px;
        min-height: 8px;
        padding: 0;
        font-size: 0;
        line-height: 0;
        overflow: hidden;
        border-radius: 999px;
    }

    .assembly-view.is-phone-dock .assembly-mobile-hint {
        top: calc(env(safe-area-inset-top, 0px) + 48px);
        font-size: 11px;
    }

    .assembly-view.is-phone-dock .assembly-dock-row-primary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .assembly-view.is-phone-dock .assembly-dock-more-group {
        display: none;
        grid-column: 1 / -1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        padding-top: 6px;
        border-top: 1px solid rgba(148, 163, 184, 0.12);
    }

    .assembly-view.is-phone-dock .assembly-dock.is-more-open .assembly-dock-more-group {
        display: grid;
    }

    .assembly-view.is-phone-dock .assembly-dock-more-group .assembly-dock-extras,
    .assembly-view.is-phone-dock .assembly-dock-more-group .assembly-dock-actions {
        display: contents;
    }

    .assembly-view.is-phone-dock .assembly-dock-more-group #assemblyFitBtn {
        grid-column: 1;
    }

    .assembly-view.is-phone-dock .assembly-dock-more-group .assembly-display-select {
        grid-column: 2;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 4px;
        min-height: 38px;
        padding: 0 8px;
        border: 1px solid rgba(148, 163, 184, 0.25);
        border-radius: 8px;
        background: rgba(15, 23, 42, 0.6);
        font-size: 10px;
        white-space: nowrap;
    }

    .assembly-view.is-phone-dock .assembly-dock-more-group .assembly-display-select select {
        flex: 1;
        min-width: 0;
        min-height: 28px;
        font-size: 11px;
    }

    .assembly-view.is-phone-dock .assembly-dock-more-group #assemblyResetAssistButton {
        grid-column: 1 / -1;
    }

    .assembly-view.is-phone-dock .assembly-dock-more-group #assemblyResetProgressButton {
        grid-column: 1;
    }

    .assembly-view.is-phone-dock .assembly-dock-more-group #assemblyLegendToggle {
        grid-column: 2;
    }

    .assembly-view.is-phone-dock .assembly-dock-more-group .assembly-mode-btn,
    .assembly-view.is-phone-dock .assembly-dock-more-group .assembly-dock-action {
        width: 100%;
        min-height: 38px;
        padding: 0 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    .assembly-view.is-phone-dock .assembly-dock-mark-inline,
    .assembly-view.is-phone-dock .assembly-lock-inline {
        grid-column: 1 / -1;
    }

    .assembly-view.is-phone-dock .assembly-legend-drawer.is-open {
        max-height: min(32vh, 240px);
    }

    .mobile-step-tab,
    .project-detail-back,
    .project-detail-primary-btn,
    .project-detail-inline-actions button,
    .project-detail-secondary-actions button,
    .pattern-actions button,
    .preview-actions button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        line-height: 1.25;
    }

    .export-modal {
        place-items: end center;
    }

    .export-modal-card {
        width: 100%;
        max-width: 100%;
        max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top, 0px)));
        border-radius: 16px 16px 0 0;
        padding: 16px;
        margin: 0;
    }

    .export-modal-head {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .export-modal-head button {
        align-self: flex-end;
    }

    .export-primary-actions {
        grid-template-columns: 1fr;
    }

    .export-primary-btn {
        min-height: 56px;
    }

    .project-detail-drawer,
    .project-detail-content {
        min-width: 0;
        max-width: 100%;
    }

    .project-layout.project-mobile-detail .project-detail-drawer {
        width: 100%;
        max-width: 100%;
    }

    .project-detail-name-input {
        min-width: 0;
        width: 100%;
    }

    .project-detail-title-row {
        flex-direction: column;
        align-items: stretch;
    }

    .project-detail-inline-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .project-detail-inline-actions button {
        width: 100%;
        min-height: 42px;
    }

    .project-detail-actions-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .project-detail-actions-bar button {
        width: 100%;
    }

    .project-detail-preview-toolbar + .project-detail-media,
    .project-detail-media {
        max-width: 100%;
        overflow: hidden;
    }

    .project-detail-media canvas,
    .project-detail-media img {
        max-width: 100%;
        height: auto;
    }

    .admin-filter-bar {
        grid-template-columns: 1fr;
    }

    .admin-visual-list {
        grid-template-columns: 1fr;
    }

    .settings-layout {
        grid-template-columns: 1fr;
    }

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

    .mobile-generate-fab:not(.hidden) {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: static;
        width: 100%;
        margin-top: 10px;
        box-shadow: none;
    }

    .onboarding-banner {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 640px) {
    .auth-screen,
    .content {
        padding: 12px;
    }

    .content {
        padding-bottom: calc(122px + env(safe-area-inset-bottom, 0px));
    }

    .auth-screen {
        width: calc(100% - 24px);
        margin: 12px auto;
    }

    .auth-brand {
        min-height: 260px;
        padding: 20px;
    }

    .auth-brand h1 {
        font-size: 28px;
    }

    .panel {
        padding: 14px;
        min-width: 0;
        max-width: 100%;
    }

    .section-grid,
    .workspace-layout {
        min-width: 0;
        max-width: 100%;
    }

    .pattern-summary-stats {
        grid-template-columns: 1fr;
    }

    .pattern-summary-layout {
        flex-direction: column;
        align-items: flex-start;
    }

    .pattern-ratio-preview {
        flex-direction: column;
        align-items: flex-start;
    }

    .preview-rotation-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .image-rotation-buttons {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .toolbar,
    .upload-form,
    .upload-form-pick,
    .settings-grid,
    .workspace-generate-panel .settings-size,
    .workspace-generate-panel .settings-palette,
    .inline-form {
        grid-template-columns: 1fr;
    }

    .bead-size-inline {
        align-items: stretch;
        flex-direction: column;
    }

    .bead-size-select {
        width: 100%;
    }

    .upload-result,
    .upload-pending {
        grid-template-columns: 1fr;
    }

    .upload-result img,
    .upload-pending img {
        width: 100%;
        height: auto;
        max-height: 180px;
    }

    .upload-pending-actions,
    .pattern-actions {
        flex-direction: column;
    }

    .upload-pending-actions button,
    .pattern-actions button {
        width: 100%;
    }

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

    .current-source-hint {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        box-sizing: border-box;
    }

    .current-source-hint .current-source-meta {
        width: 100%;
    }

    .current-source-hint .current-source-name {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        text-overflow: clip;
        display: inline;
    }

    .project-list-header {
        gap: 8px;
    }

    .project-list-create-actions {
        grid-template-columns: 1fr 1fr;
    }

    .project-detail-actions {
        grid-template-columns: 1fr;
    }

    .admin-tabs {
        display: grid;
        gap: 10px;
        overflow: visible;
    }

    .admin-tab-group {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
        gap: 8px;
        align-items: stretch;
    }

    .admin-tab-group-title {
        grid-column: 1 / -1;
        min-width: 0;
    }

    .admin-tab {
        width: 100%;
        white-space: nowrap;
        justify-content: center;
    }

    .admin-account-controls {
        grid-template-columns: 1fr;
    }

    .admin-detail-preview-wrap {
        grid-template-columns: 1fr;
    }

    button,
    .button-like {
        min-height: 44px;
    }
}

.share-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
}

.share-modal.hidden {
    display: none;
}

.share-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(3px);
}

.share-modal-card {
    position: relative;
    width: min(620px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding: 0;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.share-modal-head {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.share-modal-head {
    padding: 18px 20px;
    border-bottom: 1px solid #e5ebf3;
    background: #f8fafc;
}

.share-modal-head h3 {
    margin: 2px 0 0;
    color: #0f172a;
    font-size: 18px;
    line-height: 1.3;
}

.share-modal-eyebrow {
    margin: 0;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.share-form {
    display: grid;
    gap: 14px;
    padding: 18px 20px 0;
}

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

.share-toggle-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    min-height: 76px;
    padding: 12px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
}

.share-toggle-card input {
    margin-top: 2px;
}

.share-toggle-card span {
    display: grid;
    gap: 4px;
}

.share-toggle-card strong {
    color: #0f172a;
    font-size: 14px;
}

.share-toggle-card small,
.share-field-hint {
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
}

.share-password-panel {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #f8fbff;
}

.share-password-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.share-password-panel-head strong {
    color: #0f172a;
    font-size: 14px;
}

.share-password-state {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.share-password-state.is-locked {
    color: #9f1239;
    background: #fff1f2;
    border: 1px solid #fecdd3;
}

.share-password-state.is-open {
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}

.share-password-field {
    gap: 6px;
}

.share-clear-password {
    min-height: 36px;
    padding: 8px 10px;
    border: 1px dashed #fca5a5;
    border-radius: 8px;
    background: #fff7f7;
    color: #991b1b;
}

.share-field-hint {
    margin: -2px 0 0;
}

.share-field-hint.warning {
    color: #b45309;
}

.share-result {
    display: grid;
    gap: 12px;
    margin: 12px 20px 20px;
    padding: 12px;
    border: 1px solid #e5ebf3;
    border-radius: 8px;
    background: #f8fafc;
}

.share-modal-card > .message {
    margin: 12px 20px 0;
}

.share-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.button-link {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border-radius: 6px;
    color: #ffffff;
    background: #2563eb;
    text-decoration: none;
}

@media (max-width: 640px) {
    .share-modal-card {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
    }

    .share-modal-head {
        align-items: flex-start;
        padding: 16px;
    }

    .share-option-grid {
        grid-template-columns: 1fr;
    }

    .share-form {
        padding: 16px 16px 0;
    }

    .share-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .share-actions button,
    .share-actions .button-link {
        width: 100%;
    }

    .share-result {
        margin: 12px 16px 16px;
    }

    .share-modal-card > .message {
        margin: 12px 16px 0;
    }
}

.share-page {
    min-height: 100vh;
    padding: 20px 24px 32px;
}

.share-page-card {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 16px 20px 20px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
}

.share-password-card {
    width: min(460px, 100%);
    margin-top: min(12vh, 88px);
    padding: 22px;
}

.share-password-head {
    margin-bottom: 18px;
}

.share-password-form {
    display: grid;
    gap: 12px;
}

.share-password-form label {
    display: grid;
    gap: 6px;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
}

.share-password-form input {
    min-height: 44px;
    width: 100%;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
}

.share-password-form button {
    min-height: 44px;
    width: 100%;
    font-weight: 700;
}

.share-page-head {
    display: grid;
    gap: 6px;
    margin-bottom: 8px;
}

.share-page-head-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.share-page-head-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 0;
}

.share-page-eyebrow {
    margin: 0;
    color: #64748b;
    font-size: 12px;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.share-page-eyebrow::after {
    content: "·";
    margin-left: 8px;
    color: #cbd5e1;
}

.share-page-meta-inline {
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.share-page-head-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.share-page-title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    font-size: clamp(16px, 2vw, 20px);
    line-height: 1.3;
    font-weight: 700;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.share-page-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.share-page-preview {
    display: grid;
    gap: 6px;
}

.share-page-viewbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 14px;
}

.share-page-viewbar-toggles {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.share-zoom-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.share-zoom-btn {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

.share-zoom-label {
    min-width: 3.2em;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: #64748b;
    text-align: center;
}

.share-view-hint {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    color: #94a3b8;
}

.share-check-compact {
    font-size: 13px;
    gap: 4px;
}

.share-download-button {
    flex-shrink: 0;
    min-height: 32px;
    padding: 0 12px;
    font-size: 13px;
}

.share-page-promo {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #64748b;
    text-align: right;
    white-space: nowrap;
}

.share-page-promo strong {
    color: #334155;
    font-weight: 600;
}

.share-page-body {
    display: grid;
    gap: 14px;
}

.share-page-canvas-wrap {
    position: relative;
    width: 100%;
    height: min(68vh, 720px);
    min-height: 280px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #f1f5f9;
    overflow: hidden;
    touch-action: none;
    cursor: grab;
    user-select: none;
}

.share-page-canvas-wrap:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.share-page-canvas-wrap.is-panning {
    cursor: grabbing;
}

#shareCanvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 4px;
    background: transparent;
    transform: none;
    pointer-events: none;
}

.share-page-promo a {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.share-page-promo a:hover {
    text-decoration: underline;
}

.share-page-promo-static {
    margin-top: 12px;
    text-align: left;
}

.share-page-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.share-summary-item {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #fbfdff;
    text-align: center;
}

.share-summary-label {
    font-size: 12px;
    color: #64748b;
}

.share-summary-item strong {
    font-size: 15px;
    color: #1e293b;
}

.share-page-legend-section {
    display: grid;
    gap: 12px;
}

.share-legend-title {
    margin: 0;
    font-size: 16px;
    color: #334155;
}

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

.share-legend-item {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #fbfdff;
}

.share-legend-swatch {
    width: 32px;
    height: 32px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.share-legend-text {
    display: grid;
    gap: 2px;
    min-width: 0;
    font-size: 12px;
    line-height: 1.4;
    color: #475569;
}

.share-legend-text strong {
    color: #1e293b;
    font-size: 13px;
}

@media (max-width: 640px) {
    .share-page {
        padding: 12px 12px 20px;
    }

    .share-page-card {
        padding: 12px 14px 16px;
    }

    .share-password-card {
        margin-top: 8vh;
        padding: 18px;
    }

    .share-page-head-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .share-page-head-line {
        flex-wrap: wrap;
        white-space: normal;
    }

    .share-page-meta-inline {
        white-space: normal;
    }

    .share-page-promo {
        text-align: left;
        white-space: normal;
    }

    .share-page-head-main {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .share-download-button {
        align-self: flex-start;
    }

    .share-page-canvas-wrap {
        height: min(62vh, 560px);
        min-height: 240px;
    }

    .share-page-viewbar {
        gap: 8px;
    }

    .share-zoom-controls {
        width: 100%;
    }

    .share-legend-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

.export-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
}

.export-modal.hidden {
    display: none;
}

.export-modal-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(15, 23, 42, 0.45);
}

.export-modal-card {
    position: relative;
    z-index: 1;
    width: min(640px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #dbe3ee;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    padding: 24px;
}

.export-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.export-modal-subtitle {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: #64748b;
}

.export-preview-panel {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    background: #f8fafc;
}

.export-preview-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    font-size: 13px;
}

.export-preview-row-contents {
    align-items: center;
}

.export-preview-label {
    color: #64748b;
}

.export-preview-value {
    color: #0f172a;
    word-break: break-all;
}

.export-preview-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.export-preview-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    line-height: 1.6;
}

.export-settings {
    margin-bottom: 12px;
    padding: 16px;
    border: 1px solid #e5ebf3;
    border-radius: 12px;
    background: #ffffff;
}

.export-settings-title {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.export-form-section {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.export-form-section-inline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.export-form-section-inline #exportFileNameHint {
    grid-column: 1 / -1;
    order: 3;
    margin: -2px 0 2px;
}

.export-form-section-inline > .export-field:first-of-type {
    order: 1;
}

.export-form-section-inline > .export-field:last-of-type {
    order: 2;
}

.export-option-block {
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid #edf1f7;
    border-radius: 10px;
    background: #f8fafc;
}

.export-option-block-title {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.export-primary-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.export-primary-btn {
    display: grid;
    gap: 4px;
    align-items: start;
    min-height: 72px;
    padding: 14px 16px;
    text-align: left;
    border-radius: 12px;
    border: 1px solid #dbe3ee;
    background: #ffffff;
    color: #0f172a;
}

.export-primary-btn:hover:not(:disabled) {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
}

.export-primary-btn-pdf {
    border-color: #dbe3ee;
    background: #ffffff;
    color: #0f172a;
}

.export-primary-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.export-primary-desc {
    font-size: 12px;
    line-height: 1.5;
    color: #64748b;
}

.export-primary-btn:hover:not(:disabled) .export-primary-desc {
    color: rgba(255, 255, 255, 0.88);
}

.export-primary-btn-pdf .export-primary-desc {
    color: #64748b;
}

.export-advanced {
    margin-bottom: 12px;
    border: 1px solid #e5ebf3;
    border-radius: 12px;
    background: #ffffff;
}

.export-advanced > summary {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    list-style: none;
}

.export-advanced > summary::-webkit-details-marker {
    display: none;
}

.export-advanced > summary::before {
    content: "▸ ";
    color: #64748b;
}

.export-advanced[open] > summary::before {
    content: "▾ ";
}

.export-advanced .export-form {
    padding: 0 16px 16px;
    border-top: 1px solid #edf1f7;
}

.export-advanced .export-actions {
    margin-top: 12px;
    padding-top: 12px;
}

.export-form > label {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
}

.export-pdf-options,
.export-png-options {
    margin: 16px 0;
    padding: 16px;
    border: 1px solid #e5ebf3;
    border-radius: 12px;
    background: #f8fafc;
}

.export-pdf-options h4,
.export-png-options h4 {
    margin: 0 0 12px;
    font-size: 14px;
    color: #334155;
}

.export-pdf-settings {
    display: grid;
    gap: 16px;
}

.export-field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.export-field {
    display: grid;
    gap: 6px;
    margin: 0;
}

.export-field-label {
    font-size: 14px;
    color: #4b5563;
}

.export-format-desc {
    margin: -4px 0 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #64748b;
}

.export-option-note {
    margin: 4px 0 12px;
    padding: 0;
    font-size: 12px;
    line-height: 1.5;
    color: #94a3b8;
    background: transparent;
    border: none;
}

.export-option-block .export-option-note {
    margin: 10px 0 0;
    line-height: 1.6;
}

.export-major-grid-field {
    margin-top: 12px;
}

.export-checkbox-group {
    margin: 0;
    padding: 12px 14px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
}

.export-checkbox-group legend {
    padding: 0 6px;
    font-size: 13px;
    color: #64748b;
}

.export-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
}

.export-form .check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    min-height: 32px;
    font-size: 14px;
    color: #334155;
    cursor: pointer;
}

.export-form .check-label input {
    width: auto;
    min-height: auto;
    margin: 0;
    flex-shrink: 0;
}

.export-form .check-label span {
    line-height: 1.4;
}

.export-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5ebf3;
}

@media (max-width: 520px) {
    .export-field-row,
    .export-checkbox-grid,
    .export-form-section-inline {
        grid-template-columns: 1fr;
    }

    .export-form-section-inline #exportFileNameHint {
        order: 2;
    }

    .export-form-section-inline > .export-field:last-of-type {
        order: 3;
    }
}

.export-result {
    margin-top: 12px;
    padding: 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e5ebf3;
    line-height: 1.7;
}

/* UX enhancements */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: grid;
    gap: 10px;
    max-width: min(360px, calc(100vw - 32px));
}

@media (max-width: 900px) and ((hover: none) or (pointer: coarse)), (max-width: 767px), ((max-height: 520px) and (max-width: 1100px) and ((hover: none) or (pointer: coarse))) {
    .toast-container {
        top: calc(12px + env(safe-area-inset-top, 0px));
        right: auto;
        left: 50%;
        bottom: auto;
        transform: translateX(-50%);
        max-width: min(360px, calc(100vw - 24px));
    }

    .toast {
        transform: translateY(-8px);
    }

    .toast.show {
        transform: translateY(0);
    }
}

.toast {
    padding: 12px 16px;
    border-radius: 8px;
    color: #ffffff;
    background: #334155;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-ok { background: #15803d; }
.toast-error { background: #b91c1c; }
.toast-info { background: #2563eb; }

.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    place-items: center;
}

.confirm-modal.hidden { display: none; }

.confirm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.confirm-modal-card {
    position: relative;
    width: min(420px, calc(100vw - 32px));
    padding: 24px;
    border-radius: 8px;
    border: 1px solid #dbe3ee;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.confirm-modal-card h3 { margin: 0 0 10px; }
.confirm-modal-card p { margin: 0 0 18px; color: #475569; line-height: 1.6; }

.confirm-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.confirm-modal-input {
    margin-bottom: 12px;
}

.confirm-modal-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

.confirm-modal-card .message {
    margin: 0 0 12px;
}

.onboarding-banner {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e3a8a;
}

.onboarding-banner span {
    display: block;
    margin-top: 4px;
    color: #475569;
    font-size: 14px;
}

.upload-drop-zone {
    padding: 12px;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-drop-zone.drag-over {
    border-color: #2563eb;
    background: #eff6ff;
}

.upload-drop-zone-disabled {
    opacity: 0.55;
    pointer-events: none;
    cursor: not-allowed;
}

.upload-drop-zone-disabled .file-input {
    pointer-events: none;
}

.upload-hint { margin: 8px 0 0; }

.current-source-hint {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e40af;
    font-size: 14px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.current-source-hint .current-source-thumb {
    flex: 0 0 48px;
}

.current-source-hint .current-source-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 6px;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.current-source-hint .current-source-name {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.current-source-hint .current-source-size {
    flex: 0 0 auto;
    opacity: 0.9;
}

.advanced-settings {
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #fbfdff;
}

.advanced-settings summary {
    cursor: pointer;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    list-style: none;
}

.advanced-settings summary::-webkit-details-marker {
    display: none;
}

.advanced-settings summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 6px;
    color: #94a3b8;
    transition: transform 0.15s ease;
}

.advanced-settings[open] summary::before {
    transform: rotate(90deg);
}

.advanced-settings-intro {
    margin: 0 0 8px;
    font-size: 12px;
}

.advanced-settings[open] summary { margin-bottom: 6px; }

.advanced-settings-groups {
    display: grid;
    gap: 8px;
}

.advanced-settings-group {
    padding: 8px 10px;
    border: 1px solid #e8eef5;
    border-radius: 6px;
    background: #fff;
}

.advanced-settings-group-title {
    margin: 0 0 6px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.advanced-settings-grid {
    gap: 8px !important;
    margin-bottom: 0 !important;
}

.advanced-settings-grid .setting-field {
    display: grid;
    gap: 4px;
}

.advanced-settings-grid .setting-field-span {
    grid-column: 1 / -1;
}

.setting-field-label {
    color: #334155;
    font-size: 13px;
    font-weight: 600;
}

.setting-field-hint {
    color: #94a3b8;
    font-size: 11px;
    line-height: 1.4;
}

.pattern-summary-panel {
    margin: 4px 0 8px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.pattern-summary-layout {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.pattern-summary-meta {
    display: grid;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.pattern-summary-meta > strong {
    color: #1e293b;
    font-size: 14px;
}

.pattern-summary-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
}

.pattern-summary-stats > div {
    display: grid;
    gap: 2px;
}

.pattern-summary-stats span {
    color: #64748b;
    font-size: 11px;
}

.pattern-summary-stats strong {
    color: #1e293b;
    font-size: 14px;
    font-weight: 600;
}

.pattern-summary-extra {
    margin: 0;
    color: #94a3b8;
    font-size: 11px;
}

.pattern-ratio-preview {
    display: flex;
    gap: 14px;
    align-items: center;
    margin: 10px 0 12px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.pattern-ratio-shape {
    flex: 0 0 auto;
    width: 96px;
    height: 96px;
    border: 2px solid #2563eb;
    border-radius: 6px;
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.pattern-ratio-shape.is-warning {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fde68a 0%, #fffbeb 100%);
}

.pattern-ratio-shape.is-extreme {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fecaca 0%, #fef2f2 100%);
}

.pattern-ratio-meta {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.pattern-ratio-meta strong {
    color: #1e293b;
    font-size: 15px;
}

.pattern-ratio-size {
    color: #64748b;
    font-size: 13px;
}

.pattern-ratio-warning {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

.pattern-ratio-warning.warn {
    color: #b45309;
}

.pattern-ratio-warning.danger {
    color: #b91c1c;
}

.preview-rotation-toolbar {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    justify-content: stretch;
    padding: 12px 16px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #ffffff;
    min-width: 0;
    max-width: 100%;
}

.preview-rotation-title {
    display: grid;
    gap: 2px;
}

.preview-rotation-title strong {
    color: #0f172a;
    font-size: 14px;
}

.preview-rotation-title span {
    color: #64748b;
    font-size: 12px;
}

.image-rotation-buttons {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
}

.rotation-option {
    min-height: 34px;
    min-width: 0;
    padding: 7px 6px;
    border: 0;
    border-right: 1px solid #dbe3ee;
    border-radius: 0;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    white-space: normal;
    line-height: 1.25;
}

.rotation-option:last-child {
    border-right: 0;
}

.rotation-option:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.rotation-option:active {
    transform: translateY(1px);
}

.rotation-option.secondary {
    background: #f8fafc;
    color: #475569;
}

.rotation-option.secondary:hover {
    background: #eef2f7;
}

.rotation-option.active {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.generate-estimate-panel {
    margin: 0 0 12px;
    padding: 12px 14px;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    background: #f8fbff;
}

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

.generate-estimate-grid > div {
    display: grid;
    gap: 4px;
}

.generate-estimate-grid span {
    color: #64748b;
    font-size: 12px;
}

.generate-estimate-grid strong {
    color: #1e293b;
    font-size: 15px;
}

.generate-estimate-extra {
    margin: 10px 0 0;
}

.generate-estimate { margin: 0 0 12px; }

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

.pattern-actions button:first-child { flex: 1; min-width: 140px; }

.focus-highlight {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.24);
    border-radius: 12px;
}

.project-layout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

.project-layout.project-desktop {
    min-height: calc(100dvh - 108px);
}

.project-sort-label {
    display: block;
    margin: 0;
    font-size: 0;
}

.project-sort-label select {
    min-width: 118px;
    min-height: 38px;
    padding: 6px 28px 6px 10px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    font-size: 13px;
}

@container project-list (max-width: 999px) {
    .project-list-filters {
        grid-template-columns: 1fr;
    }

    .project-search {
        width: 100%;
    }

    .project-sort-label {
        min-width: 0;
        width: 100%;
    }

    .project-sort-label select {
        min-width: 0;
        width: 100%;
        max-width: none;
    }
}

.project-detail-topbar {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 8px 0 10px;
    background: linear-gradient(180deg, #ffffff 85%, rgba(255, 255, 255, 0));
}

.project-detail-back {
    display: none;
    width: fit-content;
    align-items: center;
    justify-content: center;
    line-height: 1.25;
    text-align: center;
    box-sizing: border-box;
}

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

.project-detail-inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.project-detail-inline-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.25;
    min-height: 38px;
}

.project-detail-name-input {
    flex: 1;
    min-width: 160px;
}

.project-detail-hero {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.project-detail-primary-btn {
    min-height: 44px;
    font-size: 15px;
    font-weight: 700;
}

.project-detail-secondary-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.project-detail-preview-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 10px;
}

.project-detail-legend-section {
    margin-top: 18px;
}

.project-detail-legend-section h3 {
    margin: 0 0 12px;
}

.project-reference-panel {
    margin-top: 4px;
    padding: 10px 12px;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #fbfdff;
}

.project-reference-panel summary {
    cursor: pointer;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
}

.project-list-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    padding: 12px;
    overflow: hidden;
    container-type: inline-size;
    container-name: project-list;
}

#projectView .project-list-panel {
    padding: 12px;
    min-width: 0;
}

#projectView .project-list-panel h3 {
    margin: 0;
}

.project-list-header {
    display: grid;
    gap: 8px;
    flex-shrink: 0;
    margin-bottom: 6px;
}

.project-list-scroll {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.project-list-scroll::-webkit-scrollbar {
    width: 4px;
}

.project-list-scroll::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.35);
}

.project-list-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.project-list-batch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 2;
    flex-shrink: 0;
    padding: 0 0 4px;
    margin: 0;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
}

.project-list-controls,
.project-list-viewport,
.project-list-listhead,
.project-list-stack {
    display: none;
}

.project-batch-select-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    min-height: 24px;
    padding: 0;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.project-batch-select-all input {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #2563eb;
}

.project-batch-select-all:has(input:disabled) {
    opacity: 0.45;
    cursor: not-allowed;
}

.project-batch-delete {
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #ffffff;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.project-batch-delete:not(:disabled) {
    border-color: #fecaca;
    color: #dc2626;
    background: #ffffff;
}

.project-batch-delete:not(:disabled):hover {
    background: #fef2f2;
}

.project-batch-delete:disabled {
    border-color: #e8eef5;
    background: #f8fafc;
    color: #b0bcc9;
    cursor: not-allowed;
}

.project-list-message {
    margin: 0;
    min-height: 0;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 6px;
}

.project-list-message:empty,
.project-list-scroll > .message:empty,
#recycleListMessage:empty {
    display: none;
    margin: 0;
    min-height: 0;
    padding: 0;
}

.project-list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.project-toolbar-btn {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.project-list-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.project-list-create-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.project-create-primary,
.project-create-secondary {
    min-height: 38px;
    font-size: 13px;
    font-weight: 600;
}

.project-list-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.project-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}

.project-list-header h3 {
    margin: 0;
    font-size: 16px;
}

.project-search {
    width: 100%;
    min-height: 38px;
}

.project-empty-state {
    display: grid;
    gap: 6px;
    place-content: center;
    min-height: 160px;
    padding: 20px 12px;
    text-align: center;
    color: #64748b;
    border: 1px dashed #dbe3ee;
    border-radius: 10px;
    background: #f8fafc;
}

.project-empty-state strong {
    color: #334155;
    font-size: 15px;
}

.project-empty-state p {
    margin: 0;
    font-size: 13px;
}

.project-empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.project-detail-drawer {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.project-detail-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
}

.project-detail-placeholder {
    display: grid;
    flex: 1;
    place-content: center;
    gap: 8px;
    min-height: 320px;
    padding: 32px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #64748b;
    text-align: center;
}

.project-detail-placeholder strong {
    color: #334155;
    font-size: 18px;
}

.project-detail-content.hidden {
    display: none;
}

.project-detail-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.project-detail-header h3 {
    margin: 0;
}

.project-detail-actions-bar {
    display: none;
}

.project-detail-header {
    display: none;
}

.project-detail-actions {
    display: none;
}

.project-detail-side {
    display: grid;
    gap: 12px;
    align-content: start;
}

.project-detail-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.project-detail-legend {
    max-height: 280px;
    overflow-y: auto;
}

#projectView .project-check {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    min-height: auto;
    cursor: pointer;
}

#projectView .project-check input {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: #2563eb;
}

#projectView .project-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 8px 20px rgba(20, 31, 52, 0.08);
}

#projectView .project-card-info {
    display: none;
}

#projectView .project-card.active {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

#projectView .project-card:has(.project-select:checked) {
    border-color: #93c5fd;
    background: #f8fbff;
}

.project-status-badge {
    display: inline-flex;
    width: fit-content;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 12px;
}

.upload-form-pick {
    grid-template-columns: 1fr;
    justify-items: start;
}

.upload-form-pick .file-name {
    justify-self: stretch;
    width: 100%;
}

.upload-pending {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    margin-top: 12px;
    padding: 14px;
    border: 1px solid #fde68a;
    border-radius: 8px;
    background: #fffbeb;
    overflow: hidden;
}

.upload-pending.hidden {
    display: none;
}

.upload-pending img {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border: 1px solid #fde68a;
    border-radius: 6px;
    background: #ffffff;
}

.local-preview-info {
    display: grid;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    color: #92400e;
    font-size: 14px;
}

.local-preview-info strong {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
}

.upload-pending-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.palette-toolbar {
    grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
}

.palette-browse-bar {
    display: grid;
    gap: 0;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid #e8eef5;
    border-radius: 12px;
    background: linear-gradient(180deg, #fafbfd 0%, #ffffff 100%);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.palette-browse-primary {
    display: grid;
    grid-template-columns: minmax(240px, 1.35fr) minmax(180px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.palette-browse-filters {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid #edf1f7;
}

.palette-main-filters {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid #edf1f7;
}

.palette-filter-label {
    padding-top: 7px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

.palette-field {
    display: grid;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
}

.palette-field-grow {
    min-width: 0;
}

.palette-field input,
.palette-field select,
.palette-search-input {
    width: 100%;
}

.palette-control-shell {
    position: relative;
}

.palette-control-shell::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;
    width: 7px;
    height: 7px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

.palette-select,
.palette-search-input {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.palette-select {
    appearance: none;
    padding-right: 36px;
    cursor: pointer;
}

.palette-select:hover,
.palette-search-input:hover {
    border-color: #93c5fd;
}

.palette-select:focus,
.palette-search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.palette-search-input {
    padding-left: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 11px center;
    -webkit-appearance: none;
    appearance: none;
}

.palette-search-input::-webkit-search-decoration,
.palette-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.palette-family-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.palette-family-chips.compact .palette-family-chip {
    min-height: 30px;
    padding: 0 10px 0 8px;
    font-size: 12px;
}

.palette-family-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 12px 0 8px;
    border: 1px solid #dbe3ee;
    border-radius: 999px;
    background: #ffffff;
    color: #475569;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.palette-family-chip:hover {
    border-color: #93c5fd;
    background: #f8fbff;
    color: #1e293b;
}

.palette-family-chip.active {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
    box-shadow: inset 0 0 0 1px #bfdbfe;
}

.palette-family-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    flex-shrink: 0;
}

.palette-family-dot.is-all {
    background: linear-gradient(135deg, #ef4444 0%, #eab308 35%, #22c55e 55%, #3b82f6 75%, #a855f7 100%);
}

.palette-family-chip[data-family="red"] .palette-family-dot { background: #ef4444; }
.palette-family-chip[data-family="orange"] .palette-family-dot { background: #f97316; }
.palette-family-chip[data-family="yellow"] .palette-family-dot { background: #eab308; }
.palette-family-chip[data-family="green"] .palette-family-dot { background: #22c55e; }
.palette-family-chip[data-family="cyan"] .palette-family-dot { background: #06b6d4; }
.palette-family-chip[data-family="blue"] .palette-family-dot { background: #3b82f6; }
.palette-family-chip[data-family="purple"] .palette-family-dot { background: #a855f7; }
.palette-family-chip[data-family="pink"] .palette-family-dot { background: #ec4899; }
.palette-family-chip[data-family="brown"] .palette-family-dot { background: #a16207; }
.palette-family-chip[data-family="gray"] .palette-family-dot { background: #94a3b8; }
.palette-family-chip[data-family="white"] .palette-family-dot { background: #ffffff; }
.palette-family-chip[data-family="black"] .palette-family-dot { background: #1e293b; }

.palette-bar-action {
    align-self: end;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    white-space: nowrap;
}

.palette-bar-action-short {
    display: none;
}

.palette-filter-drawer {
    border: 0;
}

.palette-filter-drawer > .palette-browse-filters,
.palette-filter-drawer > .palette-main-filters {
    display: grid;
}

.palette-filter-drawer > summary {
    display: none;
    list-style: none;
}

.palette-filter-drawer > summary::-webkit-details-marker {
    display: none;
}

.palette-toolbar-primary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.palette-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.palette-toolbar-scroll {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.palette-toolbar-more-trigger {
    display: none;
}

.palette-toolbar-secondary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.palette-colors-scroll {
    min-height: 0;
}

.palette-summary {
    margin: 0 0 14px;
}

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

.palette-tab {
    border: 1px solid #dbe3ef;
    background: #fff;
    color: #334155;
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
}

.palette-tab.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.palette-tab-panel.hidden {
    display: none;
}

.palette-empty-state {
    display: grid;
    gap: 8px;
    padding: 28px 24px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    color: #475569;
}

.palette-empty-state strong {
    color: #0f172a;
    font-size: 16px;
}

.palette-mine-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    max-width: 100%;
    min-width: 0;
}

.palette-sidebar {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    min-width: 0;
}

.palette-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.palette-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
}

.palette-sidebar-actions {
    display: grid;
    gap: 8px;
}

.palette-sidebar-actions button {
    width: 100%;
}

.palette-sidebar-list {
    display: grid;
    gap: 8px;
    max-height: 520px;
    overflow: auto;
}

.palette-sidebar-item {
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 12px;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.palette-sidebar-item:hover {
    border-color: #93c5fd;
}

.palette-sidebar-item.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px #2563eb;
    background: #eff6ff;
}

.palette-sidebar-item strong {
    font-size: 14px;
}

.palette-sidebar-item span {
    font-size: 12px;
    color: #64748b;
}

.palette-main {
    min-width: 0;
    max-width: 100%;
}

.palette-main-detail {
    display: grid;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.palette-main-header {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    min-width: 0;
}

.palette-main-title h4 {
    margin: 0 0 4px;
    font-size: 18px;
}

.palette-main-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-width: 0;
    max-width: 100%;
}

.palette-main-toolbar input[type="search"],
.palette-main-toolbar .palette-search-input {
    flex: 1 1 220px;
    min-width: min(180px, 100%);
}

.button-like {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    font-size: 14px;
}

.palette-danger-btn {
    color: #b91c1c;
    border-color: #fecaca;
}

.palette-add-panel {
    padding: 14px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: #f8fbff;
}

.palette-add-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.palette-add-form label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
}

.palette-add-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.palette-color-grid-browse {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.palette-quick-colors {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
}

.palette-quick-section h4 {
    margin: 0 0 8px;
    font-size: 13px;
    color: #64748b;
}

.palette-quick-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.palette-quick-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 4px 10px 4px 4px;
    border: 1px solid #dbe3ee;
    border-radius: 999px;
    background: #ffffff;
    color: #334155;
    font-size: 12px;
}

.palette-quick-chip .color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 999px;
}

.palette-color-card {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid #edf1f7;
    border-radius: 10px;
    background: #ffffff;
}

.palette-color-card.color-card-highlight,
.color-card-manage.color-card-highlight {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
    animation: palette-highlight-pulse 1.2s ease 2;
}

@keyframes palette-highlight-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18); }
    50% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.28); }
}

.palette-color-card-main {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.palette-color-card-main:hover,
.palette-color-card-main:focus,
.palette-color-card-main:active {
    color: inherit;
    background: transparent;
}

.palette-color-card-main:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
    border-radius: 8px;
}

.palette-color-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.palette-color-card-actions button {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

.palette-color-card-actions .is-favorite {
    color: #d97706;
    border-color: #fde68a;
    background: #fffbeb;
}

.hex-input-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.hex-preview-swatch {
    width: 36px;
    height: 36px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #f8fafc;
}

.field-hint {
    display: block;
    min-height: 18px;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.4;
    color: #64748b;
}

.field-hint.error {
    color: #b91c1c;
}

.field-hint.ok {
    color: #047857;
}

.palette-family-select {
    min-width: 132px;
}

.color-detail-preview {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    margin-bottom: 12px;
}

.color-detail-swatch {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    border: 1px solid #dbe3ee;
}

.color-detail-meta {
    display: grid;
    gap: 6px;
    font-size: 14px;
    color: #334155;
}

.color-detail-hex-field {
    display: grid;
    gap: 6px;
    margin-bottom: 4px;
}

.color-detail-hex-label {
    font-size: 13px;
    color: #64748b;
}

.color-detail-hex-copy {
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #f8fafc;
    color: #0f172a;
    font: inherit;
    font-size: 16px;
    letter-spacing: 0.02em;
}

.color-detail-hex-copy:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.admin-color-form-actions,
.admin-paste-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-paste-panel {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.admin-paste-panel.hidden {
    display: none;
}

.admin-paste-panel textarea {
    width: 100%;
    min-height: 110px;
    padding: 10px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

.admin-paste-preview {
    display: grid;
    gap: 6px;
    max-height: 180px;
    overflow: auto;
    font-size: 12px;
    color: #475569;
}

.admin-paste-preview .error-line {
    color: #b91c1c;
}

.palette-color-grid-manage {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 8px;
}

.palette-reorder-hint {
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
}

.color-card-manage {
    position: relative;
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.color-card-manage.color-card-reorderable {
    padding-top: 28px;
}

.color-drag-handle {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 6px;
    color: #94a3b8;
    background: transparent;
    font-size: 14px;
    line-height: 1;
    cursor: grab;
    touch-action: none;
}

.color-drag-handle:hover,
.color-drag-handle:focus-visible {
    color: #475569;
    background: #f1f5f9;
}

.color-card-manage.is-dragging {
    opacity: 1;
    transform: scale(1.02);
    border-color: #3b82f6;
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.22);
}

.color-card-manage.is-dragging-floating {
    position: fixed;
    z-index: 1200;
    margin: 0;
    pointer-events: none;
    will-change: left, top;
}

.color-card-placeholder {
    min-height: 120px;
    border-radius: 10px;
    border: 1px dashed #93c5fd;
    background: linear-gradient(135deg, rgba(219, 234, 254, 0.85), rgba(239, 246, 255, 0.92));
    transition: transform 180ms cubic-bezier(0.2, 0, 0.2, 1);
}

.palette-color-grid-manage.is-pointer-dragging .color-card-manage:not(.is-dragging-floating) {
    transition: transform 180ms cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.12s ease, border-color 0.12s ease;
}

.color-card-manage.is-drag-over {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.color-card-manage:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.color-card-manage button {
    min-height: unset;
    line-height: 1.3;
}

.color-card-main {
    display: grid;
    gap: 6px;
    width: 100%;
    padding: 0;
    border: none;
    border-radius: 0;
    color: #172033;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.color-card-main:hover,
.color-card-main:focus,
.color-card-main:active {
    color: #172033;
    background: transparent;
}

.color-card-main:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-radius: 8px;
}

.color-card-manage .color-swatch {
    width: 100%;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.color-card-info {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.color-card-info strong {
    font-size: 13px;
    font-weight: 600;
}

.color-card-name {
    font-size: 12px;
    color: #334155;
    font-weight: 500;
}

.color-card-info code {
    font-size: 11px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.color-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}

.color-card-action {
    flex: 1;
    min-height: 30px;
    padding: 4px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    cursor: pointer;
}

.color-card-action:hover,
.color-card-action:focus,
.color-card-action:active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.color-card-action.danger {
    color: #b91c1c;
    background: #fff;
}

.color-card-action.danger:hover,
.color-card-action.danger:focus,
.color-card-action.danger:active {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.color-edit-preview {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-edit-preview-swatch {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.1);
}

.palette-dialog {
    width: min(480px, calc(100vw - 32px));
    border: none;
    border-radius: 14px;
    padding: 0;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}

.palette-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
}

.palette-dialog-form {
    display: grid;
    gap: 12px;
    padding: 20px;
}

.palette-dialog-form h4 {
    margin: 0;
}

.palette-dialog-form label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
}

.palette-dialog-form textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
    line-height: 1.45;
    resize: vertical;
}

.palette-dialog-form .admin-paste-preview {
    max-height: 160px;
    overflow-y: auto;
}

.palette-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

.edit-color-message {
    margin: 0;
    min-height: 36px;
}

.palette-dialog-form input.input-error {
    border-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.14);
}

.duplicate-palette-dialog {
    width: min(680px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    overflow: hidden;
}

.duplicate-palette-form {
    box-sizing: border-box;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.duplicate-color-fieldset {
    min-width: 0;
    margin: 0;
    padding: 12px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
}

.duplicate-color-fieldset legend {
    padding: 0 6px;
    color: #334155;
    font-weight: 700;
}

.duplicate-color-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.duplicate-color-toolbar > div {
    display: flex;
    gap: 6px;
}

.duplicate-color-toolbar button {
    min-height: 32px;
    padding: 5px 10px;
}

.duplicate-color-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: min(42vh, 360px);
    overflow-y: auto;
    padding: 2px;
}

.duplicate-color-option {
    display: grid !important;
    grid-template-columns: auto 28px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
}

.duplicate-color-option:has(input:checked) {
    border-color: #93c5fd;
    background: #eff6ff;
}

.duplicate-color-option input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.duplicate-color-option .color-swatch {
    width: 28px;
    height: 28px;
}

.duplicate-color-option span:last-child {
    min-width: 0;
}

.duplicate-color-option strong,
.duplicate-color-option small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.duplicate-color-option small {
    margin-top: 2px;
    color: #64748b;
}

.duplicate-color-loading {
    grid-column: 1 / -1;
    padding: 20px;
    text-align: center;
}

@media (max-width: 640px) {
    .duplicate-color-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .duplicate-color-toolbar > div,
    .duplicate-color-toolbar button {
        flex: 1;
    }

    .duplicate-color-list {
        grid-template-columns: 1fr;
        max-height: 38vh;
    }
}

.palette-page-message {
    margin-top: 0;
    margin-bottom: 10px;
}

.palette-page-message:not(:empty) {
    position: sticky;
    top: 0;
    z-index: 20;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 窄屏桌面 / 带指针平板：收窄侧栏、主要工作区改单栏（不改变 isMobileLayout 判定） */
@media (min-width: 768px) and (max-width: 960px) {
    .app-shell {
        grid-template-columns: 188px minmax(0, 1fr);
    }

    .sidebar {
        padding: 16px 12px;
        gap: 14px;
    }

    .sidebar-brand {
        padding-bottom: 12px;
    }

    .sidebar-brand strong {
        font-size: 17px;
    }

    .sidebar-brand span {
        font-size: 12px;
    }

    .nav-item {
        font-size: 13px;
        min-height: 36px;
    }

    .content {
        padding: 20px 16px;
    }

    .topbar h2 {
        font-size: 24px;
    }

    .workspace-layout {
        grid-template-columns: 1fr;
    }

    .project-layout.project-desktop {
        grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
        min-height: auto;
    }

    .settings-layout {
        grid-template-columns: 1fr;
    }
}

/* 平板触摸端：窄侧栏 + 桌面双栏 + 工作台/项目页紧凑布局 */
.app-shell.tablet-layout {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    min-height: 100dvh;
}

.app-shell.tablet-layout .sidebar {
    display: flex;
    padding: 14px 10px;
    gap: 12px;
}

.app-shell.tablet-layout .sidebar-brand,
.app-shell.tablet-layout .sidebar-logout {
    display: grid;
}

.app-shell.tablet-layout .sidebar-brand strong {
    font-size: 16px;
    line-height: 1.25;
}

.app-shell.tablet-layout .sidebar-brand span {
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-shell.tablet-layout .nav-item {
    font-size: 12px;
    min-height: 38px;
    padding: 0 8px;
}

.app-shell.tablet-layout .sidebar-logout {
    min-height: 36px;
    font-size: 12px;
}

.app-shell.tablet-layout .content {
    order: unset;
    padding: 18px 14px;
}

.app-shell.tablet-layout .topbar {
    margin-bottom: 14px;
}

.app-shell.tablet-layout .topbar h2 {
    font-size: 22px;
}

.app-shell.tablet-layout .mobile-bottom-nav {
    display: none !important;
}

.app-shell.tablet-layout .project-layout.project-desktop {
    grid-template-columns: minmax(200px, 248px) minmax(0, 1fr);
    gap: 10px;
    min-height: calc(100dvh - 92px);
}

.app-shell.tablet-layout #projectView.view.active {
    min-height: calc(100dvh - 92px);
}

.app-shell.tablet-layout .workspace-layout {
    grid-template-columns: minmax(200px, 30%) minmax(0, 70%);
    gap: 10px;
    align-items: start;
}

.app-shell.tablet-layout .workspace-library-head {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.app-shell.tablet-layout .workspace-library-title {
    width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
}

.app-shell.tablet-layout .workspace-library-title h3 {
    font-size: 14px;
    white-space: nowrap;
    writing-mode: horizontal-tb;
}

.app-shell.tablet-layout .workspace-library-actions {
    width: 100%;
}

.app-shell.tablet-layout .workspace-library-actions button {
    min-height: 32px;
    padding: 4px 6px;
    font-size: 12px;
}

.app-shell.tablet-layout .workspace-library-filters {
    grid-template-columns: 1fr;
    gap: 8px;
}

.app-shell.tablet-layout .workspace-library-filters input {
    width: 100%;
    min-height: 38px;
    font-size: 14px;
}

.app-shell.tablet-layout .workspace-library-filter-toolbar {
    width: 100%;
    justify-content: stretch;
    flex-wrap: nowrap;
    gap: 6px;
}

.app-shell.tablet-layout .workspace-library-filter-toolbar select {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    min-height: 38px;
    font-size: 14px;
}

.app-shell.tablet-layout .workspace-library-filter-toggle,
.app-shell.tablet-layout button.workspace-library-filter-toggle {
    flex: 0 1 auto;
    min-width: 0;
    min-height: 38px;
}

.app-shell.tablet-layout .workspace-file-scroll {
    max-height: min(360px, 38vh);
}

.app-shell.tablet-layout .preview-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 8px 10px;
}

.app-shell.tablet-layout .preview-toolbar-title {
    display: none;
}

.app-shell.tablet-layout .preview-toolbar-main {
    display: contents;
}

.app-shell.tablet-layout .preview-options {
    display: contents;
}

.app-shell.tablet-layout .preview-options .check-label {
    min-height: 28px;
    font-size: 12px;
}

.app-shell.tablet-layout .preview-grid-step-label {
    font-size: 12px;
    white-space: nowrap;
}

.app-shell.tablet-layout .preview-actions {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 6px;
    width: auto;
    margin-left: auto;
}

.app-shell.tablet-layout .preview-actions button {
    flex: 0 1 auto;
    min-width: 0;
    min-height: 34px;
    font-size: 12px;
    white-space: nowrap;
}

.app-shell.tablet-layout .preview-rotation-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding: 8px 10px;
}

.app-shell.tablet-layout .preview-rotation-title span {
    display: none;
}

.app-shell.tablet-layout .image-rotation-buttons {
    flex: 1 1 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.app-shell.tablet-layout .workspace-generate-panel .pattern-result {
    gap: 8px;
    margin-top: 8px;
}

.app-shell.tablet-layout #patternPreview {
    max-height: min(360px, 40vh);
}

.app-shell.tablet-layout #patternSummary.summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
}

.app-shell.tablet-layout .pattern-legend-fold {
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #fbfdff;
}

.app-shell.tablet-layout .pattern-legend-fold-title {
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 700;
    list-style: none;
    cursor: pointer;
}

.app-shell.tablet-layout .pattern-legend-fold-title::-webkit-details-marker {
    display: none;
}

.app-shell.tablet-layout .workspace-pattern-legend,
.app-shell.tablet-layout .project-detail-legend {
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 6px;
    max-height: 160px;
    overflow-y: auto;
    padding: 0 8px 8px;
}

.app-shell.tablet-layout .workspace-pattern-legend .color-item,
.app-shell.tablet-layout .project-detail-legend .color-item {
    padding: 5px 6px;
    grid-template-columns: 24px minmax(0, 1fr);
    font-size: 11px;
}

.app-shell.tablet-layout .workspace-pattern-legend .color-swatch,
.app-shell.tablet-layout .project-detail-legend .color-swatch {
    width: 24px;
    height: 24px;
}

.app-shell.tablet-layout #projectView .project-list-panel {
    padding: 8px;
}

.app-shell.tablet-layout .project-list-filters {
    grid-template-columns: 1fr;
    gap: 8px;
}

.app-shell.tablet-layout .project-search {
    width: 100%;
    min-height: 38px;
    font-size: 14px;
}

.app-shell.tablet-layout .project-sort-label {
    width: 100%;
    min-width: 0;
}

.app-shell.tablet-layout .project-sort-label select {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 38px;
    font-size: 14px;
}

.app-shell.tablet-layout .project-list-batch {
    flex-wrap: nowrap;
}

.app-shell.tablet-layout .project-recycle-batch {
    flex-wrap: wrap;
}

.app-shell.tablet-layout .project-layout:not(.project-mobile-detail) .project-detail-drawer {
    display: flex;
}

.app-shell.tablet-layout .project-detail-back {
    display: none;
}

.app-shell.tablet-layout #projectView .project-detail-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 14px;
}

.app-shell.tablet-layout #projectView .project-detail-media {
    min-height: min(300px, 42vw);
    aspect-ratio: 1;
    max-height: min(440px, 52vh);
}

.app-shell.tablet-layout .project-detail-legend {
    max-height: none;
    overflow: visible;
}

.app-shell.tablet-layout .settings-layout {
    grid-template-columns: 1fr;
    gap: 14px;
}

/* 平板颜色库：收窄左侧库列表，把宽度让给右侧详情与色块网格 */
.app-shell.tablet-layout .palette-mine-layout {
    grid-template-columns: minmax(116px, 144px) minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
}

.app-shell.tablet-layout .palette-sidebar {
    padding: 8px;
    gap: 6px;
}

.app-shell.tablet-layout .palette-sidebar-head {
    gap: 4px;
}

.app-shell.tablet-layout .palette-sidebar-head strong {
    font-size: 13px;
}

.app-shell.tablet-layout .palette-count-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
}

.app-shell.tablet-layout .palette-sidebar-actions {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.app-shell.tablet-layout .palette-sidebar-actions button {
    min-height: 32px;
    padding: 0 6px;
    font-size: 11px;
    line-height: 1.2;
    white-space: normal;
}

.app-shell.tablet-layout .palette-sidebar-list {
    max-height: none;
    gap: 6px;
}

.app-shell.tablet-layout .palette-sidebar-item {
    padding: 8px;
    gap: 2px;
}

.app-shell.tablet-layout .palette-sidebar-item .palette-kind-badge {
    display: none;
}

.app-shell.tablet-layout .palette-sidebar-item > span:not(.palette-sidebar-item-head) {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.3;
}

.app-shell.tablet-layout .palette-sidebar-item-head strong {
    font-size: 13px;
}

.app-shell.tablet-layout .palette-main-detail {
    min-width: 0;
}

.app-shell.tablet-layout .palette-main-header {
    padding: 10px 12px;
    gap: 8px;
}

.app-shell.tablet-layout .palette-main-title h4 {
    font-size: 16px;
}

.app-shell.tablet-layout .palette-main-title .hint {
    margin: 0;
    font-size: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-shell.tablet-layout .palette-main-toolbar {
    display: grid;
    gap: 6px;
}

.app-shell.tablet-layout .palette-main-toolbar .palette-search-input {
    width: 100%;
    min-width: 0;
    flex: unset;
    min-height: 34px;
    font-size: 13px;
}

.app-shell.tablet-layout #paletteView .palette-toolbar-row {
    position: relative;
    flex-wrap: nowrap;
    gap: 6px;
}

.app-shell.tablet-layout #paletteView .palette-toolbar-scroll {
    display: block;
    flex: 1 1 0;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.app-shell.tablet-layout #paletteView .palette-toolbar-scroll::-webkit-scrollbar {
    display: none;
}

.app-shell.tablet-layout #paletteView .palette-toolbar-primary {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    width: max-content;
}

.app-shell.tablet-layout #paletteView .palette-toolbar-primary button {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
    white-space: nowrap;
}

.app-shell.tablet-layout #paletteView .palette-toolbar-more-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
    white-space: nowrap;
}

.app-shell.tablet-layout #paletteView .palette-toolbar-secondary {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 30;
    min-width: 200px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.app-shell.tablet-layout #paletteView .palette-toolbar-row.is-more-open .palette-toolbar-secondary {
    display: flex;
}

.app-shell.tablet-layout .palette-main-filters {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.app-shell.tablet-layout .palette-family-chips.compact .palette-family-chip {
    min-height: 28px;
    padding: 0 8px;
    font-size: 11px;
}

.app-shell.tablet-layout .palette-reorder-hint {
    margin-bottom: 6px;
    padding: 6px 8px;
    font-size: 12px;
}

.app-shell.tablet-layout .palette-color-grid-manage {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px;
}

.app-shell.tablet-layout .palette-color-grid-manage > .color-card-manage {
    min-width: 0;
}

.app-shell.tablet-layout .color-card-manage {
    padding: 8px;
    gap: 6px;
    overflow: hidden;
}

.app-shell.tablet-layout .color-card-manage.color-card-reorderable {
    padding-top: 24px;
}

.app-shell.tablet-layout .color-card-main {
    min-width: 0;
    width: 100%;
}

.app-shell.tablet-layout .color-card-manage .color-swatch {
    width: 100%;
    max-width: 100%;
    height: 40px;
    box-sizing: border-box;
}

.app-shell.tablet-layout .color-card-info strong {
    font-size: 12px;
}

.app-shell.tablet-layout .color-card-name,
.app-shell.tablet-layout .color-card-info code {
    font-size: 10px;
}

.app-shell.tablet-layout .color-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 0;
}

.app-shell.tablet-layout .color-card-action {
    min-width: 0;
    min-height: 26px;
    padding: 2px 4px;
    font-size: 11px;
}

.app-shell.tablet-layout .palette-add-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-shell.mobile-palette-layout.tablet-layout #paletteView .palette-mine-layout {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
}

.pattern-legend-fold {
    margin: 0;
}

.pattern-legend-fold-title {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.pattern-legend-fold-title::-webkit-details-marker {
    display: none;
}

.project-detail-legend-section .pattern-legend-fold-title {
    margin: 0 0 10px;
    color: #0f172a;
    font-size: 15px;
    font-weight: 700;
}

.project-detail-legend-section .pattern-legend-fold-title::before {
    content: "▸ ";
    color: #64748b;
    font-weight: 400;
}

.project-detail-legend-section .pattern-legend-fold[open] .pattern-legend-fold-title::before {
    content: "▾ ";
}

#patternResult .pattern-legend-fold {
    margin-top: 8px;
}

#patternResult .pattern-legend-fold-title {
    margin: 0;
    padding: 8px 0;
    color: #334155;
    font-size: 14px;
    font-weight: 700;
}

#patternResult .pattern-legend-fold-title::before {
    content: "▸ ";
    color: #64748b;
    font-weight: 400;
}

#patternResult .pattern-legend-fold[open] .pattern-legend-fold-title::before {
    content: "▾ ";
}

@media (max-width: 900px) {
    .app-shell.tablet-layout #projectView .project-detail-grid {
        grid-template-columns: 1fr;
    }

    .app-shell.tablet-layout #projectView .project-detail-media {
        min-height: min(280px, 48vw);
        max-height: min(400px, 56vh);
    }
}

@media (min-width: 901px) and (max-width: 1200px) {
    .app-shell:not(.editor-focus) {
        grid-template-columns: 188px minmax(0, 1fr);
    }

    .app-shell:not(.editor-focus) .workspace-layout {
        grid-template-columns: minmax(220px, 32%) minmax(0, 68%);
        gap: 12px;
    }

    .app-shell:not(.editor-focus) .project-layout.project-desktop {
        grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
    }

    .app-shell:not(.editor-focus) #projectView .project-detail-grid {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    }

    .app-shell:not(.editor-focus) .workspace-library-head {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .app-shell:not(.editor-focus) .workspace-library-title {
        width: 100%;
        min-width: 0;
        flex-wrap: nowrap;
    }

    .app-shell:not(.editor-focus) .workspace-library-title h3 {
        white-space: nowrap;
        writing-mode: horizontal-tb;
    }

    .app-shell:not(.editor-focus) .workspace-library-actions {
        width: 100%;
    }

    .app-shell:not(.editor-focus) .workspace-library-filters {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .app-shell:not(.editor-focus) .workspace-library-filters input {
        width: 100%;
        min-height: 38px;
        font-size: 14px;
    }

    .app-shell:not(.editor-focus) .workspace-library-filter-toolbar {
        width: 100%;
        justify-content: stretch;
        flex-wrap: nowrap;
        gap: 6px;
    }

    .app-shell:not(.editor-focus) .workspace-library-filter-toolbar select {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
        min-height: 38px;
        font-size: 14px;
    }

    .app-shell:not(.editor-focus) .workspace-library-filter-toggle,
    .app-shell:not(.editor-focus) button.workspace-library-filter-toggle {
        flex: 0 1 auto;
        min-width: 0;
        min-height: 38px;
    }

    .app-shell:not(.editor-focus) #projectView .project-list-filters {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .app-shell:not(.editor-focus) #projectView .project-search {
        width: 100%;
        min-height: 38px;
        font-size: 14px;
    }

    .app-shell:not(.editor-focus) #projectView .project-sort-label {
        width: 100%;
        min-width: 0;
    }

    .app-shell:not(.editor-focus) #projectView .project-sort-label select {
        width: 100%;
        min-width: 0;
        max-width: none;
        min-height: 38px;
        font-size: 14px;
    }

    .app-shell:not(.editor-focus) .preview-toolbar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 10px;
        padding: 8px 10px;
    }

    .app-shell:not(.editor-focus) .preview-toolbar-title {
        display: none;
    }

    .app-shell:not(.editor-focus) .preview-toolbar-main {
        display: contents;
    }

    .app-shell:not(.editor-focus) .preview-options {
        display: contents;
    }

    .app-shell:not(.editor-focus) .preview-actions {
        display: inline-flex;
        flex: 0 0 auto;
        width: auto;
        gap: 6px;
        margin-left: auto;
    }

    .app-shell:not(.editor-focus) .preview-actions button {
        flex: 0 1 auto;
        width: auto;
        min-width: 0;
        white-space: nowrap;
    }

    .app-shell:not(.editor-focus) .workspace-pattern-legend {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        max-height: 200px;
        overflow-y: auto;
    }

    .app-shell:not(.editor-focus) .project-detail-legend {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        max-height: 200px;
        overflow-y: auto;
    }

    .app-shell:not(.editor-focus):not(.tablet-layout) .palette-mine-layout {
        grid-template-columns: minmax(140px, 168px) minmax(0, 1fr);
        gap: 10px;
    }

    .app-shell:not(.editor-focus):not(.tablet-layout) .palette-color-grid-manage {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 6px;
    }

    .app-shell:not(.editor-focus):not(.tablet-layout) .palette-color-grid-manage > .color-card-manage {
        min-width: 0;
        overflow: hidden;
    }
}

@media (max-width: 960px) {
    .palette-mine-layout {
        grid-template-columns: 1fr;
    }

    .palette-sidebar-list {
        max-height: 220px;
    }

    .palette-browse-primary {
        grid-template-columns: 1fr;
    }

    .palette-browse-bar {
        padding: 12px;
    }

    .palette-browse-filters,
    .palette-main-filters {
        grid-template-columns: 1fr;
    }

    .palette-filter-label {
        padding-top: 0;
    }

    .palette-family-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .palette-bar-action {
        width: 100%;
    }

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

@media (max-width: 640px) {
    .palette-add-form {
        grid-template-columns: 1fr;
    }
}

.settings-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.settings-subnav {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 6px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #ffffff;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.settings-subtab {
    flex-shrink: 0;
    white-space: nowrap;
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #475569;
}

button.settings-subtab {
    color: #475569;
    background: transparent;
    border: 1px solid transparent;
}

button.settings-subtab:hover:not(.active) {
    background: #f8fafc;
    color: #334155;
}

.settings-subtab.active {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

button.settings-subtab.active {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

/* 移动端「我的」页顶：用户信息 + Tab 导航（与桌面侧栏「我的」统一） */
.settings-mobile-profile {
    display: none;
    grid-column: 1 / -1;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
}

.settings-mobile-profile-main {
    display: grid;
    gap: 4px;
}

.settings-mobile-profile-main strong {
    font-size: 17px;
    color: #0f172a;
}

.settings-mobile-profile-role {
    font-size: 13px;
    color: #64748b;
}

.settings-mobile-profile-hint {
    margin: 0;
    font-size: 12px;
}

@media (max-width: 900px) and ((hover: none) or (pointer: coarse)), (max-width: 767px), ((max-height: 520px) and (max-width: 1100px) and ((hover: none) or (pointer: coarse))) {
    .settings-mobile-profile {
        display: grid;
    }

    .settings-subnav {
        position: sticky;
        top: 0;
        z-index: 3;
    }
}

.settings-card {
    height: 100%;
}

.settings-info-grid,
.settings-stats-grid,
.settings-limits-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.settings-panel.active {
    grid-column: 1 / -1;
}

.settings-info-grid > div,
.settings-stats-grid > div,
.settings-limits-grid > div {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #f8fafc;
}

.settings-info-grid span,
.settings-stats-grid span,
.settings-limits-grid span {
    color: #64748b;
    font-size: 12px;
}

.settings-subsection {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #edf1f7;
}

.settings-subsection h4 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.settings-form-inline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.settings-profile-nickname {
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid #edf1f7;
}

.settings-account-top {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.85fr);
    gap: 18px;
    align-items: start;
}

.settings-account-primary > h3,
.settings-account-aside > h3 {
    margin: 0 0 14px;
}

.settings-account-aside {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid #e8eef5;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.settings-info-grid-compact,
.settings-stats-grid-compact,
.settings-limits-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 0;
}

.settings-account-aside .settings-inline-heading {
    margin: 4px 0 0;
}

.settings-account-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
    gap: 18px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #edf1f7;
}

.settings-account-bottom .settings-subsection {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.settings-profile-nickname button[type="submit"] {
    min-height: 38px;
    padding: 0 16px;
    white-space: nowrap;
}

.settings-account-forms {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}

.settings-action-card {
    display: grid;
    gap: 0;
    padding: 16px;
    border: 1px solid #e8eef5;
    border-radius: 10px;
    background: #f8fafc;
    transition: border-color 0.15s, box-shadow 0.15s;
    align-content: start;
    min-height: 100%;
}

.settings-action-card.is-open {
    border-color: #bfdbfe;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.settings-action-card-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.settings-action-card-summary .settings-action-card-head {
    flex: 1;
    min-width: 0;
}

.settings-action-card-head h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.settings-action-card-head .hint {
    margin: 4px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: #64748b;
}

button.settings-action-toggle,
.settings-action-toggle {
    flex-shrink: 0;
    min-height: 34px;
    padding: 0 14px;
    font-size: 13px;
    white-space: nowrap;
}

.settings-security-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 16px;
}

.settings-security-modal.hidden {
    display: none;
}

.settings-security-modal-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(15, 23, 42, 0.45);
}

.settings-security-modal-card {
    position: relative;
    z-index: 1;
    width: min(440px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid #dbe3ee;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.settings-security-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.settings-security-modal-head h3 {
    margin: 0;
    font-size: 18px;
    color: #0f172a;
}

.settings-security-modal-subtitle {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: #64748b;
}

.settings-security-modal-close {
    flex-shrink: 0;
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.settings-security-modal .settings-compact-form {
    gap: 14px;
}

.settings-compact-form {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    border: 0;
}

.settings-compact-form > button[type="submit"] {
    justify-self: start;
    margin-top: 2px;
}

.settings-compact-form .settings-form-actions > button[type="submit"] {
    margin-top: 0;
}

.settings-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.settings-form-message {
    margin: 0;
    min-height: 0;
    font-size: 13px;
    line-height: 1.45;
}

.settings-form-message:empty {
    display: none;
}

.settings-form-message:not(:empty) {
    margin-top: 2px;
    padding: 8px 10px;
    border-radius: 6px;
}

.settings-form-message.error {
    color: #b91c1c;
    background: #fef2f2;
}

.settings-form-message.ok {
    color: #15803d;
    background: #f0fdf4;
}

.settings-profile-nickname .settings-form-message {
    grid-column: 1 / -1;
}

.settings-security-mode-wrap {
    display: grid;
    gap: 6px;
}

.settings-security-mode-label {
    color: #4b5563;
    font-size: 14px;
}

.settings-segmented {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 4px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
}

.settings-segmented-item {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.settings-segmented-item input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.settings-segmented-item span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 6px;
    color: #64748b;
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
}

.settings-segmented-item:has(input:checked) span {
    color: #1d4ed8;
    background: #eff6ff;
    font-weight: 600;
}

.settings-security-detail {
    display: grid;
    gap: 0;
}

.settings-profile-actions {
    margin-top: 16px;
    padding-top: 16px;
}

.settings-profile-danger {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.settings-profile-danger h4 {
    margin: 0 0 6px;
}

.settings-profile-danger .hint {
    margin: 0 0 10px;
}

.settings-compact-form input.input-error,
.settings-profile-nickname input.input-error,
.settings-compact-form select.input-error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.settings-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

@media (max-width: 1100px) {
    .settings-account-top,
    .settings-account-bottom {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .settings-info-grid,
    .settings-stats-grid,
    .settings-limits-grid,
    .settings-info-grid-compact,
    .settings-stats-grid-compact,
    .settings-limits-grid-compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .settings-account-forms {
        grid-template-columns: 1fr;
    }

    .settings-quick-actions {
        grid-template-columns: 1fr;
    }
}

.pattern-limits-hint {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

.pattern-limits-hint.error {
    color: #b91c1c;
}

.admin-config-intro {
    margin: 0 0 12px;
}

.admin-config-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #f8fafc;
}

.admin-config-search {
    width: 100%;
}

.admin-config-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.admin-config-recent {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.admin-config-recent strong {
    color: #475569;
    font-size: 12px;
}

.admin-config-recent span {
    padding: 4px 8px;
    border-radius: 999px;
    color: #64748b;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    font-size: 12px;
}

.admin-config-toolbar-actions .active {
    color: #1d4ed8;
    border-color: #93c5fd;
    background: #eff6ff;
}

.admin-config-layout {
    display: grid;
    grid-template-columns: 184px minmax(0, 1fr);
    gap: 14px;
}

.admin-config-sidebar {
    display: grid;
    gap: 8px;
    align-content: start;
    position: sticky;
    top: 12px;
}

.admin-config-group-nav {
    min-height: 36px;
    text-align: left;
    justify-content: flex-start;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
}

.admin-config-group-nav.active {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

.admin-config-main {
    display: grid;
    gap: 12px;
}

.admin-config-empty {
    padding: 28px 16px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    color: #64748b;
    background: #f8fafc;
    text-align: center;
}

.admin-config-section {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #ffffff;
}

.admin-config-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.admin-config-section-head h4 {
    margin: 0;
}

.admin-config-section-actions {
    display: flex;
    gap: 8px;
}

.admin-config-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 180px);
    gap: 18px;
    align-items: center;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.admin-config-row.is-dirty {
    border-color: #93c5fd;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
    background: #eff6ff;
}

.admin-config-row.has-error {
    border-color: #fca5a5;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.08);
    background: #fff7f7;
}

.admin-config-row.hidden {
    display: none;
}

.admin-config-impact {
    color: #2563eb;
    font-size: 12px;
}

.admin-config-copy {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.admin-config-key {
    width: fit-content;
    max-width: 100%;
    padding: 2px 6px;
    border-radius: 5px;
    color: #64748b;
    background: #eef2f7;
    font-family: Consolas, monospace;
    font-size: 11px;
    overflow-wrap: anywhere;
}

.admin-config-control {
    display: flex;
    justify-content: flex-end;
    min-width: 0;
}

.admin-config-control > input {
    width: 100%;
    max-width: 180px;
}

.admin-config-control .admin-config-toggle {
    margin-top: 0;
}

.admin-config-main .message {
    grid-column: 1 / -1;
}

@media (max-width: 900px) and ((hover: none) or (pointer: coarse)), (max-width: 767px), ((max-height: 520px) and (max-width: 1100px) and ((hover: none) or (pointer: coarse))) {
    .admin-config-layout {
        grid-template-columns: 1fr;
    }

    .admin-config-sidebar {
        position: static;
        display: flex;
        gap: 8px;
        padding-bottom: 4px;
        overflow-x: auto;
        scrollbar-width: thin;
    }

    .admin-config-group-nav {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

@media (max-width: 640px) {
    .admin-config-toolbar {
        grid-template-columns: 1fr;
    }

    .admin-config-toolbar-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .admin-config-toolbar-actions button {
        width: 100%;
    }

    .admin-config-recent {
        grid-column: 1;
    }

    .admin-config-section {
        padding: 12px;
    }

    .admin-config-section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-config-section-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .admin-config-section-actions button {
        width: 100%;
    }

    .admin-config-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .admin-config-control {
        justify-content: flex-start;
    }

    .admin-config-control > input {
        max-width: none;
    }
}

.admin-visual-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.admin-visual-card,
.admin-export-card {
    position: relative;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 12px 10px 34px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-account-card:not(tr) {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 10px 12px 10px 34px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-visual-card:hover,
.admin-account-card:not(tr):hover {
    border-color: #cbd5e1;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
}

.admin-account-card:not(tr) {
    grid-template-columns: 1fr;
    padding-left: 34px;
}

.admin-visual-card > .admin-row-check,
.admin-account-card > .admin-row-check {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.admin-visual-thumb {
    width: 72px;
    height: 72px;
    border: 1px solid #edf1f7;
    border-radius: 8px;
}

.admin-visual-thumb img {
    object-fit: cover;
}

.admin-visual-thumb.placeholder {
    display: grid;
    place-items: center;
    padding: 8px;
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
}

.admin-visual-body {
    display: grid;
    gap: 8px;
    align-content: start;
    min-width: 0;
}

.admin-visual-body strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-visual-meta {
    color: #64748b;
    font-size: 12px;
}

.admin-account-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
}

.admin-account-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    gap: 10px;
    align-items: end;
}

.admin-account-controls label {
    display: grid;
    gap: 6px;
    font-size: 13px;
}

.admin-export-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.admin-row-check input[type="checkbox"]:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.admin-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    max-width: 100%;
    padding: 2px 10px 2px 8px;
    border: 0;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    background: transparent;
    color: #334155;
}

.admin-status-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    flex-shrink: 0;
}

.admin-status-badge.status-admin {
    color: #1e40af;
}

.admin-status-badge.status-admin::before {
    background: #3b82f6;
}

.admin-status-badge.status-success,
.admin-status-badge.status-done,
.admin-status-badge.status-active {
    color: #15803d;
}

.admin-status-badge.status-success::before,
.admin-status-badge.status-done::before,
.admin-status-badge.status-active::before {
    background: #22c55e;
}

.admin-status-badge.status-pending {
    color: #92400e;
}

.admin-status-badge.status-pending::before {
    background: #f59e0b;
}

.admin-status-badge.status-processing {
    color: #1e40af;
}

.admin-status-badge.status-processing::before {
    background: #3b82f6;
}

.admin-status-badge.status-failed {
    color: #b91c1c;
}

.admin-status-badge.status-failed::before {
    background: #ef4444;
}

.admin-status-badge.status-inactive {
    color: #64748b;
}

.admin-status-badge.status-inactive::before {
    background: #cbd5e1;
}

.admin-status-badge.status-expired {
    color: #b45309;
}

.admin-status-badge.status-expired::before {
    background: #f59e0b;
}

.admin-account-identity {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.admin-account-email {
    font-size: 15px;
    line-height: 1.35;
    word-break: break-all;
}

.admin-account-nickname,
.admin-account-id {
    color: #64748b;
    font-size: 13px;
    line-height: 1.4;
}

.admin-account-card .admin-account-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-account-card .admin-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-danger-btn {
    color: #b91c1c;
    border-color: #fecaca;
}

.danger-btn {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fff7f7;
}

.admin-detail-body h4 {
    margin: 0 0 10px;
}

.admin-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.admin-detail-grid > div {
    display: grid;
    gap: 4px;
    padding: 10px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #ffffff;
}

.admin-detail-grid span {
    color: #64748b;
    font-size: 12px;
}

.admin-detail-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.admin-record-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.admin-record-card {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    align-items: center;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-record-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
}

.admin-share-record:not(tr),
.admin-export-record:not(tr) {
    align-items: start;
}

.admin-share-record > .admin-row-check,
.admin-export-record > .admin-row-check {
    align-self: center;
    margin-top: 0;
}

.admin-record-main {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-width: 0;
}

.admin-record-content {
    min-width: 0;
}

.admin-record-headline {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 6px;
}

.admin-record-headline-text {
    min-width: 0;
}

.admin-record-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.admin-token-pill {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    max-width: 100%;
}

.admin-token-pill code {
    font-size: 11px;
    color: #475569;
    background: transparent;
}

.admin-link-btn {
    min-height: auto;
    padding: 0;
    border: 0;
    color: #2563eb;
    background: transparent;
    font-size: 12px;
    cursor: pointer;
}

.admin-link-btn:hover {
    color: #1d4ed8;
    background: transparent;
    text-decoration: underline;
}

.admin-record-card.is-inactive {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.admin-record-card.is-pending {
    border-color: #fde68a;
    background: #fffbeb;
}

.admin-record-body {
    min-width: 0;
}

.admin-record-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.admin-record-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: #0f172a;
}

.admin-record-sub {
    display: block;
    margin-top: 2px;
    color: #94a3b8;
    font-size: 12px;
}

.admin-record-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px 16px;
}

.admin-record-field span {
    display: block;
    margin-bottom: 2px;
    color: #94a3b8;
    font-size: 11px;
    letter-spacing: 0.04em;
}

.admin-record-field strong {
    display: block;
    color: #0f172a;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

.admin-record-error {
    margin: 6px 0 0;
    padding: 6px 8px;
    border-radius: 6px;
    color: #b91c1c;
    background: #fef2f2;
    font-size: 12px;
}

.admin-record-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-record-actions-inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
}

.admin-record-actions button,
.admin-record-actions-inline button {
    width: auto;
    min-height: 30px;
    padding: 0 10px;
    font-size: 13px;
}

.admin-record-hint {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
}

.admin-record-thumb .admin-visual-thumb {
    width: 52px;
    height: 52px;
}

.admin-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 24px;
}

.admin-preview-modal.hidden {
    display: none;
}

.admin-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.admin-preview-dialog {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(960px, 100%);
    max-height: min(88vh, 900px);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
    overflow: hidden;
}

.admin-preview-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.admin-preview-body {
    min-height: 320px;
    padding: 16px;
    overflow: auto;
    background: #ffffff;
}

.admin-preview-image {
    display: block;
    max-width: 100%;
    max-height: calc(88vh - 120px);
    margin: 0 auto;
    border-radius: 8px;
    background: #f8fafc;
}

.admin-preview-iframe {
    display: block;
    width: 100%;
    min-height: 480px;
    height: calc(88vh - 120px);
    border: 0;
    border-radius: 8px;
    background: #f8fafc;
}

.admin-palette-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.admin-palette-sidebar,
.admin-palette-main {
    min-width: 0;
}

.admin-palette-sidebar {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #f8fafc;
}

.admin-palette-sidebar h4,
.admin-palette-workspace-head h4 {
    margin: 0;
}

.admin-palette-list {
    display: grid;
    gap: 8px;
    max-height: 480px;
    overflow: auto;
    grid-auto-rows: min-content;
    align-content: start;
}

.admin-palette-item {
    display: grid;
    gap: 4px;
    width: 100%;
    min-height: unset;
    height: auto;
    padding: 10px 12px;
    text-align: left;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    align-self: start;
    white-space: normal;
}

.admin-palette-item:hover {
    border-color: #93c5fd;
    background: #ffffff;
    color: #334155;
}

.admin-palette-item strong {
    display: block;
    font-size: 14px;
    line-height: 1.35;
    word-break: break-word;
}

.admin-palette-item span {
    display: block;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
    word-break: break-word;
}

.admin-palette-item.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
    background: #eff6ff;
}

.admin-palette-create summary,
.admin-palette-section summary {
    cursor: pointer;
    font-weight: 600;
    color: #334155;
}

.admin-palette-create,
.admin-palette-section {
    padding: 11px 14px;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #ffffff;
}

.admin-palette-section[open] {
    border-color: #dbe3ee;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.admin-palette-main {
    display: grid;
    gap: 12px;
}

.admin-palette-empty {
    display: grid;
    gap: 8px;
    padding: 28px 20px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    text-align: center;
}

.admin-palette-workspace {
    display: grid;
    gap: 10px;
}

.admin-palette-workspace-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    padding: 0 2px 8px;
    border-bottom: 1px solid #edf1f7;
}

.admin-palette-workspace-head .hint {
    margin: 0;
    text-align: right;
}

.admin-form-stack,
.admin-color-form,
.admin-import-form {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    align-items: end;
}

.admin-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.admin-checkbox-row {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.admin-template-create {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.admin-form-stack label,
.admin-color-form label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #475569;
}

.admin-color-form {
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    column-gap: 12px;
    row-gap: 8px;
    align-items: start;
}

.admin-color-form > label,
.hex-input-row,
.hex-input-row input {
    min-width: 0;
}

.admin-color-form-actions {
    grid-column: 1 / -1;
    margin-top: 2px;
}

.admin-color-form button {
    justify-self: start;
}

.admin-color-form .field-hint:empty {
    display: none;
}

.admin-import-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

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

.admin-import-hint {
    margin: 8px 0 0;
}

#paletteAdminMessage {
    white-space: pre-line;
}

.admin-palette-color-grid {
    max-height: 420px;
    overflow: auto;
}

.admin-palette-section > .compact-head {
    flex-direction: row;
    align-items: center;
    margin: 0 0 10px;
}

.admin-palette-section > .compact-head h4 {
    margin: 0;
}

.admin-detail-preview-wrap {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.admin-detail-preview {
    width: 160px;
    height: 160px;
    object-fit: contain;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #f8fafc;
}

@media (max-width: 900px) and ((hover: none) or (pointer: coarse)), (max-width: 767px), ((max-height: 520px) and (max-width: 1100px) and ((hover: none) or (pointer: coarse))) {
    .admin-overview-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .settings-layout {
        grid-template-columns: 1fr;
    }

    .admin-account-controls {
        grid-template-columns: 1fr;
    }

    .admin-account-card .admin-row-actions {
        flex-direction: column;
    }

    .admin-account-card .admin-row-actions button {
        width: 100%;
    }

    .admin-palette-layout {
        grid-template-columns: 1fr;
    }

    .admin-color-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-list-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-list-toolbar .admin-filter-bar {
        grid-template-columns: 1fr;
    }

    .admin-bulk-bar {
        justify-content: space-between;
        width: 100%;
        padding-top: 8px;
        border-top: 1px solid #eef2f7;
    }

    .admin-record-main {
        grid-template-columns: 44px minmax(0, 1fr);
        grid-template-areas:
            "thumb content"
            "actions actions";
    }

    .admin-record-thumb {
        grid-area: thumb;
    }

    .admin-record-content {
        grid-area: content;
    }

    .admin-record-actions-inline {
        grid-area: actions;
        justify-content: flex-start;
        margin-top: 4px;
    }

    .admin-record-thumb .admin-visual-thumb {
        width: 44px;
        height: 44px;
    }

    .admin-bulk-delete-btn {
        margin-left: auto;
    }

    .admin-visual-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .admin-palette-workspace-head {
        display: grid;
        gap: 4px;
    }

    .admin-palette-workspace-head .hint {
        text-align: left;
    }

    .admin-color-form,
    .admin-import-form {
        grid-template-columns: 1fr;
    }

    .admin-import-form button,
    .admin-import-form .button-like,
    .admin-color-form-actions button {
        width: 100%;
    }

    .admin-import-actions {
        display: grid;
    }
}

.settings-panel { max-width: none; }
.settings-form { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid #edf1f7; }
.settings-form:last-of-type { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }

.settings-section-desc {
    margin: -4px 0 18px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.settings-inline-heading {
    margin: 22px 0 12px;
    padding-top: 18px;
    border-top: 1px solid #edf1f7;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

.settings-preference-form {
    display: grid;
    gap: 0;
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}

#settingsPreferencePanel {
    container-type: inline-size;
    container-name: settings-preference;
}

.settings-pref-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}

.settings-pref-columns .settings-pref-group {
    margin-top: 0;
    min-width: 0;
    height: 100%;
}

.settings-pref-columns .settings-pref-group-algo {
    grid-column: 1 / -1;
    height: auto;
}

.settings-pref-algo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-field-gap);
}

.settings-pref-group .check-label {
    min-height: 32px;
}

.settings-form-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    width: 100%;
    margin-top: 16px;
}

.settings-form-footer > button {
    flex: 0 0 auto;
    min-width: 120px;
}

.settings-shares-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.settings-shares-summary-item {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid #e8eef5;
    border-radius: 10px;
    background: #f8fafc;
}

.settings-shares-summary-item span {
    color: #64748b;
    font-size: 12px;
}

.settings-shares-summary-item strong {
    font-size: 20px;
    color: #0f172a;
    line-height: 1.2;
}

.settings-shares-summary-item.is-active strong {
    color: #15803d;
}

.settings-shares-summary-item.is-closed strong {
    color: #64748b;
}

.settings-shares-summary-item.is-expired strong {
    color: #b45309;
}

.settings-pref-group {
    display: grid;
    gap: var(--space-field-gap);
    padding: var(--space-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg-subtle);
    align-content: start;
}

.settings-pref-group h4 {
    margin: 0 0 2px;
    font-size: var(--font-tab);
    font-weight: 600;
    color: var(--color-text-secondary);
    letter-spacing: 0.02em;
}

.settings-pref-group label {
    margin: 0;
    min-width: 0;
}

.settings-pref-group label select,
.settings-pref-group .palette-pick-select {
    width: 100%;
    min-width: 0;
}

.settings-pref-group .field-hint {
    margin-top: 4px;
    font-size: var(--font-hint);
    color: var(--color-text-muted);
    line-height: 1.45;
}

.panel h3 {
    font-size: var(--font-panel-title);
}

.settings-subtab {
    font-size: var(--font-tab);
}

.hint,
.field-hint,
.settings-section-desc {
    font-size: var(--font-hint);
    color: var(--color-text-muted);
}

.settings-preference-form > button[type="submit"] {
    justify-self: start;
    margin-top: 16px;
}

.palette-pref-picker {
    display: grid;
    gap: 10px;
}

.palette-pref-label {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
}

.palette-scope-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 4px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #fff;
}

.palette-scope-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #475569;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.palette-scope-btn:hover {
    background: #f8fafc;
    color: #1e293b;
}

.palette-scope-btn.active[data-scope="default"] {
    border-color: #cbd5e1;
    background: #f1f5f9;
    color: #0f172a;
    box-shadow: inset 0 0 0 1px #e2e8f0;
}

.palette-scope-btn.active[data-scope="system"] {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
    box-shadow: inset 0 0 0 1px #bfdbfe;
}

.palette-scope-btn.active[data-scope="mine"] {
    border-color: #86efac;
    background: #f0fdf4;
    color: #15803d;
    box-shadow: inset 0 0 0 1px #bbf7d0;
}

.palette-kind-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex-shrink: 0;
}

.palette-kind-dot.system {
    background: #2563eb;
    box-shadow: 0 0 0 2px #dbeafe;
}

.palette-kind-dot.mine {
    background: #16a34a;
    box-shadow: 0 0 0 2px #dcfce7;
}

.palette-pick-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.palette-pick-select {
    width: 100%;
}

.palette-kind-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.palette-kind-badge.system {
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.palette-kind-badge.mine {
    color: #15803d;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.palette-kind-badge.compact {
    min-height: 22px;
    padding: 0 7px;
    font-size: 11px;
}

.palette-sidebar-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.palette-sidebar-item-head strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

select.palette-grouped-select {
    border-color: #dbe3ee;
}

@media (min-width: 901px) {
    .settings-info-grid,
    .settings-stats-grid,
    .settings-limits-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

@container settings-preference (max-width: 720px) {
    .settings-pref-columns {
        grid-template-columns: 1fr;
    }

    .settings-pref-algo-grid {
        grid-template-columns: 1fr;
    }

    .palette-scope-switch {
        grid-template-columns: 1fr;
    }
}

@container settings-preference (max-width: 520px) {
    .settings-form-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-form-footer > button {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 720px) {
    .settings-pref-columns {
        grid-template-columns: 1fr;
    }

    .settings-pref-algo-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .settings-pref-group {
        padding: 14px;
    }

    .settings-form-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-form-footer > button {
        width: 100%;
        min-width: 0;
    }

    .palette-scope-switch {
        grid-template-columns: 1fr;
    }

    .palette-pick-wrap {
        grid-template-columns: 1fr;
    }

    .palette-kind-badge:not(.compact) {
        justify-self: start;
    }
}

.source-preview figure {
    margin: 0;
    display: grid;
    gap: 6px;
}

.source-preview figcaption {
    color: #64748b;
    font-size: 12px;
    text-align: center;
}

.tool-icon {
    margin-right: 4px;
}

.admin-overview-bar {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
}

.admin-stats-panel {
    overflow: hidden;
    border-color: #dbeafe;
    background:
        radial-gradient(circle at 100% 0, rgba(37, 99, 235, 0.09), transparent 34%),
        #ffffff;
}

.admin-stats-head {
    align-items: flex-start;
    margin-bottom: 20px;
}

.admin-stats-head > div {
    min-width: 0;
}

.admin-stats-head h3 {
    margin: 3px 0 4px;
}

.admin-stats-head .hint {
    margin: 0;
}

.admin-section-kicker {
    display: block;
    color: #2563eb;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.admin-status-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.admin-status-chip {
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #ffffff;
    color: #475569;
    font-size: 12px;
    font-weight: 500;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.admin-status-chip strong {
    margin-left: 4px;
    color: #0f172a;
    font-weight: 700;
}

.admin-status-chip:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.admin-status-chip.active {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.admin-config-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.admin-view .admin-shell {
    background: #f1f5f9;
    padding: 16px;
    border-radius: 8px;
}

.admin-stat-card {
    position: relative;
    min-width: 0;
    min-height: 128px;
    padding: 18px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.admin-stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #2563eb;
}

.admin-stat-card:nth-child(2)::before {
    background: #7c3aed;
}

.admin-stat-card:nth-child(3)::before {
    background: #0891b2;
}

.admin-stat-card:nth-child(4)::before {
    background: #ea580c;
}

.admin-stat-card:nth-child(5)::before {
    background: #16a34a;
}

.admin-stat-card:nth-child(6)::before {
    background: #475569;
}

.admin-stat-card strong {
    display: block;
    margin-top: 12px;
    font-size: clamp(24px, 2vw, 30px);
    line-height: 1.1;
    color: #0f172a;
    overflow-wrap: anywhere;
}

.admin-stat-card span {
    display: block;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
}

.admin-stat-card small {
    display: block;
    margin-top: 7px;
    color: #94a3b8;
    font-size: 12px;
}

@media (max-width: 1100px) {
    .admin-overview-bar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .admin-view .admin-shell {
        padding: 10px;
    }

    .admin-stats-head {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .admin-stats-head button {
        width: 100%;
    }

    .admin-overview-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .admin-stat-card {
        min-height: 112px;
        padding: 14px;
    }
}

.admin-storage-intro {
    margin: 0 0 14px;
}

.admin-storage-days-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #475569;
    font-size: 13px;
}

.admin-storage-days-field input {
    width: 78px;
    min-height: 34px;
    padding: 0 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
}

.admin-storage-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 16px;
}

.admin-storage-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.admin-storage-action {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.admin-storage-action-copy strong {
    display: block;
    color: #0f172a;
    font-size: 14px;
}

.admin-storage-action-copy p {
    margin: 6px 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.6;
}

.admin-storage-action-copy span {
    color: #475569;
    font-size: 12px;
    font-weight: 600;
}

.admin-storage-action button {
    align-self: flex-start;
}

.admin-storage-types {
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.admin-storage-types h4 {
    margin: 0 0 10px;
    color: #0f172a;
    font-size: 14px;
}

.admin-storage-type {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed #e2e8f0;
    font-size: 13px;
}

.admin-storage-type:last-child {
    border-bottom: none;
}

.admin-storage-type-name {
    flex: 1;
    min-width: 0;
    color: #334155;
    font-weight: 600;
}

.admin-storage-type-count {
    color: #94a3b8;
    font-size: 12px;
}

.admin-storage-type strong {
    color: #0f172a;
}

.admin-storage-orphans > .hint {
    margin-bottom: 10px;
}

.admin-storage-orphan-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.admin-storage-orphan-block {
    min-width: 0;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.admin-storage-orphan-block h4 {
    margin: 0 0 10px;
    color: #0f172a;
    font-size: 14px;
}

.admin-storage-orphan-block h4 .hint {
    font-weight: 400;
}

@media (max-width: 1100px) {
    .admin-storage-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-storage-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-storage-orphan-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .admin-storage-cards {
        grid-template-columns: 1fr;
    }

    .admin-storage-actions {
        grid-template-columns: 1fr;
    }

    .admin-storage-action button {
        width: 100%;
    }

    .admin-storage-days-field input {
        width: 64px;
    }
}

.mobile-generate-fab {
    position: fixed;
    right: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    z-index: 900;
    min-height: 48px;
    padding: 0 20px;
    border-radius: 999px;
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.35);
}

.mobile-generate-fab.hidden { display: none; }

.editor-view:fullscreen,
.editor-view.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 800;
    background: #eef2f6;
}

.editor-view:fullscreen .editor-body,
.editor-view.is-fullscreen .editor-body {
    flex: 1;
    min-height: 0;
}

.editor-view.mobile-simulated-landscape:is(:fullscreen, .is-fullscreen) {
    z-index: 10000 !important;
}

.editor-view.mobile-simulated-landscape:is(:fullscreen, .is-fullscreen) .editor-main {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 100dvh !important;
    height: 100dvw !important;
    max-width: 100dvh !important;
    max-height: 100dvw !important;
    transform: translate(-50%, -50%) rotate(90deg) !important;
}

.editor-view.is-mobile-layout:is(:fullscreen, .is-fullscreen) .toolbar-group-view .editor-landscape-tool:not(.hidden) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

button.loading {
    opacity: 0.85;
    cursor: wait;
}

.share-page-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 26px;
    border: 1px solid #93c5fd;
    border-radius: 14px;
    background: linear-gradient(135deg, #dbeafe 0%, #ecfdf5 55%, #eff6ff 100%);
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.12);
}

.share-page-cta-copy {
    flex: 1 1 240px;
    min-width: 0;
}

.share-page-cta-eyebrow {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #2563eb;
}

.share-page-cta-title {
    margin: 0 0 6px;
    font-size: clamp(18px, 2.4vw, 22px);
    line-height: 1.3;
    color: #0f172a;
}

.share-page-cta-desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #475569;
}

.share-page-cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 168px;
    padding: 12px 28px;
    border-radius: 999px;
    background: #2563eb;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.share-page-cta-button:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.34);
}

.share-page-footer {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #edf1f7;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
}

.share-page-footer strong {
    color: #64748b;
    font-weight: 600;
}

.share-page-options {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 0;
}

@media (max-width: 900px) and ((hover: none) or (pointer: coarse)), (max-width: 767px), ((max-height: 520px) and (max-width: 1100px) and ((hover: none) or (pointer: coarse))) {
    #projectView.view.active {
        min-height: auto;
    }

    .project-layout {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .project-layout.project-desktop {
        min-height: auto;
    }

    .project-list-filters {
        grid-template-columns: 1fr;
    }

    .project-list-scroll {
        overflow: visible;
        flex: none;
    }

    #projectView .project-list-panel > #projectRecyclePanel {
        flex: none;
    }

    #projectView .project-recycle-grid {
        overflow: visible;
        flex: none;
    }

    #projectView .project-card:not(.project-recycle-card) {
        grid-template-columns: 48px minmax(0, 1fr) 18px;
    }

    #projectView .project-card-thumb-wrap,
    #projectView .project-card-thumb {
        width: 48px;
        height: 48px;
    }

    #projectView .project-card.project-recycle-card {
        grid-template-columns: 20px 48px minmax(0, 1fr);
        grid-template-areas:
            "check thumb body"
            "actions actions actions";
        align-items: start;
    }

    #projectView .project-card.project-recycle-card .project-recycle-check {
        grid-area: check;
        min-height: 48px;
    }

    #projectView .project-card.project-recycle-card .project-card-thumb-wrap {
        grid-area: thumb;
    }

    #projectView .project-card.project-recycle-card .project-recycle-body {
        grid-area: body;
    }

    #projectView .project-card.project-recycle-card .project-recycle-actions {
        grid-area: actions;
        flex-direction: row;
        width: 100%;
        justify-content: stretch;
        padding-top: 0;
    }

    #projectView .project-card.project-recycle-card .project-recycle-actions button {
        flex: 1;
        min-width: 0;
    }

    .project-recycle-batch {
        flex-direction: column;
        align-items: stretch;
        padding: 0 2px;
    }

    .project-recycle-batch-left {
        width: 100%;
        margin: 0;
        justify-content: flex-start;
    }

    .project-recycle-batch-actions {
        width: 100%;
    }

    .project-recycle-batch-actions button {
        flex: 1;
        min-height: 32px;
        min-width: 0;
    }

    .project-recycle-batch-all {
        width: auto;
        margin: 0;
    }

    .project-detail-content {
        overflow: visible;
    }

    .project-layout:not(.project-mobile-detail) .project-detail-drawer {
        display: none;
    }

    .project-layout.project-mobile-detail .project-list-panel {
        display: none;
    }

    .project-layout.project-mobile-detail .project-detail-drawer {
        display: block;
        padding: 12px;
    }

    .project-layout.project-mobile-detail .project-detail-content {
        padding-right: 0;
    }

    .project-layout.project-mobile-detail .project-detail-topbar {
        gap: 10px;
        margin-bottom: 14px;
        padding: 12px;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #f8fafc;
    }

    .project-layout.project-mobile-detail .project-detail-back {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 42px;
        padding: 0 14px;
        line-height: 1.25;
        text-align: center;
    }

    .project-layout.project-mobile-detail .project-detail-title-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .project-layout.project-mobile-detail .project-detail-name-input {
        width: 100%;
        min-height: 42px;
    }

    .project-layout.project-mobile-detail .project-detail-inline-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }

    .project-layout.project-mobile-detail .project-detail-inline-actions button {
        width: 100%;
        min-height: 42px;
    }

    .project-layout.project-mobile-detail .project-detail-primary-btn,
    .project-layout.project-mobile-detail .project-detail-secondary-actions button {
        width: 100%;
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        line-height: 1.25;
    }

    .project-detail-secondary-actions {
        grid-template-columns: 1fr 1fr;
    }

    #projectView .project-detail-grid {
        grid-template-columns: 1fr;
    }

    .project-detail-actions {
        grid-template-columns: 1fr;
    }

    .project-detail-actions-bar {
        width: 100%;
        justify-content: stretch;
    }

    .project-detail-actions-bar input {
        max-width: none;
    }

    .mobile-generate-fab:not(.hidden) {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        right: 16px;
        left: 16px;
        bottom: calc(88px + env(safe-area-inset-bottom, 0px));
        width: auto;
    }

    .onboarding-banner {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (min-width: 901px) {
    .mobile-generate-fab {
        display: none !important;
    }
}

@media (min-width: 901px) and (max-width: 1199px) {
    .workspace-layout {
        grid-template-columns: minmax(280px, 35%) minmax(0, 65%);
    }

    .workspace-generate-panel .settings-size,
    .workspace-generate-panel .settings-palette {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .workspace-layout {
        grid-template-columns: minmax(320px, 34%) minmax(0, 66%);
    }
}

/* ── 开工看板模式 ── */
.view.assembly-view.active,
.view.assembly-view:not(.hidden) {
    display: flex !important;
    flex-direction: column;
    position: relative;
}

.assembly-view {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    padding: 0 !important;
    background: #020617;
    color: #f8fafc;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.assembly-workspace {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
    background: #020617;
}

.assembly-workspace.is-chrome-collapsed .assembly-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    transform: translateY(-100%);
    transition: transform 0.22s ease;
    pointer-events: none;
}

.assembly-workspace.is-chrome-collapsed .assembly-dock {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    transform: translateY(100%);
    transition: transform 0.22s ease;
    pointer-events: none;
}

.assembly-workspace.has-legend-open.is-chrome-collapsed .assembly-dock,
.assembly-workspace.has-legend-open.is-chrome-collapsed .assembly-legend-drawer.is-open {
    position: relative;
    transform: none;
    pointer-events: auto;
}

.assembly-workspace.is-chrome-collapsed .assembly-stage {
    flex: 1;
}

.assembly-workspace.is-chrome-collapsed.is-chrome-peek .assembly-topbar,
.assembly-workspace.is-chrome-collapsed.is-chrome-peek .assembly-dock,
.assembly-workspace.has-legend-open.is-chrome-collapsed .assembly-topbar {
    transform: translateY(0);
    pointer-events: auto;
}

.assembly-show-chrome {
    position: absolute;
    left: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 6;
    min-height: 36px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, 0.45);
    background: rgba(15, 23, 42, 0.88);
    color: #e0f2fe;
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.45);
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.assembly-show-chrome:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(125, 211, 252, 0.65);
}

.assembly-show-chrome.hidden {
    display: none;
}

.assembly-view * {
    user-select: none;
    -webkit-user-select: none;
}

.assembly-view input,
.assembly-view textarea {
    user-select: text;
    -webkit-user-select: text;
}

.assembly-view button.secondary {
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.28);
    min-height: 32px;
    padding: 0 12px;
    font-size: 12px;
}

.assembly-view button.secondary:hover {
    background: rgba(30, 41, 59, 0.92);
    border-color: rgba(148, 163, 184, 0.45);
}

.assembly-view button.secondary:disabled {
    color: #64748b;
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(148, 163, 184, 0.15);
}

.assembly-view:not(.hidden) {
    display: flex;
}

.app-shell.editor-focus .assembly-view:not(.hidden) {
    flex: 1;
    min-height: 0;
    height: 100%;
}

@media (max-width: 900px) and ((hover: none) or (pointer: coarse)), (max-width: 767px), ((max-height: 520px) and (max-width: 1100px) and ((hover: none) or (pointer: coarse))) {
    .app-shell.editor-focus {
        height: var(--app-vh, 100svh);
        max-height: var(--app-vh, 100svh);
        min-height: var(--app-vh, 100svh);
    }

    html:has(.app-shell.editor-focus:not(.hidden)),
    html:has(.app-shell.editor-focus:not(.hidden)) body,
    html:has(.app-shell.editor-focus:not(.hidden)) #app {
        height: var(--app-vh, 100svh);
        max-height: var(--app-vh, 100svh);
        overflow: hidden;
    }

    .app-shell.editor-focus .assembly-view:not(.hidden):not(:fullscreen):not(.is-fullscreen),
    .app-shell.editor-focus .editor-view:not(.hidden):not(:fullscreen):not(.is-fullscreen) {
        position: fixed;
        top: var(--app-vt, 0px);
        left: var(--app-vl, 0px);
        right: auto;
        bottom: auto;
        z-index: 900;
        width: var(--app-vw, 100%);
        height: var(--app-vh, 100svh);
        max-height: var(--app-vh, 100svh);
        min-height: 0;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    .app-shell.editor-focus .assembly-view:is(:fullscreen, .is-fullscreen):not(.hidden),
    .app-shell.editor-focus .editor-view:is(:fullscreen, .is-fullscreen):not(.hidden) {
        position: fixed !important;
        inset: 0 !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    .app-shell.editor-focus .assembly-view:not(.hidden) .assembly-workspace,
    .app-shell.editor-focus .editor-view:not(.hidden) .editor-workspace {
        height: 100%;
        min-height: 0;
    }

    .app-shell.editor-focus .content {
        padding: 0 !important;
        height: 0;
        flex: 0;
        overflow: hidden;
    }
}

.assembly-topbar {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(6px + env(safe-area-inset-top, 0px)) calc(12px + env(safe-area-inset-right, 0px)) 6px calc(12px + env(safe-area-inset-left, 0px));
    background: rgba(2, 6, 23, 0.96);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    flex-shrink: 0;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.assembly-mobile-hint {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 52px);
    left: calc(8px + env(safe-area-inset-left, 0px));
    right: calc(8px + env(safe-area-inset-right, 0px));
    z-index: 29;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.96);
    border: 1px solid rgba(251, 191, 36, 0.35);
    color: #fcd34d;
    font-size: 12px;
    line-height: 1.5;
    pointer-events: auto;
}

.assembly-mobile-hint.hidden {
    display: none;
}

.assembly-mobile-hint .secondary {
    flex-shrink: 0;
    min-height: 36px;
    padding: 0 10px;
    font-size: 12px;
}

.assembly-topbar-center {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 2px;
}

.assembly-top-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.assembly-progress-text {
    font-size: 12px;
    color: #94a3b8;
}

.assembly-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.assembly-sync-status {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    white-space: nowrap;
}

.assembly-sync-status.is-local {
    background: rgba(251, 191, 36, 0.15);
    color: #fcd34d;
}

.assembly-sync-status.is-saving {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

.assembly-sync-status.is-flash {
    animation: assembly-sync-flash 0.6s ease;
}

@keyframes assembly-sync-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; transform: scale(1.04); }
}

.assembly-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.assembly-canvas-wrap {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    touch-action: none;
    background: #0f172a;
    border-radius: 0;
    border: none;
}

.assembly-canvas-wrap.pan-mode {
    cursor: grab;
}

.assembly-canvas-wrap.pan-mode:active {
    cursor: grabbing;
}

.assembly-canvas-wrap.mark-mode {
    cursor: crosshair;
}

.assembly-canvas-wrap.lock-mode {
    cursor: default;
}

.assembly-canvas-wrap.lock-mode.pan-mode {
    cursor: grab;
}

.assembly-canvas-wrap.lock-mode.pan-mode:active {
    cursor: grabbing;
}

.assembly-canvas-wrap.lock-pick-row {
    cursor: row-resize;
}

.assembly-canvas-wrap.lock-pick-col {
    cursor: col-resize;
}

.assembly-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.assembly-lock-bar {
    display: none;
}

.assembly-dock-lock-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    padding-top: 6px;
    margin-top: 2px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    overflow-x: auto;
    scrollbar-width: thin;
}

.assembly-dock-lock-row.hidden {
    display: none;
}

.assembly-workspace.has-lock-inline .assembly-dock-row-primary {
    gap: 6px;
}

.assembly-view:not(.is-phone-dock) .assembly-workspace:is(.has-mark-inline, .has-lock-inline) .assembly-dock-row-primary {
    flex-wrap: wrap !important;
    row-gap: 6px;
    align-content: flex-start;
    overflow-x: visible;
    overflow-y: visible;
}

.assembly-view:not(.is-phone-dock) .assembly-workspace:is(.has-mark-inline, .has-lock-inline) .assembly-dock-mark-inline,
.assembly-view:not(.is-phone-dock) .assembly-workspace:is(.has-mark-inline, .has-lock-inline) .assembly-lock-inline {
    flex: 1 1 100%;
    width: 100%;
    order: 10;
}

.assembly-view:not(.is-phone-dock) .assembly-workspace:is(.has-mark-inline, .has-lock-inline) .assembly-dock-modes {
    flex: 1 1 auto;
    min-width: 0;
}

.assembly-view:not(.is-phone-dock) .assembly-workspace:is(.has-mark-inline, .has-lock-inline) .assembly-dock-extras {
    flex: 1 1 auto;
    min-width: 0;
}

.assembly-view:not(.is-phone-dock) .assembly-workspace:is(.has-mark-inline, .has-lock-inline) .assembly-dock-actions {
    flex: 0 0 auto;
    margin-left: auto;
}

.assembly-lock-hint {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
    flex-shrink: 0;
}

.assembly-dock-mark-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.assembly-dock-mark-inline.hidden {
    display: none;
}

.assembly-mark-tools {
    display: inline-flex;
    gap: 4px;
    flex-shrink: 0;
}

.assembly-mark-tool-btn {
    min-height: 30px;
    padding: 0 10px;
    border-radius: 7px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.72);
    color: #cbd5e1;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.assembly-mark-tool-btn.is-active {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.35);
    color: #fff;
    font-weight: 600;
}

.assembly-mark-undo-btn,
.assembly-mark-redo-btn {
    min-height: 30px;
    padding: 0 10px;
    border-radius: 7px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.72);
    color: #cbd5e1;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.assembly-mark-undo-btn:disabled,
.assembly-mark-redo-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.assembly-mark-undo-btn:not(:disabled):hover,
.assembly-mark-redo-btn:not(:disabled):hover {
    border-color: rgba(148, 163, 184, 0.5);
    color: #f1f5f9;
}

.assembly-canvas-wrap.mark-mode.mark-tool-brush {
    cursor: cell;
}

.assembly-canvas-wrap.mark-mode.mark-tool-region {
    cursor: crosshair;
}

.assembly-region-bar {
    position: absolute;
    left: 50%;
    bottom: calc(var(--assembly-dock-h, 72px) + 12px);
    z-index: 14;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: calc(100% - 24px);
    padding: 6px 8px;
    border-radius: 12px;
    border: 1px solid rgba(56, 189, 248, 0.35);
    background: rgba(15, 23, 42, 0.94);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    pointer-events: auto;
}

.assembly-region-bar.hidden {
    display: none;
}

.assembly-region-summary {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    padding: 0 4px;
}

.assembly-region-btn {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(30, 41, 59, 0.85);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.assembly-region-btn.primary {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.55);
    color: #fff;
}

.assembly-region-btn.secondary {
    color: #94a3b8;
}

.assembly-region-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.assembly-swipe-lock-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.72);
    color: #cbd5e1;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    white-space: nowrap;
}

.assembly-swipe-lock-label input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #38bdf8;
    cursor: pointer;
}

.assembly-swipe-lock-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #7dd3fc;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.assembly-swipe-lock-status.hidden {
    display: none;
}

.assembly-swipe-lock-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    flex-shrink: 0;
}

.assembly-canvas-wrap.swipe-locking {
    cursor: cell;
}

.assembly-lock-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
    padding: 0 8px;
    margin: 0 2px;
    border-left: 1px solid rgba(148, 163, 184, 0.18);
    border-right: 1px solid rgba(148, 163, 184, 0.18);
}

.assembly-lock-inline.hidden {
    display: none;
}

.assembly-lock-axis {
    display: inline-flex;
    gap: 4px;
    flex-shrink: 0;
}

.assembly-axis-btn {
    min-height: 30px;
    padding: 0 8px;
    border-radius: 7px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.72);
    color: #cbd5e1;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.assembly-axis-btn.is-active {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.35);
    color: #fff;
    font-weight: 600;
}

.assembly-lock-summary {
    font-size: 11px;
    color: #7dd3fc;
    white-space: nowrap;
    flex-shrink: 0;
}

.assembly-clear-locks {
    min-height: 30px;
    padding: 0 8px;
    border-radius: 7px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(30, 41, 59, 0.72);
    color: #e2e8f0;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

.assembly-clear-locks.hidden {
    display: none;
}

.assembly-lock-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.assembly-lock-nudge {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.assembly-lock-sep {
    color: rgba(148, 163, 184, 0.28);
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
    user-select: none;
}

.assembly-lock-tag {
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    white-space: nowrap;
    min-width: 14px;
}

.assembly-view .assembly-lock-input {
    width: 72px;
    min-width: 72px;
    max-width: 72px;
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.82);
    color: #f8fafc;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    text-align: center;
    flex-shrink: 0;
    user-select: text;
    -webkit-user-select: text;
    -moz-appearance: textfield;
    appearance: textfield;
}

.assembly-view .assembly-lock-input::-webkit-outer-spin-button,
.assembly-view .assembly-lock-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.assembly-lock-input:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.assembly-lock-input::placeholder {
    color: #64748b;
    font-size: 13px;
}

.assembly-reset-assist.hidden,
.assembly-dock-action.hidden {
    display: none;
}

.assembly-dock-more-group {
    display: contents;
}

.assembly-dock.is-more-open .assembly-more-toggle {
    color: #93c5fd;
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.22);
}

.assembly-dock-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.assembly-dock-row-primary {
    width: 100%;
    flex-wrap: nowrap;
}

.assembly-dock-extras {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
    flex-shrink: 1;
}

.assembly-dock-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.assembly-dock-action {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
    white-space: nowrap;
}

.assembly-reset-progress:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.assembly-nudge-btn {
    min-width: 28px;
    width: 28px;
    min-height: 15px;
    height: 15px;
    line-height: 1;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 5px;
    background: rgba(15, 23, 42, 0.78);
    color: #e2e8f0;
    font-size: 10px;
    cursor: pointer;
}

.assembly-nudge-btn:active {
    background: rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
}

.assembly-mode-btn.secondary-fit {
    border-style: dashed;
    opacity: 0.9;
}

.assembly-dock {
    position: relative;
    z-index: 20;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 6px calc(10px + env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) calc(10px + env(safe-area-inset-left, 0px));
    border-radius: 0;
    background: rgba(2, 6, 23, 0.96);
    border-top: 1px solid rgba(148, 163, 184, 0.14);
    flex-shrink: 0;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.assembly-display-settings {
    display: none;
}

.assembly-display-select {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #cbd5e1;
    flex-shrink: 0;
    white-space: nowrap;
}

.assembly-display-label {
    font-size: 12px;
    color: #94a3b8;
}

.assembly-display-select select {
    min-height: 30px;
    width: auto;
    min-width: 58px;
    padding: 0 6px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.75);
    color: #e2e8f0;
    font-size: 12px;
}

.assembly-dock-modes {
    display: inline-flex;
    gap: 6px;
    flex-shrink: 0;
}

.assembly-mode-btn {
    min-height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.6);
    color: #cbd5e1;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
}

.assembly-mode-btn.assembly-more-toggle {
    display: none;
}

.assembly-view.is-phone-dock .assembly-mode-btn.assembly-more-toggle {
    display: inline-flex;
}

.assembly-view:not(.is-phone-dock) .assembly-mode-btn.assembly-more-toggle {
    display: none;
}

.assembly-view .assembly-mode-btn:hover {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(148, 163, 184, 0.4);
}

.assembly-mode-btn.is-active {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.35);
    color: #fff;
    font-weight: 600;
}

.assembly-canvas-wrap.is-mirrored {
    box-shadow: inset 0 0 0 2px rgba(13, 148, 136, 0.45);
}

.assembly-legend-drawer {
    flex-shrink: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease;
    margin: 0;
    border-radius: 0;
    background: rgba(15, 23, 42, 0.96);
    border-top: 1px solid transparent;
    border-bottom: 1px solid transparent;
}

.assembly-legend-drawer.is-open {
    max-height: min(36vh, 280px);
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    border-top-color: rgba(148, 163, 184, 0.18);
    border-bottom-color: rgba(148, 163, 184, 0.12);
    padding: 10px 12px;
}

.assembly-legend-hint {
    margin: 0 0 8px;
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.5;
}

.assembly-legend-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 6px;
}

.assembly-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(15, 23, 42, 0.5);
    color: #e2e8f0;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
}

.assembly-legend-item:focus {
    outline: none;
}

.assembly-legend-item:focus-visible {
    outline: 2px solid rgba(56, 189, 248, 0.65);
    outline-offset: 2px;
}

.assembly-legend-item:hover {
    background: rgba(30, 41, 59, 0.72);
    border-color: rgba(148, 163, 184, 0.28);
}

.assembly-legend-item.is-active {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
}

.assembly-legend-swatch-wrap {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}

.assembly-legend-swatch {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-sizing: border-box;
}

.assembly-legend-badge {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.85);
}

.assembly-legend-text {
    display: grid;
    gap: 2px;
    font-size: 12px;
}

.assembly-legend-text strong {
    font-size: 13px;
}

.project-progress-metric {
    grid-column: 1 / -1;
}

.project-progress-bar-wrap {
    margin-top: 8px;
    display: grid;
    gap: 6px;
}

.project-progress-bar {
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.project-progress-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #38bdf8);
    transition: width 0.3s ease;
}

.project-progress-label {
    font-size: 12px;
    color: #64748b;
}

.project-detail-secondary-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.assembly-view:is(:fullscreen, .is-fullscreen) {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 900;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #020617;
}

.assembly-view.mobile-simulated-landscape:is(:fullscreen, .is-fullscreen) {
    z-index: 10000 !important;
}

.assembly-view.mobile-simulated-landscape:is(:fullscreen, .is-fullscreen) .assembly-workspace {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 100dvh !important;
    height: 100dvw !important;
    max-width: 100dvh !important;
    max-height: 100dvw !important;
    transform: translate(-50%, -50%) rotate(90deg) !important;
}

.assembly-view.is-mobile-layout:is(:fullscreen, .is-fullscreen) .assembly-topbar-actions .assembly-landscape-btn:not(.hidden),
.assembly-view.is-mobile-layout:is(:fullscreen, .is-fullscreen) .assembly-topbar-actions .mobile-landscape-btn:not(.hidden) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.assembly-view:is(:fullscreen, .is-fullscreen) .assembly-topbar-actions .assembly-topbar-chip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.assembly-view:fullscreen:not(.mobile-simulated-landscape) .assembly-workspace,
.assembly-view.is-fullscreen:not(.mobile-simulated-landscape) .assembly-workspace {
    height: 100%;
}

.assembly-view:fullscreen .assembly-topbar,
.assembly-view.is-fullscreen .assembly-topbar {
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
}

.assembly-view:fullscreen .assembly-dock,
.assembly-view.is-fullscreen .assembly-dock {
    padding-bottom: calc(5px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 1024px) {
    .assembly-dock-row {
        gap: 6px;
    }

    .assembly-mode-btn,
    .assembly-dock-action {
        min-height: 40px;
    }
}

@media (max-width: 900px) and ((hover: none) or (pointer: coarse)), (max-width: 767px), ((max-height: 520px) and (max-width: 1100px) and ((hover: none) or (pointer: coarse))) {
    .assembly-view.is-mobile-layout .assembly-back-btn,
    .assembly-view.is-mobile-layout .assembly-fullscreen-btn {
        min-height: 44px;
        padding: 0 12px;
    }

    .assembly-view.is-mobile-layout .assembly-topbar-center {
        gap: 1px;
    }

    .assembly-view.is-mobile-layout .assembly-top-title {
        font-size: 13px;
    }

    .assembly-view.is-mobile-layout:not(.is-phone-dock) .assembly-sync-status {
        font-size: 10px;
        padding: 4px 6px;
    }

    .assembly-view.is-mobile-layout:not(.is-phone-dock):not(.mobile-simulated-landscape) .assembly-dock-row-primary .assembly-dock-actions {
        margin-left: auto;
    }

    .assembly-view.is-phone-dock .assembly-mode-btn,
    .assembly-view.is-phone-dock .assembly-dock-action {
        min-height: 44px;
        padding: 0 12px;
        font-size: 13px;
    }

    .assembly-view.is-phone-dock .assembly-nudge-btn {
        min-width: 40px;
        width: 40px;
        min-height: 28px;
        height: 28px;
        font-size: 12px;
    }

    .assembly-view.is-mobile-layout .assembly-lock-input {
        width: 80px;
        min-width: 80px;
        max-width: 80px;
        height: 36px;
        min-height: 36px;
        font-size: 15px;
    }

    .assembly-view.is-phone-dock .assembly-dock-mark-inline {
        flex-basis: 100%;
        order: 3;
    }

    .assembly-view.is-phone-dock .assembly-mark-undo-btn,
    .assembly-view.is-phone-dock .assembly-mark-redo-btn {
        min-height: 36px;
    }

    .assembly-view.is-mobile-layout .assembly-region-bar {
        bottom: calc(var(--assembly-dock-h, 88px) + 8px);
        padding: 8px 10px;
        gap: 8px;
    }

    .assembly-view.is-mobile-layout .assembly-region-btn {
        min-height: 40px;
        padding: 0 14px;
        font-size: 13px;
    }

    .assembly-view.is-phone-dock .assembly-legend-drawer.is-open {
        max-height: min(32vh, 240px);
    }

    .assembly-landscape-btn.is-active,
    .assembly-view .mobile-landscape-btn.is-active {
        color: #93c5fd;
        border-color: #2563eb;
        background: rgba(37, 99, 235, 0.25);
    }

    .assembly-view.is-mobile-layout .assembly-landscape-btn,
    .assembly-view.is-mobile-layout .mobile-landscape-btn:not(.hidden) {
        display: inline-flex;
    }
}

@media (max-width: 640px) {
    /* 非竖屏小屏仍允许顶栏换行；竖屏规则见 max-width:900px touch 块 */
    .assembly-view.is-mobile-layout:not(.is-phone-dock):not(.landscape-mode-on):not(.is-landscape-layout) .assembly-topbar {
        flex-wrap: wrap;
        gap: 6px;
        padding-top: calc(6px + env(safe-area-inset-top, 0px));
    }

    .assembly-view.is-mobile-layout:not(.is-phone-dock):not(.landscape-mode-on):not(.is-landscape-layout) .assembly-topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .assembly-dock-lock-row {
        overflow-x: auto;
        justify-content: flex-start;
        scrollbar-width: thin;
    }

    .assembly-swipe-lock-label {
        min-height: 44px;
        font-size: 13px;
    }

    .assembly-lock-inline {
        min-width: max-content;
    }

    .assembly-dock-modes {
        flex: 1;
        min-width: 0;
    }

    .assembly-dock-modes .assembly-mode-btn {
        flex: 1;
        min-width: 0;
        padding: 0 8px;
        font-size: 12px;
    }

    .assembly-view.is-phone-dock .assembly-legend-drawer.is-open:not(.is-legend-panel) .assembly-legend-list {
        grid-template-columns: 1fr;
    }

    .project-detail-secondary-actions {
        grid-template-columns: 1fr;
    }
}

.project-share-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #a7f3d0;
    justify-self: start;
}

.settings-stat-link {
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.settings-stat-link:hover,
.settings-stat-link:focus-visible {
    background: #f8fafc;
    outline: none;
}

.my-shares-head {
    margin-bottom: 0;
}

.my-shares-list.admin-list {
    display: block;
    margin-top: 12px;
}

.my-shares-empty {
    padding: 28px 16px;
    text-align: center;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    color: #64748b;
}

.my-shares-empty strong {
    display: block;
    margin-bottom: 8px;
    color: #0f172a;
    font-size: 16px;
}

@media (max-width: 720px) {
    #settingsSharesPanel .panel-head.my-shares-head {
        flex-direction: column;
        align-items: stretch;
    }

    #settingsSharesPanel .admin-status-summary {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }
}

/* 安全/模板/回收站扩展 */
.auth-forgot-row { margin: 8px 0 0; text-align: right; }
.workspace-templates-panel { margin: 12px 0; }
.workspace-templates-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* 模板选择弹窗（横向列表：左缩略图 + 右文字，布局稳定） */
.tpl-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(360px, 44vh);
    overflow-y: auto;
    padding: 2px;
}

button.tpl-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    flex-shrink: 0;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    color: #334155;
    text-align: left;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

button.tpl-card:hover {
    border-color: #bfdbfe;
    background: #f8fafc;
}

button.tpl-card.is-active {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.tpl-thumb {
    width: 68px;
    height: 68px;
    flex-shrink: 0;
    object-fit: contain;
    border-radius: 8px;
    background: #f8fafc;
    padding: 5px;
    box-sizing: border-box;
}

.tpl-body {
    display: grid;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.tpl-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.tpl-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
}

.tpl-size {
    color: #64748b;
    font-size: 0.75rem;
    white-space: nowrap;
}

.tpl-desc {
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.5;
}

.tpl-tag {
    justify-self: start;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.7rem;
}


.danger-btn { color: #b91c1c; border-color: #fecaca; }

/* —— 移动端适配加强：与 UiUtils.isMobileLayout() 断点对齐的补充规则 —— */
@media (max-width: 900px) and ((hover: none) or (pointer: coarse)),
       (max-width: 767px),
       ((max-height: 520px) and (max-width: 1100px) and ((hover: none) or (pointer: coarse))) {
    /* iOS 避免聚焦输入框时自动放大页面 */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
    select,
    textarea,
    #paletteView .palette-select,
    #paletteView .palette-search-input,
    .workspace-library-filters input,
    .workspace-library-filter-toolbar select,
    .project-search,
    .project-sort-label select,
    .auth-card input,
    .auth-card select,
    .admin-filter-keyword,
    .admin-filter-select,
    .admin-table-select,
    .settings-compact-form input,
    .settings-compact-form select,
    .share-password-form input,
    .export-form input,
    .export-form select {
        font-size: 16px;
    }

    .check-label {
        min-height: 44px;
        padding: 4px 0;
    }

    .check-label input[type="checkbox"],
    .check-label input[type="radio"],
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
    }

    .admin-bulk-check,
    .admin-row-check {
        min-height: 44px;
        padding: 4px 2px;
    }

    .admin-bulk-check input[type="checkbox"],
    .admin-row-check input[type="checkbox"] {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
        max-width: 20px;
        flex-basis: 20px;
    }

    .admin-row-check-disabled {
        width: 20px;
        height: 20px;
    }

    table.admin-table {
        min-width: 640px;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 8px;
        font-size: 13px;
    }

    .admin-pager button,
    .admin-bulk-delete-btn {
        min-height: 40px;
        padding: 0 12px;
    }

    .preview-actions button {
        min-height: 44px;
        font-size: 13px;
    }

    .preview-options .check-label {
        min-height: 40px;
        font-size: 13px;
    }

    #paletteView .palette-tab,
    #paletteView .palette-select,
    #paletteView .palette-search-input,
    #paletteView .palette-bar-action,
    #paletteView .palette-sidebar-actions button {
        min-height: 44px;
    }

    #paletteView .palette-filter-drawer > summary {
        min-height: 40px;
    }

    .mobile-step-tab {
        min-height: 44px;
        font-size: 14px;
    }

    .workspace-upload-panel .compact-toolbar button,
    .workspace-library-actions button,
    .file-actions button {
        min-height: 44px;
    }

    .share-modal-card {
        width: min(100vw - 16px, 520px);
        max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        padding: 16px;
        border-radius: 14px;
    }

    .export-modal-card {
        width: min(100vw - 16px, 640px);
        max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        padding: 16px;
        border-radius: 14px;
    }

    .confirm-modal-card {
        width: min(100vw - 24px, 420px);
        padding: 20px 16px;
    }

    .settings-security-modal {
        padding: 12px;
    }

    .settings-security-modal-card {
        width: min(100vw - 24px, 440px);
        max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        padding: 20px 16px;
        border-radius: 14px;
    }

    .settings-security-modal-head {
        margin-bottom: 14px;
    }

    .confirm-modal-actions {
        flex-wrap: wrap;
    }

    .confirm-modal-actions button {
        flex: 1 1 calc(50% - 5px);
        min-height: 44px;
    }

    .assembly-nudge-btn {
        min-width: 36px;
        width: 36px;
        min-height: 26px;
        height: 26px;
        font-size: 12px;
        border-radius: 6px;
    }

    .topbar {
        gap: 8px;
        margin-bottom: 10px;
    }

    .topbar h2 {
        font-size: clamp(18px, 5vw, 22px);
    }

    /* 横屏矮视口：压缩页面边距，给画布更多空间 */
    html.is-mobile-layout .app-shell:not(.mobile-palette-layout):not(.editor-focus) .content {
        padding-left: max(10px, env(safe-area-inset-left, 0px));
        padding-right: max(10px, env(safe-area-inset-right, 0px));
    }
}

/* 窄屏（含桌面缩小窗口）：登录页强制单栏，避免 minmax(420px) 撑破 */
@media (max-width: 900px) {
    .auth-screen {
        grid-template-columns: 1fr;
        gap: 20px;
        width: min(680px, calc(100% - 32px));
        margin: 20px auto;
        padding: 0;
        min-height: auto;
        align-items: stretch;
    }

    .auth-brand {
        min-height: 220px;
        padding: 24px;
    }

    .auth-brand h1 {
        font-size: clamp(26px, 7vw, 34px);
    }

    .auth-brand::after {
        width: min(240px, 70%);
        height: 120px;
        margin-top: 20px;
    }

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

@media (max-width: 520px) {
    .settings-info-grid,
    .settings-stats-grid,
    .settings-limits-grid,
    .settings-info-grid-compact,
    .settings-stats-grid-compact,
    .settings-limits-grid-compact {
        grid-template-columns: 1fr;
    }

    .admin-overview-bar {
        grid-template-columns: 1fr;
    }

    .share-page-cta {
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
    }

    .share-page-cta-button {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    .mobile-bottom-nav.has-admin .mobile-bottom-label {
        font-size: 9px;
    }

    .mobile-bottom-item {
        min-height: 48px;
        padding: 2px 1px;
    }
}

/* JS 布局类兜底：保证与 isMobileLayout() 同步时底栏/侧栏一致 */
html.is-mobile-layout .app-shell:not(.tablet-layout):not(.hidden) {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

html.is-mobile-layout .app-shell:not(.tablet-layout) .sidebar {
    display: none;
}

html.is-mobile-layout .app-shell:not(.tablet-layout):not(.mobile-palette-layout):not(.editor-focus) .content {
    order: 1;
    flex: 1;
    min-width: 0;
    min-height: 0;
    padding-bottom: calc(126px + env(safe-area-inset-bottom, 0px));
}

html.is-mobile-layout #mobileBottomNav:not(.hidden) {
    display: grid;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

.list-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.list-pager-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.share-page-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* 管理后台小屏：筛选/批量栏与表格操作纵向堆叠 */
@media (max-width: 720px) {
    .admin-list-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .admin-list-toolbar .admin-filter-bar {
        flex: 1 1 auto;
        width: 100%;
        grid-template-columns: 1fr;
    }

    .admin-bulk-bar {
        flex-wrap: wrap;
        width: 100%;
        justify-content: flex-start;
    }

    .admin-panel .panel-head,
    .admin-panel .panel-head-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .admin-panel .panel-head-actions {
        width: 100%;
    }

    .admin-panel .inline-form,
    .admin-panel form,
    .admin-form-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .admin-panel .inline-form > label,
    .admin-panel form > label,
    .admin-form-grid > label {
        width: 100%;
        min-width: 0;
    }

    .admin-form-actions,
    .admin-form-actions button {
        width: 100%;
    }

    .admin-table-wrap,
    .admin-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .editor-toolbar-groups {
        gap: 6px;
    }

    .editor-toolbar button {
        min-height: 40px;
        padding: 0 10px;
    }
}

 

/* ===== 社区 ===== */
.community-shell { display: flex; flex-direction: column; gap: 8px; padding: 0 0 28px; }
#communityMessage {
    display: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0;
}
#communityMessage.is-visible {
    display: block !important;
    padding: 2px 4px;
}
.community-toolbar {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--color-border-strong, #cbd5e1);
    border-radius: 14px;
    background: var(--color-bg-surface, #fff);
}
.community-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.community-tabs::-webkit-scrollbar {
    display: none;
    height: 0;
}
.community-tab,
.community-toolbar-actions .secondary,
.community-toolbar-actions .project-detail-primary-btn { border-radius: 999px; }
button.community-tab,
.community-tab {
    border: none;
    background: transparent;
    color: var(--color-text-secondary, #64748b);
    padding: 8px 14px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    flex: 0 0 auto;
    min-height: 36px;
}
button.community-tab:hover:not(.active),
.community-tab:hover:not(.active) {
    background: var(--color-bg-muted, #e8eef5);
    color: var(--color-text-primary, #172033);
}
button.community-tab.active,
.community-tab.active {
    background: var(--color-primary, #2563eb);
    color: #fff;
    border-color: transparent;
}
.community-toolbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 0 0 auto;
}
.community-toolbar-actions .secondary,
.community-toolbar-actions .project-detail-primary-btn {
    min-height: 36px;
    padding: 8px 14px;
    font-weight: 600;
}
.community-toolbar-actions .secondary.active {
    background: var(--color-primary, #2563eb);
    color: #fff;
    border-color: transparent;
}
.community-toolbar-actions .project-detail-primary-btn { white-space: nowrap; }
.community-unread {
    display: inline-flex;
    min-width: 1.2em;
    padding: 0 6px;
    margin-left: 4px;
    border-radius: 999px;
    background: var(--color-danger, #c45c4a);
    color: #fff;
    font-size: 12px;
}
.community-panel { min-height: 0; }
.community-panel .empty-state {
    padding: 28px 16px;
    text-align: center;
    color: var(--color-text-secondary, #64748b);
    background: var(--color-bg-surface, #fff);
    border: 1px dashed var(--color-border-strong, #cbd5e1);
    border-radius: 14px;
}
.community-empty-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}
.community-loading {
    padding: 36px 16px;
    text-align: center;
    color: var(--color-text-muted, #64748b);
    font-size: var(--font-body, 14px);
}
.community-back-bar {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
}
.community-back-btn {
    min-height: 36px;
    font-weight: 600;
}
.community-section-title {
    margin: 0 0 12px;
    font-size: var(--font-section-title, 15px);
    font-weight: 700;
    color: var(--color-text-primary, #172033);
}
.community-feed, .community-grid, .community-topics { display: grid; gap: 12px; }
/* 动态流：单列满宽（避免 auto-fill 空轨道造成中间一列两边空） */
.community-feed {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: none !important;
    margin: 0 !important;
    margin-inline: 0 !important;
    gap: 12px;
}
.community-panel:has(> .community-feed) > .community-load-more,
.community-panel:has(> .community-feed) > .empty-state {
    max-width: none;
    margin-inline: 0;
    width: 100%;
}
.community-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.community-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border, #dbe3ee);
    border-radius: 16px;
    overflow: hidden;
    background: var(--color-bg-surface, #fff);
    min-width: 0;
    box-shadow: var(--shadow-card, 0 1px 2px rgba(15, 23, 42, 0.06));
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.community-feed .community-card {
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px rgba(15, 23, 42, 0.06);
}
.community-pattern-card {
    cursor: pointer;
}
.community-pattern-card:hover {
    border-color: var(--color-border-strong, #cbd5e1);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}
.community-grid .community-card-media,
.community-pattern-card .community-card-media {
    position: relative;
    aspect-ratio: 4 / 3;
    width: 100%;
    background: var(--color-bg-muted, #f1f5f9);
    overflow: hidden;
    flex: 0 0 auto;
}
.community-grid .community-card-media img,
.community-pattern-card .community-card-media img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center;
    display: block;
}
.community-featured-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 1;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: var(--color-primary, #2563eb);
    color: #fff;
}
.community-featured-badge.is-inline {
    position: static;
    display: inline-flex;
    vertical-align: middle;
    margin-right: 8px;
}
.community-feed .community-card-media {
    width: 100%;
    max-height: 420px;
    aspect-ratio: auto;
    background: var(--color-bg-muted, #f1f5f9);
    overflow: hidden;
    flex: 0 0 auto;
}
.community-feed .community-card-media:not(.is-multi) {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: min(420px, 52vh);
    min-height: 0;
    padding: 0;
}
.community-feed .community-card-media:not(.is-multi) img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(420px, 52vh);
    object-fit: contain;
    display: block;
    margin: 0 auto;
}
.community-feed .community-card-media.is-multi {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    max-height: none;
}
.community-feed .community-card-media.is-multi.is-triple {
    grid-template-columns: repeat(3, 1fr);
}
.community-feed .community-card-media.is-multi img {
    height: 160px;
    max-height: 160px;
}
.community-card-placeholder {
    height: 100%;
    min-height: 120px;
    display: grid;
    place-items: center;
    gap: 4px;
    color: var(--color-text-muted, #8a8378);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.06), transparent 55%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 11px,
            rgba(148, 163, 184, 0.18) 11px,
            rgba(148, 163, 184, 0.18) 12px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 11px,
            rgba(148, 163, 184, 0.18) 11px,
            rgba(148, 163, 184, 0.18) 12px
        ),
        var(--color-bg-muted, #f1f5f9);
}
.community-card-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.community-pattern-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-primary, #172033);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.community-card-owner {
    font-size: 12px;
    color: var(--color-link, #2f6f5e);
    align-self: flex-start;
}
.community-card-stats {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-secondary, #475569);
    font-weight: 600;
}
.community-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}
.community-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--color-border, #dbe3ee);
    background: var(--color-bg-subtle, #f8fafc);
    color: var(--color-text-secondary, #475569);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.4;
}
button.community-chip {
    font-family: inherit;
}
.community-chip:hover {
    border-color: var(--color-primary, #2563eb);
    color: var(--color-primary, #2563eb);
    background: var(--color-bg-muted, #eef2ff);
}
.community-card-meta { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.community-card-side {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}
.community-card-author-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.community-card-author-row .community-inline-follow { margin-left: 0; }
.community-card-author {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.community-card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(145deg, var(--color-primary, #3b82f6), var(--color-primary-hover, #1d4ed8));
}
.community-card-author-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.community-card-author-text .linkish {
    font-weight: 600;
    color: var(--color-text-primary, #172033);
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.community-card-time {
    font-size: 12px;
    color: var(--color-text-muted, #64748b);
}
.community-card-content {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: var(--color-text-primary, #172033);
    white-space: pre-wrap;
    word-break: break-word;
}
.community-tag {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--color-bg-muted, #eef5f1);
    color: var(--color-link, #2f6f5e);
    flex: 0 0 auto;
}
.community-tag.is-showcase {
    background: #e0e7ff;
    color: #3730a3;
}
.community-card-footer {
    padding: 4px 10px 8px;
    border-top: 1px solid var(--color-border, #e8eef5);
}
.community-card-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.community-pattern-card .community-card-actions {
    margin-top: 4px;
}
.community-feed .community-card-actions .secondary {
    border: none;
    background: transparent;
    color: var(--color-text-secondary, #475569);
    font-weight: 600;
    padding: 8px 10px;
    border-radius: 10px;
}
.community-feed .community-card-actions .secondary:hover {
    background: var(--color-bg-muted, #f1f5f9);
    color: var(--color-text-primary, #172033);
}
@media (max-width: 720px) {
  .community-feed { grid-template-columns: 1fr; gap: 12px; }
  .community-panel:has(> .community-feed) > .community-load-more,
  .community-panel:has(> .community-feed) > .empty-state { max-width: none; }
  .community-feed .community-card-media.is-multi img {
    height: 120px;
    max-height: 120px;
  }
  .community-feed .community-card-body { padding: 12px; gap: 8px; }
  .community-feed .community-card-actions .secondary {
    min-height: 40px;
    flex: 1 1 auto;
  }
}
.community-plaza-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
    padding: 10px;
    border-radius: 12px;
    background: var(--color-bg-surface, #fff);
    border: 1px solid var(--color-border, #dbe3ee);
    align-items: center;
}
.community-plaza-filters input,
.community-plaza-filters select {
    flex: 1;
    min-width: 120px;
    min-height: 36px;
}
.community-plaza-filters .secondary { min-height: 36px; }
.community-plaza-topics {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1 0 100%;
    margin: 0;
}
.community-plaza-topic-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-secondary, #475569);
}
.community-plaza-topics:empty,
.community-plaza-topics.hidden { display: none; }
.community-plaza-topics .community-chip.is-active {
    background: var(--color-primary, #2563eb);
    border-color: transparent;
    color: #fff;
}
.community-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 12px;
}
.community-section-head .community-section-title { margin: 0; }
.community-topic-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.community-topic-status {
    margin-left: 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-muted, #64748b);
}
.community-topic-active-field {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}
.community-follow-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.community-follow-list:empty { display: none; }
.community-follow-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--color-border, #dbe3ee);
    border-radius: 12px;
    background: var(--color-bg-surface, #fff);
}
.community-follow-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-weight: 600;
    color: var(--color-text-primary, #172033);
}
.community-follow-main span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.community-follow-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}
.community-follow-avatar.is-fallback {
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(145deg, var(--color-primary, #3b82f6), var(--color-primary-hover, #1d4ed8));
}
.community-follow-card .secondary {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 4px 10px;
}
.community-inline-follow {
    min-height: 28px;
    padding: 2px 10px;
    font-size: 12px;
    margin-left: 8px;
}
button.community-profile-stat {
    font: inherit;
    color: var(--color-text-muted, #64748b);
}
button.community-profile-stat:hover { color: var(--color-primary, #2563eb); }

.community-topics-layout {
    width: 100%;
    max-width: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.community-topics {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.community-topic-card {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 0;
    padding: 0;
    margin: 0;
    border: 1px solid var(--color-border, #dbe3ee);
    border-radius: 14px;
    overflow: hidden;
    background: var(--color-bg-surface, #fff);
    box-shadow: var(--shadow-card, 0 1px 2px rgba(15, 23, 42, 0.06));
    min-height: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.community-topic-card.is-clickable {
    cursor: pointer;
}
.community-topic-card.is-clickable:hover {
    border-color: var(--color-primary, #2563eb);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}
.community-topic-cover {
    width: 96px;
    min-height: 96px;
    background: var(--color-bg-muted, #f1f5f9);
    overflow: hidden;
}
.community-topic-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.community-topic-cover-fallback {
    width: 100%;
    height: 100%;
    min-height: 96px;
    display: grid;
    place-items: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(145deg, var(--color-primary, #3b82f6), var(--color-primary-hover, #1d4ed8));
}
.community-topic-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    justify-content: center;
}
.community-topic-body strong {
    font-size: 15px;
    color: var(--color-text-primary, #172033);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.community-topic-desc {
    margin: 0;
    font-size: 13px;
    color: var(--color-text-muted, #64748b);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.community-ranking {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--color-border, #dbe3ee);
    border-radius: 14px;
    overflow: hidden;
    background: var(--color-bg-surface, #fff);
    box-shadow: var(--shadow-card, 0 1px 2px rgba(15, 23, 42, 0.06));
}
.community-rank-row {
    display: grid;
    grid-template-columns: 36px 56px 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border, #e8eef5);
    cursor: pointer;
    transition: background 0.12s ease;
}
.community-rank-row:last-child { border-bottom: none; }
.community-rank-row:hover {
    background: var(--color-bg-subtle, #f8fafc);
}
.community-rank-idx {
    font-weight: 800;
    font-size: 16px;
    text-align: center;
    color: var(--color-text-muted, #64748b);
}
.community-rank-row.is-top-1 .community-rank-idx { color: #ca8a04; }
.community-rank-row.is-top-2 .community-rank-idx { color: #64748b; }
.community-rank-row.is-top-3 .community-rank-idx { color: #b45309; }
.community-rank-cover {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--color-bg-muted, #f1f5f9);
    flex: 0 0 auto;
}
.community-rank-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.community-rank-cover-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: var(--color-text-muted, #64748b);
    background: var(--color-bg-muted, #e2e8f0);
}
.community-rank-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.community-rank-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-primary, #172033);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.community-rank-author {
    font-size: 12px;
    color: var(--color-text-muted, #64748b);
}
.community-rank-meta {
    font-size: 12px;
    color: var(--color-text-secondary, #475569);
    font-weight: 600;
}

.community-detail-hero { display: grid; gap: 16px; margin-bottom: 16px; }
@media (min-width: 800px) {
  .community-detail-hero { grid-template-columns: minmax(180px, 280px) 1fr; align-items: start; }
}
.community-detail-hero img {
    width: 100%;
    border-radius: 12px;
    background: var(--color-bg-muted, #f3efe7);
}
.community-detail-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin: 0 0 8px;
}
.community-detail-desc {
    margin: 8px 0;
    color: var(--color-text-secondary, #334155);
    line-height: 1.5;
}
.community-detail-author {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 8px 0 0;
}
.community-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.community-detail-actions .project-detail-primary-btn { min-height: 40px; padding: 10px 16px; }
.community-detail-actions .secondary { min-height: 36px; }
.community-compose-dialog input[type="file"] {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px dashed var(--color-border-strong, #cbd5e1);
    border-radius: 10px;
    background: var(--color-bg-muted, #f1f5f9);
    color: var(--color-text-secondary, #64748b);
    font-size: 14px;
    cursor: pointer;
}
.community-material ul { list-style: none; padding: 0; margin: 8px 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.community-material li { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.community-material .swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.12); }
.community-compose-preview { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.community-compose-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; display: block; }
.community-compose-thumb {
    position: relative;
    width: 72px;
    height: 72px;
}
.community-compose-thumb button {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 999px;
    border: none;
    background: var(--color-text-secondary, #334155);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}
.community-compose-bind {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-muted, #64748b);
}
.community-compose-bind.is-locked .community-compose-bind-title {
    color: #6d28d9;
}
.community-compose-bind-title { font-weight: 600; color: var(--color-text-secondary, #475569); }
.community-compose-dialog {
    width: min(520px, calc(100vw - 24px));
    max-height: min(90vh, 720px);
}
.community-compose-dialog .palette-dialog-form {
    max-height: min(90vh, 720px);
    overflow: auto;
}
.community-dialog-message { margin-top: 0; min-height: 0; }
.community-dialog-message:empty { display: none; }

/* 我的子 Tab：对齐 project-view-tabs */
.community-subtabs {
    display: flex;
    width: 100%;
    max-width: 420px;
    gap: 4px;
    margin-bottom: 12px;
    padding: 4px;
    border-radius: 10px;
    background: var(--color-bg-muted, #f1f5f9);
    border: 1px solid var(--color-border, #e2e8f0);
    box-sizing: border-box;
}
.community-subtab {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--color-text-secondary, #475569);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    min-height: 36px;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.community-subtab:hover:not(.active) {
    background: var(--color-bg-subtle, #e8eef5);
    color: var(--color-text-primary, #1e293b);
}
.community-subtab.active {
    background: var(--color-primary, #2563eb);
    color: #fff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.28);
}
.community-mine-status-tabs {
    max-width: 280px;
    margin-top: -4px;
    margin-bottom: 14px;
}
.community-mine-status-tabs .community-subtab {
    padding: 6px 10px;
    font-size: 0.92em;
    font-weight: 500;
}
.community-mine-status-tabs .community-subtab.active {
    background: #0f766e;
    box-shadow: 0 1px 3px rgba(15, 118, 110, 0.28);
}
.community-status-badge {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.community-status-badge.is-published {
    background: #dcfce7;
    color: #166534;
}
.community-status-badge.is-hidden {
    background: var(--color-bg-muted, #f1f5f9);
    color: var(--color-text-secondary, #475569);
}
.community-load-more { display: block; width: 100%; margin-top: 12px; }
.community-load-more.hidden { display: none; }
.community-comment-list { max-height: 280px; overflow: auto; margin-bottom: 12px; display: grid; gap: 10px; }
.community-comment-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border, #ece7de);
}
.community-notice-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border, #dbe3ee);
    border-radius: 14px;
    overflow: hidden;
    background: var(--color-bg-surface, #fff);
    max-width: 760px;
}
.community-notice {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid var(--color-border, #e8eef5);
    border-left: 3px solid transparent;
    cursor: pointer;
    padding: 12px 14px;
    color: var(--color-text-primary, #172033);
}
.community-notice:last-child { border-bottom: none; }
.community-notice:hover { background: var(--color-bg-subtle, #f8fafc); }
.community-notice.is-unread {
    background: var(--color-bg-muted, #f7faf8);
    border-left-color: var(--color-primary, #2563eb);
    font-weight: 600;
}
.community-notice .hint {
    display: block;
    margin-top: 4px;
}
.admin-community-feature-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center; }
.admin-community-feature-toolbar input { min-width: 140px; }
.admin-topic-row, .admin-report-row {
    padding: 12px;
    border: 1px solid var(--color-border, #e2ddd3);
    border-radius: 12px;
    margin-bottom: 8px;
}
.admin-topic-form { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 12px; }
.community-profile-head {
    display: flex;
    justify-content: flex-start;
    gap: 14px;
    align-items: center;
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid var(--color-border, #dbe3ee);
    border-radius: 14px;
    background: var(--color-bg-surface, #fff);
    box-shadow: var(--shadow-card, 0 1px 2px rgba(15, 23, 42, 0.06));
    max-width: 760px;
}
.community-profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}
.community-profile-avatar.is-fallback {
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(145deg, var(--color-primary, #3b82f6), var(--color-primary-hover, #1d4ed8));
}
.community-profile-info {
    flex: 1;
    min-width: 0;
}
.community-profile-info h3 {
    margin: 0 0 6px;
}
.community-profile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 0;
    color: var(--color-text-muted, #64748b);
    font-size: 13px;
}
.community-profile-stats strong {
    color: var(--color-text-primary, #172033);
}
.linkish {
    background: none;
    border: none;
    color: var(--color-link, #2f6f5e);
    cursor: pointer;
    padding: 0;
    text-align: left;
}
@media (max-width: 720px) {
  .community-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 8px;
    gap: 8px;
  }
  .community-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0;
    scrollbar-width: none;
  }
  .community-tabs::-webkit-scrollbar {
    display: none;
    height: 0;
  }
  .community-toolbar-actions {
    width: 100%;
    justify-content: stretch;
  }
  .community-toolbar-actions .secondary,
  .community-toolbar-actions .project-detail-primary-btn {
    flex: 1 1 auto;
  }
  .community-plaza-filters { padding: 8px; }
  .community-topics-layout { max-width: none; }
  .community-topics { grid-template-columns: 1fr; }
  .community-topic-card { grid-template-columns: 72px 1fr; }
  .community-topic-cover { width: 72px; min-height: 72px; }
  .community-topic-cover-fallback { min-height: 72px; font-size: 22px; }
  .community-rank-row { grid-template-columns: 28px 44px 1fr; gap: 10px; padding: 10px 12px; }
  .community-rank-cover { width: 44px; height: 44px; border-radius: 8px; }
  .community-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .community-subtabs { max-width: none; }
  .community-notice-list,
  .community-profile-head { max-width: none; }
  .mobile-bottom-nav { gap: 0; }
  .mobile-bottom-item { min-width: 0; padding: 6px 2px; }
  .mobile-bottom-label { font-size: 11px; }
}
