/* Compact cards on phones for public pages (the strategy trade list).
   The client area has the same rules in app.css ("Card tables" and "Compact cards on phones");
   public pages don't load app.css, so this is their copy: keep the two in step.
   Markup: <table class="table-cards cc-table">, rows <tr class="cc-row cc-up|cc-down|cc-open">,
   lfCardSum() (escape.js) as the row's last cell, other cells .cc-more (shown when opened),
   .cc-hide (already in the summary) or .cc-only (phones only). Desktop tables are unchanged. */
.cc-table td.cc-sum, .cc-table td.cc-only { display: none; }

@media (max-width: 900px) {
    .table-scroll > table.table-cards { min-width: 0 !important; }
    table.table-cards, table.table-cards tbody, table.table-cards tr, table.table-cards td { display: block; width: 100%; }
    table.table-cards thead { display: none; }
    table.table-cards tr { border: 1px solid var(--border-glass); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px;
        background: var(--bg-card); }
    table.table-cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0 !important;
        border: 0 !important; border-bottom: 1px solid var(--border-glass) !important; text-align: right; font-size: 13px;
        overflow-wrap: anywhere; }
    table.table-cards td:last-child { border-bottom: 0 !important; }
    table.table-cards td::before { content: attr(data-label); flex-shrink: 0; text-align: left; font-size: 11.5px; font-weight: 600;
        text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
    table.table-cards td:not([data-label])::before { content: none; }
    table.table-cards td[colspan] { display: block; text-align: left; }
    table.table-cards td[colspan]::before { content: none; }
    .table-scroll:has(> table.table-cards) { overflow-x: visible; padding: 10px 0; }
    .table-scroll > table.table-cards tbody > tr:last-child { margin-bottom: 0; }

    .cc-table tr.cc-row.is-open td.cc-only { display: flex !important; }
    .cc-table tr.cc-row td.cc-more { white-space: nowrap; padding-left: 16px !important; padding-right: 14px !important; }
    .cc-table tr.cc-row { display: flex !important; flex-direction: column; position: relative; overflow: hidden;
        padding: 0 !important; transition: box-shadow .15s ease; }
    .cc-table tr.cc-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
    .cc-table tr.cc-row.cc-up::before { background: #10b981; }
    .cc-table tr.cc-row.cc-down::before { background: #ef4444; }
    .cc-table tr.cc-row.cc-open::before { background: #3b82f6; }
    .cc-table tr.cc-row.is-open { box-shadow: 0 6px 18px rgba(15, 23, 42, .08); }

    .cc-table td.cc-sum { display: flex !important; order: -1; align-items: center; gap: 12px; cursor: pointer;
        justify-content: flex-start !important; flex-wrap: nowrap !important; white-space: normal; text-align: left;
        padding: 12px 14px 12px 16px !important; border-bottom: 0 !important; -webkit-tap-highlight-color: transparent; }
    .cc-table td.cc-sum::before { content: none; }
    .cc-table td.cc-sum:focus-visible { outline: 2px solid var(--color-accent, #3b82f6); outline-offset: -2px; }
    .cc-table tr.cc-row.is-open td.cc-sum { border-bottom: 1px solid var(--border-glass) !important; }

    .cc-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
    .cc-ico svg { width: 17px; height: 17px; }
    .cc-ico.cc-up { color: #059669; background: rgba(16, 185, 129, .13); }
    .cc-ico.cc-down { color: #dc2626; background: rgba(239, 68, 68, .12); }
    .cc-ico.cc-muted { color: var(--text-muted); background: rgba(148, 163, 184, .16); }
    .cc-ico.cc-open { color: #2563eb; background: rgba(59, 130, 246, .13); }
    html[data-theme="dark"] .cc-ico.cc-open { color: #60a5fa; }
    html[data-theme="dark"] .cc-ico.cc-up { color: #34d399; }
    html[data-theme="dark"] .cc-ico.cc-down { color: #f87171; }

    .cc-sum-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
    .cc-sum-line { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
    .cc-sum-line strong { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
    .cc-tag { flex: 1 1 auto; min-width: 0; font-size: 11.5px; font-weight: 600; color: var(--text-muted);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .cc-sum-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    .cc-figs { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
    .cc-amt { font-family: var(--font-mono, ui-monospace, monospace); font-size: 14.5px; font-weight: 700; white-space: nowrap; }
    .cc-amt.is-up { color: var(--color-success, #10b981); } .cc-amt.is-down { color: var(--color-danger, #ef4444); }
    .cc-figs-sub { font-family: var(--font-mono, ui-monospace, monospace); font-size: 11.5px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }

    .cc-chev { flex: none; width: 8px; height: 8px; margin-left: 2px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
        transform: rotate(45deg) translate(-2px, -2px); transition: transform .18s ease; opacity: .7; }
    .cc-table tr.cc-row.is-open .cc-chev { transform: rotate(-135deg) translate(-1px, -1px); }

    .cc-table tr.cc-row:not(.is-open) td.cc-more { display: none !important; }
    .cc-table tr.cc-row td.cc-hide { display: none !important; }
    @media (prefers-reduced-motion: reduce) { .cc-chev, .cc-table tr.cc-row { transition: none; } }
}
