/* Presentation layer for the portal's independent applications.
   Native invoice cards, calculator tables, PDF coordinates and form contracts stay intact. */
body.portal-layout {
  --section-border: var(--portal-line, #dfe6ef);
  --section-ink: var(--portal-ink, #1f3048);
  --section-muted: var(--portal-muted, #65758a);
  --section-soft: #f6f9fd;
  --section-accent: #315fa5;
  --section-shadow: 0 4px 18px #20385805;
}

/* Price search: a clear request, comparable offers and a distinct purchase total. */
body.portal-layout main:has(#price-search) .workspace { border: 1px solid var(--section-border); border-top: 3px solid #5c83c3; border-radius: 16px; box-shadow: var(--section-shadow); background: #fff; }
body.portal-layout main:has(#price-search) .workspace__heading h1 { font-size: clamp(27px, 2.5vw, 36px); letter-spacing: -.035em; }
body.portal-layout main:has(#price-search) .workspace__heading .lead { color: var(--section-muted); max-width: 750px; }
body.portal-layout main:has(#price-search) .updated { padding: 15px 18px; border: 1px solid #e4ebf4; background: var(--section-soft); border-radius: 10px; }
body.portal-layout main:has(#price-search) .request-form textarea { background: #fcfdff; border-color: #ccd9e9; }
body.portal-layout main:has(#price-search) .search-examples { border-top-color: #e6edf5; }
body.portal-layout main:has(#price-search) :is(.results, .latest-products) { border: 1px solid var(--section-border); border-radius: 16px; box-shadow: var(--section-shadow); background: #fff; }
body.portal-layout main:has(#price-search) :is(.results__heading, .latest-products__heading) { background: #fff; border-bottom-color: #e4ebf4; }
body.portal-layout main:has(#price-search) .results-summary strong { color: #245d49; font-size: 25px; letter-spacing: -.03em; }
body.portal-layout main:has(#price-search) .request-number { border-radius: 9px; background: #eaf1fc; color: #315fa5; }
body.portal-layout main:has(#price-search) .offer { background: #fff; border: 1px solid #dce5f0; border-radius: 12px; padding: 18px; box-shadow: 0 2px 8px #20385803; }
body.portal-layout main:has(#price-search) .offer__supplier { background: #edf3fd; color: #3a5c8b; border-radius: 6px; }
body.portal-layout main:has(#price-search) .offer__rank { background: #f1f5fa; color: #61748c; }
body.portal-layout main:has(#price-search) .offer__product strong { font-size: 15px; line-height: 1.5; color: #263e5a; }
body.portal-layout main:has(#price-search) .rate-grid > div { background: #f8fbfe; border-color: #e1e9f3; border-radius: 8px; }
body.portal-layout main:has(#price-search) .procurement { padding: 12px; border-radius: 9px; background: #edf7f1; border-color: #cce2d5; }
body.portal-layout main:has(#price-search) .procurement--unavailable { background: #fff8eb; border-color: #ebd8b6; }

/* Sales and driver lists keep their table structure and horizontal scrolling. */
body.portal-layout :is(.deals-heading, .drivers-heading) { padding: 4px 0 5px; }
body.portal-layout :is(.deals-heading, .drivers-heading) h1 { font-size: clamp(28px, 2.8vw, 37px); letter-spacing: -.035em; }
body.portal-layout :is(.deals-heading, .drivers-heading) .muted { max-width: 770px; line-height: 1.65; }
body.portal-layout :is(.deals-panel, .drivers-panel) { border: 1px solid var(--section-border); border-radius: 15px; box-shadow: var(--section-shadow); }
body.portal-layout .deal-metrics { gap: 12px; border: 0; background: transparent; }
body.portal-layout .deal-metrics article { min-width: 0; border: 1px solid var(--section-border); border-radius: 12px; background: #fff; padding: 20px; box-shadow: var(--section-shadow); }
body.portal-layout .deal-metrics article:last-child { background: #eff6ff; border: 1px solid #d6e4f7; }
body.portal-layout .deal-metrics strong { color: #2b486d; letter-spacing: -.03em; }
body.portal-layout :is(.deal-filters, .driver-filters) { background: var(--section-soft); border-bottom: 1px solid #e5ecf5; padding: 20px; }
body.portal-layout :is(.deals-panel, .drivers-panel) .list-caption { padding-top: 12px; }
body.portal-layout :is(.deal-table, .driver-table) th { background: #f8fafd; color: #60748e; font-size: 12px; letter-spacing: .01em; }
body.portal-layout :is(.deal-table, .driver-table) td { border-bottom-color: #e9eef5; }
body.portal-layout :is(.deal-table, .driver-table) tbody tr:hover { background: #f3f7fd; }
body.portal-layout :is(.deals-panel, .drivers-panel) .pagination { background: #fbfcfe; border-top: 1px solid #e9eef5; }
body.portal-layout :is(#deal-dialog, #driver-dialog) { border: 1px solid #d9e3f0; border-radius: 17px; box-shadow: 0 24px 100px #152b4a33; }
body.portal-layout :is(#deal-form, #driver-form) .dialog-heading { padding-bottom: 17px; border-bottom: 1px solid #e8edf5; }
body.portal-layout #driver-form .form-section { border-color: #dfe8f3; border-radius: 10px; }
body.portal-layout #deal-form .profit-preview { background: #eff6ff; border-color: #d5e3f5; border-radius: 11px; }

/* Call notebook: calm writing surface, larger editorial cards, visible saved state. */
body.portal-layout #main-content.calls-page { --call-accent: #3c6fba; --call-ink: #263d57; --call-muted: #64758a; --call-line: #dfe7f1; }
body.portal-layout #main-content.calls-page .note-panel { border-radius: 15px; border-color: #dbe6f3; box-shadow: var(--section-shadow); }
body.portal-layout #main-content.calls-page .note-heading label { font-size: 20px; letter-spacing: -.02em; }
body.portal-layout #main-content.calls-page .note-help { font-size: 14px; line-height: 1.65; }
body.portal-layout #main-content.calls-page #call-text { font-size: 16px; border-color: #d4dfed; background: repeating-linear-gradient(#fcfdff 0, #fcfdff 28px, #e7edf5 29px, #fcfdff 30px); }
body.portal-layout #main-content.calls-page #call-text:focus { border-color: #7399ce; box-shadow: 0 0 0 3px #5786c31a; }
body.portal-layout #main-content.calls-page .note-bottom { font-size: 12px; line-height: 1.5; }
body.portal-layout #main-content.calls-page .call-btn { border-radius: 9px; min-height: 44px; font-size: 13px; }
body.portal-layout #main-content.calls-page .wall-heading h2 { line-height: 1.1; }
body.portal-layout #main-content.calls-page :is(.wall-caption, .wall-source) { font-size: 13px; line-height: 1.7; }
body.portal-layout #main-content.calls-page .tattoo { border-radius: 13px; border-color: #1634520a; padding: 21px; min-height: 205px; box-shadow: 0 2px 8px #20385804; }
body.portal-layout #main-content.calls-page .tattoo h3 { font-size: 17px; line-height: 1.45; }
body.portal-layout #main-content.calls-page .tattoo p { font-size: 14px; line-height: 1.65; opacity: 1; }
body.portal-layout #main-content.calls-page .tattoo p > span { font-size: 10px; letter-spacing: .1em; }
body.portal-layout #main-content.calls-page .tone-0 { background: #f9eac0; color: #625025; }
body.portal-layout #main-content.calls-page .tone-1 { background: #d6eee5; color: #265e4c; }
body.portal-layout #main-content.calls-page .tone-2 { background: #e6e1f5; color: #554674; }
body.portal-layout #main-content.calls-page .tone-3 { background: #f6ddd0; color: #754c37; }
body.portal-layout #main-content.calls-page .tone-4 { background: #355e98; color: #fff; }
body.portal-layout #main-content.calls-page .tone-5 { background: #f1dfe9; color: #72445d; }

/* Documents, buyer invoices and passports: visual grouping, native row layouts. */
body.portal-layout :is(#ttn, #authority, #invoice, #sales-invoice, #history).panel { border: 1px solid var(--section-border); border-radius: 15px; box-shadow: var(--section-shadow); background: #fff; }
body.portal-layout :is(#ttn, #authority, #invoice, #sales-invoice) .panel__heading { padding-bottom: 18px; border-bottom: 1px solid #e5edf7; }
body.portal-layout #ttn .form-step { font-size: 15px; color: #405a7c; }
body.portal-layout #ttn .form-step span { border-radius: 8px; background: #eaf1fd; color: #315fa5; }
body.portal-layout .authority-company { background: #f7faff; border: 1px solid #dce7f5; border-left: 3px solid #6e93c8; border-radius: 10px; }
body.portal-layout .authority-section > legend { font-size: 17px; color: #334f70; }
body.portal-layout .authority-item { background: #fcfdff; border-color: #dfe8f4; border-radius: 10px; }
body.portal-layout #sales-invoice :is(.sales-toolbar, .sales-bottom) { gap: 16px; }
body.portal-layout #sales-invoice :is(.sales-buyer, .sales-paste, .sales-details) { border-color: #dce6f3; border-radius: 10px; background: #fafdff; }
body.portal-layout #sales-invoice .sales-totals article { border: 1px solid #e3eaf4; background: #f4f8fd; border-radius: 11px; padding: 17px; }
body.portal-layout #sales-invoice .sales-totals .sales-profit { background: #edf7f0; border-color: #d7e8dd; }
body.portal-layout #sales-invoice .sales-totals .sales-loss { background: #fff1ee; border-color: #eed9d4; }
body.portal-layout #sales-invoice .sales-history-row { padding: 19px 0; border-bottom-color: #e3ebf6; }
body.portal-layout .pc .pc-card { border-radius: 14px; border-color: #dfe7f2; box-shadow: var(--section-shadow); }
body.portal-layout .pc .pc-card-title { padding-bottom: 17px; border-bottom: 1px solid #e8eef6; }
body.portal-layout .pc .pc-step { background: #eaf2fd; color: #3c6298; border-radius: 10px; }
body.portal-layout .pc .pc-card-title p { font-size: 13px; }
body.portal-layout .pc .pc-preview-panel { border-color: #d9e4f2; box-shadow: var(--section-shadow); }
body.portal-layout .pc .pc-certificate { background: #fcfdff; border-color: #dfe8f4; }

/* Calculator result surfaces retain the application's number and table geometry. */
body.portal-layout #metal-calculator :is(.mc-workspace, .mc-family-card, .mc-list) { border-color: #dce6f3; border-radius: 14px; box-shadow: var(--section-shadow); }
body.portal-layout #metal-calculator .mc-family-card { background: #fff; }
body.portal-layout #metal-calculator .mc-card-title h2 { letter-spacing: -.015em; color: #2e4869; }
body.portal-layout #metal-calculator .mc-step { border-radius: 7px; color: #486d9b; background: #edf3fc; }
body.portal-layout #metal-calculator .mc-categories { border: 1px solid #dce6f2; background: #eaf0f8; border-radius: 10px; }
body.portal-layout #metal-calculator .mc-value-field { background: #f7faff; border-color: #dce7f6; border-radius: 11px; }
body.portal-layout #metal-calculator .mc-value-field.mc-source { background: #edf5ff; border-color: #80a7dc; }
body.portal-layout #metal-calculator .mc-result { padding: 17px; border: 1px solid #dbe7f7; background: #eef5ff; border-radius: 10px; }
body.portal-layout #metal-calculator .mc-reference { background: #fafcff; border-color: #e0e8f3; border-radius: 11px; }
body.portal-layout #transport-calculator .tc-workspace > .panel { margin-top: 8px; background: #fff; border-color: #dce6f3; border-radius: 14px; box-shadow: var(--section-shadow); }
body.portal-layout #transport-calculator .tc-result-main { border: 1px solid #d2e3f5; background: #edf5ff; border-radius: 11px; padding: 20px; }
body.portal-layout #transport-calculator .tc-result-main strong { letter-spacing: -.035em; color: #254f7e; }
body.portal-layout #transport-calculator .tc-vehicle-option { border-radius: 9px; }
body.portal-layout #transport-calculator .tc-vehicle-option[aria-pressed="true"] { color: #28568f; background: #edf4ff; border-color: #8daedc; }

/* PDF editor: chrome only. Do not change paper, canvas, zoom stage or coordinates. */
body.portal-layout .pe :is(.pe-upload, .pe-filebar, .pe-sidebar, .pe-bottom) { border-color: #dce5ee; }
body.portal-layout .pe .pe-upload { background: #fff; border-color: #b8cce6; border-radius: 15px; box-shadow: var(--section-shadow); }
body.portal-layout .pe .pe-filebar { background: #fff; border-radius: 13px 13px 0 0; }
body.portal-layout .pe .pe-toolbar { background: #f5f8fc; border-color: #dce5ee; }
body.portal-layout .pe .pe-sidebar { background: #fbfcfe; }
body.portal-layout .pe .pe-tip { background: #f2f6fb; border-top-color: #dce5ee; color: #5c718d; }
body.portal-layout .pe .pe-bottom { border-radius: 0 0 13px 13px; }
body.portal-layout .pe .pe-archive-notice { background: #f1f6fd; border-color: #dbe6f6; color: #536e90; }
body.portal-layout .pe .pe-element { border-radius: 7px; }
body.portal-layout .pe .pe-element:has(input:checked) { background: #eaf3ff; border-color: #bbd2ef; }
body.portal-layout .pa :is(.pa-file, .pa-summary) { border-color: #dfe7f3; box-shadow: var(--section-shadow); }
body.portal-layout .pa .pa-file { border-radius: 13px; }

/* Competitor documents and invoice correction. */
body.portal-layout :is(.mtt-workspace, .mtt-result-head, .mtt-editor, .mtt-previews, .mtt-documents, .mtt-products, .mtt-email) { border-color: #dfe7f3; border-radius: 15px; box-shadow: var(--section-shadow); }
body.portal-layout .mtt-heading h1 { font-size: clamp(28px, 2.7vw, 38px); letter-spacing: -.035em; }
body.portal-layout .mtt-status { border-radius: 9px; background: #eff8f3; border-color: #d2e7db; }
body.portal-layout .mtt-dropzone { background: #f8fbff; border-color: #bbcee8; border-radius: 12px; }
body.portal-layout .mtt-send-panel { background: #f4f8fe; border-color: #dbe6f6; border-radius: 12px; }
body.portal-layout .mtt-file-icon { background: #456d9f; border-radius: 9px; }
body.portal-layout .mtt-summary article { background: #2e4767; border-radius: 12px; }
body.portal-layout .mtt-summary article:nth-child(2) { background: #376f63; }
body.portal-layout .mtt-summary article:nth-child(3) { background: #81704b; }
body.portal-layout :is(.mtt-editor-toolbar, .mtt-preview-card) { border-color: #dfe7f2; background: #f8faff; }
body.portal-layout .mtt-document { border-color: #dce6f3; border-radius: 12px; }
body.portal-layout .city-signatures { border-color: #dfe7f2; border-radius: 15px; box-shadow: var(--section-shadow); }
body.portal-layout .city-signatures .signature-table-scroll { border-color: #dce6f1; border-radius: 10px; }
body.portal-layout .process-card { background: #fff; border-color: #dbe6f3; border-radius: 15px; box-shadow: var(--section-shadow); }
body.portal-layout .process-card .file-input { background: #f8fbff; border-color: #b9cde7; border-radius: 12px; }
body.portal-layout :is(.flow-card, .history-card, .feedback-card, .result-card) { background: #fff; border-color: #dfe7f3; border-radius: 15px; box-shadow: var(--section-shadow); }
body.portal-layout .flow-card .flow li { border-bottom-color: #e7eef6; }
body.portal-layout .result-copy .totals > div:not(.totals__arrow) { border-color: #dfe7f2; background: #f6f9fd; border-radius: 10px; }

/* Order confirmation has its own namespace and native interactive cargo drawing. */
body.portal-layout #main-content[data-base="/mtt/orders"] { --green: #315fa5; --pale: #edf4ff; --line: #dfe6ef; --ink: #243d5c; --muted: #65758a; }
body.portal-layout #main-content[data-base="/mtt/orders"] .page-title h1 { font-size: clamp(28px, 2.8vw, 38px); line-height: 1.2; letter-spacing: -.035em; }
body.portal-layout #main-content[data-base="/mtt/orders"] .page-title p { font-size: 15px; line-height: 1.65; }
body.portal-layout #main-content[data-base="/mtt/orders"] .card { border-color: #dfe7f3; border-radius: 15px; background: #fff; box-shadow: var(--section-shadow); }
body.portal-layout #main-content[data-base="/mtt/orders"] .steps { display: flex; list-style: none; gap: 12px; padding: 14px; border: 1px solid #dfe8f5; border-radius: 12px; background: #f8fbff; }
body.portal-layout #main-content[data-base="/mtt/orders"] .steps li { display: flex; flex: 1 1 0; min-width: 0; font-size: 13px; line-height: 1.5; }
body.portal-layout #main-content[data-base="/mtt/orders"] .steps b { flex-shrink: 0; border-radius: 8px; }
body.portal-layout #main-content[data-base="/mtt/orders"] .drop-zone { border-color: #b6cae7; background: #f8fbff; border-radius: 12px; }
body.portal-layout #main-content[data-base="/mtt/orders"] .drop-zone > div { min-width: 0; }
body.portal-layout #main-content[data-base="/mtt/orders"] :is(.fineprint, .field-hint, .quiet-box) { font-size: 13px; line-height: 1.6; }
body.portal-layout #main-content[data-base="/mtt/orders"] .quiet-box { background: #f4f8fd; border: 1px solid #e0e9f6; border-radius: 10px; }
body.portal-layout #main-content[data-base="/mtt/orders"] .cargo-preview { background: #f5f9fe; border-color: #dbe6f4; }
body.portal-layout #main-content[data-base="/mtt/orders"] .action-bar { border-color: #cfdef3; background: #edf4ff; border-radius: 13px; }
body.portal-layout #main-content[data-base="/mtt/orders"] :is(.email-subject-row, .table-scroll) { border-color: #dce6f3; background: #f6f9fe; }
body.portal-layout #main-content[data-base="/mtt/orders"] .history-list a { border-color: #dfe7f3; border-radius: 12px; box-shadow: var(--section-shadow); }

/* Sports share calmer surfaces, legible statuses and explicit filter grouping. */
body.portal-layout :is(.cs2-results, .cs2-sidebar, .summary-sidebar, .summary-statistics, .tt-section, .ufc-section) { border-color: #dde6f2; border-radius: 14px; background: #fff; box-shadow: var(--section-shadow); }
body.portal-layout :is(.cs2-heading, .summary-heading) h1 { letter-spacing: -.035em; }
body.portal-layout .cs2-filter-panel > summary { color: #294a70; }
body.portal-layout .cs2-filters { background: #fbfcff; }
body.portal-layout .cs2-match-card { border-color: #dce6f3; border-radius: 13px; background: #fff; box-shadow: var(--section-shadow); }
body.portal-layout .cs2-match-card-head { background: #f8fafd; border-bottom-color: #e7edf6; color: #526d8e; }
body.portal-layout .cs2-match-card-footer { background: #fcfdff; border-top-color: #e7edf6; }
body.portal-layout .cs2-team-symbol { background: #edf3fb; border: 1px solid #e0e9f5; border-radius: 9px; }
body.portal-layout .ec-gbox { border-color: #e0e7f1; border-radius: 9px; }
body.portal-layout .ec-ghead { background: #f3f7fd; border-bottom-color: #e0e8f4; color: #526c8d; }
body.portal-layout .summary-collectors { border-color: #dde7f3; border-radius: 13px; }
body.portal-layout .summary-statistics-group { background: #f8faff; border-color: #e1e9f5; border-radius: 11px; }
body.portal-layout .summary-game-settings[open] > summary { box-shadow: inset 3px 0 var(--game-color, #315fa5); }
body.portal-layout .tt-live-status { box-shadow: var(--section-shadow); }

/* VPN keeps warning/critical colors and all infrastructure actions explicit. */
body.portal-layout .vpn-page .card { border-color: #dde7f3; border-radius: 15px; box-shadow: var(--section-shadow); }
body.portal-layout .vpn-page .gauge { border-color: #e0e8f4; border-radius: 11px; background: #f6f9fd; }
body.portal-layout .vpn-page .gauge .val { letter-spacing: -.025em; }
body.portal-layout .vpn-page .add-form { background: #f6f9fe; border: 1px solid #e3ebf6; border-radius: 11px; }
body.portal-layout .vpn-page .nodes .node { border-radius: 10px; }
body.portal-layout .vpn-page .nodes .node.active { box-shadow: inset 0 0 0 1px #43846525; }

@media (min-width: 761px) {
  body.portal-layout main:has(#price-search) .request-item { padding-top: 26px; padding-bottom: 30px; }
  body.portal-layout #main-content.calls-page .tattoo-grid { gap: 15px; }
  body.portal-layout #sales-invoice .sales-toolbar { margin-bottom: 17px; }
  body.portal-layout #sales-invoice .sales-bottom { margin-top: 17px; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .upload-card { padding: 28px; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .editor-columns { gap: 20px; }
}

/* The legacy business breakpoint stacks this grid; reset the send panel's
   desktop placement so it cannot create an unintended second column. */
@media (min-width: 981px) and (max-width: 1300px) {
  body.portal-layout .mtt-upload .mtt-send-panel { grid-column: 1; grid-row: auto; }
}

@media (max-width: 760px) {
  /* Separate daily and weekly source schedules without compressing metric rows. */
  body.portal-layout main:has(#price-search) .stats article:has(> small) { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 6px; }
  body.portal-layout main:has(#price-search) .stats article:has(> small) > :is(span, strong, small) { min-width: 0; max-width: 100%; margin: 0; white-space: normal; overflow-wrap: anywhere; }
  body.portal-layout main:has(#price-search) .stats article:has(> small) > strong { font-size: 16px; line-height: 1.5; }
  body.portal-layout main:has(#price-search) .stats article:has(> small) > small { color: var(--section-muted); font-size: 13px; line-height: 1.55; }

  /* Price search: keep complete supplier names, descriptions and amounts visible. */
  body.portal-layout .request-form__actions { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout .request-form__actions .form-note { grid-column: auto; }
  body.portal-layout .search-examples { align-items: stretch; }
  body.portal-layout .search-examples button { white-space: normal; text-align: left; }
  body.portal-layout .latest-products__heading,
  body.portal-layout .results__heading { flex-wrap: wrap; gap: 10px; }
  body.portal-layout .latest-products__heading > p,
  body.portal-layout .results__heading > p,
  body.portal-layout .results-summary,
  body.portal-layout .results-summary > p { min-width: 0; max-width: 100%; text-align: left; }
  body.portal-layout .latest-product { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  body.portal-layout .latest-product > * { grid-column: 1; min-width: 0; }
  body.portal-layout .latest-product__price { text-align: left; white-space: normal; }
  body.portal-layout .latest-product__description :is(strong, span),
  body.portal-layout .offer__supplier,
  body.portal-layout .offer__product span { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  body.portal-layout .request-item__title > div { min-width: 0; }
  body.portal-layout .request-item__title h3 { overflow-wrap: anywhere; }
  body.portal-layout .offers,
  body.portal-layout .more-offers,
  body.portal-layout .no-offer,
  body.portal-layout .geography-note { margin-left: 0; }
  body.portal-layout .offer { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  body.portal-layout .offer > * { grid-column: auto; min-width: 0; }
  body.portal-layout .offer__availability,
  body.portal-layout .offer__price { border-top: 1px solid #dfe7ee; padding-top: 12px; }
  body.portal-layout .offer__price .rate-grid strong,
  body.portal-layout .offer__price .procurement__total,
  body.portal-layout .weight-line b { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  body.portal-layout .offer__price a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }
  body.portal-layout .offer__place small,
  body.portal-layout .offer__product small,
  body.portal-layout .offer__price small { font-size: 12px; line-height: 1.55; }
  body.portal-layout .offer__availability > span,
  body.portal-layout .offer__price > span { font-size: 11px; }
  body.portal-layout .result-jump { gap: 10px; }
  body.portal-layout .result-jump a { max-width: min(300px, 82vw); white-space: normal; overflow-wrap: anywhere; }

  /* Sales and drivers retain scrollable tables with all columns. */
  body.portal-layout :is(.deals-heading, .drivers-heading) { flex-wrap: wrap; align-items: flex-start; }
  body.portal-layout :is(.deals-heading, .drivers-heading) > div { min-width: 0; }
  body.portal-layout :is(.deals-heading, .drivers-heading) h1 { overflow-wrap: anywhere; }
  body.portal-layout :is(.deals-page, .drivers-page) .list-caption { gap: 10px; flex-wrap: wrap; }
  body.portal-layout :is(.deals-page, .drivers-page) .pagination { flex-wrap: wrap; gap: 10px; }
  body.portal-layout :is(.deal-table, .driver-table) :is(.row-open, a[href^="tel:"]) { display: inline-flex; align-items: center; min-height: 44px; }
  body.portal-layout :is(#deal-dialog, #driver-dialog) { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }
  body.portal-layout :is(#deal-form, #driver-form) .dialog-heading { gap: 12px; align-items: flex-start; }
  body.portal-layout :is(#deal-form, #driver-form) .dialog-heading > div { min-width: 0; }
  body.portal-layout :is(#deal-form, #driver-form) .dialog-heading h2 { overflow-wrap: anywhere; }
  body.portal-layout :is(#deal-form, #driver-form) .dialog-heading > button { flex-shrink: 0; }
  body.portal-layout :is(#deal-form, #driver-form) .dialog-footer { flex-wrap: wrap; gap: 10px; }
  body.portal-layout :is(#deal-form, #driver-form) .dialog-footer > button { white-space: normal; }
  body.portal-layout #driver-form .form-section,
  body.portal-layout #driver-form .loading-section { min-width: 0; }
  body.portal-layout #deal-form #source-cells { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  body.portal-layout #deal-form #source-cells dd { margin-bottom: 10px; }

  /* Call notebook: readable body text and a clear saved-state line. */
  body.portal-layout #main-content.calls-page .calls-heading { flex-wrap: wrap; }
  body.portal-layout #main-content.calls-page .subheading,
  body.portal-layout #main-content.calls-page .note-help { font-size: 14px; line-height: 1.6; }
  body.portal-layout #main-content.calls-page #call-text { font-size: 16px; }
  body.portal-layout #main-content.calls-page .note-bottom { flex-wrap: wrap; font-size: 12px; }
  body.portal-layout #main-content.calls-page .call-btn { min-height: 44px; font-size: 14px; white-space: normal; }
  body.portal-layout #main-content.calls-page .history-entry { min-height: 44px; flex-wrap: wrap; }
  body.portal-layout #main-content.calls-page .history-entry strong { white-space: normal; overflow-wrap: anywhere; }
  body.portal-layout #main-content.calls-page .history-entry small { font-size: 12px; }
  body.portal-layout #main-content.calls-page .wall-caption,
  body.portal-layout #main-content.calls-page .wall-motto { font-size: 13px; }
  body.portal-layout #main-content.calls-page .tattoo h3 { font-size: 16px; line-height: 1.45; }
  body.portal-layout #main-content.calls-page .tattoo p { font-size: 14px; line-height: 1.6; opacity: 1; }
  body.portal-layout #main-content.calls-page .tattoo p > span { font-size: 11px; }

  /* Document forms: additional room for requisites, files and generated links. */
  body.portal-layout :is(.authority-grid, .authority-grid--three) { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout .authority-actions { gap: 12px; }
  body.portal-layout .authority-actions > button { width: 100%; }
  body.portal-layout .authority-lookup > .field { max-width: none; }
  body.portal-layout .authority-lookup > button { width: 100%; }
  body.portal-layout #authority-status a { margin-left: 0; padding: 10px 0; overflow-wrap: anywhere; }
  body.portal-layout .document-signing-option { align-items: flex-start; }
  body.portal-layout .document-signing-option input { margin-top: 3px; }
  body.portal-layout .upload-form { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout :is(.user-card__heading, .user-card__footer) { flex-wrap: wrap; }
  body.portal-layout .user-card__heading > div { min-width: 0; overflow-wrap: anywhere; }
  body.portal-layout .pc :is(.pc-heading p, .pc-card-title p, .pc-hint, .pc-company p) { overflow-wrap: anywhere; }
  body.portal-layout .pc .pc-card-title { flex-wrap: wrap; }
  body.portal-layout .pc .pc-actions { gap: 10px; flex-wrap: wrap; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  body.portal-layout .pc .pc-preview-heading { flex-wrap: wrap; }
  body.portal-layout .pc .pc-certificate-head { flex-wrap: wrap; }
  body.portal-layout .pc .pc-metric { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 44px; }

  /* Calculators: do not touch native result table/card or numeric input sizing. */
  body.portal-layout #metal-calculator .mc-workspace { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout #metal-calculator .mc-config { border-right: 0; border-bottom: 1px solid #e7ecf3; border-radius: 11px 11px 0 0; }
  body.portal-layout #metal-calculator .mc-converter { border-radius: 0 0 11px 11px; }
  body.portal-layout #metal-calculator .mc-heading { flex-wrap: wrap; }
  body.portal-layout #metal-calculator .mc-categories { width: 100%; flex-wrap: wrap; }
  body.portal-layout #metal-calculator .mc-category { flex: 1 1 auto; min-height: 44px; font-size: 14px; padding: 9px 10px; white-space: normal; }
  body.portal-layout #metal-calculator .mc-product-option { font-size: 14px; }
  body.portal-layout #metal-calculator .mc-value-field > input { font-size: 32px !important; }
  body.portal-layout #metal-calculator :is(.mc-help, .mc-method, .mc-edit-hint, .mc-reference p) { font-size: 13px; }
  body.portal-layout #metal-calculator .mc-breakdown dl > div { flex-wrap: wrap; gap: 4px 12px; }
  body.portal-layout #metal-calculator .mc-breakdown dd { overflow-wrap: anywhere; }
  body.portal-layout #metal-calculator .mc-list-heading { flex-wrap: wrap; }
  body.portal-layout #metal-calculator .mc-actions button { flex: 1 1 auto; white-space: normal; }
  body.portal-layout .tc-vehicle-option { flex: 1 1 auto; white-space: normal; }
  body.portal-layout .tc-result-main strong { overflow-wrap: anywhere; }
  body.portal-layout .tc-breakdown div { flex-wrap: wrap; gap: 4px 12px; }
  body.portal-layout .tc-breakdown dd { max-width: 100%; overflow-wrap: anywhere; }
  body.portal-layout .tc-rates-row > * { min-width: 0; overflow-wrap: anywhere; }

  /* PDF tools wrap around the native scroll/zoom stage; canvas is unchanged. */
  body.portal-layout .pe :is(.pe-heading, .pe-file-actions, .pe-bottom) { flex-wrap: wrap; }
  body.portal-layout .pe .pe-file-info > div { min-width: 0; }
  body.portal-layout .pe .pe-file-info strong { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  body.portal-layout .pe .pe-file-actions > button { flex: 1 1 auto; white-space: normal; }
  body.portal-layout .pe .pe-control-group { min-width: 0; max-width: 100%; }
  body.portal-layout .pe .pe-modes { flex-wrap: wrap; }
  body.portal-layout .pe .pe-ocr { flex-wrap: wrap; }
  body.portal-layout .pe .pe-ocr p { font-size: 13px; }
  body.portal-layout .pe .pe-element { min-height: 44px; }
  body.portal-layout .pe .pe-element .pe-element-text { white-space: normal; overflow-wrap: anywhere; }
  body.portal-layout .pe .pe-object-note { font-size: 12px; }
  body.portal-layout .pa .pa-actions a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }
  body.portal-layout .pa .pa-pagination { flex-wrap: wrap; gap: 14px; margin: 24px 0; }
  body.portal-layout .pa .pa-pagination a { padding: 10px 0; }

  /* MTT, email signatures and invoice correction. */
  body.portal-layout :is(.mtt-heading, .mtt-result-head, .mtt-section-heading) { min-width: 0; gap: 16px; }
  body.portal-layout :is(.mtt-heading, .mtt-result-head, .mtt-section-heading) > div { min-width: 0; }
  body.portal-layout :is(.mtt-heading, .mtt-result-head, .mtt-summary) :is(h1, h2, strong) { overflow-wrap: anywhere; }
  body.portal-layout .mtt-dropzone { min-width: 0; grid-template-columns: auto minmax(0, 1fr); }
  body.portal-layout .mtt-dropzone :is(strong, span) { min-width: 0; overflow-wrap: anywhere; }
  body.portal-layout .mtt-file-button { max-width: 100%; white-space: normal; }
  body.portal-layout .mtt-editor-toolbar { min-width: 0; }
  body.portal-layout .mtt-editor-toolbar label { min-width: 0; }
  body.portal-layout .mtt-edit-table-wrap { max-width: 100%; overscroll-behavior-x: contain; }
  body.portal-layout .mtt-email-fields { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout .mtt-email fieldset { min-width: 0; flex-wrap: wrap; }
  body.portal-layout .mtt-document { grid-template-columns: auto minmax(0, 1fr); }
  body.portal-layout .mtt-document > div { min-width: 0; overflow-wrap: anywhere; }
  body.portal-layout .mtt-document a { grid-column: 1 / -1; white-space: normal; text-align: center; padding: 10px 16px; }
  body.portal-layout .city-signatures { padding: 18px; }
  body.portal-layout .city-signatures .section-title { flex-wrap: wrap; gap: 12px; }
  body.portal-layout .city-signatures .signature-toolbar { flex-wrap: wrap; gap: 10px; }
  body.portal-layout .city-signatures .signature-table-scroll,
  body.portal-layout .city-signatures .signature-preview { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
  body.portal-layout .process-card .file-input { padding: 16px; }
  body.portal-layout .result-copy { min-width: 0; }
  body.portal-layout .result-copy :is(h2, p),
  body.portal-layout .result-copy .totals strong { overflow-wrap: anywhere; }
  body.portal-layout .feedback-actions > button { flex: 1 1 160px; white-space: normal; }

  /* Match pages: wrap names and controls without changing any native table. */
  body.portal-layout .cs2-status-tabs { max-width: 100%; flex-wrap: wrap; gap: 6px; }
  body.portal-layout .cs2-status-tabs a { flex: 1 1 auto; min-height: 44px; white-space: normal; text-align: center; }
  body.portal-layout .cs2-match-card-head { flex-wrap: wrap; gap: 8px; }
  body.portal-layout .cs2-match-card-head > a { min-width: 0; overflow-wrap: anywhere; }
  body.portal-layout .cs2-team-line { min-width: 0; }
  body.portal-layout .cs2-team-line > strong,
  body.portal-layout .cs2-team-line > span:not(.cs2-team-symbol) { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  body.portal-layout .cs2-team-line > b { flex-shrink: 0; }
  body.portal-layout :is(.ec-team, .dota2-cell-team) { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  body.portal-layout .ec-gtable :is(th, td) { height: auto; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  body.portal-layout .ec-gtable :is(.ec-gpct, .ec-gmark) { white-space: nowrap; overflow-wrap: normal; }
  body.portal-layout .ec-odds,
  body.portal-layout .dota2-odds { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout .ec-odds .cs2-bb-price > span,
  body.portal-layout .dota2-odds .cs2-bb-price > span,
  body.portal-layout.summary-page .summary-card .cs2-bb-price > span { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  body.portal-layout .cs2-model-selector label { max-width: 100%; }
  body.portal-layout .cs2-model-selector select { min-width: 0; max-width: 100%; }
  body.portal-layout .summary-toolbar { flex-wrap: wrap; }
  body.portal-layout .summary-collectors summary { flex-wrap: wrap; }
  body.portal-layout .summary-collectors summary span { max-width: 100%; text-align: left; }
  body.portal-layout .summary-collector { overflow-wrap: anywhere; }
  body.portal-layout .ufc-fighters :is(dt, dd) { min-width: 0; overflow-wrap: anywhere; }

  /* VPN: keep service names and controls usable beside long unit identifiers. */
  body.portal-layout .vpn-page .row > div { min-width: 0; max-width: 100%; }
  body.portal-layout .vpn-page :is(.meta, .status-msg, .card strong) { overflow-wrap: anywhere; }
  body.portal-layout .vpn-page .row > div:last-child > button { margin-top: 6px; }
  body.portal-layout .vpn-page .gauge { min-width: 0; flex: 1 1 140px; }
  body.portal-layout .vpn-page .gauge .val { overflow-wrap: anywhere; }
  body.portal-layout .vpn-page .node { min-width: 0; max-width: 100%; flex-wrap: wrap; }
  body.portal-layout .vpn-page .node .delay { margin-left: auto; }
  body.portal-layout .vpn-page .add-form label { min-width: 0; }
  body.portal-layout .vpn-page pre { max-width: 100%; overscroll-behavior: contain; }

  /* The order editor keeps its cargo SVG at its native proportions. */
  body.portal-layout #main-content[data-base="/mtt/orders"] .page-title { min-width: 0; }
  body.portal-layout #main-content[data-base="/mtt/orders"] :is(.page-title h1, .private-pill, .tag) { overflow-wrap: anywhere; white-space: normal; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .steps { flex-wrap: wrap; gap: 12px; padding: 14px; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .steps li { flex: 1 1 150px; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .steps b { display: inline-grid; place-items: center; }
  body.portal-layout #main-content[data-base="/mtt/orders"] :is(.card, .upload-card) { padding: 18px; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .drop-zone { padding: 16px; gap: 13px; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .section-title { gap: 12px; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .section-title > div { min-width: 0; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .section-title h2 { overflow-wrap: anywhere; }
  body.portal-layout #main-content[data-base="/mtt/orders"] :is(.cargo-metrics, .totals-bar, .preview-navigation) { flex-wrap: wrap; gap: 12px; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .cargo-preview { padding: 14px; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .action-bar { padding: 18px; gap: 16px; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .action-bar > div { min-width: 0; overflow-wrap: anywhere; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .history-list span { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  body.portal-layout #main-content[data-base="/mtt/orders"] :is(.email-brand-controls, .email-subject-row) { min-width: 0; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .signature-actions :is(.signature-select, .signature-download) { min-height: 44px; padding-top: 12px; padding-bottom: 12px; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .city-signatures { min-width: 0; max-width: 100%; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .signature-table-scroll { width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .signature-preview { min-width: 0; max-width: 100%; overflow-x: auto; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .signature-actions { min-width: 0; max-width: 100%; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .signature-actions :is(button, a) { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
}

/* Reinforce the order app's existing mobile signature cards, independently of
   desktop column widths. The table bindings and every action remain present. */
@media (max-width: 650px) {
  body.portal-layout #main-content[data-base="/mtt/orders"] .signature-table,
  body.portal-layout #main-content[data-base="/mtt/orders"] .signature-table > tbody,
  body.portal-layout #main-content[data-base="/mtt/orders"] .signature-table > tbody > tr,
  body.portal-layout #main-content[data-base="/mtt/orders"] .signature-table > tbody > tr > :is(th, td) { min-width: 0; max-width: 100%; width: 100%; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .signature-actions .button { width: 100%; }
}

@media (max-width: 480px) {
  body.portal-layout :is(.deals-heading, .drivers-heading) > button { width: 100%; }
  body.portal-layout .deals-page .deal-filters,
  body.portal-layout .drivers-page .driver-filters { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout :is(.deal-filters, .driver-filters) .search-label { grid-column: auto; }
  body.portal-layout .deal-metrics { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout .deal-metrics article { border-right: 0; border-bottom: 1px solid #dfe5ed; }
  body.portal-layout .deal-metrics article:last-child { border-bottom: 0; }
  body.portal-layout :is(#deal-form, #driver-form) .dialog-footer > button { flex: 1 1 100%; }
  body.portal-layout #main-content.calls-page .tattoo-grid { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout #main-content.calls-page .tattoo { min-height: 0; padding: 18px; }
  body.portal-layout #main-content.calls-page .note-actions .call-btn { flex: 1 1 100%; }
  body.portal-layout #main-content.calls-page .wall-number { font-size: 72px; }
  body.portal-layout .pc .pc-fields { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout .pc .pc-summary { flex-wrap: wrap; }
  body.portal-layout .pc .pc-actions > button { flex: 1 1 100%; }
  body.portal-layout .pc .pc-file-controls { width: 100%; justify-content: flex-end; }
  body.portal-layout #metal-calculator .mc-product-results { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout #metal-calculator .mc-two { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout .tc-cities { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout .tc-rates-row { gap: 6px; padding: 8px 6px; font-size: 12px; }
  body.portal-layout .pe .pe-bottom { gap: 12px; }
  body.portal-layout .pe .pe-bottom > div { width: 100%; }
  body.portal-layout .pe .pe-bottom small { max-width: 100%; }
  body.portal-layout .pe .pe-bottom > button { width: 100%; }
  body.portal-layout .pe .pe-control-group:not(.pe-zoom-controls) { flex-wrap: wrap; }
  body.portal-layout .mtt-result-head h2 { font-size: 25px; }
  body.portal-layout .mtt-dropzone { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  body.portal-layout .mtt-file-icon { grid-row: auto; }
  body.portal-layout .mtt-file-button { grid-column: 1; justify-self: stretch; text-align: center; }
  body.portal-layout .mtt-status { max-width: 100%; min-width: 0; }
  body.portal-layout .mtt-status > div { min-width: 0; overflow-wrap: anywhere; }
  body.portal-layout.cs2-category .cs2-filters { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout.cs2-category .cs2-filters > * { grid-column: auto; }
  body.portal-layout .summary-statistics-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  body.portal-layout .summary-collector-grid { grid-template-columns: minmax(0, 1fr); }
  body.portal-layout.summary-page .summary-card .ec-odds .cs2-bb,
  body.portal-layout.summary-page .summary-card .dota2-odds .cs2-bb { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  body.portal-layout.summary-page .summary-card .cs2-bb-heading { grid-row: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  body.portal-layout.summary-page .summary-card :is(.cs2-bb-prices, .cs2-bb-meta) { grid-column: 1; }
  body.portal-layout .vpn-page .add-form :is(label, button) { flex: 1 1 100%; width: 100%; }
  body.portal-layout .vpn-page .gauge { flex-basis: 100%; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .steps { flex-direction: column; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .steps li { flex-basis: auto; align-items: center; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .steps b { width: 28px; height: 28px; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .preview-navigation > button { flex: 1 1 auto; white-space: normal; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .preview-navigation > span { flex: 1 1 100%; order: -1; }
  body.portal-layout #main-content[data-base="/mtt/orders"] .signature-download { display: block; margin-left: 0; }
}
