/* Marketplaces (the console's Marketplaces mockup): one card per platform with its logo tile, mode, status chip,
   the problem it has with its M-code and "Next:", three numbers, the last event and whether its secrets are set,
   then the event log (what came in, what went out) with a segmented filter, and the capability matrix. Tokens and
   the shared components (pill, code, btn, panel, table) come from app.css; everything here is this page's own. */

/* ── the cards: three across, two under 1100 px, one on a phone ── */
.mk-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1100px) { .mk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .mk-grid { grid-template-columns: minmax(0, 1fr); } }

.mk-card { background: var(--panel-grad); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; box-shadow: var(--shadow); }
.mk-card--warn { border-color: color-mix(in oklab, var(--warn) 40%, var(--line)); }
.mk-card--bad { border-color: color-mix(in oklab, var(--bad) 40%, var(--line)); }
.mk-card--neutral { border-color: var(--line-2); }

/* head: the 46 px logo tile, the name over the mode, the status chip at the right */
.mk-card__head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; min-width: 0; }
.mk-card__logo { width: 46px; height: 46px; border-radius: 13px; background: var(--panel-2); border: 1px solid var(--line-2); display: grid; place-items: center; flex: none; }
.mk-card__logo .mlogo { width: 26px; height: 26px; border-radius: 6px; vertical-align: 0; }
.mk-card__id { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mk-card__name { font-size: 15px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-card__mode { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.mk-card__status { margin-left: auto; font-weight: 500; font-size: 12px; flex: none; }

/* the problem: the code, a bold title, what happened and the next step, on the tone's tint */
.mk-warn { margin: 0 18px 12px; padding: 9px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--ink-2); font-size: 12px; line-height: 1.5; text-wrap: pretty; }
.mk-warn--bad { background: var(--bad-bg); }
.mk-warn--neutral, .mk-warn--mute { background: var(--panel-2); }
.mk-warn .code { margin-right: 3px; vertical-align: 1px; }
.mk-warn strong { color: var(--ink); font-weight: 600; }

/* three numbers between two rules */
.mk-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.mk-stat { padding: 10px 18px; display: flex; flex-direction: column; gap: 3px; border-right: 1px solid var(--line); min-width: 0; }
.mk-stat:last-child { border-right: 0; }
.mk-stat__l { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-stat__v { font: 600 15px/1.2 var(--mono); color: var(--ink); white-space: nowrap; }
.mk-stat__v--warn { color: var(--warn); }
.mk-stat__v--bad { color: var(--bad); }

/* last event, API key, webhook secret */
.mk-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; padding: 12px 18px; margin: 0; font-size: 12.5px; }
.mk-kv dt { color: var(--ink-3); white-space: nowrap; }
.mk-kv dd { margin: 0; font-family: var(--mono); letter-spacing: .03em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.mk-kv__word { font-family: var(--sans); letter-spacing: 0; color: var(--ink-2); }
.mk-kv__word--ok { color: var(--ok); }
.mk-kv__word--bad { color: var(--bad); }
.mk-kv__word--mute { color: var(--ink-3); }

/* foot: Test connection (the primary) and Pull orders now, on the plain panel colour */
.mk-card__foot { margin-top: auto; display: flex; gap: 6px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel); }
.mk-card__foot .btn--primary { flex: 1; }
.mk-card__foot .btn { height: 32px; border-radius: 9px; }

/* ── the event log ── */
.mk-log__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.mk-log__head .panel__title { flex: none; }
.mk-log__sub { font-size: 12px; color: var(--ink-3); min-width: 0; }
/* the segmented filter: links, the one that is on raised */
.lseg { margin-left: auto; display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); flex: none; }
.lseg__a { height: 28px; padding: 0 10px; border-radius: 7px; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-3); text-decoration: none; white-space: nowrap; }
.lseg__a:hover { color: var(--ink); text-decoration: none; }
.lseg__a.is-active { background: var(--panel-2); color: var(--ink); }
.lseg__n { font: 500 11px/1 var(--mono); color: var(--ink-3); }
.lseg__a.is-active .lseg__n { color: var(--ink-2); }
.lseg__n--bad { color: var(--bad); }

.mk-table { min-width: 760px; }
.mk-table th, .mk-table td { padding: 10px 14px; }
.mk-table th { border-bottom: 1px dashed var(--line-2); }
.mk-table td { border-bottom: 1px dashed var(--line); }
.mk-table tbody tr:hover td { background: var(--panel-2); }
.mk-table .r { text-align: right; }
.mk-time { font: 12px/1 var(--mono); color: var(--ink-3); white-space: nowrap; }
.mk-table .mchip { gap: 8px; color: var(--ink-2); }
.mk-event { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.mk-tag { font: 500 10.5px/18px var(--mono); padding: 0 6px; border-radius: 5px; background: var(--panel-2); color: var(--ink-3); flex: none; }
.mk-tag--in { color: var(--accent); }
.mk-ev { font-family: var(--mono); font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.mk-err { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-3); max-width: 440px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-ref { font: 500 12.5px/1 var(--mono); color: var(--accent); white-space: nowrap; }
.mk-ref--plain { color: var(--ink-2); }
.mk-code { display: inline-block; font: 600 12px/20px var(--mono); padding: 0 7px; border-radius: 5px; color: var(--ink-3); background: var(--panel-2); white-space: nowrap; }
.mk-code--ok { color: var(--ok); background: var(--ok-bg); }
.mk-code--bad { color: var(--bad); background: var(--bad-bg); }
.mk-code--warn { color: var(--warn); background: var(--warn-bg); }
.mk-lat { font: 12px/1 var(--mono); color: var(--ink-3); white-space: nowrap; }
.mk-lat--warn { color: var(--warn); }

/* ── the capability matrix ── */
.mk-matrix { margin-top: 16px; }
.mk-matrix__head { display: flex; flex-direction: column; gap: 3px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.mk-matrix__sub { font-size: 12px; color: var(--ink-3); text-wrap: pretty; }
.mk-matrix .table { min-width: 560px; }
.mk-matrix .table th { border-bottom: 1px dashed var(--line-2); }
.mk-matrix .table td { border-bottom: 1px dashed var(--line); }
.mk-matrix .mchip { color: var(--ink); font-weight: 500; }
