:root{
  --button-height-small:28px;
  --button-height-standard:32px;
  --button-height-prominent:34px;
  --button-font-small:11px;
  --button-font-standard:12px;
  --button-font-weight:500;
  --button-radius:4px;
  --button-icon-radius:6px;
  --button-gap:6px;
  --button-primary:#2563eb;
  --button-primary-hover:#1d4ed8;
  --button-primary-active:#1e40af;
  --button-border:#c7d3e2;
  --button-text:#40546c;
  --button-hover:#edf5ff;
  --button-focus:#3b82f6;
  --button-danger:#b4232f;
  --button-danger-soft:#fff4f4;
}

button{
  box-sizing:border-box;
  border-width:1px;
  border-style:solid;
  border-radius:var(--button-radius);
  font-family:Manrope,"Noto Sans SC","Microsoft YaHei",sans-serif;
  font-weight:var(--button-font-weight);
  line-height:1.2;
  transition:background-color .14s ease,border-color .14s ease,color .14s ease,opacity .14s ease;
}
button:focus-visible{outline:2px solid var(--button-focus);outline-offset:2px}
button:disabled,button[aria-disabled="true"]{opacity:.45!important;cursor:not-allowed;transition:none}
button[aria-busy="true"],button.is-loading{pointer-events:none;cursor:wait}
button .flat-icon{width:15px;height:15px}

.ui-button,
.content-head>button,.detail-head>button:last-of-type,.admin-page-head>button,.admin-card>header button,.admin-panel header button,
.case-create-modal form>footer button,.case-delete-modal footer button,.legal-policy-modal>footer button,.registration-card form>footer button,
.modal-actions button,.profile-actions button,.profile-section-head>button,.avatar-editor button,.settings-actions button,.legal-draft-actions button,
.image-item button,.readonly-plan-summary button,.readonly-image button,.registration-admin .modal-actions button,
.export-options article>button,.export-modal footer button,.line-generator>footer button,.workbench-text-dialog footer button,
.ai-report-actions button,.ai-generate-button,.ai-quote-actions button,.wb-head button,.wb-upload,.ring-confirm-actions button,.ring-start-supplement,
.flip-actions button,.reset-image,.plate-reset,.workbench-entry-error button,.registration-entry,.doctor-pick-btn,.msg-load-error button,.geometry-generate{
  min-height:var(--button-height-standard);
  height:var(--button-height-standard);
  padding:0 12px;
  border-color:var(--button-border);
  border-radius:var(--button-radius);
  background:#fff;
  color:var(--button-text);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:var(--button-gap);
  font-size:var(--button-font-standard);
  font-weight:var(--button-font-weight);
  line-height:1;
  white-space:nowrap;
  cursor:pointer;
}

.ui-button:hover,
.content-head>button:hover,.detail-head>button:last-of-type:hover,.admin-page-head>button:hover,.admin-card>header button:hover,.admin-panel header button:hover,
.modal-actions button:hover,.profile-actions button:hover,.profile-section-head>button:hover,.settings-actions button:hover,
.case-create-modal form>footer button:hover,.case-delete-modal footer button:hover,.registration-card form>footer button:hover,
.export-options article>button:hover,.export-modal footer button:hover,.line-generator>footer button:hover,.workbench-text-dialog footer button:hover,
.registration-entry:hover,.doctor-pick-btn:hover,.msg-load-error button:hover,.geometry-generate:hover{
  border-color:#91add1;
  background:var(--button-hover);
  color:#2459a8;
}

.ui-button--small,
.row-actions button,.data-row button,.implant-item footer button,.registration-row button,.provider-actions button,.route-list button,.prompt-version-list button,
.credit-ledger-list button,.object-actions button,.layer-row button,.geometry-hole-row button,.msg-page-buttons button,.tool-preset-card>button,
.case-row .archive-btn,.case-row .unarchive-btn,.legal-current-grid button,.legal-editor-grid article>button,.legal-history-row button,.category-panel header button{
  min-height:var(--button-height-small);
  height:var(--button-height-small);
  padding:0 9px;
  border-radius:var(--button-radius);
  font-size:var(--button-font-small);
  font-weight:var(--button-font-weight);
  line-height:1;
  white-space:nowrap;
}

