/* «Чертёж»: синий лист в клетку, пунктирные рамки, моноширинные подписи, оранжевые цены и кнопки. */
:root {
  --bg: #0D2B5E;
  --grid: rgba(255, 255, 255, 0.06);
  --sheet: rgba(13, 43, 94, 0.88);
  --field: #0B2350;
  --line: #5A7BC0;
  --line-soft: #36579A;
  --text: #EEF3FF;
  --soft: #C3D2EE;
  --muted: #A8BCE3;
  --accent: #FF8A2B;
  --accent-ink: #1A0E00;
  --accent-soft: rgba(255, 138, 43, 0.14);
  --done: #7BE0B3;
  --work: #9DB8FF;
  --danger: #FF9A9A;
  --head: "Tektur", "Fira Sans", system-ui, sans-serif;
  --body: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Fira Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; color: var(--text); font: 15px/1.45 var(--body); -webkit-text-size-adjust: 100%; }
html { background: var(--bg); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 20px 20px;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--head); margin: 0; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; }
h2 { font-size: 17px; font-weight: 500; }
h3 { font-size: 16px; font-weight: 500; }
p { margin: 0; }
.muted { color: var(--muted); }
.soft { color: var(--soft); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); letter-spacing: .04em; }
.label { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.accent { color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.screen { display: flex; flex-direction: column; flex: 1; animation: in .18s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.section { padding: 0 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 8px; }
.stack.loose { gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.grow { flex: 1; min-width: 0; }

/* --- шапки --- */
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; }
.brand .name { flex: 1; font-family: var(--head); font-weight: 500; font-size: 15px; letter-spacing: .02em; }
.top { display: flex; align-items: center; gap: 6px; padding: 12px 12px 6px; position: sticky; top: 0; z-index: 5; background: linear-gradient(var(--bg) 72%, rgba(13, 43, 94, 0)); }
.top h1 { font-size: 21px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .label { padding-right: 8px; }
.icon-btn { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 0; background: transparent; color: var(--text); text-decoration: none; position: relative; }
.icon-btn.framed { border: 1px solid var(--line); }
.icon-btn:active { background: rgba(255, 255, 255, .06); }
.icon-btn .count { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font: 500 12px/20px var(--mono); text-align: center; }
.icon-btn .dot { position: absolute; top: -4px; right: -4px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }

/* --- кнопки --- */
.btn { display: flex; width: 100%; min-height: 52px; padding: 0 18px; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 16px; text-decoration: none; text-align: center; transition: transform .08s, opacity .15s; }
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); min-height: 48px; font-size: 15px; }
.btn.quiet { background: transparent; color: var(--muted); min-height: 44px; font-size: 14px; font-weight: 500; }
.btn.danger { background: transparent; color: var(--danger); border-color: #6A3B52; min-height: 46px; font-size: 15px; }
.btn.small { min-height: 40px; font-size: 14px; width: auto; padding: 0 14px; }
.btn.added { background: transparent; color: var(--accent); border-color: var(--accent); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: 500 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }

/* --- листы и карточки --- */
.sheet, .card { background: var(--sheet); border: 1px dashed var(--line); border-radius: 12px; }
.card { padding: 14px; display: flex; flex-direction: column; gap: 6px; color: var(--text); text-decoration: none; }
a.card:active, button.card:active { border-style: solid; }
button.card { text-align: left; width: 100%; font: inherit; }
.card.attn { border-color: var(--accent); border-style: solid; }
.card .title { font-size: 15px; font-weight: 600; }
.meta { font: 11px/1.4 var(--mono); letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
.price { font-family: var(--head); font-weight: 700; font-size: 18px; color: var(--accent); white-space: nowrap; }
.price .per { font: 400 11px var(--mono); color: var(--muted); }
.price.big { font-size: 30px; }
.price.plain { color: var(--text); }
.strike { text-decoration: line-through; color: var(--muted); font-size: 14px; }

/* список услуг на листе с пунктирными разделителями */
.list { display: flex; flex-direction: column; }
.list > * + * { border-top: 1px dashed var(--line-soft); }
.lrow { display: flex; gap: 12px; align-items: center; padding: 12px 14px; color: var(--text); text-decoration: none; }
.lrow .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lrow .t { font-size: 15px; font-weight: 600; }

.pic { width: 40px; height: 40px; flex: none; border: 1px dashed var(--line); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--text); }

/* --- главная --- */
.drawing { height: 150px; border: 1px dashed var(--line); border-radius: 14px; background: rgba(13, 43, 94, .7); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.drawing svg { width: 100%; max-width: 320px; height: auto; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.steps > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.steps .n { font: 11px var(--mono); color: var(--accent); letter-spacing: .06em; }
.steps .t { font-size: 14px; font-weight: 600; }
.steps .d { font-size: 12px; color: var(--muted); }

.studio { display: flex; align-items: center; gap: 10px; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; color: var(--soft); text-decoration: none; font-size: 13px; }
.studio .go { font: 12px var(--mono); color: var(--accent); }
.foot { margin-top: auto; padding: 8px 20px 24px; }

/* --- баннеры --- */
.banner { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--soft); background: var(--sheet); }
.banner.warn { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.banner.ok { border-color: var(--done); color: var(--text); }
.banner.dev { margin: 0 20px 14px; }

/* --- количество --- */
.qty-ctl { display: inline-flex; align-items: center; gap: 6px; }
.qbtn { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 20px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.qbtn:active { background: rgba(255, 255, 255, .06); }
.qty-ctl input.qty { width: 56px; flex: none; height: 40px; padding: 0 4px; text-align: center; font: 500 16px var(--mono); border-radius: 8px; }

/* --- поля --- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .field > .flabel { font: 12px var(--mono); letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.field .req { color: var(--accent); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .hint.ok { color: var(--done); font-family: var(--mono); letter-spacing: .03em; text-transform: uppercase; }
.field .err { display: none; font-size: 13px; color: var(--danger); }
.field.invalid .err { display: block; }
.field.invalid input, .field.invalid textarea { border-color: #A2505F; }
input[type="text"], input[type="url"], textarea, select { width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 16px; color: var(--text); outline: none; transition: border-color .15s; }
textarea { min-height: 110px; resize: vertical; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: #6E86B8; }
input:focus, textarea:focus { border-color: var(--accent); }
.promo-row { display: flex; gap: 8px; }
.promo-row input { flex: 1; min-width: 0; font-family: var(--mono); }
.promo-row input:not(:placeholder-shown) { text-transform: uppercase; }
.promo-row .btn.small { min-height: 46px; flex: none; }

/* --- итог --- */
.totals { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; font: 13px var(--mono); color: var(--soft); }
.totals .line { display: flex; justify-content: space-between; gap: 12px; }
.totals .sum { display: flex; justify-content: space-between; align-items: baseline; padding-top: 4px; }
.totals .sum span:first-child { font: 600 16px var(--body); color: var(--text); }
.totals .disc { color: var(--accent); }

/* --- файлы --- */
.files { display: flex; flex-direction: column; gap: 8px; }
.file { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-soft); border-radius: 10px; padding: 8px 6px 8px 12px; background: var(--field); color: var(--text); text-decoration: none; }
.file .n { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .n > div { white-space: normal; }
.file .s { font: 11px var(--mono); color: var(--muted); white-space: nowrap; padding-right: 6px; }
.file.bad { border-color: #A2505F; }
.bar { height: 3px; border-radius: 2px; background: var(--line-soft); margin-top: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.drop { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border: 1px dashed var(--line); border-radius: 10px; background: transparent; color: var(--soft); font-size: 15px; width: 100%; }

/* --- статусы --- */
.chip { display: inline-flex; align-items: center; gap: 6px; font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; color: var(--soft); white-space: nowrap; }
.chip.details { border-color: var(--accent); color: var(--accent); }
.chip.work { border-color: var(--work); color: var(--work); }
.chip.done { border-color: var(--done); color: var(--done); }
.chip.off { color: var(--muted); border-color: var(--line-soft); }

.track { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.track span { display: flex; flex-direction: column; gap: 6px; font: 11px/1.25 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.track span::before { content: ""; height: 3px; border-radius: 2px; background: var(--line-soft); }
.track span.on { color: var(--text); }
.track span.on::before { background: var(--accent); }

.item { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.item .head { display: flex; gap: 12px; align-items: flex-start; }
.item .head .t { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; }
.result { display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--line-soft); padding-top: 10px; }
.quote { font-size: 14px; color: var(--soft); white-space: pre-wrap; border-left: 2px solid var(--line); padding-left: 10px; }
details.sent summary { cursor: pointer; font: 12px var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); list-style: none; }
details.sent summary::-webkit-details-marker { display: none; }
details.sent[open] summary { margin-bottom: 8px; }
dl.kv { margin: 0; display: flex; flex-direction: column; gap: 14px; }
dl.kv dt { font: 11px var(--mono); letter-spacing: .05em; color: var(--muted); text-transform: uppercase; }
dl.kv dd { margin: 2px 0 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { display: grid; grid-template-columns: 104px 1fr; gap: 10px; font-size: 13px; }
.timeline .when { font: 11px/1.6 var(--mono); color: var(--muted); white-space: nowrap; }
.timeline .note { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: pre-wrap; }

/* --- низ экрана --- */
.dock { position: sticky; bottom: 0; padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(13, 43, 94, 0), var(--bg) 26%); display: flex; flex-direction: column; gap: 8px; margin-top: auto; z-index: 4; }
.dock .note { text-align: center; font-size: 13px; color: var(--muted); }

.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 40px 24px; text-align: center; }
.center .btn { max-width: 320px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner.sm { width: 16px; height: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translate(-50%, -20px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; z-index: 50; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #FFD2D2; color: #3A0B12; }
.sheet-back { position: fixed; inset: 0; background: rgba(4, 12, 30, .6); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.sheet-back .sheet-box { width: 100%; max-width: 520px; background: var(--bg); border-top: 1px dashed var(--line); border-radius: 16px 16px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.sheet-back p { font-size: 15px; margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  .screen, .toast, .btn { animation: none; transition: none; }
}
