/* Shared neutral themes. Only the CEP shell may supply --host-background. */
:host {
  color-scheme: dark;
  --background: var(--host-background, #181818);
  --surface: #252525;
  --surface-hover: #303030;
  --surface-raised: #222222;
  --border: #3d3d3d;
  --border-soft: #303030;
  --text: #f1f1ef;
  --muted: #a7a7a2;
  --faint: #8c8c87;
  --gold: #efc96e;
  --gold-hover: #f5d487;
  --blue: var(--gold);
  --link: #e7cc8f;
  --error: #edaaa2;
  --error-background: #382522;
  --error-border: #68413a;
  --focus: #d6b567;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  background: var(--background);
  color: var(--text);
}
:host[data-theme="light"] {
  color-scheme: light;
  --background: var(--host-background, #fcfcfb);
  --surface: #eeeeec;
  --surface-hover: #e6e6e3;
  --surface-raised: #ffffff;
  --border: #deded9;
  --border-soft: #e9e9e5;
  --text: #252523;
  --muted: #74746e;
  --faint: #85857f;
  --gold: #f4d17e;
  --gold-hover: #efc768;
  --link: #796025;
  --error: #a43d31;
  --error-background: #fff0ec;
  --error-border: #eccac2;
  --focus: #ac8123;
}
* { box-sizing: border-box; }
:host { display: block; min-width: 0; font-size: 13px; line-height: 1.5; }
:host { background: var(--background); font-size: 13px; line-height: 1.5; }
button, input, select { font: inherit; }
button, summary, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, input, select, summary { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--link); }
button { color: inherit; }
button:disabled { color: var(--faint); }
button:disabled.primary-button { opacity: .65; }
input, select { min-width: 0; max-width: 100%; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 4px; }
input:not([type="checkbox"]):not([type="range"]):not([type="color"]), select { width: 100%; min-height: 34px; padding: 7px 10px; }
input::placeholder { color: #a5aebb; opacity: 1; }
input:disabled, select:disabled { color: #a6afbc; opacity: .8; }
input[type="checkbox"] { width: 15px; height: 15px; margin: 2px 0 0; flex: 0 0 15px; accent-color: var(--blue); }
input[type="range"] { padding: 0; accent-color: var(--blue); cursor: pointer; }
[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; }
.brand { font-size: 24px; font-weight: 700; letter-spacing: -.6px; line-height: 1; }
.local-badge { color: #bdc5d1; font-size: 12px; white-space: nowrap; }
.primary-button { min-height: 40px; width: 100%; border: 1px solid #73afff; border-radius: 4px; background: var(--blue); color: white; font-weight: 600; }
.primary-button:hover:not(:disabled) { background: #78b0ff; }
.secondary-button { background: #333941; border: 1px solid #535e6d; border-radius: 4px; padding: 7px 12px; min-height: 33px; }
.secondary-button:hover:not(:disabled) { background: #414953; }
.inline-link, .text-button { background: none; border: 0; padding: 0; color: var(--link); }
.inline-link:hover, .text-button:hover { text-decoration: underline; }
.inline-link { display: inline; }
.hint { margin: 6px 0 0; color: var(--faint); font-size: 11px; line-height: 1.6; }
.error-banner { padding: 10px 12px; border: 1px solid #7d4944; background: #392d2e; color: var(--error); border-radius: 4px; margin: 10px 0; overflow-wrap: anywhere; }
.error-banner .text-button { display: block; margin-top: 4px; }
.notice { padding: 8px 10px; border: 1px solid #405571; border-radius: 4px; color: #c4d8ef; margin: 8px 0; font-size: 12px; }
.form-error { color: var(--error); font-size: 12px; margin: 12px 0 0; }
.boot-message, .loading-view { padding: 28px; color: var(--muted); }
.loading-view .brand { color: var(--text); margin-bottom: 32px; }

/* The selected portrait reference is a full-bleed form, with no outer card. */
.login-view { min-height: 100vh; min-height: 100svh; max-width: 1024px; margin: 0 auto; display: flex; flex-direction: column; padding: clamp(20px, 5.08vw, 52px); }
.login-header { display: flex; align-items: center; justify-content: space-between; }
.login-header .brand { font-size: clamp(22px, 4.7vw, 48px); letter-spacing: -.9px; }
.login-header .local-badge { font-size: clamp(12px, 2.35vw, 24px); }
.login-form-area { margin: clamp(20px, 5.2vw, 54px) clamp(0px, 6.54vw, 67px) 0; }
.login-form-area h1 { font-size: clamp(24px, 5.66vw, 58px); line-height: 1.25; letter-spacing: -.6px; margin: 0; font-weight: 650; }
.login-subtitle { color: #b8bfcb; font-size: clamp(14px, 3.13vw, 32px); margin: clamp(3px, .8vw, 8px) 0 0; letter-spacing: .02em; }
#auth-form { margin-top: clamp(22px, 5.2vw, 53px); }
.auth-field { display: block; font-size: clamp(12px, 2.54vw, 26px); margin: 0 0 clamp(14px, 3.1vw, 32px); }
.auth-field input:not([type="checkbox"]) { display: block; margin-top: clamp(3px, .8vw, 8px); min-height: clamp(36px, 7.62vw, 78px); padding: clamp(8px, 1vw, 10px) clamp(12px, 2.5vw, 26px); font-size: clamp(12px, 2.64vw, 27px); border-radius: 5px; background: #282b30; }
.consent-block { margin-top: clamp(18px, 4vw, 41px); }
.consent-line { display: flex; align-items: flex-start; gap: clamp(9px, 2.1vw, 22px); font-size: clamp(11px, 2.44vw, 25px); line-height: 1.55; }
.consent-line input { width: clamp(16px, 3.32vw, 34px); height: clamp(16px, 3.32vw, 34px); flex-basis: clamp(16px, 3.32vw, 34px); margin-top: 2px; }
.device-disclosure { color: var(--muted); font-size: clamp(10px, 2.05vw, 21px); margin: clamp(6px, 1.3vw, 13px) 0 0 calc(clamp(16px, 3.32vw, 34px) + clamp(9px, 2.1vw, 22px)); }
.auth-submit { margin-top: clamp(16px, 3.4vw, 35px); min-height: clamp(36px, 7.72vw, 79px); font-size: clamp(15px, 3.13vw, 32px); }
.register-prompt { color: var(--muted); font-size: clamp(12px, 2.64vw, 27px); margin: clamp(16px, 3.6vw, 37px) 0 0; }
.login-footer { margin-top: auto; padding-top: 70px; color: #b8c1cf; font-size: clamp(10px, 1.7vw, 17px); }

.workspace-view { width: 100%; max-width: 640px; margin: 0 auto; min-height: 100vh; min-height: 100svh; padding: 18px; display: flex; flex-direction: column; }
.app-header { display: flex; gap: 12px; align-items: center; min-width: 0; padding-bottom: 12px; }
.app-header .brand { font-size: 25px; }
.app-header .local-badge { margin-right: auto; font-size: 10px; }
.header-menu { position: relative; font-size: 11px; }
.header-menu summary { cursor: pointer; white-space: nowrap; color: var(--muted); }
.account-menu summary { overflow: hidden; text-overflow: ellipsis; max-width: 92px; }
.header-popover { position: absolute; z-index: 15; right: 0; top: calc(100% + 10px); width: 190px; padding: 12px; background: #2a2e34; border: 1px solid #505967; border-radius: 5px; box-shadow: 0 8px 24px #0005; overflow-wrap: anywhere; }
.header-popover p { margin: 0 0 9px; }
.header-popover > button { display: block; text-align: left; width: 100%; background: none; border: 0; padding: 8px; border-radius: 3px; }
.header-popover > button:hover:not(:disabled) { background: #3a424e; }
.workspace-context { padding: 10px 0 11px; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); margin-bottom: 14px; }
.project-label, .sequence-label { display: flex; align-items: center; gap: 10px; min-width: 0; }
.project-label > span, .sequence-label > span { font-size: 11px; color: var(--faint); flex: 0 0 48px; }
.project-label strong { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 500; font-size: 12px; }
.project-label .text-button { font-size: 11px; white-space: nowrap; }
.sequence-label { margin-top: 9px; }
.sequence-label select { font-size: 12px; }
.connection-reason { color: #b6bdc8; font-size: 11px; margin: 8px 0 0; overflow-wrap: anywhere; }
.functions { display: grid; gap: 8px; }
.helper-functions { align-items: start; border-top: 1px solid var(--border-soft); padding-top: 10px; margin-top: 12px; }
.diagnostic-functions { margin-top: 12px; }
.feature-row { min-width: 0; position: relative; border: 1px solid #424a55; border-radius: 5px; background: #282d34; }
.feature-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; position: relative; min-width: 0; min-height: 48px; }
.feature-main { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 2px; grid-column: 1; grid-row: 1; min-width: 0; text-align: left; border: 0; border-radius: 4px 0 0 4px; background: transparent; padding: 7px 11px; }
.feature-main:not(:disabled):hover { background: #353e4b; }
.feature-name { color: var(--text); font-size: 13px; line-height: 1.3; font-weight: 550; }
.feature-main:disabled .feature-name { color: #c4cad4; }
.feature-subtitle { display: block; max-width: 100%; color: #a6b0bd; font-size: 10px; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
/* Keep the native disclosure while placing its content in the feature grid. */
.feature-parameters { display: contents; }
.feature-parameters::details-content { display: contents; }
.feature-parameters:not([open]) > .parameter-panel { display: none; }
.feature-parameters > summary { display: list-item; grid-column: 2; grid-row: 1; list-style-position: inside; min-width: 62px; min-height: 48px; line-height: 48px; padding: 0 8px; border-left: 1px solid #424a55; color: #bfc9d8; cursor: pointer; font-size: 11px; white-space: nowrap; }
.feature-parameters > summary::before { content: none; }
.feature-parameters > summary:hover { background: #343c48; }
.feature-parameters[open] > summary { background: #3b4656; }
.parameter-panel { grid-column: 1 / -1; grid-row: 2; min-width: 0; padding: 15px; border-top: 1px solid #596575; border-radius: 0 0 4px 4px; background: #2b3038; overflow-wrap: anywhere; }
.parameter-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 12px; }
.parameter-heading h3 { font-size: 13px; margin: 0; }
.parameter-heading .hint { margin: 0; }
.menu-field { display: block; font-size: 12px; margin: 12px 0; }
.menu-field input, .menu-field select { margin-top: 5px; }
.menu-note { font-size: 12px; color: var(--muted); margin: 0 0 14px; }
[data-sequence-manual], [data-sequence-auto], [data-sequence-custom] { min-width: 0; margin: 0; padding: 0; border: 0; }
.auto-sequence-toggle { margin: 15px 0; cursor: pointer; }
.auto-sequence-toggle > input[role="switch"] { appearance: none; position: relative; width: 34px; height: 20px; flex-basis: 34px; margin: 0; padding: 0; border: 1px solid #657184; border-radius: 10px; background: #3d4653; cursor: pointer; }
.auto-sequence-toggle > input[role="switch"]::before { content: ""; position: absolute; width: 14px; height: 14px; top: 2px; left: 2px; border-radius: 50%; background: #e8edf4; }
.auto-sequence-toggle > input[role="switch"]:checked { background: var(--blue); border-color: var(--blue); }
.auto-sequence-toggle > input[role="switch"]:checked::before { transform: translateX(14px); }
.auto-sequence-toggle > input[role="switch"]:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
.sequence-size-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sequence-size-fields > .menu-field { min-width: 0; margin: 0 0 12px; }
.duration-controls { display: flex; gap: 12px; align-items: center; }
.duration-controls > input { flex: 1; min-width: 50px; }
.number-unit { display: flex; gap: 6px; align-items: center; color: var(--muted); flex: 0 0 86px; }
.number-unit input { width: 62px; }
.color-fields { min-width: 0; margin: 15px 0; padding: 0; border: 0; border-top: 1px solid #454d58; }
.color-fields legend { padding-top: 11px; font-size: 12px; }
.color-custom { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.color-custom > label { display: block; font-size: 11px; margin: 0; }
.color-custom select { padding-left: 6px; font-size: 11px; }
.color-custom .hint { grid-column: 1 / -1; margin: 0; }
.save-parameters { width: 100%; }
.correction-branch { border-top: 1px solid #454d58; margin: 15px 0; padding-top: 12px; }
.correction-branch h4 { margin: 0; font-size: 12px; }
.unavailable-note { color: #c0ad8c; font-size: 11px; margin: 6px 0; }
.check-line { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; }
.task-progress { position: absolute; top: 0; right: 0; bottom: 0; left: 0; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 4px; opacity: .16; accent-color: #68a5fa; background: transparent; }
.task-progress::-webkit-progress-bar { background: transparent; }
.task-progress::-webkit-progress-value { background: #68a5fa; }
.task-controls { display: flex; grid-column: 2; grid-row: 1; gap: 5px; align-items: center; position: relative; z-index: 2; padding: 8px; }
.task-controls button { background: #364353; border: 1px solid #5b6d85; padding: 5px 7px; border-radius: 3px; font-size: 11px; max-width: 70px; }
.task-controls button:hover:not(:disabled) { background: #475e79; }
.is-active { border-color: #637e9e; }
.has-failed { border-color: #76514c; }
.intro { margin: 18px 0 12px; color: var(--muted); }
.intro > summary { cursor: pointer; font-size: 13px; color: #d1d8e2; }
.intro-body { padding: 9px 0 0; }
.intro-body > p { margin: 0 0 7px; font-size: 11px; }
.intro-body > p > span { display: inline-block; color: #8f9cad; margin-right: 12px; }
.intro-body > .hint { font-size: 10px; color: #929ead; }
.logs-section { margin-top: auto; padding-top: 8px; }
.logs-toggle { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 10px 0; border: 0; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); text-align: left; background: none; color: #c9d1de; font-size: 12px; }
.logs-toggle > span:last-child { color: var(--link); font-size: 11px; }
.log-count { color: #d1ac85; font-size: 10px; margin-left: 6px; }
.log-list { max-height: 290px; overflow-y: auto; list-style: none; padding: 0; margin: 0; }
.log-entry { padding: 11px 0; border-bottom: 1px solid var(--border-soft); overflow-wrap: anywhere; }
.log-meta { display: flex; gap: 10px; font-size: 10px; color: var(--faint); }
.log-entry p { font-size: 12px; color: #c6cfdb; margin: 5px 0 0; }
.log-entry.error p, .log-entry.warn p { color: #edc5a4; }
.log-details { margin-top: 8px; font-size: 11px; }
.log-details > summary { color: var(--link); cursor: pointer; }
.checked-files { list-style: none; padding: 0; margin: 8px 0 0; }
.checked-files li { display: grid; gap: 3px; padding: 8px 0; border-top: 1px solid var(--border-soft); }
.checked-files strong { color: #c2d5e7; font-size: 10px; font-weight: 500; }
.checked-file-name { overflow-wrap: anywhere; color: #d0d8e2; }
.checked-files .hint { margin: 0; font-size: 10px; overflow-wrap: anywhere; }
.empty-logs { font-size: 11px; color: var(--faint); padding: 12px 0; }
.app-footer { font-size: 9px; color: #8e98a7; margin-top: 8px; padding-bottom: 4px; }
.dialog-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; inset: 0; z-index: 50; background: #0009; display: grid; place-items: center; padding: 20px; }
.policy-dialog { max-width: 460px; max-height: 85vh; max-height: 85svh; overflow-y: auto; padding: 24px; background: #2b3038; border: 1px solid #596575; border-radius: 6px; }
.policy-dialog h2 { font-size: 17px; margin: 0 0 15px; }
.policy-dialog p { color: #bcc6d5; font-size: 12px; line-height: 1.8; }
.policy-dialog .primary-button { margin-top: 12px; }
.availability-list { margin: 0; font-size: 11px; }
.availability-list dt { color: #e0e6ef; margin-top: 12px; }
.availability-list dd { color: #aeb9c8; margin: 4px 0 0; line-height: 1.65; }
@media (min-width: 400px) {
  .helper-functions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .helper-functions .feature-parameters > summary { min-width: 52px; padding: 0 6px; font-size: 10px; }
  .helper-functions .feature-main { padding-left: 9px; padding-right: 7px; }
  .helper-functions .parameter-panel { padding: 12px; }
}
@media (max-width: 380px) {
  .workspace-view { padding: 14px 12px; }
  .app-header { gap: 8px; }
  .account-menu summary { max-width: 70px; }
  .feature-main { padding: 7px 10px; }
  .feature-parameters > summary { min-width: 56px; padding: 0 8px; }
  .task-controls { padding: 5px; gap: 4px; }
  .task-controls button { padding: 5px; font-size: 10px; }
  .feature-name { font-size: 13px; }
  .feature-subtitle { font-size: 10px; }
  .login-form-area { margin-left: 0; margin-right: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* The two-step workflow keeps real capability failures readable at narrow widths. */
.feature-main:disabled .feature-subtitle { white-space: normal; overflow: visible; }
.feature-recovery { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 0 11px 9px; }
.feature-recovery .text-button { font-size: 12px; min-height: 28px; }
.development-functions { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 4px; }
.development-functions > summary, .processing-target-options > summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.processing-target-options { margin: 12px 0; }
.parameter-feedback { margin: 12px 0 0; overflow-wrap: anywhere; }

.operation-fields { min-width: 0; margin: 16px 0; padding: 10px; border: 1px solid var(--border-soft); }
.operation-fields legend { color: var(--muted); font-size: 12px; }
.operation-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.operation-preview { margin: 14px 0; padding: 12px; border: 1px solid #52647b; border-radius: 4px; }
.operation-preview strong { font-size: 12px; }
.operation-preview ul { max-height: 180px; overflow: auto; padding-left: 18px; font-size: 11px; }
.operation-preview button { margin-top: 10px; }
.repair-tabs { display: flex; gap: 6px; margin: 12px 0; }
.repair-tabs button { flex: 1; padding: 9px 6px; border: 1px solid #596575; border-radius: 4px; background: #252b34; color: #ced8e6; }
.repair-tabs button[aria-pressed="true"] { background: #40516b; border-color: #8eaedb; color: #fff; }
.repair-details { margin: 10px 0; }
.repair-details > summary { cursor: pointer; color: var(--muted); margin-bottom: 10px; }
.repair-details[open] { max-height: 360px; overflow: auto; }
.repair-match { padding-left: 10px; border-left: 2px solid #596575; }
.repair-pending { color: #f0d399; font-size: 12px; }
.repair-sample-pair { margin: 10px 0; padding: 8px; border: 1px solid #596575; min-width: 0; }
.repair-analysis { margin: 12px 0; padding: 10px; border: 1px solid #596575; border-radius: 4px; }
.repair-analysis ul { padding-left: 18px; }
.repair-analysis li { margin: 8px 0; overflow-wrap: anywhere; }
.repair-sample-names { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }


/* Commercial panel: regular two-column controls, shared geometry in both themes. */
.commercial-panel { position: relative; width: 100%; max-width: 640px; min-height: 100vh; min-height: 100svh; margin: 0 auto; padding: 20px; }
.panel-header { position: relative; display: flex; align-items: center; gap: 12px; height: 28px; margin-bottom: 20px; }
.panel-header .brand { font-size: 18px; line-height: 24px; font-weight: 750; letter-spacing: -.55px; text-transform: uppercase; }
.panel-status-dot { display: block; flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.panel-status-dot.is-connected { background: #32b75c; }
.panel-icon { display: block; flex: 0 0 18px; width: 18px; height: 18px; pointer-events: none; }
.panel-menu-toggle, .dialog-header > button, .panel-notice .dismiss { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; color: var(--muted); border: 0; border-radius: 6px; background: transparent; }
.panel-menu-toggle { margin-left: auto; }
.panel-menu-toggle:hover, .dialog-header > button:hover, .panel-notice .dismiss:hover { color: var(--text); background: var(--surface-hover); }
.sequence-field { display: block; min-width: 0; margin: 0 0 20px; }
.processing-project { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sequence-field select, .repair-reference select { width: 100%; height: 40px; min-height: 40px; border-radius: 8px; border: 1px solid var(--border-soft); background-color: transparent; padding: 0 12px; font-size: 13px; line-height: 20px; }
.sequence-field select { font-weight: 550; }
.tool-group { min-width: 0; margin: 0 0 20px; }
.group-heading { display: flex; align-items: center; min-height: 16px; margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 500; line-height: 16px; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tool-button { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; min-width: 0; height: 40px; padding: 0 14px; border: 1px solid transparent; border-radius: 8px; background: var(--surface); color: var(--text); font-size: 14px; line-height: 22px; font-weight: 550; text-align: left; white-space: nowrap; }
.tool-button > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tool-button:hover:not(:disabled) { background: var(--surface-hover); }
.tool-button.is-primary { background: var(--gold); color: #282515; }
.tool-button.is-primary:hover:not(:disabled) { background: var(--gold-hover); }
.tool-button:disabled { color: var(--faint); opacity: .65; }
.tool-button.is-primary:disabled { color: #62563b; opacity: .65; }
.tool-action-group { display: flex; min-width: 0; height: 40px; border-radius: 8px; background: var(--surface); }
.tool-action-group.is-primary { background: var(--gold); }
.tool-action-group .tool-button { flex: 1 1 auto; width: auto; min-width: 0; padding: 0 8px; gap: 4px; border-radius: 8px 0 0 8px; background: transparent; }
.feature-options-toggle { display: flex; flex: 0 0 24px; align-items: center; justify-content: center; width: 24px; height: 40px; padding: 0; color: var(--muted); background: transparent; border: 0; border-left: 1px solid var(--border-soft); border-radius: 0 8px 8px 0; }
.feature-options-toggle .panel-icon { width: 14px; height: 14px; flex-basis: 14px; }
.is-primary .feature-options-toggle { color: #423820; }
.feature-options-toggle:hover:not(:disabled) { background: var(--surface-hover); }
.feature-options-toggle:disabled { opacity: .5; }
.feature-options-toggle[aria-expanded="true"] { background: var(--surface-hover); }
.feature-popover.panel-dialog-card { position: fixed; z-index: 35; max-width: none; width: calc(100vw - 40px); max-height: calc(100vh - 40px); border-radius: 12px; }
.feature-popover .dialog-header { padding: 12px; }
.feature-title { display: flex; min-width: 0; align-items: center; gap: 8px; }
.feature-help { display: inline-flex; flex: 0 0 24px; width: 24px; height: 24px; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 6px; color: var(--muted); background: transparent; }
.feature-help .panel-icon { width: 18px; height: 18px; }
.feature-help:hover, .feature-help:focus-visible { color: var(--text); background: var(--surface-hover); }
.feature-help-tooltip { position: fixed; z-index: 110; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-raised); color: var(--muted); font-size: 12px; line-height: 20px; box-shadow: 0 8px 24px #0003; }
.feature-help-tooltip p { margin: 0; }
.feature-popover .panel-dialog-body { padding: 0 12px 12px; }
.feature-popover .parameter-form { margin: 0; }
.feature-popover .parameter-form > h3 { display: none; }
.feature-popover .parameter-form .menu-field:first-of-type { margin-top: 4px; }
.choice-native { display: none !important; }
.choice-select { display: block; min-width: 0; width: 100%; position: relative; }
.choice-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 40px; min-width: 0; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--background); color: var(--text); font: inherit; font-size: 14px; line-height: 20px; text-align: left; }
.choice-trigger > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice-trigger > .panel-icon { flex: 0 0 14px; width: 14px; height: 14px; color: var(--muted); }
.choice-trigger:disabled { color: var(--faint); cursor: default; }
.choice-trigger[aria-expanded="true"] { border-color: var(--gold); }
.sequence-field .choice-trigger { font-weight: 550; background: transparent; border-color: var(--border-soft); }
.repair-reference .choice-trigger { background: transparent; border-color: var(--border-soft); }
.choice-listbox { position: fixed; z-index: 100; overflow-y: auto; padding: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-raised); color: var(--text); box-shadow: 0 8px 24px #0003; overscroll-behavior: contain; }
.choice-option { display: flex; align-items: center; min-height: 40px; padding: 8px 12px; border-radius: 8px; color: var(--text); font-size: 14px; line-height: 20px; overflow-wrap: anywhere; cursor: pointer; }
.choice-option.is-selected { box-shadow: inset 3px 0 var(--gold); background: var(--surface); }
.choice-option.is-active, .choice-option:hover { background: var(--surface-hover); }
.choice-option[aria-disabled="true"] { color: var(--faint); cursor: default; background: transparent; box-shadow: none; }
.choice-trigger:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.repair-reference { display: block; min-width: 0; }
.repair-reference select { font-size: 13px; }
.panel-menu { position: absolute; top: 34px; right: 0; z-index: 20; width: 176px; padding: 6px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px #0002; }
.panel-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 7px 10px; color: var(--text); text-align: left; background: none; border: 0; border-radius: 6px; font-size: 13px; }
.panel-menu-item:hover { background: var(--surface-hover); }
.panel-menu-item .panel-icon { width: 16px; height: 16px; flex-basis: 16px; color: var(--muted); }
.panel-dialog { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: #0006; }
.panel-dialog-card { display: flex; flex-direction: column; width: 100%; max-width: 360px; max-height: calc(100vh - 32px); max-height: calc(100svh - 32px); padding: 0; overflow: hidden; background: var(--surface-raised); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 50px #0003; }
.dialog-header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 16px; }
.panel-dialog-body { flex: 1 1 auto; min-height: 0; padding: 0 20px 20px; overflow-y: auto; overscroll-behavior: contain; }
.dialog-header h2 { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; }
.dialog-header > button { flex: 0 0 28px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.panel-dialog-card p { overflow-wrap: anywhere; }
.panel-dialog-card .parameter-heading { display: none; }
.panel-dialog-card .parameter-form + .parameter-form { border-top: 1px solid var(--border-soft); margin-top: 20px; padding-top: 8px; }
.panel-dialog-card .menu-field { margin: 12px 0; color: var(--muted); font-size: 12px; }
.feature-popover .parameter-form .sequence-size-fields > .menu-field { display: grid; grid-template-rows: 20px 40px; row-gap: 5px; min-width: 0; margin: 0 0 12px; }
.sequence-size-fields > .menu-field > input { width: 100%; height: 40px; margin: 0; }
.panel-dialog-card input:not([type="checkbox"]):not([type="range"]):not([type="color"]), .panel-dialog-card select, .feedback-input { min-height: 40px; border-radius: 8px; border-color: var(--border); background: var(--background); color: var(--text); font-size: 14px; }
.panel-dialog-card .check-line { align-items: flex-start; gap: 8px; margin: 14px 0; color: var(--text); font-size: 12px; }
.panel-dialog-card .hint, .panel-dialog-card .menu-note, .diagnostic-summary { color: var(--muted); font-size: 12px; line-height: 20px; }
.panel-dialog-card .secondary-button, .dialog-actions button { min-height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 12px; }
.appearance-options { display: grid; gap: 8px; }
.appearance-options button { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 12px; background: var(--surface); color: var(--text); border: 1px solid transparent; border-radius: 8px; text-align: left; }
.appearance-options button.is-selected { border-color: var(--focus); }
.feedback-input { display: block; width: 100%; min-height: 112px; padding: 10px 12px; line-height: 20px; resize: vertical; font: inherit; }
.panel-progress { margin: 20px 0 0; padding: 12px; border: 1px solid var(--border-soft); border-radius: 8px; color: var(--muted); font-size: 12px; }
.panel-progress p { margin: 0 0 8px; }
.panel-progress progress { display: block; width: 100%; height: 3px; border: 0; border-radius: 2px; overflow: hidden; accent-color: var(--gold); }
.panel-progress progress::-webkit-progress-bar { background: var(--border-soft); }
.panel-progress progress::-webkit-progress-value { background: var(--gold); }
.panel-progress .task-controls { position: static; display: flex; padding: 8px 0 0; }
.panel-progress .task-controls button { display: inline-flex; gap: 6px; align-items: center; max-width: none; min-height: 30px; padding: 4px 8px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.panel-progress .task-controls .panel-icon { width: 14px; height: 14px; flex-basis: 14px; }
.panel-notice { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 16px; padding: 10px 10px 10px 12px; color: var(--error); background: var(--error-background); border: 1px solid var(--error-border); border-radius: 8px; font-size: 12px; line-height: 20px; overflow-wrap: anywhere; }
.panel-notice > span, .panel-notice > p { flex: 1; min-width: 0; margin: 0; }
.panel-notice .dismiss { flex: 0 0 24px; width: 24px; height: 24px; margin-top: -2px; }
.panel-notice .panel-icon { width: 14px; height: 14px; flex-basis: 14px; }
.commercial-panel :focus-visible, .panel-dialog :focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.login-view { max-width: 440px; padding: 20px; }
.login-header .brand { font-size: 18px; text-transform: uppercase; }
.login-header .local-badge { font-size: 11px; color: var(--muted); }
.login-form-area { margin: 32px 0 0; }
.login-form-area h1 { font-size: 24px; }
.login-subtitle { font-size: 13px; color: var(--muted); margin-top: 8px; }
#auth-form { margin-top: 24px; }
.auth-field { font-size: 12px; margin-bottom: 16px; }
.auth-field input:not([type="checkbox"]) { min-height: 40px; margin-top: 6px; padding: 8px 12px; font-size: 13px; border-radius: 8px; background: var(--surface); }
.consent-block { margin-top: 20px; }
.consent-line { gap: 8px; font-size: 11px; }
.consent-line input { width: 15px; height: 15px; flex-basis: 15px; }
.device-disclosure { font-size: 10px; margin: 8px 0 0 23px; }
.auth-submit { min-height: 40px; margin-top: 20px; font-size: 14px; }
.primary-button { background: var(--gold); border-color: transparent; border-radius: 8px; color: #282515; }
.primary-button:hover:not(:disabled) { background: var(--gold-hover); }
.register-prompt { font-size: 12px; margin-top: 16px; }
.login-footer { font-size: 10px; color: var(--muted); }
.policy-dialog { background: var(--surface-raised); border-color: var(--border); border-radius: 12px; }
.policy-dialog p { color: var(--muted); }
.error-banner { background: var(--error-background); border-color: var(--error-border); }
@media (max-width: 319px) {
  .tool-button { gap: 8px; padding-left: 10px; padding-right: 8px; font-size: 14px; }
  .repair-reference select { padding-left: 8px; padding-right: 4px; font-size: 12px; }
}
.progress-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.panel-notice .icon-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; width: 24px; height: 24px; margin-top: -2px; padding: 0; color: var(--error); background: transparent; border: 0; border-radius: 6px; }
.panel-notice .icon-button:hover { background: var(--surface-hover); }
.settings-sections .parameter-form > h3 { margin: 0 0 12px; font-size: 13px; line-height: 20px; font-weight: 600; }
.panel-dialog-card fieldset { min-width: 0; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 8px; }
.panel-dialog-card fieldset legend { color: var(--muted); font-size: 12px; padding: 0 4px; }
.diagnostic-summary button { min-height: 36px; margin: 0 6px 6px 0; padding: 7px 12px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: 12px; }
.diagnostic-summary button:hover:not(:disabled), .panel-dialog-card .secondary-button:hover:not(:disabled), .panel-progress .task-controls button:hover:not(:disabled) { background: var(--surface-hover); }
/* CEP's native option popup can stay light even when its select is dark. */
select { color-scheme: light; }
select option, select optgroup { background-color: #fff; color: #202020; }
select option:disabled, select optgroup:disabled { background-color: #fff; color: #686868; }
select option:checked { background-color: #d8e9f8; color: #101820; }
.panel-dialog-card .log-entry p, .panel-dialog-card .checked-file-name { color: var(--text); }
.panel-dialog-card .log-entry.error p, .panel-dialog-card .log-entry.warn p { color: var(--error); }
.panel-dialog-card .checked-files strong { color: var(--muted); }
.panel-dialog-card .auto-sequence-toggle > input[role="switch"] { background: var(--surface); border-color: var(--border); }
.panel-dialog-card .auto-sequence-toggle > input[role="switch"]:checked { background: var(--gold); border-color: var(--gold); }

/* Indeterminate means a read is active without a confirmed item denominator. */
.panel-progress progress:not([value]) { background: linear-gradient(90deg, var(--border-soft) 0%, var(--gold) 45%, var(--border-soft) 85%); background-size: 200% 100%; animation: panel-read-progress 1.5s linear infinite; }
.panel-progress progress:not([value])::-webkit-progress-bar { background: transparent; }
.panel-progress .progress-message { color: var(--text); line-height: 1.55; overflow-wrap: anywhere; }
.panel-progress .progress-count { font-variant-numeric: tabular-nums; }
@keyframes panel-read-progress { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .panel-progress progress:not([value]) { animation: none; } }
.panel-notice[role="status"] { color: var(--muted); background: var(--surface); border-color: var(--border-soft); }
.panel-notice[role="status"] .icon-button { color: var(--muted); }

@media (max-width: 340px) {
  .tool-action-group .tool-button { padding-left: 4px; padding-right: 4px; }
  .tool-grid .choice-trigger { padding-left: 8px; padding-right: 8px; }
}

.panel-progress .progress-static { display: block; width: 100%; height: 3px; border-radius: 2px; background: var(--border-soft); }
.panel-progress.is-terminal progress { animation: none; }
.panel-progress.is-terminal .task-controls:empty { display: none; }

/* 整步撤销提示条 */
.undo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 8px 12px 0; padding: 8px 10px; border-radius: 8px;
  border: 1px solid rgba(255, 200, 90, 0.35); background: rgba(255, 200, 90, 0.08);
  font-size: 12px; line-height: 1.4;
}
.undo-banner span { flex: 1 1 auto; min-width: 0; }
.undo-banner button { flex: 0 0 auto; }

/* Geometry adapts the original pure view to a compact website preview. */
:host{contain:content}.commercial-panel{min-height:0;padding:12px}.panel-header{height:24px;margin-bottom:8px}.processing-project{margin-bottom:4px}.sequence-field{margin-bottom:10px}.sequence-field select,.repair-reference select{height:32px;min-height:32px}.tool-group{margin-bottom:10px}.tool-group:last-child{margin-bottom:0}.group-heading{margin-bottom:6px}.tool-button,.tool-action-group,.feature-options-toggle{height:34px}.tool-button{font-size:13px}.tool-button[data-preview-control]{cursor:pointer;transition:transform .14s ease,border-color .14s ease,box-shadow .14s ease}.tool-button[data-preview-control]:is(:hover,:focus-visible,.is-preview-active){border-color:var(--gold);box-shadow:0 0 0 1px #efc96e35,0 4px 14px #0003;transform:translateY(-1px)}.tool-button.is-primary[data-preview-control]:is(:hover,:focus-visible,.is-preview-active){border-color:#fff0bb}.tool-action-group:has(.is-preview-active){box-shadow:0 0 0 1px var(--gold)}button:disabled,select:disabled{cursor:default}.preview-description{margin:0;padding:12px 14px 14px;border-top:1px solid var(--border-soft);color:var(--muted);font-size:12px;line-height:1.6;min-height:72px}.preview-description strong{color:var(--gold);font-weight:600}.preview-description p{margin:4px 0 0}.preview-disclaimer{margin:8px 14px 12px;color:var(--faint);font-size:11px;line-height:1.5}
@media(prefers-reduced-motion:reduce){.tool-button[data-preview-control]{transition:none;transform:none!important}}
