.main-col { display: flex; flex-direction: column; min-width: 0; }
select.lang { width: 152px; height: 28px; min-height: 28px; font-size: 12px; padding: 2px 8px; }

main { flex: 1; padding: 8px 16px 40px; }
.wrap { display: flex; flex-direction: column; gap: 14px; }
.wrap.narrow { max-width: 440px; margin: 0 auto; }

.card-title { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: var(--fs-h4); }
.card-intro { font-size: var(--fs-hint); color: var(--t-muted); margin-top: 4px; }

/* sidebar account chip */
.side-user { display: flex; flex-direction: column; gap: 3px; }
.side-user b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user span { font-size: 12px; color: var(--t-faint); }
.side-user .bal { color: var(--color-accent); font-weight: 600; }

/* auth */
.auth-tabs { display: flex; gap: 4px; }
.auth-tabs .btn { flex: 1; }
.auth-tabs .btn.on { color: var(--color-accent); border-color: var(--color-accent); background: var(--tint-accent-12); }
.fields { display: flex; flex-direction: column; gap: 10px; }
.field .hint { font-size: 11.5px; color: var(--t-faint); margin-top: 4px; }
/* an error is red, not the accent: in this palette the accent is what links and buttons wear */
.form-err { font-size: 13px; color: var(--color-red); min-height: 18px; }
[data-theme="dark"] .form-err, [data-theme="dark"] .status.err { color: var(--color-red); color: color-mix(in srgb, var(--color-red) 55%, var(--color-text)); }
.auth-note { font-size: 12.5px; color: var(--t-muted); line-height: 1.6; }

/* generation — the drop zone and the file list are shared by all three uploads
   (Ф2, оферта, акт), so they are classes rather than ids */
.drop {
  position: relative; padding: 22px; text-align: center; cursor: pointer;
  border: 1px dashed var(--t-accent-border); border-radius: var(--radius-panel);
  transition: background .15s, border-color .15s;
}
.drop:hover, .drop.over { background: var(--tint-accent-10); border-color: var(--color-accent); }
.drop.over { border-style: solid; }
.drop .dz-title { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: var(--fs-h5); }
.drop .lbl { margin-top: 6px; }
.drop .btn { margin-top: 12px; }

