/* StartMarket shared components. Feature CSS may define layout, never a parallel visual language. */

/* Data table contract: desktop remains a semantic table; mobile becomes a labelled card stream. */
table[data-sm-table-ready] {
  font-variant-numeric: tabular-nums;
}

.sm-mobile-table-toggle {
  display: none;
}

@media (max-width: 820px) {
  html body [data-sm-table-container] {
    max-width: 100%;
    max-height: none;
    overflow: visible;
    border-radius: var(--sm-panel, 14px);
    background: var(--sm-bg, #f5f7fb);
    scrollbar-gutter: auto;
  }

  html body table.sm-mobile-table[data-sm-table-ready] {
    display: block;
    width: 100%;
    min-width: 0;
    border: 0;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 0;
    background: transparent;
  }

  html body table.sm-mobile-table[data-sm-table-ready] > colgroup {
    display: none;
  }

  html body table.sm-mobile-table[data-sm-table-ready] > thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
  }

  html body table.sm-mobile-table[data-sm-table-ready] > :is(tbody, tfoot) {
    display: grid;
    gap: 10px;
    width: 100%;
    padding: 10px;
  }

  html body table.sm-mobile-table[data-sm-table-ready] > :is(tbody, tfoot) > tr {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--sm-border, #dce2ec);
    border-radius: var(--sm-panel, 14px);
    background: var(--sm-surface, #fff);
    box-shadow: 0 3px 10px rgba(26, 44, 78, .08);
  }

  html body table.sm-mobile-table[data-sm-table-ready] > :is(tbody, tfoot) > tr[hidden] {
    display: none;
  }

  html body table.sm-mobile-table[data-sm-table-ready] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-label] {
    position: relative;
    display: flex;
    grid-column: span 1;
    min-width: 0;
    min-height: 66px;
    margin: 0;
    padding: 9px 7px;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    border: 0;
    border-right: 1px solid var(--sm-border, #dce2ec);
    border-bottom: 1px solid var(--sm-border, #dce2ec);
    border-radius: 0;
    background: var(--sm-surface, #fff);
    color: var(--sm-text, #252932);
    text-align: center;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
    hyphens: none;
    font-size: 13px;
    line-height: 1.35;
    vertical-align: top;
    order: var(--sm-mobile-order, 999);
  }

  html body table.sm-mobile-table[data-sm-table-ready] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-label]::before {
    content: attr(data-sm-label);
    display: block;
    min-height: 24px;
    color: var(--sm-muted, #647084);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .02em;
    text-transform: uppercase;
  }

  html body table.sm-mobile-table[data-sm-table-ready] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-identity],
  html body table.sm-mobile-table[data-sm-table-ready] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-span="full"] {
    display: block;
    grid-column: 1 / -1;
    min-height: 0;
    padding: 11px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--sm-border, #dce2ec);
    background: #f7f9fc;
    text-align: left;
  }

  html body table.sm-mobile-table[data-sm-table-ready] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-identity]::before,
  html body table.sm-mobile-table[data-sm-table-ready] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-span="full"]::before {
    display: none;
  }

  html body table.sm-mobile-table[data-sm-table-ready] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-secondary] {
    display: none;
  }

  html body table.sm-mobile-table[data-sm-table-ready] > :is(tbody, tfoot) > tr[data-sm-expanded] > :is(td, th)[data-sm-secondary] {
    display: flex;
  }

  html body table.sm-mobile-table[data-sm-table-ready] > :is(tbody, tfoot) > tr[data-sm-expanded] > :is(td, th)[data-sm-secondary][data-sm-span="full"] {
    display: block;
  }

  html body table.sm-mobile-table[data-sm-table-ready] :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    max-width: 100%;
  }

  html body table.sm-mobile-table[data-sm-table-ready] :is(button, .seller-button, .btn, a.button, a.button-link) {
    min-height: 44px;
  }

  html body table.sm-mobile-table[data-sm-table-ready] .sm-mobile-table-toggle {
    display: inline-flex;
    min-height: 36px;
    margin-top: 9px;
    padding: 7px 10px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--sm-border, #dce2ec);
    border-radius: var(--sm-control, 10px);
    background: var(--sm-surface, #fff);
    color: var(--sm-blue, #233e72);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
  }

  html body table.sm-mobile-table[data-sm-table-ready] .sm-mobile-table-toggle::after {
    content: "↓";
  }

  html body table.sm-mobile-table[data-sm-table-ready] tr[data-sm-expanded] .sm-mobile-table-toggle::after {
    content: "↑";
  }

  html body table.sm-mobile-table[data-sm-table-ready] > caption {
    display: block;
    width: 100%;
  }
}

@media (max-width: 430px) {
  html body table.sm-mobile-table[data-sm-table-ready] > :is(tbody, tfoot) > tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html body table.sm-mobile-table[data-sm-table-ready] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-label] {
    min-height: 60px;
  }
}