button.primary,.ui-button--primary,.wb-head button.accent,.legal-policy-modal>footer button{
  min-height:var(--button-height-prominent)!important;
  height:var(--button-height-prominent)!important;
  padding:0 14px!important;
  border:1px solid var(--button-primary)!important;
  border-radius:var(--button-radius);
  background:var(--button-primary)!important;
  color:#fff!important;
  font-size:var(--button-font-standard);
  font-weight:var(--button-font-weight);
  line-height:1;
  white-space:nowrap;
}
button.primary .flat-icon,.ui-button--primary .flat-icon,.wb-head button.accent .flat-icon{width:15px;height:15px}
button.primary:hover,.ui-button--primary:hover,.wb-head button.accent:hover,.legal-policy-modal>footer button:hover{border-color:var(--button-primary-hover)!important;background:var(--button-primary-hover)!important}
button.primary:active,.ui-button--primary:active,.wb-head button.accent:active,.legal-policy-modal>footer button:active{border-color:var(--button-primary-active)!important;background:var(--button-primary-active)!important}

.ui-button--danger,button.danger,button.danger-btn,button.danger-button{
  min-height:var(--button-height-standard);
  height:var(--button-height-standard);
  padding:0 12px;
  border:1px solid #dba6aa;
  border-radius:var(--button-radius);
  background:#fff;
  color:var(--button-danger);
  font-size:var(--button-font-standard);
  font-weight:var(--button-font-weight);
  white-space:nowrap;
}
.ui-button--danger:hover,button.danger:hover,button.danger-btn:hover,button.danger-button:hover{border-color:#c95c65;background:var(--button-danger-soft);color:#971d28}
.case-delete-modal footer .case-delete-confirm{
  min-height:var(--button-height-prominent);
  height:var(--button-height-prominent);
  padding:0 14px;
  border-color:var(--button-danger);
  border-radius:var(--button-radius);
  background:var(--button-danger);
  color:#fff;
  font-size:var(--button-font-standard);
  font-weight:var(--button-font-weight);
}

.ui-button--link,.legal-current-grid button,.legal-editor-grid article>button,.legal-history-row button,.registration-consent button,.bell-foot button,.registration-page-top>button{
  min-height:0;
  height:auto;
  padding:2px 0;
  border:0;
  border-radius:0;
  background:transparent;
  color:#2563eb;
  font-weight:var(--button-font-weight);
}

.ui-icon-button,.modal-x,.profile-head>button,.case-create-modal>header button,.case-delete-modal>header>button,
.legal-policy-modal>header button,.workbench-text-dialog-close,.export-modal>header>button,.cut-tool-submenu header button{
  width:28px;
  min-width:28px;
  height:28px;
  min-height:28px;
  padding:0;
  border:1px solid transparent;
  border-radius:var(--button-icon-radius);
  background:transparent;
  display:inline-grid;
  place-items:center;
  font-size:18px;
  font-weight:var(--button-font-weight);
  line-height:1;
  cursor:pointer;
}
.bell-btn{width:30px;min-width:30px;height:30px;min-height:30px;padding:0;border-color:transparent;border-radius:var(--button-icon-radius);display:grid;place-items:center}
.case-actions>summary{width:30px;height:30px;padding:0;border-width:1px;border-radius:var(--button-icon-radius)}
.case-actions>div{top:36px}.case-actions.open-up>div{bottom:36px}
.case-actions>summary .flat-icon{width:15px;height:15px}
.geometry-hole-row button,.plate-bend-list article>header button{width:28px;min-width:28px;height:28px;min-height:28px;padding:0;border-radius:var(--button-icon-radius);display:grid;place-items:center}

.workbench .ui-button,.workbench .wb-head button,.workbench .wb-upload,.workbench .object-actions button,.workbench .layer-row button,
.workbench .ring-confirm-actions button,.workbench .ring-start-supplement,.workbench .flip-actions button,.workbench .reset-image,
.workbench .plate-reset,.workbench .workbench-text-dialog footer button{
  border-color:#465467;
  background:#242c36;
  color:#cbd6e4;
}
.workbench .workbench-text-dialog footer button{border-color:var(--button-border);background:#fff;color:var(--button-text)}
.workbench button.primary,.workbench .wb-head button.accent{border-color:var(--button-primary)!important;background:var(--button-primary)!important;color:#fff!important}

.nav-rail nav button,.admin-nav nav button,.nav-exit,.admin-exit,.msg-sidebar button,.filter-row button,.tabs button,.profile-tabs button,
.straight-plate-panel>nav button,.tool-drawer button,.case-actions>div button,.profile-menu-list button,.settings-provider-tab,
.compose-type-option,.implant-choice,.cut-preset-choice,.cut-submenu-item,.view-strip button,.version-view-strip button,
.credit-account-list>button,.ai-run-list>button,.category-item,.profile-avatar-button,.profile-credit-box,.feature-switch,
.registration-attachment,.plate-zone-add button,.measure-row,.version-history button{
  font-weight:var(--button-font-weight);
}
.filter-row button.active,.profile-tabs button.active,.case-actions>div button span,.msg-sidebar button.active{font-weight:var(--button-font-weight)}
.nav-rail nav button .flat-icon,.admin-nav nav button .flat-icon,.tool-drawer button .flat-icon{width:18px;height:18px}

@media (prefers-reduced-motion:reduce){button{transition:none}}

/* Implant version forms: compact, card-based projection uploads. */
.dynamic-implant-form .form-grid{margin-bottom:16px}
.implant-view-editor{margin:16px 0;border:1px solid #d6e1ed;background:#f8fbff}
.implant-view-editor>header{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:13px 14px;border-bottom:1px solid #dce6f1;background:#f4f8fd}
.implant-view-editor>header small{display:block;color:#27759f;font-size:9px;font-weight:600;letter-spacing:.12em}
.implant-view-editor>header h3{margin:4px 0 0;color:#233b59;font-size:14px}
.implant-view-editor>header p{margin:4px 0 0;color:#72839a;font-size:10px}
.implant-view-add{flex:0 0 auto;border:1px solid #a9c5e5;background:#fff;color:#225f9d;padding:0 10px;height:30px;font-size:11px}
.implant-view-add:disabled{color:#8291a2;border-color:#d2dbe5;background:#f5f7fa;cursor:not-allowed}
.implant-view-card-grid{display:grid;grid-template-columns:repeat(var(--implant-view-count),minmax(0,1fr));gap:10px;padding:12px}
.implant-view-card{min-width:0;border:1px solid #d4dfeb;background:#fff;padding:10px;display:grid;grid-template-columns:1fr auto;gap:8px}
.implant-view-card>header{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;min-height:20px}
.implant-view-card>header span b,.implant-view-card>header span small{display:block}
.implant-view-card>header span b{color:#233b59;font-size:11px;font-weight:600}
.implant-view-card>header span small{margin-top:2px;color:#7990a9;font-size:8px;letter-spacing:.08em}
.implant-view-remove{width:22px;height:22px;padding:0;border:1px solid #d9a7a4;background:#fff7f6;color:#b74740;font-size:15px;line-height:1}
.implant-view-card:only-child .implant-view-remove{opacity:.45;pointer-events:none}
.implant-view-upload-target{grid-column:1/-1;position:relative;min-height:112px;border:1px dashed #9cb7d5;background:#f7faff;display:grid;place-items:center;overflow:hidden;cursor:pointer}
.implant-view-upload-target>img{max-width:100%;width:100%;height:112px;object-fit:contain;background:#f3f6fa}
.implant-view-upload-target input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.implant-view-empty{text-align:center;color:#6f88a5}
.implant-view-empty i,.implant-view-empty b,.implant-view-empty small{display:block;font-style:normal}
.implant-view-empty i{color:#4381c3;font-size:22px;line-height:1}
.implant-view-empty b{margin-top:5px;color:#3e638b;font-size:11px;font-weight:500}
.implant-view-empty small{margin-top:4px;font-size:9px}
.implant-view-card:has(img:not([src=""])) [data-empty-view]{display:none}
.implant-view-dimensions{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.implant-view-dimensions label{display:grid;gap:4px;color:#647991;font-size:9px;font-weight:500}
.implant-view-dimensions input{width:100%;height:30px;border:1px solid #b9cadc;background:#fff;padding:0 8px;color:#203a58;font-size:11px;font-weight:500}
.implant-view-dimensions input[readonly]{border-color:#b9ddd5;background:#eef8f5;color:#1e6b5b;cursor:not-allowed}
.implant-view-dimension-note{grid-column:1/-1;margin-top:-3px;color:#2f7867;font-size:9px}
.implant-view-file-button{height:28px;border:1px solid #aec7e2;background:#fff;color:#285f95;padding:0 9px;font-size:10px}
.implant-view-file-name{align-self:center;min-width:0;overflow:hidden;color:#70849b;font-size:9px;white-space:nowrap;text-overflow:ellipsis}
.implant-view-card .dxf-import-status,.implant-view-card .dxf-view-existing{grid-column:1/-1;margin:0;padding:7px 8px;font-size:9px}
.implant-view-card .dxf-import-status em,.implant-view-card .dxf-view-existing em{font-size:9px}
.implant-card-no-view{grid-column:1/-1;padding:14px;text-align:center;color:#8594a4;font-size:10px;font-style:normal}
.view-strip span small,.version-view-strip span small{display:block;margin-top:2px;color:#71859b;font-size:8px;font-weight:400}
@media(max-width:860px){.implant-view-card-grid{grid-template-columns:1fr}.implant-view-editor{--implant-view-count:1!important}}

/* Workbench property control contract: shared sizing, alignment and blue actions. */
.workbench .property-panel{--property-control-height:32px;--property-gap:10px;color:#cbd6e4}
.workbench .property-panel>small,.workbench .property-panel>header small{color:#60a5fa;letter-spacing:.08em}
.workbench .property-panel>h3,.workbench .property-panel>header h3{margin:6px 0 12px;color:#e5edf7;font-size:16px;line-height:1.35}
.workbench .property-panel label{font-size:11px;line-height:1.35}
.workbench .property-panel input:not([type="range"]):not([type="checkbox"]),.workbench .property-panel select{box-sizing:border-box;min-height:var(--property-control-height);border-color:#465467;background:#242c36;color:#e5edf7;font-size:12px}
.workbench .property-panel input:focus,.workbench .property-panel select:focus,.workbench .property-panel textarea:focus{border-color:var(--button-focus)!important;box-shadow:0 0 0 2px #3b82f626;outline:0}
.workbench .property-control-section{margin:14px 0}
.workbench .measurement-label-controls{display:grid!important;grid-template-columns:minmax(0,1fr) 132px!important;grid-template-rows:auto auto;align-items:end;gap:8px 10px!important;margin:14px 0!important;padding:0!important;border:0!important;background:transparent!important}
.workbench .measurement-label-controls>.measurement-font-field,.workbench .measurement-label-controls>label:first-child{grid-column:1;grid-row:1;min-width:0}
.workbench .measurement-label-controls>label:has(#measurementLabelVisible),.workbench .measurement-label-controls>label:has(#intersectionLabelVisible){grid-column:2;grid-row:1}
.workbench .measurement-label-controls>.label-reset-button{grid-column:1;grid-row:2;width:100%;min-width:0;height:var(--property-control-height);min-height:var(--property-control-height);padding:0 9px!important;font-size:var(--button-font-small)!important}
.workbench .measurement-label-controls>label:has(#measurementConnectorVisible),.workbench .measurement-label-controls>label:has(#intersectionConnectorVisible){grid-column:2;grid-row:2}
.workbench .measurement-label-switch{box-sizing:border-box;display:flex!important;align-items:center;width:132px;min-height:var(--property-control-height);padding:0!important;border:0!important;background:transparent!important}
.workbench .measurement-label-switch>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px!important;color:#cbd6e4!important}
.workbench .measurement-label-switch>i{margin-left:auto}
.workbench .object-actions{gap:8px;margin-top:16px;padding-top:12px;border-top:1px solid #354154}
.workbench .object-actions button{height:var(--property-control-height);min-height:var(--property-control-height);padding:0 9px;font-size:var(--button-font-small)}
.workbench .property-action-button{display:inline-flex!important;align-items:center;justify-content:flex-start;gap:8px;overflow:hidden;text-align:left}
.workbench .property-action-button .property-action-icon{display:inline-grid;place-items:center;flex:0 0 22px;width:22px;height:22px;border-radius:5px;background:var(--button-primary);color:#fff}
.workbench .property-action-button .property-action-icon .flat-icon{width:13px;height:13px}
.workbench .property-action-button .property-action-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.workbench .property-action-button.property-action-danger{border-color:#65424a;background:#2e272c;color:#f5d9dd}
.workbench .property-action-button.property-action-danger .property-action-icon{background:var(--button-danger)}
.workbench .property-action-button.primary .property-action-icon{background:#ffffff2b}
.workbench .implant-view-options button.active,.workbench .implant-property-tabs button.active,.workbench .unified-material-tabs button.active,.workbench .visual-cut-side button.active,.workbench .plate-zone-add button.active,.workbench .ring-start-supplement.active{border-color:#60a5fa!important;background:var(--button-primary)!important;color:#fff!important}
.workbench .unified-material-advanced button.primary{border-color:var(--button-primary)!important;background:var(--button-primary)!important;color:#fff!important}
.workbench .unified-material-advanced .plate-mode-note,.workbench .unified-material-advanced .visual-mode-note{border-left-color:#3b82f6;background:#172944;color:#bfdbfe}
@media(max-width:1120px){.workbench .measurement-label-controls{grid-template-columns:minmax(0,1fr) 124px!important}.workbench .measurement-label-switch{width:124px}}

/* Stable, compact action column for the workbench layer list. */
.workbench .layer-row{display:grid;grid-template-columns:minmax(0,1fr) 104px;align-items:center;gap:10px}
.workbench .layer-row>.layer-info,.workbench .layer-row>span:first-child{min-width:0}
.workbench .layer-row>.layer-info b,.workbench .layer-row>.layer-info small{overflow-wrap:anywhere}
.workbench .layer-actions{display:flex;align-items:center;justify-content:flex-end;align-self:center;gap:4px;width:104px;min-width:104px}
.workbench .layer-actions .layer-action{box-sizing:border-box;height:28px;min-height:28px;margin:0;border:1px solid #4b5b70;border-radius:5px;background:#263241;color:#cbd6e4;font-size:10px;line-height:1}
.workbench .layer-actions .layer-action--visibility{min-width:36px;padding:0 7px}
.workbench .layer-actions .layer-action--icon{position:relative;display:grid;place-items:center;width:28px;min-width:28px;padding:0;background:rgb(37 99 235 / 18%);border-color:rgb(96 165 250 / 40%);color:#bfdbfe}
.workbench .layer-actions .layer-action--icon .flat-icon{width:14px;height:14px}
.workbench .layer-actions .layer-action--delete{background:rgb(220 38 38 / 16%);border-color:rgb(248 113 113 / 38%);color:#fecaca}
.workbench .layer-actions .layer-action--icon:hover,.workbench .layer-actions .layer-action--icon:focus-visible{background:rgb(37 99 235 / 30%);border-color:#60a5fa;color:#eff6ff;outline:0}
.workbench .layer-actions .layer-action--delete:hover,.workbench .layer-actions .layer-action--delete:focus-visible{background:rgb(220 38 38 / 28%);border-color:#f87171;color:#fff1f2}
.workbench .layer-action--icon::after{position:absolute;right:0;bottom:calc(100% + 6px);z-index:30;max-width:132px;padding:6px 8px;border:1px solid #42516a;border-radius:4px;background:#111827;color:#e5edf7;content:attr(data-tooltip);font-size:10px;line-height:1.2;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .14s ease}
.workbench .layer-action--icon:hover::after,.workbench .layer-action--icon:focus-visible::after{opacity:1}

/* Keep the dark calibration dialog on the same compact modal action contract. */
.workbench .calibration-dialog footer button{display:inline-flex;align-items:center;justify-content:center;gap:var(--button-gap);min-width:104px;min-height:var(--button-height-standard);height:var(--button-height-standard);padding:0 12px;border:1px solid #465467;border-radius:var(--button-radius);background:#242c36;color:#cbd6e4;font-size:var(--button-font-small);font-weight:var(--button-font-weight);line-height:1;white-space:nowrap;cursor:pointer}
.workbench .calibration-dialog footer button:hover{border-color:#60a5fa;background:#2b394b;color:#eff6ff}
.workbench .calibration-dialog footer button.primary{min-height:var(--button-height-standard)!important;height:var(--button-height-standard)!important;padding:0 12px!important}
.workbench .calibration-dialog footer button .property-action-icon{flex:0 0 20px}

/* Compact ring-saw workflow: one stable row for supplement, undo and cut. */
.ring-object-panel{container-type:inline-size}
.ring-cut-actionbar{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;align-items:stretch;gap:6px;width:100%;min-width:0;margin:2px 0 4px}
.ring-cut-actionbar .ring-cut-action{box-sizing:border-box;display:inline-flex!important;align-items:center;justify-content:center;gap:5px;min-width:0!important;width:100%!important;max-width:none!important;min-height:32px!important;height:32px!important;margin:0!important;padding:0 7px!important;border:1px solid #46546a;border-radius:4px;background:#252d38;color:#cbd6e4;font-size:10px!important;font-weight:600;line-height:1;white-space:nowrap;overflow:hidden;cursor:pointer}
.ring-cut-actionbar button:hover{border-color:#6f8eb7;background:#2c394a;color:#f2f7ff}
.ring-cut-actionbar button.active{border-color:#60a5fa;background:#1f4272;color:#eaf3ff;box-shadow:inset 0 0 0 1px #60a5fa4d}
.ring-cut-actionbar button.ring-cut-primary{border-color:#2563eb;background:#2563eb;color:#fff}
.ring-cut-actionbar button.ring-cut-primary:hover{border-color:#1d4ed8;background:#1d4ed8;color:#fff}
.ring-cut-actionbar button:disabled{border-color:#394452;background:#202731;color:#738096}
.ring-cut-actionbar button .flat-icon{flex:0 0 14px;width:14px;height:14px}
.ring-cut-actionbar button span{min-width:0;overflow:hidden;text-overflow:ellipsis}
@container(max-width:250px){.ring-cut-actionbar button span{display:none}.ring-cut-actionbar .ring-cut-action{padding:0 6px!important}}
