:root {
  --paper: #f3f6f8;
  --ink: #24343d;
  --muted: #75828b;
  --line: #e0e7eb;
  --green: #147d78;
  --green-soft: #e6f3f0;
}

.ui-icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  vertical-align: middle;
  background: currentColor;
  mask: var(--icon) center / contain no-repeat;
  -webkit-mask: var(--icon) center / contain no-repeat;
}
.icon-settings { --icon: url('/static/assets/lucide/settings.svg'); }
.icon-reset { --icon: url('/static/assets/lucide/rotate-ccw.svg'); }
.icon-restart { --icon: url('/static/assets/lucide/chevrons-left.svg'); }
.icon-download { --icon: url('/static/assets/lucide/download.svg'); }
.icon-upload { --icon: url('/static/assets/lucide/upload.svg'); }
.icon-plus { --icon: url('/static/assets/lucide/plus.svg'); }
.icon-trash { --icon: url('/static/assets/lucide/trash-2.svg'); }
.icon-logout { --icon: url('/static/assets/lucide/log-out.svg'); }
.icon-feedback { --icon: url('/static/assets/lucide/message-square.svg'); }

.header-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 16px; }
.feedback-trigger { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 12px; border: 1px solid #b9d4d1; border-radius: 5px; background: #f0f8f6; color: #147d78; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.feedback-trigger:hover { background: #e6f3f0; }
.auth-feedback { position: fixed; z-index: 5; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); background: #fff; }
.feedback-dialog { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 24px; border: 1px solid #dce6e7; border-radius: 8px; background: #fff; color: #24343d; overflow-y: auto; box-sizing: border-box; box-shadow: 0 16px 60px #24343d30; }
.feedback-dialog::backdrop { background: #182b3a66; }
.feedback-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.feedback-heading h2 { margin: 0; font-size: 18px; }
.feedback-close { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; background: transparent; color: #75828b; font-size: 26px; cursor: pointer; }
.feedback-form { display: grid; gap: 12px; }
.feedback-form label { color: #526571; font-size: 13px; }
.feedback-form textarea, .feedback-form input:not([type='checkbox']) { width: 100%; padding: 12px; border: 1px solid #dbe4e8; border-radius: 5px; font: inherit; font-size: 16px; color: #24343d; background: #fff; box-sizing: border-box; }
.feedback-form textarea { resize: vertical; min-height: 120px; max-height: 240px; }
.feedback-contact { display: grid; gap: 8px; }
.feedback-attach { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.feedback-attach input { width: 18px; height: 18px; accent-color: #147d78; }
.feedback-status { min-height: 18px; margin: 0; color: #bd4747; font-size: 12px; line-height: 1.5; }
.feedback-submit { width: 100%; min-height: 44px; padding: 10px 16px; border: 0; border-radius: 5px; background: #147d78; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.feedback-submit:disabled { opacity: .5; cursor: wait; }
.feedback-success { text-align: center; }
.feedback-success h3 { margin: 20px 0 12px; font-size: 20px; color: #147d78; }
.feedback-success p { margin: 0 0 28px; font-size: 13px; color: #75828b; }
.feedback-dialog [hidden] { display: none !important; }
.feedback-dialog :focus-visible, .feedback-trigger:focus-visible { outline: 2px solid #147d78; outline-offset: 2px; }
.feedback-image-heading { display: flex; justify-content: space-between; align-items: center; color: #526571; font-size: 13px; }
.feedback-image-heading small { font-size: 12px; color: #75828b; }
.feedback-image-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.feedback-image { position: relative; min-width: 0; margin: 0; }
.feedback-image img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; border: 1px solid #dbe4e8; border-radius: 4px; }
.feedback-image figcaption { margin-top: 5px; color: #75828b; font-size: 12px; }
.feedback-image-remove { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid #dbe4e8; border-radius: 4px; background: #fff; color: #526571; cursor: pointer; }
.feedback-upload { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 44px; padding: 8px 12px; border: 1px solid #b9d4d1; border-radius: 5px; color: #147d78; background: #f0f8f6; font-size: 13px; font-weight: 600; cursor: pointer; }
.feedback-upload:disabled, .feedback-image-remove:disabled { opacity: .5; cursor: default; }
.feedback-image-note { margin: -4px 0 0; color: #75828b; font-size: 12px; line-height: 1.6; }
.feedback-sales { margin: 0; color: #526571; font-size: 12px; line-height: 1.6; }
.feedback-success .feedback-sales { margin-bottom: 20px; color: #526571; }
@media (max-width: 600px) {
  .feedback-dialog { padding: 18px; }
  .feedback-image-remove { width: 36px; height: 36px; }
}

.keyu-mark {
  position: relative;
  display: block;
  flex: 0 0 52px;
  width: 52px;
  height: 50px;
  overflow: hidden;
  background: #fff;
}
.keyu-mark img {
  position: absolute;
  width: 345px;
  max-width: none;
  height: auto;
  left: -21px;
  top: -29px;
}
.app-shell, .app-shell.app-mode-cutting {
  grid-template-columns: 336px minmax(0, 1fr);
  grid-template-rows: 74px minmax(0, 1fr);
  background: var(--paper);
}
.app-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.keyu-brand { display: flex; align-items: center; min-width: 0; gap: 16px; }
.keyu-brand-text { min-width: 0; }
.keyu-brand h1 { color: #103e66; font-size: 19px; font-weight: 700; line-height: 1.4; }
.keyu-brand p { margin-top: 2px; color: #7b8893; font-size: 11px; line-height: 1.5; }
.app-header .customer-account { gap: 16px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.app-header .customer-account > div { justify-items: end; gap: 3px; }
.app-header .customer-account strong { color: #526571; font-size: 12px; font-weight: 600; }
.app-header .customer-account small { color: #8b979f; }
.app-header .customer-account button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-color: var(--line); color: #647780; }
.app-shell .side-panel { gap: 0; padding: 0 20px 12px; max-height: none; background: #fff; border-right: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: #dbe3e6 transparent; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; min-height: 66px; gap: 12px; }
.panel-heading h2 { font-size: 16px; font-weight: 650; }
.panel-unit { color: #8a969e; font-size: 11px; }
.app-shell .input-form { gap: 0; }
.app-shell .form-section { padding: 0 0 20px; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
.app-shell .section-title { min-height: 36px; margin: 0 0 12px; padding: 0; border: 0; background: transparent; }
.app-shell .section-title > span { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; }
.app-shell .section-title > span::before { content: ''; width: 3px; height: 14px; border-radius: 2px; background: #147d78; }
.app-shell .section-title small { display: none; }
.app-shell .product-section { border-top: 1px solid var(--line); padding-top: 14px; }
.app-shell .grid-2 { gap: 10px; }
.app-shell label { font-size: 11px; color: #6e7e87; font-weight: 500; gap: 6px; }
.app-shell input[type='number'], .app-shell select { height: 38px; border-color: #dbe4e8; border-radius: 5px; font-size: 13px; font-weight: 500; color: #243a45; background: #fff; }
.app-shell input[type='number']:focus, .app-shell select:focus { border-color: #147d78; box-shadow: 0 0 0 2px #e1f0ec; }
.app-shell button { transition: background-color .15s, border-color .15s; }
.app-shell button:focus-visible, .disclosure summary:focus-visible { outline: 2px solid #147d78; outline-offset: 2px; }
.app-shell button:disabled { opacity: .4; }
.app-shell .mini-button { border-radius: 5px; border-color: #dbe4e8; color: #59707c; background: #fff; font-weight: 500; }
.app-shell .mini-button:hover:not(:disabled) { border-color: #9dbbbd; background: #f1f7f7; }
.disclosure { min-width: 0; border: 0; border-top: 1px solid #edf1f3; }
.disclosure summary { display: flex; align-items: center; gap: 8px; min-height: 38px; color: #70818b; font-size: 12px; font-weight: 500; cursor: pointer; list-style: none; user-select: none; }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::after { content: ''; flex: 0 0 6px; width: 6px; height: 6px; margin-left: auto; border-right: 1.5px solid #7b8b93; border-bottom: 1.5px solid #7b8b93; transform: rotate(45deg); transition: transform .15s; }
.disclosure[open] > summary::after { transform: rotate(225deg); }
.disclosure summary strong, .disclosure summary small { font-size: 11px; font-weight: 500; color: #147d78; }
.board-options { margin-top: 14px; }
.app-shell .preset-row, .app-shell .board-candidate-box, .app-shell .product-toolbox { padding: 0 0 12px; border: 0; border-radius: 0; margin: 0; background: transparent; box-shadow: none; }
.app-shell .board-candidate-box { padding-top: 6px; }
.app-shell .board-candidate-head { font-size: 11px; font-weight: 500; }
.app-shell .board-candidate-chip { padding: 5px 8px; font-size: 11px; font-weight: 500; border-color: #dce7e8; color: #486a71; background: #f4f8f8; }
.section-tools { display: flex; align-items: center; gap: 6px; }
.app-shell .tool-icon { display: grid; place-items: center; width: 30px; min-width: 30px; height: 30px; padding: 0; background: transparent; }
.app-shell .section-tools .tool-icon { border-color: transparent; }
.app-shell .product-rows { gap: 8px; }
.app-shell .product-row { padding: 12px; gap: 10px; border: 1px solid #e1e8eb; border-radius: 6px; background: #fff; }
.app-shell .product-row-active { border-color: #aecbca; background: #f8fbfa; }
.app-shell .product-row-head strong { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 650; }
.app-shell .product-row-head strong::before { content: ''; width: 7px; height: 7px; border-radius: 2px; background: #54b580; }
.app-shell .product-row:nth-child(2n) .product-row-head strong::before { background: #70aadb; }
.app-shell .product-row:nth-child(3n) .product-row-head strong::before { background: #d9a454; }
.app-shell .product-row .tool-icon { height: 26px; width: 26px; min-width: 26px; border: 0; color: #97a2a9; }
.app-shell .product-row .ui-icon { width: 15px; height: 15px; }
.app-shell .secondary-button { display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; margin: 10px 0; border: 1px dashed #cddbdd; border-radius: 5px; color: #147d78; background: #fff; font-size: 12px; font-weight: 600; }
.app-shell .product-toolbox .product-preset-row { margin: 0; padding: 0; background: transparent; }
.app-shell .submit-panel { margin: 0; padding: 14px 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; }
.app-shell .mode-toolbox-head { grid-template-columns: 30px minmax(0, 1fr); }
.app-shell .mode-state { display: none; }
.app-shell .mode-segment-button { height: 34px; padding: 0 2px; border-radius: 5px; color: #6f808a; font-size: 11px; font-weight: 500; }
.app-shell .mode-segment-button-active { color: #147d78; border-color: #a8cdc6; background: #eaf4f1; }
.quantity-options { margin-top: 6px; }
.quantity-options .product-mode-list { padding-bottom: 12px; }
.app-shell .product-mode-item { border: 0; padding: 0; }
.example-options { margin-top: 8px; }
.app-shell .test-case-loader { padding: 0 0 12px; border: 0; border-radius: 0; background: transparent; }
.app-shell .status-line { flex: 0 0 auto; min-height: 34px; padding: 10px 0; border: 0; border-radius: 0; color: #7c8b93; background: transparent; font-size: 11px; line-height: 1.5; }
.app-shell .status-line.error { color: #c54848; }
.app-shell .floating-actions { position: sticky; bottom: -12px; display: grid; grid-template-columns: 1fr; flex: 0 0 auto; gap: 8px; margin-top: auto; padding: 12px 0; border: 0; background: #fff; box-shadow: 0 -8px 12px rgba(255,255,255,.9); }
.app-mode-plan #floatingConfirmPlan { display: none; }
.app-shell .floating-action { height: 42px; border-radius: 5px; background: #147d78; border: 1px solid #147d78; color: #fff; font-weight: 600; font-size: 14px; }
.app-mode-cutting .floating-actions { grid-template-columns: 1fr; }
.app-mode-cutting #floatingGeneratePlan { display: none; }
.app-mode-cutting #floatingBackToPlan { background: #fff; color: #147d78; border-color: #c6dcda; }
.app-shell .app-icp { flex: 0 0 auto; margin: 6px auto 0; padding: 0; font-size: 9px; color: #9aa6ad; }
.app-shell .main-stage { padding: 0; gap: 0; min-width: 0; min-height: 0; height: 100%; }
.app-shell .workspace, .app-shell.app-mode-cutting .workspace { grid-template-columns: minmax(0, 1fr) 300px; gap: 0; }
.app-shell .scene-host { border: 0; border-radius: 0; background: #f6f8f4; }
.app-shell .result-panel { padding: 20px; gap: 0; border: 0; border-radius: 0; background: #fff; border-left: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: #dbe3e6 transparent; }
.app-shell .result-panel > .card { margin: 0; padding: 18px 0; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); background: transparent; box-shadow: none; }
.app-shell .result-panel > .card h3 { font-size: 13px; font-weight: 650; margin-bottom: 12px; }
.app-shell .metric-row { gap: 0; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.app-shell .metric-row div { min-height: 62px; padding: 4px 10px; border: 0; border-radius: 0; border-right: 1px solid var(--line); background: transparent; }
.app-shell .metric-row div:first-child { padding-left: 0; }
.app-shell .metric-row div:last-child { border-right: 0; }
.app-shell .metric-row span { font-size: 11px; }
.app-shell .metric-row strong { margin-top: 8px; color: #19475b; font-size: 22px; font-weight: 650; }
.app-shell .plan-confirm-card .primary-button { height: 42px; border-radius: 5px; background: #147d78; font-weight: 600; }
.app-shell .info-list { gap: 6px; }
.app-shell .info-item { border-radius: 3px; background: #f5f7f8; }
.scene-info-details { margin-top: 12px; }
.app-shell .board-plan-switcher { padding: 0 0 16px; border: 0; background: #fff; }
.app-shell .scene-view-controls { width: 156px; display: grid; grid-template-columns: minmax(0, 1fr) 32px; padding: 0; gap: 8px; top: 16px; left: 16px; }
.scene-projection-controls { min-width: 0; }
.app-shell .scene-projection-button { height: 32px; padding: 0; border-radius: 4px; font-size: 11px; font-weight: 600; border-color: #d9e3e4; color: #67808a; background: #fff; box-shadow: none; }
.app-shell .scene-projection-button-active { color: #147d78; background: #eaf5f1; border-color: #b0ceca; }
.app-shell .scene-view-reset { position: static; display: grid; width: 32px; height: 32px; place-items: center; border-radius: 4px; border-color: #d9e3e4; color: #67808a; box-shadow: none; }
.app-shell .scene-view-picker { grid-column: 1; min-height: 84px; }
.app-shell .view-cube-canvas { width: 84px; height: 84px; }
.app-shell .scene-step-controls { top: 16px; right: 16px; padding: 6px; border: 1px solid #dfe8e7; border-radius: 6px; background: #fff; box-shadow: 0 2px 8px rgba(49,76,72,.04); }
.app-shell .scene-settings-button, .app-shell .scene-long-image-button, .app-shell .scene-step-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.app-shell .scene-step-button { background: #147d78; }
.app-shell .scene-step-button-secondary { color: #62817c; background: #fff; }
.app-shell .scene-step-button-restart, .app-shell #replayCutStep { width: 34px; min-width: 34px; padding: 0; }
.app-shell .scene-step-skip-toggle strong { font-size: 11px; font-weight: 500; }
.app-shell .cut-mode-head { display: none; }
.app-shell .animation-explain-card { padding: 14px 0; border: 0; border-radius: 0; background: transparent; }
.app-shell .scene-animation-flow div { box-shadow: none; border-color: #e0e7eb; background: #f7f9fa; }
.auth-brand .keyu-mark { flex-shrink: 0; }
.auth-brand h1 { font-size: 20px; color: #103e66; }
.auth-brand p { font-size: 12px; }

.login-method-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 6px;
  background: #f0f4f6;
}
.login-method-controls button {
  min-width: 0;
  min-height: 40px;
  padding: 6px 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #5e6f7c;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.login-method-controls button[aria-pressed="true"] {
  background: #fff;
  color: #126853;
  box-shadow: 0 1px 4px #182f3f12;
}
.auth-form [hidden] { display: none !important; }
@media (max-width: 980px) {
  .login-method-controls button { min-height: 44px; }
}

@media (max-width: 1440px) and (min-width: 981px) and (min-height: 501px) {
  .app-shell, .app-shell.app-mode-cutting { grid-template-columns: 300px minmax(0, 1fr); }
  .app-shell .side-panel { padding-inline: 16px; }
  .app-shell .workspace, .app-shell.app-mode-cutting .workspace { grid-template-columns: minmax(0, 1fr) 248px; }
  .app-shell .result-panel { padding: 16px; }
  .app-mode-cutting .scene-step-controls { top: auto; bottom: 12px; left: 12px; right: 12px; display: flex; flex-wrap: wrap; justify-content: flex-end; }
  .app-mode-cutting .scene-dimension-panel { bottom: 110px !important; }
}

@media (max-width: 980px), (max-width: 1024px) and (max-height: 500px) {
  .app-header { flex: 0 0 64px; padding: 0 14px; gap: 8px; }
  .keyu-brand { gap: 8px; }
  .keyu-brand h1 { font-size: 16px; }
  .keyu-brand p { display: none; }
  .keyu-mark { flex-basis: 46px; width: 46px; height: 46px; }
  .keyu-mark img { width: 315px; left: -20px; top: -26px; }
  .app-header .customer-account > div { display: none; }
  .app-header .customer-account button { height: 36px; width: 36px; }
  .header-actions { gap: 6px; }
  .app-header .feedback-trigger { gap: 4px; padding: 0 8px; }
  .app-shell .side-panel { padding: 0 16px 12px; }
  .panel-heading { min-height: 54px; }
  .app-shell input[type='number'], .app-shell select { height: 44px; font-size: 16px; }
  .app-shell .grid-2 { gap: 10px; }
  .app-shell .form-section { padding-bottom: 16px; }
  .app-shell .section-tools .tool-icon { width: 40px; height: 40px; }
  .app-shell .disclosure summary { min-height: 44px; }
  .app-shell .product-row .tool-icon { width: 36px; height: 36px; }
  .app-shell .product-row { padding: 10px; gap: 8px; }
  .app-shell .mode-segment-button { min-height: 40px; font-size: 11px; }
  .app-shell .floating-action { height: 46px; }
  .app-shell .floating-actions { padding-top: 10px; }
  .app-shell .main-stage { padding: 0; }
  .app-shell .result-panel { padding: 16px; border: 0; }
  .app-shell .scene-view-controls { top: 10px; left: 10px; width: 142px; grid-template-columns: minmax(0, 1fr) 36px; gap: 6px; }
  .app-shell .scene-projection-button { height: 36px; }
  .app-shell .scene-view-reset { width: 36px; height: 36px; }
  .app-shell .scene-view-picker { min-height: 72px; }
  .app-shell .view-cube-canvas { width: 72px; height: 72px; }
  .app-shell .scene-step-controls { top: auto; bottom: 8px; left: 8px; right: 8px; display: grid; }
  .app-mode-plan .scene-step-controls { top: 10px; bottom: auto; left: auto; right: 10px; padding: 0; border: 0; background: transparent; box-shadow: none; }
  .app-mode-plan .scene-step-controls .scene-long-image-button { font-size: 11px; }
  .app-mode-plan .scene-step-controls .scene-long-image-button .ui-icon { display: none; }
  .app-shell .scene-step-button-restart, .app-shell #replayCutStep { width: 100%; min-width: 0; }
  .app-shell .scene-step-controls .scene-long-image-button { gap: 3px; }
  .scene-step-controls .scene-long-image-button .ui-icon { width: 14px; height: 14px; }
  .mobile-plan-actions .mobile-confirm-plan { background: #147d78; border-color: #147d78; }
  .mobile-plan-actions button { color: #147d78; }
  .mobile-navigation { background: #fff; border-color: #e0e7eb; }
  .mobile-navigation button { color: #7c8e96; font-size: 13px; }
  .mobile-navigation button[aria-selected='true'] { color: #147d78; box-shadow: none; background: #e9f4f1; }
  .auth-brand h1 { font-size: 18px; }
}

@media (max-width: 359px) {
  .app-header { padding-inline: 8px; gap: 6px; }
  .keyu-brand h1 { font-size: 14px; }
  .keyu-brand { gap: 4px; }
  .app-header .keyu-mark { flex-basis: 36px; width: 36px; }
  .app-header .keyu-mark img { width: 270px; left: -19px; top: -20px; }
  .app-header .feedback-trigger { font-size: 11px; padding-inline: 5px; }
  .app-header .feedback-trigger .ui-icon { width: 14px; height: 14px; }
  .app-header .customer-account button { width: 32px; }
}

@media (max-width: 1024px) and (max-height: 500px) {
  .app-header { flex-basis: 50px; }
  .keyu-mark { height: 44px; }
  .app-shell .scene-step-controls { display: grid; }
  .app-mode-cutting .scene-dimension-panel {
    top: auto !important;
    left: auto !important;
    right: 8px !important;
    bottom: 64px !important;
    max-height: 160px;
  }
}

@media (max-width: 599px) and (max-height: 650px) {
  .app-mode-cutting .scene-dimension-panel {
    top: auto !important;
    right: 8px !important;
    bottom: 118px !important;
    left: auto !important;
    width: 132px;
    max-height: 132px;
  }
  .scene-dimension-panel strong { font-size: 13px; }
  .scene-dimension-ruler { height: 80px; min-height: 80px; }
  .scene-dimension-segment { min-height: 16px; }
  .scene-dimension-segment em { font-size: 11px; white-space: nowrap; }
}