/* Compact semantic variants. Templates opt in; desktop table semantics stay unchanged. */
@media (max-width: 820px) {
  html body table.sm-mobile-table[data-sm-table-ready][data-sm-mobile-layout="entity-list"] > :is(tbody, tfoot) > tr {
    grid-template-columns: minmax(0, 1fr);
  }

  html body table.sm-mobile-table[data-sm-table-ready][data-sm-mobile-layout="entity-list"] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-label]:not([data-sm-identity]) {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 48px;
    padding: 10px 12px;
    align-items: center;
    gap: 14px;
    border-right: 0;
    text-align: right;
  }

  html body table.sm-mobile-table[data-sm-table-ready][data-sm-mobile-layout="entity-list"] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-label]:not([data-sm-identity])::before {
    min-height: 0;
    text-align: left;
  }

  html body table.sm-mobile-table[data-sm-table-ready][data-sm-mobile-layout="entity-list"] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-secondary] {
    display: none;
  }

  html body table.sm-mobile-table[data-sm-table-ready][data-sm-mobile-layout="entity-list"] > :is(tbody, tfoot) > tr[data-sm-expanded] > :is(td, th)[data-sm-secondary] {
    display: grid;
  }

  html body table.sm-mobile-table[data-sm-table-ready][data-sm-mobile-layout="key-value"] > :is(tbody, tfoot) {
    display: block;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--sm-border, #dce2ec);
    border-radius: var(--sm-panel, 14px);
    background: var(--sm-surface, #fff);
  }

  html body table.sm-mobile-table[data-sm-table-ready][data-sm-mobile-layout="key-value"] > :is(tbody, tfoot) > tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    overflow: visible;
    border: 0;
    border-bottom: 1px solid var(--sm-border, #dce2ec);
    border-radius: 0;
    box-shadow: none;
  }

  html body table.sm-mobile-table[data-sm-table-ready][data-sm-mobile-layout="key-value"] > :is(tbody, tfoot) > tr:last-child {
    border-bottom: 0;
  }

  html body table.sm-mobile-table[data-sm-table-ready][data-sm-mobile-layout="key-value"] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-label] {
    display: flex;
    grid-column: auto;
    min-height: 50px;
    padding: 11px 13px;
    align-items: flex-start;
    justify-content: center;
    border: 0;
    background: transparent;
    text-align: right;
  }

  html body table.sm-mobile-table[data-sm-table-ready][data-sm-mobile-layout="key-value"] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-identity] {
    align-items: flex-start;
    text-align: left;
  }

  html body table.sm-mobile-table[data-sm-table-ready][data-sm-mobile-layout="key-value"] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-label]::before {
    display: none;
  }

  html body table.sm-mobile-table[data-sm-table-ready][data-sm-mobile-layout="decision"] > :is(tbody, tfoot) > tr {
    grid-template-columns: minmax(0, 1fr);
  }

  html body table.sm-mobile-table[data-sm-table-ready][data-sm-mobile-layout="decision"] > :is(tbody, tfoot) > tr > :is(td, th)[data-sm-label] {
    grid-column: 1 / -1;
    min-height: 0;
    padding: 10px 12px;
    align-items: flex-start;
    border-right: 0;
    text-align: left;
  }
}

@media print {
  .sm-mobile-table-toggle {
    display: none !important;
  }
}

/* T-278B: shared paired report summaries. */
.sm-report-pair{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-top:16px;align-items:start}
.sm-report-panel{min-width:0;position:relative;margin:0!important}
.sm-report-panel h2{margin:0;font-size:18px}
.sm-report-panel .seller-muted{font-size:12px;line-height:1.45}
.sm-report-facts{margin:12px 0;font-variant-numeric:tabular-nums}
.sm-report-facts>div{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:11px 0;border-bottom:1px solid var(--sm-line,#dce2eb)}
.sm-report-facts dt{font-weight:600}
.sm-report-facts dd{margin:0;text-align:right;display:grid;gap:3px}
.sm-report-facts dd strong,.sm-report-facts dd small{white-space:nowrap}
.sm-report-facts dd strong{font-size:18px}
.sm-report-facts dd small{color:var(--sm-muted,#6d7890)}
.sm-report-calculation-wrap{max-width:100%;overflow-x:auto}
.sm-report-calculation{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums}
.sm-report-calculation th,.sm-report-calculation td{padding:9px 6px;border-bottom:1px solid var(--sm-line,#dce2eb);vertical-align:top;font-size:14px}
.sm-report-calculation th{font-weight:600;text-align:left}
.sm-report-calculation td{text-align:right;white-space:nowrap}
.sm-report-calculation thead th:not(:first-child){text-align:right}
.sm-report-calculation .sm-report-result th,.sm-report-calculation .sm-report-result td{padding-top:14px;border-top:2px solid var(--sm-line,#dce2eb);border-bottom:0}
.sm-report-result strong{font-size:22px}
.sm-report-facts .sm-report-result dd strong{font-size:22px}
.sm-report-panel .positive{color:var(--sm-success,#187244)}
.sm-report-panel .negative{color:var(--sm-danger,#c43232)}
@media(max-width:1100px){.sm-report-pair{grid-template-columns:minmax(0,1fr)}}
@media(max-width:480px){.sm-report-calculation{min-width:340px}.sm-report-facts dd strong{font-size:16px}}

