/* =====================================================================
   Phase 3 (ADR-038): human UX. Loaded last.
   1) one calm status vocabulary (.st), "Co jest ważne teraz" panel, strategy cards, progressive disclosure, metrics, strategy search;
   2) compact desktop density from 1024 px (on top of density.css >= 1280 px): real layout, never transform/zoom.
   Fewer borders: secondary content is plain rows, not nested cards; only warnings get colour.
   ===================================================================== */

/* ---------- plain status (StatusVocabulary) ---------- */
.st { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; line-height: 1.3; padding: 1px 0; white-space: normal; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: var(--gray); }
.st-good::before { background: var(--up); }
.st-warn { color: var(--warn); }
.st-warn::before { background: var(--warn); }
.st-bad { color: var(--down); }
.st-bad::before { background: var(--down); }
.st-muted { color: var(--text-dim); font-weight: 500; }
.st-muted::before { background: var(--text-faint); }

/* ---------- "Co jest ważne teraz" ---------- */
.now-panel { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.now-panel--compact { padding: 0; background: none; border: 0; margin-bottom: 10px; }
.now-panel--compact .now-lines { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.now-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.now-title { font-size: 16px; font-weight: 700; margin: 0; }
.now-lines { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px 18px; }
.now-lines li { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: baseline; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.now-label { min-width: 0; font-size: 12px; color: var(--text-dim); }
.now-value { min-width: 0; text-decoration: none; color: inherit; }
a.now-value:hover .st { text-decoration: underline; }
.now-item { margin-top: 8px; padding: 6px 10px; border-left: 3px solid var(--warn); background: var(--warn-dim); border-radius: 0 6px 6px 0; font-size: 12.5px; }
.now-item a { margin-left: 6px; color: inherit; font-weight: 600; }
.now-item--act { border-left-color: var(--down); }
.now-next { margin-top: 10px; font-size: 12.5px; }
.now-next a { font-weight: 600; }
.now-next b { margin-right: 5px; }

/* ---------- progressive disclosure ---------- */
details.disclose > summary { cursor: pointer; font-size: 12.5px; color: var(--text-dim); padding: 6px 0; list-style: none; user-select: none; }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary::before { content: "\25B8  "; }
details.disclose[open] > summary::before { content: "\25BE  "; }
details.disclose > summary:hover { color: var(--text); }
details.disclose-block { border-top: 1px solid var(--border); padding-top: 4px; }

/* ---------- summaries ---------- */
.summary-line, .sync-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; font-size: 12.5px; color: var(--text-dim); }
.summary-line b { color: var(--text); }
.sync-line a { margin-left: auto; }

/* ---------- strategy rows (Przegląd) and cards (Bot) ---------- */
.strategy-rows { display: flex; flex-direction: column; }
.strategy-row { display: grid; grid-template-columns: minmax(120px, 200px) minmax(120px, 170px) minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 7px 2px;
    border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; font-size: 13px; }
.strategy-row:hover b { text-decoration: underline; }
.bc-now { display: flex; flex-direction: column; gap: 1px; }
.bc-now span { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.bc-now b { font-size: 13px; }
.bc-more { font-size: 11px; color: var(--text-faint); }
.dim-rows { display: flex; flex-direction: column; margin-top: 8px; }
.dim-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); }
.dim-k { font-size: 12.5px; font-weight: 600; display: flex; flex-direction: column; }
.dim-k small { font-weight: 400; color: var(--text-faint); font-size: 11px; }
.dim-v { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 12.5px; min-width: 0; }
.dim-a { display: flex; justify-content: flex-end; }

/* ---------- metrics ---------- */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 18px; }
.metric { display: flex; flex-direction: column; min-width: 0; }
.metric-label { font-size: 12px; color: var(--text-dim); cursor: help; }
.metric-value { font-size: 18px; font-variant-numeric: tabular-nums; }
.metric-help { font-size: 11px; color: var(--text-faint); line-height: 1.35; }

/* ---------- integration ---------- */
.integ-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.integ-head h3 { margin: 0; }
.integ-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 16px; margin: 10px 0 6px; }
.integ-grid > div { display: flex; flex-direction: column; min-width: 0; }
.integ-grid span { font-size: 11px; color: var(--text-dim); }
.integ-grid b { font-size: 14px; }

/* ---------- strategy search ---------- */
.search-form .opt-group { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px 8px; min-width: 0; }
.search-form legend, .opt-label { width: 100%; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; padding: 0; }
.opt { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px;
    cursor: pointer; background: var(--bg); max-width: 100%; }
.opt:has(input:checked) { border-color: var(--crypto); background: rgba(247,147,26,.10); }
.opt small { font-size: 11px; }
.tf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tf-chip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; }
.tf-chip.on { border-color: var(--crypto); background: rgba(247,147,26,.13); }
.tf-chip:disabled { cursor: not-allowed; color: var(--text-faint); opacity: .75; }
.tf-chip small { font-size: 10px; }
.adv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 14px; align-items: end; }
.search-preview { padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px dashed var(--border); font-size: 12.5px; line-height: 1.5; }

/* ---------- quotes: lighter strip ---------- */
.quote-strip .quote-card { text-decoration: none; color: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }

/* ---------- phones ---------- */
@media (max-width: 700px) {
    .now-lines { grid-template-columns: minmax(0, 1fr); }
    .now-label { min-width: 84px; }
    .strategy-row { grid-template-columns: minmax(0, 1fr) auto; }
    .strategy-row > :last-child { grid-column: 1 / -1; }
    .dim-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    .dim-a { justify-content: flex-start; }
    .integ-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sync-line a { margin-left: 0; }
    .opt, .tf-chip { min-height: 40px; }
}

