:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --accent: #d6402b; --accent-soft: #fdecea; --ok: #1f8a4c; --err: #b42318;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171c; --card: #1d2128; --text: #e8eaee; --muted: #9aa1ad; --line: #2e333c; --accent-soft: #3a211e; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
.top { padding: 32px 0 8px; }
h1 { font-size: clamp(22px, 4vw, 30px); line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 0 0 12px; }
.lead { color: var(--muted); margin: 0 0 16px; }
.muted { color: var(--muted); } .small { font-size: 14px; }

.drop { display: block; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--card);
  padding: 32px 16px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; margin: 8px 0 16px; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { color: var(--accent); }
.drop-title { font-weight: 600; margin-top: 6px; }
.drop-hint { color: var(--muted); font-size: 14px; margin-top: 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.album-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.album-name { font-weight: 600; word-break: break-word; }
.album-meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.album-price { font-size: 22px; font-weight: 700; white-space: nowrap; }
.remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px 0; }
.remove:hover { color: var(--err); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.progress { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-top: 12px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.err { color: var(--err); margin-top: 8px; }

.same { margin: 0 0 12px; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px; margin-top: 14px; }
.opt-wide { grid-column: 1 / -1; }
.opt-label { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 15px; background: var(--card); }
.seg input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; margin: 4px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.stepper { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 40px; border: none; background: var(--bg); color: var(--text); font-size: 18px; cursor: pointer; }
.stepper input { width: 64px; border: none; text-align: center; font-size: 16px; background: var(--card); color: var(--text); -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

details.breakdown { margin-top: 12px; }
details.breakdown summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.table td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table td.n { text-align: right; white-space: nowrap; }
.table-scroll { overflow-x: auto; }

.radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.pill input { accent-color: var(--accent); }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 16px 0; }
.totals dt { color: var(--muted); } .totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand { font-size: 24px; font-weight: 700; color: var(--text); }
.btn { background: var(--accent); color: #fff; border: none; border-radius: 12px; padding: 12px 22px; font-size: 16px; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 520px) { .table { font-size: 13px; } .table td.q { white-space: normal; color: var(--muted); } .card { padding: 14px; } }

.notice { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; }
.order-form { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 12px; max-width: 520px; }
.order-form h2 { margin-bottom: 0; }
.field { display: grid; gap: 4px; }
.field span { font-size: 14px; color: var(--muted); }
.field input, .field textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); width: 100%; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field.bad input { border-color: var(--err); }
.btn-ghost { background: none; color: var(--accent); border: 1px solid var(--accent); }
[hidden] { display: none !important; }
.over { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); display: grid; gap: 6px; }
.over-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.over .check { flex-wrap: wrap; }
.stepper-sm button { width: 32px; font-size: 16px; }
.stepper-sm input { width: 48px; font-size: 15px; }
.card-actions { display: flex; gap: 18px; flex-wrap: wrap; }
.remove.copy { color: var(--accent); }
.comment-field { margin: 0 0 14px; max-width: 520px; }
/* Тест для производства: суммы скрыты (HIDE_PRICES=1 в настройках сервера) */
.no-prices .album-price, .no-prices #totals, .no-prices #delivery-note { display: none !important; }

/* Режим производства: без цен и данных клиента, только номер заказа и Excel */
.prod .client-only { display: none !important; }
body:not(.prod) .prod-only { display: none !important; }

/* Режим менеджера */
body:not(.mgr) .mgr-only { display: none !important; }
.mgr .client-only { display: none !important; }
.mgr-bar { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin: 0 0 12px; font-size: 15px; }
.link { background: none; border: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.mgr-form { display: grid; gap: 12px; max-width: 620px; margin: 0 0 14px; }
.mgr-form select { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.num { font: inherit; width: 110px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); }
.save-state { margin-left: 12px; }
.task-res { margin-top: 14px; word-break: break-all; }
.hist { display: grid; gap: 2px; }
.hist a { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 8px; border-radius: 10px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); }
.hist a:hover { background: var(--bg); }
.hist .h-main { font-weight: 600; } .hist .h-sum { text-align: right; font-weight: 600; white-space: nowrap; }
.hist .h-meta { color: var(--muted); font-size: 13px; grid-column: 1 / -1; }
.manual { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; font-size: 14px; }
.album-price s { color: var(--muted); font-size: 15px; font-weight: 400; margin-right: 6px; }
.lines { margin-top: 10px; }
.lines .table td:first-child { width: 55%; }

/* Шаблоны цен */
.pgroup { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 14px 0 0; }
.pgroup legend { font-weight: 600; padding: 0 6px; }
.pgroup p { margin: 0 0 8px; }
.pairs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 20px; }
.pairs label { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ptable th { font-weight: 500; font-size: 13px; color: var(--muted); text-align: left; padding: 4px; }
.ptable td { padding: 4px; }
.tpl-actions { margin-top: 12px; }
.grow { flex: 1; min-width: 220px; }
.grow select { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); width: 100%; }
.danger { color: var(--err); border-color: var(--err); }
.sticky-save { position: sticky; bottom: 0; background: var(--card); padding: 12px 0 4px; margin-top: 12px; }
.num:disabled { opacity: .75; }
.field .num, .manual .num { width: 110px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