.filelist { display: flex; flex-direction: column; gap: 7px; margin: 0; padding: 0; list-style: none; }
.filelist li {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--radius-control);
  background: var(--color-bg); border: 1px solid var(--color-divider);
}
.filelist .nm { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist .sz { font-size: 11.5px; color: var(--t-faint); }

.opts { display: flex; flex-direction: column; gap: 8px; }
/* an option's explanation sits under it, indented past the checkbox square */
.opt-hint { font-size: var(--fs-hint); color: var(--t-faint); padding-left: 24px; line-height: 1.55; }
/* what a checkbox switches on: stays visible but goes quiet while the box is off,
   so the reader sees what the option controls before turning it on */
.sub-opt { display: flex; flex-direction: column; gap: 7px; padding-left: 24px; }
.sub-opt.off, .check.off { opacity: .45; }
.sub-opt .input { max-width: 320px; }

/* section layout shared by оферта / акт / нархнома */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.party { display: grid; grid-template-columns: 1.5fr 1fr; gap: 9px; }
/* Ф3 requisites: typed once, remembered per account */
details.f3req { padding-left: 24px; }
details.f3req.off { opacity: .45; }
details.f3req > summary { cursor: pointer; font-size: 13.5px; color: var(--color-accent); padding: 2px 0; }
details.f3req .f3body { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.f3party { display: flex; flex-direction: column; gap: 8px; }
.f3party .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.f3party-title { font-weight: 600; font-size: 13.5px; color: var(--t-accent-body); }
.f3pick { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
.note { font-size: 12px; color: var(--t-faint); line-height: 1.6; }

.warn {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 12px; font-size: 13px;
}
.warn .body { flex: 1; min-width: 0; }

/* a block that only exists once the server answered: it owns the card's column gaps */
.panel { display: flex; flex-direction: column; gap: var(--space-4); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .tag b { margin-left: 6px; font-weight: 600; }
/* a chip holding a LIST (every quarter the books quote) has to wrap, or its single
   nowrap line drags a horizontal scrollbar across the whole page */
.chips .tag.wrap { white-space: normal; max-width: 100%; }

.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.toolbar .input { flex: 1; min-width: 150px; max-width: 320px; }
.toolbar .count { margin-left: auto; font-size: 12px; color: var(--t-faint); }

/* Decision and works grids: many columns, so they scroll inside .tablebox instead of
   forcing the page sideways on a phone. */
.grid-tbl { font-size: 12.5px; }
.grid-tbl.dec { min-width: 940px; }
.grid-tbl.akt { min-width: 900px; }
.grid-tbl td { vertical-align: middle; }
.grid-tbl .input { min-height: 30px; font-size: 12.5px; padding: 4px 7px; }
.grid-tbl select.input { max-width: 320px; }
.grid-tbl .num { text-align: right; white-space: nowrap; }
.grid-tbl .fin { text-align: right; white-space: nowrap; font-weight: 600; }
.grid-tbl .canon { display: block; font-size: 11px; color: var(--t-accent-body); }
.grid-tbl .nmcell { min-width: 220px; }
.grid-tbl .idx { color: var(--t-faint); white-space: nowrap; }

.pager { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 12.5px; color: var(--t-muted); }
.run { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.run .btn-go { height: 40px; padding: 0 20px; }
.run .quota { margin-left: auto; font-size: 12px; color: var(--t-faint); }

.status { font-size: var(--fs-hint); color: var(--t-muted); white-space: pre-wrap; }
.status.err { color: var(--color-red); }
.status:empty { display: none; }

.done {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  padding: 13px;
  border: 1px solid var(--t-accent-border); background: var(--t-accent-fill);
}
.done .msg { flex: 1; min-width: 180px; font-size: 13px; color: var(--t-accent-text); }

.limit { display: flex; flex-direction: column; gap: 9px; padding: 13px;
         border-radius: var(--radius-panel); background: var(--color-amber-soft); }
.limit .top { display: flex; align-items: flex-start; gap: 9px; }
.limit .body { font-size: 13px; }
.limit .acts { display: flex; gap: 8px; flex-wrap: wrap; padding-left: 28px; }

/* package */
.balance { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.balance .num { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 40px; line-height: 1; color: var(--color-accent); }
.balance .num small { font-size: 15px; color: var(--t-muted); margin-left: 6px; }
.balance .st { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--t-muted); }
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.tier {
  position: relative; padding: 12px; cursor: pointer; text-align: center;
  border: 1px solid var(--color-divider); border-radius: var(--radius-panel); background: transparent;
  color: var(--color-text); font: inherit;
}
.tier:hover { border-color: var(--t-accent-border); }
.tier b { display: block; font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 24px; }
.tier span { display: block; font-size: 12px; color: var(--t-muted); }
.tier .usd { color: var(--color-accent); font-size: 15px; font-weight: 600; margin-top: 4px; }
.custom { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.pending { display: flex; gap: 9px; align-items: flex-start; padding: 12px;
           border: 1px solid var(--t-accent-border); background: var(--t-accent-fill); font-size: 13px; color: var(--t-accent-text); }
.contact { font-size: 13px; color: var(--t-body); line-height: 1.7; }
.contact a { font-weight: 600; }
/* the waiting request carries its payment receipt: the state and the box to attach (or replace) one */
.pending .pn-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.pn-receipt { display: flex; flex-direction: column; gap: 7px; margin: 0; }
.pn-receipt .input.file { flex: 1; min-width: 200px; max-width: 360px; }
/* the native file box, dressed as a field: a receipt is one small file, no drop zone needed */
.input.file { padding: 5px 8px; font-size: 12.5px; color: var(--t-muted); cursor: pointer; }
/* the card to pay to: the number is what the customer retypes or copies, so it is the big thing */
.paycard { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--t-accent-border); border-radius: var(--radius-panel); }
.paycard .pc-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* never broken across two lines — a number read off the screen in halves is a number mistyped */
.paycard .pc-num { font-size: clamp(16px, 5.6vw, 24px); letter-spacing: .04em; white-space: nowrap; color: var(--color-accent); font-weight: 600; }
.paycard .pc-holder { font-size: 13.5px; color: var(--t-muted); }
.paycard .pc-holder b { color: var(--color-text); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }

/* devices */
.dev-form { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 9px; align-items: end; }
.tablebox { overflow-x: auto; }
.table { font-size: 13px; }
.table td.mono, .table td.nw { white-space: nowrap; }
/* «№»: the row's place in the list — as narrow as its digits, never wrapped */
.table .col-n { width: 1%; white-space: nowrap; color: var(--t-faint); font-variant-numeric: tabular-nums; }
.table .sub { display: block; font-size: 11.5px; color: var(--t-faint); }
/* a whole cell in that quiet type stays a cell: as a block it lost its row line */
.table td.sub { display: table-cell; }
.table .pos { color: var(--color-accent); font-weight: 600; }
.table .neg { color: var(--t-muted); }
.empty { padding: 22px; text-align: center; border: 1px dashed var(--t-dim); font-size: 13px; color: var(--t-muted); }
.steps { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 20px; font-size: 13px; color: var(--t-body); }

/* account */
.prof { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* help view */
.help-grp { display: flex; flex-direction: column; gap: 7px; }
.help-grp ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.help-grp li { font-size: 13px; color: var(--t-body); }

.site-foot { text-align: center; font-size: 11.5px; color: var(--t-faint); line-height: 1.7; }

[hidden] { display: none !important; }

@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  select.lang { width: 130px; }
  main { padding: 6px 14px 32px; }
  .tiers { grid-template-columns: 1fr; }
  .custom, .prof, .dev-form, .grid2, .party, .f3party .grid3, .f3pick { grid-template-columns: 1fr; }
  details.f3req { padding-left: 0; }
  .toolbar .count { margin-left: 0; }
  .sub-opt, .opt-hint { padding-left: 0; }
  /* a plain table of five columns or more (the grids have their own widths) keeps a readable width and scrolls inside its .tablebox —
     squeezed into the screen, its last column wrapped one word to a line */
  .tablebox > .table:not(.grid-tbl):has(th:nth-child(5)) { min-width: 680px; }
}

/* ---- MVC frame: the language switch is a small form of its own in the topbar */
.lang-form { display: flex; align-items: center; gap: 6px; margin: 0; }

/* ---- the price-list cards are radio buttons: the radio itself is hidden, its card lights up */
.tier-radio { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.tier:has(.tier-radio:checked) { border-color: var(--color-accent); background: var(--tint-accent-12); box-shadow: 0 0 0 1px var(--color-accent) inset; }
.tier:has(.tier-radio:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ---- forms that sit inside a row of buttons (delete, drop) take no room of their own */
.done form, td form { display: inline; margin: 0; }

/* ---- the native file box: visible without a script; app.js swaps in the drop zone's list */
.drop input[type=file] { display: block; margin: 12px auto 0; max-width: 100%; font-size: 12.5px; color: var(--t-muted); }
.drop.enhanced input[type=file] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }

/* ---- long lists come a page at a time (Views/Shared/_Pager.cshtml). Links, not buttons: a page
   of a list is an address. A list low on its page links to its own heading (:target). */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; }
.pagination .btn { font-size: 13px; padding: 5px 11px; min-width: 34px; }
.pagination .btn.on { color: var(--color-accent); border-color: var(--color-accent); background: var(--tint-accent-12); }
.pagination span.btn { pointer-events: none; }
.pagination [aria-disabled] { opacity: .45; }
.pagination .gap { padding: 0 4px; color: var(--t-faint); }
.pagination .range { margin-left: 10px; font-size: 12px; color: var(--t-faint); white-space: nowrap; }
:target { scroll-margin-top: 14px; }

/* ---- present for the browser (a form's default button), invisible on the page */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
