:root {
  color-scheme: light;
  --bg: #f5f8fa;
  --panel: #ffffff;
  --ink: #1A2C4C;
  --muted: rgba(26, 44, 76, 0.72);
  --line: rgba(26, 44, 76, 0.16);
  --brand: #0084A2;
  --brand-dark: #1A2C4C;
  --accent: #0084A2;
  --danger: #000000;
  --soft: #f5f8fa;
  --white: #ffffff;
  --black: #000000;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--white);
  color: var(--ink);
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 36px; line-height: 1.1; }
h2 { margin: 22px 0 12px; font-size: 18px; }

.intro p, .notice, .drop-help { color: var(--muted); }

.status-pill {
  min-width: 120px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.mode-switch label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
}

.mode-switch input {
  width: auto;
  min-height: auto;
}

.common-params {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.common-params summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 760;
}

.common-params .field-grid {
  margin-top: 12px;
}

.apply-all {
  width: 100%;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

input, select, textarea, button {
  font: inherit;
}

input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  background: var(--white);
  color: var(--ink);
}

textarea { resize: vertical; }

.dropzone {
  display: grid;
  place-items: center;
  min-height: 140px;
  border: 1px dashed rgba(0, 132, 162, 0.45);
  border-radius: 8px;
  padding: 20px;
  background: rgba(0, 132, 162, 0.06);
  text-align: center;
  cursor: pointer;
}

.dropzone input { display: none; }
.drop-title { font-size: 17px; font-weight: 760; }

.file-list {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.file-list li {
  display: grid;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  color: var(--muted);
  font-size: 13px;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 90px 110px 100px 120px auto;
  align-items: center;
  gap: 12px;
}

.file-name {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 650;
}

.file-list input {
  min-height: 34px;
  padding: 6px 8px;
}

.item-params {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.item-params summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 760;
}

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

.line-price {
  color: var(--brand-dark);
  font-weight: 800;
  text-align: right;
}

.file-list button {
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid rgba(26, 44, 76, 0.16);
  background: var(--white);
  color: var(--danger);
  font-size: 12px;
}

@media (max-width: 760px) {
  .file-row {
    grid-template-columns: 1fr 1fr;
  }
  .mode-switch,
  .item-param-grid {
    grid-template-columns: 1fr;
  }
  .line-price {
    text-align: left;
  }
}

.discount-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.discount-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.discount-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.discount-tier {
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  text-align: center;
  font-size: 12px;
}

.discount-tier strong {
  display: block;
  color: var(--brand-dark);
  font-size: 13px;
}

.discount-tier.active {
  border-color: var(--brand);
  background: rgba(0, 132, 162, 0.08);
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.side-actions {
  display: grid;
  gap: 10px;
  margin: 16px 0 14px;
}

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

button {
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  padding: 10px 15px;
  background: var(--brand);
  color: var(--white);
  font-weight: 760;
  cursor: pointer;
}

button:hover { background: var(--brand-dark); }
button.secondary {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
}
button.secondary:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--white);
}

.viewer {
  position: relative;
  height: 310px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--brand-dark);
}

.viewer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.viewer-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--white);
}

.quote-card {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 18px 0 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.quote-card span { color: var(--muted); font-weight: 700; }
.quote-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.quote-card strong { font-size: 32px; color: var(--brand-dark); }

.price-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.price-breakdown {
  display: grid;
  gap: 6px;
  margin: -4px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.price-breakdown[hidden] {
  display: none;
}

.price-breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.price-breakdown strong {
  color: var(--ink);
  white-space: nowrap;
}

.mini-update {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--accent);
  background: rgba(0, 132, 162, 0.08);
  color: var(--brand-dark);
  font-size: 13px;
}

.mini-update:hover {
  background: rgba(0, 132, 162, 0.14);
}

.metrics {
  display: grid;
  gap: 10px;
  margin: 0;
}

.metrics div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

dt { color: var(--muted); }
dd { margin: 0; font-weight: 750; text-align: right; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .intro { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 640px) {
  .app-shell { width: min(100% - 20px, 1180px); padding: 20px 0; }
  h1 { font-size: 30px; }
  .field-grid { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  .panel { padding: 16px; }
  .discount-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
