.cl-app { max-width: 1060px; margin: 0 auto; padding: 0 16px 40px; }
.cl-app h1 { font-size: 1.5rem; font-weight: 700; margin: 24px 0 16px; }

.studio { display: grid; grid-template-columns: 1fr 420px; gap: 24px; align-items: start; }
.studio .result { grid-column: 1; grid-row: 1 / 3; position: sticky; top: 16px; }
.studio .panel { grid-column: 2; grid-row: 1; }
#buy { grid-column: 2; grid-row: 2; }

.result-empty { padding: 32px 24px; text-align: center; color: #666; border: 2px dashed #ddd; border-radius: 8px; }
.result-live { border: 1px solid #e0e0e0; border-radius: 8px; padding: 20px; }

.stats { display: flex; gap: 12px; margin-bottom: 16px; }
.stat { background: #f0f4f8; border-radius: 6px; padding: 10px 14px; flex: 1; }
.stat-label { font-size: .7rem; color: #666; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.15rem; font-weight: 700; color: #2b6cb0; margin-top: 2px; }

.diagram-wrap { margin: 12px 0; }
.diagram-wrap svg { width: 100%; height: auto; display: block; }

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.thumb { width: 80px; height: 50px; border: 1px solid #ccc; border-radius: 4px; background: #f9f9f6; position: relative; overflow: hidden; }
.thumb-wm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .6rem; color: rgba(0,0,0,.2); font-weight: 700; transform: rotate(-15deg); pointer-events: none; }

.errors { margin-top: 8px; }
.err-msg { font-size: .8rem; color: #c53030; background: #fff5f5; padding: 8px 10px; border-radius: 4px; margin: 4px 0; }

.section-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #444; margin: 16px 0 8px; }

.stock-rows, .part-rows { display: flex; flex-direction: column; gap: 6px; }
.stock-row, .part-row { display: flex; gap: 4px; align-items: flex-start; }
.stock-fields, .part-fields { display: flex; gap: 4px; flex: 1; min-width: 0; flex-wrap: wrap; }

.sf, .pf { display: block; min-width: 0; flex: 1; }
.sf span, .pf span { display: block; margin: 0 0 2px; font-size: 11px; font-weight: 600; color: #52606d; }
.sf input, .pf input[type="text"] { width: 100%; box-sizing: border-box; font-size: .85rem; padding: 7px 8px; border: 1px solid #ccc; border-radius: 4px; }
.sf input:focus, .pf input[type="text"]:focus { border-color: #2b6cb0; outline: none; box-shadow: 0 0 0 2px rgba(43,108,176,.15); }
.sf-qty { max-width: 56px; }
.pf-qty { max-width: 56px; }
.pf-grain { max-width: 44px; display: flex; flex-direction: column; align-items: center; }
.pf-grain input { width: 16px; height: 16px; margin-top: 4px; }

.row-remove { background: none; border: none; font-size: 1.2rem; color: #999; cursor: pointer; padding: 6px 4px; line-height: 1; margin-top: 15px; }
.row-remove:hover { color: #c00; }

.add-row { font-size: .8rem; color: #2b6cb0; text-decoration: none; display: inline-block; margin: 4px 0 12px; }
.add-row:hover { text-decoration: underline; }
.add-row-group { display: flex; gap: 16px; }
.paste-link { color: #666; }

.paste-area { margin: 0 0 12px; }
.paste-area textarea { width: 100%; box-sizing: border-box; font-size: .8rem; padding: 8px; border: 1px solid #ccc; border-radius: 4px; resize: vertical; font-family: monospace; }
.paste-btn { font-size: .8rem; padding: 6px 14px; background: #f0f4f8; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; margin-top: 4px; }
.paste-btn:hover { background: #e2e8f0; }

.options { border-top: 1px solid #eee; padding-top: 12px; margin-top: 4px; }
.ctrl { margin-bottom: 10px; }
.ctrl label { display: block; font-size: .75rem; font-weight: 600; margin-bottom: 3px; color: #333; }
.ctrl input[type="text"] { font-size: .85rem; padding: 7px 8px; border: 1px solid #ccc; border-radius: 4px; width: 100%; box-sizing: border-box; }
.ctrl input[type="text"]:focus { border-color: #2b6cb0; outline: none; box-shadow: 0 0 0 2px rgba(43,108,176,.15); }
.ctrl-row { display: flex; gap: 12px; }
.ctrl-row .ctrl { flex: 1; }

.unit-toggle { display: flex; border: 1px solid #ccc; border-radius: 4px; overflow: hidden; }
.unit-btn { flex: 1; padding: 7px; font-size: .8rem; font-weight: 500; border: none; background: #fff; cursor: pointer; color: #333; transition: background .15s, color .15s; }
.unit-btn:first-child { border-right: 1px solid #ccc; }
.unit-btn.active { background: #2b6cb0; color: #fff; }

a.dl,
a.dl-again { display: inline-block; padding: 12px 28px; background: #2b6cb0; color: #fff; border-radius: 6px; text-decoration: none; font-weight: 600; font-size: 1rem; text-align: center; }
a.dl:hover { background: #2456a0; }
a.dl-again { background: #f5f5f5; color: #333; font-size: .85rem; padding: 8px 18px; }
a.dl-again:hover { background: #eee; }

#buy { display: block; text-align: center; width: 100%; box-sizing: border-box; margin-top: 16px; }
#buy.inert { opacity: .4; cursor: default; }

.order { max-width: 480px; margin: 40px auto; text-align: center; }
.order h1 { font-size: 1.5rem; }
.order-stat { font-size: 1.1rem; color: #2b6cb0; font-weight: 600; margin: 8px 0 20px; }
.order .dl, .order .dl-again { display: block; width: max-content; max-width: 100%; box-sizing: border-box; margin: 0 auto 12px; }
.new-plan { display: inline-block; color: #2b6cb0; font-size: .85rem; text-decoration: none; margin-top: 8px; }
.new-plan:hover { text-decoration: underline; }
.sent { font-size: .85rem; color: #666; margin-top: 20px; }

.cl-pay { max-width: 1060px; margin: 0 auto; padding: 0 16px 40px; }
.cl-back { font-size: .85rem; color: #2b6cb0; text-decoration: none; display: inline-block; margin: 16px 0 12px; }
.cl-back:hover { text-decoration: underline; }
.pay-grid { display: flex; gap: 24px; align-items: flex-start; }
.pay-art { flex: 1; min-width: 0; }
.pay-art h1 { font-size: 1.5rem; font-weight: 700; margin: 0 0 12px; }
#pay-preview svg { width: 100%; height: auto; display: block; margin-bottom: 12px; }
#pay-stats .stat { display: inline-block; margin-right: 16px; }

.pay-box { flex: 0 0 380px; }
.pay-price { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.pay-price span { font-size: .95rem; color: #333; }
.pay-price b { font-size: 1.5rem; font-weight: 700; }
.pay-mail { font-size: .8rem; color: #666; margin: 4px 0 0; }

.foot { border-top: 1px solid #eee; padding: 24px 16px; margin-top: 32px; }
.foot .wrap { max-width: 1060px; margin: 0 auto; }
.foot .links { font-size: .8rem; display: flex; gap: 16px; }
.foot .links a { color: #666; text-decoration: none; }
.foot .links a:hover { text-decoration: underline; }

@media (min-width: 861px) {
  .stock-row + .stock-row .sf span,
  .part-row + .part-row .pf span { display: none; }
  .stock-row + .stock-row .row-remove,
  .part-row + .part-row .row-remove { margin-top: 0; }
}

@media (max-width: 860px) {
  .studio { display: flex; flex-direction: column; }
  .studio .panel { order: 1; width: 100%; }
  .studio .result { order: 2; position: static; width: 100%; }
  #buy { order: 3; width: 100%; box-sizing: border-box; }
  .pay-grid { flex-direction: column; }
  .pay-art { width: 100%; }
  .pay-box { flex: none; width: 100%; }
}

@media (max-width: 500px) {
  .stock-fields { flex-wrap: wrap; }
  .part-fields { flex-wrap: wrap; }
  .sf { min-width: calc(50% - 4px); }
  .pf { min-width: calc(33% - 4px); }
  .part-fields > .pf:first-child { flex: 1 0 100%; }
  .pf-grain { min-width: auto; max-width: none; flex-direction: row; gap: 6px; align-items: center; }
  .pf-grain input { margin-top: 0; }
  .part-row .row-remove { align-self: flex-end; margin-top: 0; margin-bottom: 4px; }
}
