:root {
  color-scheme: light;
  --bg: #f3f5f6;
  --panel: #ffffff;
  --ink: #15191d;
  --muted: #626971;
  --line: #dce2e6;
  --soft: #eef2f4;
  --green: #75b843;
  --green-dark: #4f842e;
  --blue: #243f5a;
  --blue-soft: #eaf0f5;
  --amber: #c88a2d;
  --danger: #a4453c;
  --paper: #fbfcfd;
  --shadow: 0 24px 70px rgba(18, 29, 39, 0.13);
}

* {
  box-sizing: border-box;
}

@media (prefers-reduced-motion: no-preference) {
  * {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(117, 184, 67, 0.10), transparent 31%),
    linear-gradient(300deg, rgba(36, 63, 90, 0.10), transparent 42%),
    var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 28px;
}

.workspace {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: calc(100vh - 56px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: appEnter .45s ease-out both;
}

.product-nav {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f0f4f6);
  padding: 24px;
}

.brand-block {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand-block p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.eyebrow,
.section-label {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 25px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 8px;
  font-size: 20px;
  line-height: 1.25;
}

.product-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.product-button {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  padding: 8px 10px;
  transform: translateX(0);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.product-button:hover,
.product-button.active {
  border-color: rgba(36, 63, 90, 0.32);
  background: var(--panel);
}

.product-button:hover {
  transform: translateX(3px);
}

.product-button.active {
  box-shadow: inset 4px 0 0 var(--green), 0 10px 24px rgba(36, 63, 90, 0.10);
}

.product-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.product-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.product-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.config-panel {
  min-width: 0;
  padding: 24px 28px 28px;
}

.top-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.top-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f9fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 0 10px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 22px;
  border-bottom: 1px solid var(--line);
}

.secondary-action {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.secondary-action:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: translateY(-1px);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(430px, 1fr) 410px;
  gap: 26px;
  padding-top: 24px;
  align-items: start;
}

.form-surface {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  padding: 18px;
  animation: surfaceEnter .28s ease-out both;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 11px;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(36, 63, 90, 0.18);
  border-color: var(--blue);
  box-shadow: 0 8px 22px rgba(36, 63, 90, 0.08);
}

textarea {
  min-height: 78px;
  padding-top: 10px;
  resize: vertical;
}

.form-section {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 8px 0 2px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.chip:hover {
  border-color: rgba(117, 184, 67, 0.55);
  background: #f7fbf4;
  transform: translateY(-1px);
}

.chip input {
  width: auto;
  min-height: auto;
}

.result-surface {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  padding: 18px;
  position: sticky;
  top: 24px;
  animation: resultEnter .34s ease-out both;
}

.visual-frame {
  display: grid;
  place-items: center;
  min-height: 180px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.75), rgba(237,241,235,.8)),
    repeating-linear-gradient(90deg, transparent, transparent 22px, rgba(36,63,90,.045) 22px, rgba(36,63,90,.045) 23px);
}

.visual-frame svg {
  width: min(100%, 300px);
  height: 150px;
  transform-origin: center;
  animation: drawIn .55s ease-out both;
}

.visual-frame svg path {
  transition: transform .28s ease, opacity .28s ease;
}

.visual-frame:hover svg path:nth-child(1) {
  transform: translateY(-2px);
}

.visual-frame:hover svg path:nth-child(2) {
  transform: translateY(1px);
}

.result-block p {
  color: var(--muted);
  line-height: 1.45;
}

.quote-lines {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.quote-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 12px;
  animation: lineEnter .22s ease-out both;
}

.quote-line:nth-child(2) {
  animation-delay: .04s;
}

.quote-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quote-line strong {
  font-size: 15px;
  text-align: right;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
  animation: metricEnter .24s ease-out both;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.metric:nth-child(2) {
  animation-delay: .03s;
}

.metric:nth-child(3) {
  animation-delay: .06s;
}

.metric:nth-child(4) {
  animation-delay: .09s;
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(18, 29, 39, 0.08);
}

.metric:first-child {
  border-color: rgba(117, 184, 67, 0.38);
  background: #f3f9ef;
}

.bom-block {
  margin-top: 16px;
}

.bom-list {
  display: grid;
  gap: 8px;
}

.bom-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 12px;
  animation: lineEnter .22s ease-out both;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.bom-item:hover {
  border-color: rgba(36, 63, 90, 0.28);
  box-shadow: 0 10px 22px rgba(18, 29, 39, 0.07);
  transform: translateY(-1px);
}

.bom-item:nth-child(2) {
  animation-delay: .03s;
}

.bom-item:nth-child(3) {
  animation-delay: .06s;
}

.bom-item:nth-child(4) {
  animation-delay: .09s;
}

.bom-item:nth-child(5) {
  animation-delay: .12s;
}

.bom-item strong {
  font-size: 13px;
  line-height: 1.25;
}

.bom-item .bom-price {
  color: var(--blue);
  font-weight: 700;
  white-space: nowrap;
}

.bom-item small {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.35;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
  line-height: 1.2;
}

.notice-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.notice {
  border-left: 4px solid var(--blue);
  background: #eef4f7;
  border-radius: 6px;
  padding: 10px 12px;
  color: #284457;
  line-height: 1.35;
  font-size: 13px;
  animation: noticeEnter .25s ease-out both;
}

@keyframes appEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes surfaceEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes resultEnter {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes drawIn {
  from { opacity: 0; transform: scale(.96) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes lineEnter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes metricEnter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes noticeEnter {
  from { opacity: 0; transform: translateX(6px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}

.notice.warn {
  border-left-color: var(--amber);
  background: #fbf1e3;
  color: #684311;
}

.notice.danger {
  border-left-color: var(--danger);
  background: #f8e9e6;
  color: #71322b;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.drawing-block {
  margin-top: 16px;
}

.upload-box {
  display: grid;
  gap: 5px;
  border: 1px dashed rgba(36, 63, 90, 0.32);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  padding: 12px;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.upload-box:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: translateY(-1px);
}

.upload-box span {
  font-weight: 700;
}

.upload-box small,
.drawing-preview small {
  color: var(--muted);
  line-height: 1.35;
}

.upload-box input {
  display: none;
}

.drawing-preview {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.drawing-preview img {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.copy-status {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
}

@media print {
  body {
    background: #fff;
  }

  .app-shell {
    padding: 0;
  }

  .workspace {
    display: block;
    min-height: auto;
    border: 0;
    box-shadow: none;
  }

  .product-nav,
  .top-strip,
  .panel-header .secondary-action,
  .visual-frame,
  .drawing-block,
  .action-row,
  .copy-status {
    display: none;
  }

  .config-panel {
    padding: 0;
  }

  .content-grid {
    display: block;
    padding-top: 0;
  }

  .form-surface,
  .result-surface {
    position: static;
    border: 0;
    background: #fff;
    padding: 0;
  }

  .form-surface {
    margin-bottom: 18px;
  }

  .result-surface {
    break-inside: avoid;
  }
}

@media (max-width: 1040px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .product-nav {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .product-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 0;
  }

  .workspace {
    min-height: 100vh;
    border: 0;
  }

  .product-list,
  .form-surface,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .config-panel,
  .product-nav {
    padding: 18px;
  }

  .result-surface {
    position: static;
  }
}