/* ---------- compact desktop density, from 1024 px (density.css adds more from 1280 px) ---------- */
@media (min-width: 1024px) {
    .card { padding: 12px 14px; }
    .card h3 { font-size: 13.5px; margin-bottom: 8px; }
    h1.page-h1 { font-size: 19px; }
    p.page-lead { font-size: 12.5px; margin-bottom: 10px; }
    .grid { gap: 10px; }
    .kpi-value { font-size: 20px; }
    table.dt { font-size: 12.5px; }
    .bot-card2 { padding: 10px 12px; gap: 5px; }
}
@media (min-width: 1280px) {
    .now-panel { padding: 12px 14px; }
    .dim-row { padding: 5px 0; }
    .metric-value { font-size: 16px; }
}
@media (min-width: 1600px) {
    .now-lines { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Research Lab: strategy-search requests → draft batch (ADR-039) ---------- */
.req-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.req-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.req-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.draft-preview { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 3px 12px; margin: 6px 0 2px; font-size: 12.5px; }
.draft-preview dt { color: var(--text-dim); }
.draft-preview dd { margin: 0; min-width: 0; }
@media (max-width: 700px) { .draft-preview { grid-template-columns: minmax(0, 1fr); } .draft-preview dd { margin-bottom: 4px; } .req-actions { margin-left: 0; } }

/* ---------- one workspace-level mode indicator (ADR-039); the full banner only on Bot / Handel / Integracja ---------- */
.ws-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.ws-title-row .page-h1 { margin-bottom: 0; }
.mode-strip { display: inline-flex; gap: 5px; align-items: center; cursor: help; }

/* ---------- Crypto → Handel: answers first ---------- */
.trade-brief { padding: 14px 16px; }
.tb-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 20px; margin-bottom: 8px; }
.tb-coin { font-size: 20px; font-weight: 700; }
.tb-price { font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.tb-verdict { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.tb-verdict-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.tb-action { font-size: 20px; font-weight: 800; letter-spacing: .04em; padding: 2px 12px; border-radius: 8px; border: 1px solid var(--border); cursor: help; }
.tb-good { color: var(--up); border-color: var(--up); }
.tb-warn { color: var(--warn); border-color: var(--warn); }
.tb-bad { color: var(--down); border-color: var(--down); }
.tb-muted { color: var(--text-dim); }
.tb-rows { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 0 14px; margin: 0 0 8px; font-size: 13px; }
.tb-rows dt, .tb-rows dd { padding: 6px 0; border-bottom: 1px solid var(--border); margin: 0; min-width: 0; }
.tb-rows dt { color: var(--text-dim); font-size: 12.5px; display: flex; flex-direction: column; }
.tb-rows dt small { font-size: 10.5px; color: var(--text-faint); }
@media (max-width: 700px) {
    .tb-verdict { align-items: flex-start; }
    .tb-rows { grid-template-columns: minmax(0, 1fr); }
    .tb-rows dt { border-bottom: 0; padding-bottom: 0; }
    .tb-rows dd { padding-top: 2px; }
}

/* ---------- strategy detail: plain questions first (ADR-039) ---------- */
.sd-plain { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.sd-q h3 { margin-bottom: 6px; }
.sd-q h4 { margin: 12px 0 4px; font-size: 13px; }
.sd-q p { margin: 0 0 4px; }
@media (max-width: 700px) { .sd-plain { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Investor phone walkthrough fixes (ADR-039) ---------- */
.crypto-safety .ph { display: none; }
@media (max-width: 700px) {
    /* the full PAPER / REAL statement in one compact block: chips + short words, no paragraph before the content */
    .crypto-safety .ex { display: none; }
    .crypto-safety .ph { display: inline; }
    .crypto-safety > span { width: auto !important; }
    .crypto-safety .dot-sep { display: inline !important; }
    /* standalone links and status rows: finger-sized */
    a.ws-more, a.now-value, .now-item a, .integ-head a, .sync-line a { display: inline-flex; align-items: center; min-height: 40px; }
    .ws-topbar a, header a { min-height: 36px; display: inline-flex; align-items: center; }
    details.disclose > summary { min-height: 40px; display: flex; align-items: center; }
}
@media (max-width: 440px) {
    /* two cards per row at 390–430 px: values get the full card width and never break inside a word */
    .bot-card2 { padding: 10px; }
    .bot-card2 .bc-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 4px; }
    .bot-card2 b, .bot-card2 .st { overflow-wrap: normal; word-break: normal; hyphens: manual; }
    .bot-card2 .bc-head { flex-wrap: wrap; gap: 2px 6px; }
    .bot-card2 .bc-head .st { width: 100%; }
}

/* ---------- market: level vs direction (ADR-040) ---------- */
.mk-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin: 6px 0 4px; }
.mk-split dt { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.mk-split dd { margin: 2px 0 0; }
.mk-summary { margin: 4px 0 8px; font-size: 13px; }

/* ---------- Panel główny summary tiles on phones (ADR-040): balanced rows, never one orphaned tile ---------- */
@media (max-width: 700px) {
    .dash-hero-stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; width: 100%; }
    .dash-hero-stats:has(> :nth-child(4)) { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-hero-stats .hero-stat { min-width: 0; padding: 8px 10px; }
    .dash-hero-stats .hero-stat span { font-size: 10px; letter-spacing: .04em; }
}
.empty-state h3 { margin-bottom: 6px; }
.empty-state p { margin: 0 0 10px; }
