/* ==========================================================================
   HDL Commerce V3 — product UI mockup kit
   Dark app chrome on black. Used by the feature pages.
   Load AFTER base.css / modules.css.

   Source: appui.css 1-111, ported whole. Two traps preserved:
     - .meter is a fixed 74px. The only override in the whole handoff is
       `.runbars .meter { width: 100% }` on replatforma-magento.
     - `.app-scroll .app-tbl { min-width: 660px }` sits inside
       @media (max-width: 1000px), so any two-column split wrapping a mockup
       must collapse at 1000px, not 900px.

   This is the only layer allowed non-zero radii: 16px shell, 8px controls,
   7px nav items. Everything in the marketing layer is radius 0.
   ========================================================================== */

.app {
	background: var( --wp--custom--app--shell );
	border: 1px solid rgba( 255, 255, 255, 0.09 );
	border-radius: var( --wp--custom--app--radius );
	overflow: hidden;
	box-shadow: var( --wp--custom--shadow--app );
}

.app-bar {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 11px 16px;
	border-bottom: 1px solid var( --wp--custom--hairline );
	background: var( --wp--custom--app--bar );
}

.app-bar i {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.13 );
}

.app-bar .crumb {
	font-family: var( --font-mono );
	font-size: 0.72rem;
	letter-spacing: 0.04em;
	color: #7d858f;
	margin-left: 8px;
}

.app-bar .crumb b {
	color: var( --wp--preset--color--body-text );
	font-weight: 400;
}

.app-bar .right {
	margin-left: auto;
	display: flex;
	gap: 8px;
	align-items: center;
}

.app-body {
	display: grid;
	grid-template-columns: 186px 1fr;
}

.app-body.no-side {
	grid-template-columns: 1fr;
}

.app-side {
	border-right: 1px solid var( --wp--custom--hairline );
	padding: 14px 10px;
	display: flex;
	flex-direction: column;
	gap: 2px;
	background: var( --wp--custom--app--side );
}

.app-side span {
	font-family: var( --font-mono );
	font-size: 0.62rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #5d656e;
	padding: 12px 10px 6px;
}

.app-side a {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 8px 10px;
	border-radius: var( --wp--custom--app--radius-nav );
	font-size: 0.82rem;
	color: var( --wp--preset--color--muted );
	text-decoration: none;
}

.app-side a em {
	width: 5px;
	height: 5px;
	background: currentColor;
	opacity: 0.5;
	font-style: normal;
}

.app-side a.on {
	background: var( --wp--custom--wash--medium );
	color: var( --wp--preset--color--contrast );
}

.app-side a.on em {
	background: var( --wp--preset--color--accent );
	color: var( --wp--preset--color--on-accent );
	opacity: 1;
}

.app-main {
	min-width: 0;
}

.app-tb {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	border-bottom: 1px solid var( --wp--custom--hairline );
	flex-wrap: wrap;
}

.app-search {
	flex: 1 1 180px;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 8px;
	border: 1px solid rgba( 255, 255, 255, 0.1 );
	border-radius: var( --wp--custom--app--radius-control );
	padding: 8px 11px;
	background: var( --wp--custom--app--bar );
	color: var( --wp--preset--color--dim );
	font-size: 0.8rem;
}

.app-search svg {
	width: 14px;
	height: 14px;
	flex: 0 0 auto;
}

.app-btn {
	font-size: 0.78rem;
	padding: 8px 12px;
	border-radius: var( --wp--custom--app--radius-control );
	border: 1px solid var( --wp--custom--hairline-strong );
	color: var( --wp--preset--color--body-text );
	background: var( --wp--custom--app--bar );
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	gap: 7px;
}

.app-btn.pri {
	background: var( --wp--preset--color--accent );
	border-color: var( --wp--preset--color--accent );
	color: var( --wp--preset--color--on-accent );
}

.app-chip {
	font-family: var( --font-mono );
	font-size: 0.68rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 5px 9px;
	border: 1px solid var( --wp--custom--hairline-strong );
	color: var( --wp--preset--color--muted );
	white-space: nowrap;
}

.app-chip.on {
	border-color: rgba( 0, 208, 143, 0.5 );
	color: var( --wp--preset--color--accent-bright );
	background: var( --wp--custom--wash--soft );
}

/* --------------------------------------------------------------------------
   Data table
   -------------------------------------------------------------------------- */
.app-tbl {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.8rem;
}

.app-tbl th {
	text-align: left;
	font-family: var( --font-mono );
	font-size: 0.64rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var( --wp--preset--color--dim );
	font-weight: 400;
	padding: 11px 14px;
	border-bottom: 1px solid rgba( 255, 255, 255, 0.09 );
	white-space: nowrap;
}

.app-tbl td {
	padding: 11px 14px;
	border-bottom: 1px solid rgba( 255, 255, 255, 0.055 );
	color: #aeb6c0;
	vertical-align: middle;
	white-space: nowrap;
}

.app-tbl tr:last-child td {
	border-bottom: 0;
}

.app-tbl td b {
	color: var( --wp--preset--color--contrast );
	font-weight: 500;
}

.app-tbl tr.sel td {
	background: var( --wp--custom--wash--faint );
}

.app-tbl .num {
	font-family: var( --font-mono );
	font-size: 0.76rem;
	color: var( --wp--preset--color--body-text );
}

.cbx {
	width: 14px;
	height: 14px;
	border: 1px solid rgba( 255, 255, 255, 0.22 );
	display: inline-block;
	vertical-align: middle;
}

.cbx.on {
	background: var( --wp--preset--color--accent );
	color: var( --wp--preset--color--on-accent );
	border-color: var( --wp--preset--color--accent );
	position: relative;
}

.cbx.on::after {
	content: "";
	position: absolute;
	left: 3px;
	top: 1px;
	width: 6px;
	height: 9px;
	border: 2px solid var( --wp--preset--color--contrast );
	border-top: 0;
	border-left: 0;
	rotate: 40deg;
}

.thumb {
	width: 30px;
	height: 30px;
	background: #14161a;
	border: 1px solid rgba( 255, 255, 255, 0.08 );
	display: inline-block;
	vertical-align: middle;
}

/* Status pills. Only `white-space` survives: the `.eyebrow/.pill/.tag` reset in
   base.css carries !important on font, colour, border, background and padding,
   so `.pill.ok/.warn/.mute/.live` render as bare mono caps in slate. That is
   what the handoff renders; the variant colours are recorded in
   css-port-notes.md as dropped-because-neutralised. */
.pill {
	white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Completeness meter — fixed 74px by design. Only `.runbars .meter` widens it.
   -------------------------------------------------------------------------- */
.meter {
	width: 74px;
	height: 5px;
	background: rgba( 255, 255, 255, 0.1 );
	display: inline-block;
	vertical-align: middle;
	position: relative;
}

.meter i {
	position: absolute;
	inset: 0 auto 0 0;
	background: var( --wp--preset--color--accent );
	color: var( --wp--preset--color--on-accent );
}

/* --------------------------------------------------------------------------
   Right drawer
   -------------------------------------------------------------------------- */
.app-split {
	display: grid;
	grid-template-columns: 1fr 300px;
}

.app-drawer {
	border-left: 1px solid var( --wp--custom--hairline );
	padding: 16px;
	background: var( --wp--custom--app--side );
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-width: 0;
}

.app-drawer h4 {
	font-size: 0.9rem;
	color: var( --wp--preset--color--contrast );
	font-weight: 500;
}

.app-drawer label {
	display: block;
	font-family: var( --font-mono );
	font-size: 0.62rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var( --wp--preset--color--dim );
	margin-bottom: 6px;
}

.app-field {
	border: 1px solid var( --wp--custom--hairline-strong );
	background: var( --wp--custom--app--bar );
	padding: 9px 11px;
	font-size: 0.82rem;
	color: #dfe4ea;
}

.app-field.mono {
	font-family: var( --font-mono );
	font-size: 0.76rem;
}

/* --------------------------------------------------------------------------
   Activity log rows
   -------------------------------------------------------------------------- */
.app-log {
	display: flex;
	flex-direction: column;
}

.log-row {
	display: grid;
	grid-template-columns: 96px 22px 1fr auto;
	gap: 12px;
	align-items: start;
	padding: 13px 16px;
	border-bottom: 1px solid rgba( 255, 255, 255, 0.055 );
}

.log-row:last-child {
	border-bottom: 0;
}

.log-row .t {
	font-family: var( --font-mono );
	font-size: 0.72rem;
	color: var( --wp--preset--color--dim );
	padding-top: 2px;
}

.log-row .dot {
	width: 9px;
	height: 9px;
	background: var( --wp--preset--color--accent );
	color: var( --wp--preset--color--on-accent );
	margin: 5px auto 0;
}

.log-row .dot.mute {
	background: #3a3f47;
}

.log-row .txt {
	font-size: 0.84rem;
	color: #aeb6c0;
	white-space: normal;
}

.log-row .txt b {
	color: var( --wp--preset--color--contrast );
	font-weight: 500;
}

.log-row .who {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.76rem;
	color: var( --wp--custom--status--mute );
	white-space: nowrap;
}

.av {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #1a1d22;
	border: 1px solid rgba( 255, 255, 255, 0.1 );
	display: grid;
	place-items: center;
	font-family: var( --font-mono );
	font-size: 0.6rem;
	color: var( --wp--preset--color--body-text );
}

/* --------------------------------------------------------------------------
   KPI strip + charts
   -------------------------------------------------------------------------- */
.app-kpis {
	display: grid;
	grid-template-columns: repeat( 4, 1fr );
	border-bottom: 1px solid var( --wp--custom--hairline );
}

.app-kpi {
	padding: 16px;
	border-right: 1px solid rgba( 255, 255, 255, 0.055 );
}

.app-kpi:last-child {
	border-right: 0;
}

.app-kpi span {
	font-family: var( --font-mono );
	font-size: 0.62rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var( --wp--preset--color--dim );
}

.app-kpi strong {
	display: block;
	font-family: var( --font-display );
	font-weight: 400;
	font-size: 1.55rem;
	color: var( --wp--preset--color--contrast );
	letter-spacing: -0.02em;
	margin-top: 8px;
	line-height: 1;
}

.app-kpi small {
	font-size: 0.72rem;
	color: var( --wp--custom--status--ok );
	display: block;
	margin-top: 6px;
}

.app-kpi small.dn {
	color: #e88f8f;
}

.bars {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	height: 132px;
	padding: 16px;
}

.bars i {
	flex: 1;
	background: linear-gradient( 180deg, var( --wp--preset--color--accent ), rgba( 0, 208, 143, 0.22 ) );
	min-width: 4px;
}

.bars i.mute {
	background: rgba( 255, 255, 255, 0.09 );
}

.spark {
	display: block;
	width: 100%;
	height: 44px;
}

.legend {
	display: flex;
	gap: 16px;
	padding: 0 16px 14px;
	font-family: var( --font-mono );
	font-size: 0.66rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var( --wp--preset--color--dim );
}

.legend b {
	display: inline-block;
	width: 9px;
	height: 9px;
	background: var( --wp--preset--color--accent );
	color: var( --wp--preset--color--on-accent );
	margin-right: 6px;
}

.legend b.alt {
	background: #3a3f47;
}

/* small stat strip under a mockup */
.app-foot {
	display: flex;
	gap: 18px;
	flex-wrap: wrap;
	padding: 12px 16px;
	border-top: 1px solid var( --wp--custom--hairline );
	font-family: var( --font-mono );
	font-size: 0.68rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var( --wp--preset--color--dim );
}

/* --------------------------------------------------------------------------
   Code panel — shared by the API pages
   -------------------------------------------------------------------------- */
.cbx-code {
	background: var( --wp--custom--app--shell );
	border: 1px solid rgba( 255, 255, 255, 0.09 );
	border-radius: 14px;
	overflow: hidden;
}

.cbx-code .hd {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 10px 14px;
	border-bottom: 1px solid var( --wp--custom--hairline );
}

.cbx-code .hd i {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.13 );
}

.cbx-code .hd span {
	font-family: var( --font-mono );
	font-size: 0.7rem;
	color: #7d858f;
	margin-left: 6px;
}

.cbx-code pre {
	margin: 0;
	padding: 18px;
	font-family: var( --font-mono );
	font-size: 0.78rem;
	line-height: 1.7;
	color: #cfd6de;
	overflow: auto;
}

.cbx-code .k {
	color: var( --wp--custom--status--ok );
}

.cbx-code .s {
	color: var( --wp--custom--status--warn );
}

.cbx-code .c {
	color: #5d656e;
}

.cbx-code .p {
	color: #c9f5e4;
}

.cbx-code .n {
	color: var( --wp--custom--status--live );
}

/* --------------------------------------------------------------------------
   How-it-works steps — the 2px seam over a hairline parent
   -------------------------------------------------------------------------- */
.steps3 {
	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	gap: 2px;
	background: var( --wp--custom--hairline );
	border: 1px solid var( --wp--custom--hairline );
}

.steps3 > div {
	background: var( --wp--preset--color--base );
	padding: clamp( 20px, 2.4vw, 30px );
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.steps3 .n {
	font-family: var( --font-mono );
	font-size: 0.7rem;
	letter-spacing: 0.14em;
	color: var( --wp--preset--color--accent );
}

.steps3 h3 {
	font-size: var( --wp--preset--font-size--lead );
	color: var( --wp--preset--color--contrast );
	font-weight: 500;
}

.steps3 p {
	font-size: 0.9rem;
	color: var( --wp--preset--color--muted );
	line-height: 1.6;
}

/* mockup caption */
.app-cap {
	display: flex;
	gap: 10px;
	align-items: baseline;
	margin-top: 14px;
	font-size: 0.84rem;
	color: var( --wp--custom--status--mute );
}

.app-cap i {
	width: 9px;
	height: 9px;
	background: var( --wp--preset--color--accent );
	color: var( --wp--preset--color--on-accent );
	flex: 0 0 auto;
	translate: 0 -1px;
}

/* --------------------------------------------------------------------------
   1000px is the mockup breakpoint. `.app-scroll .app-tbl { min-width: 660px }`
   lives here, so any wrapping split must collapse at 1000px too.
   -------------------------------------------------------------------------- */
@media ( max-width: 1000px ) {
	.app-body {
		grid-template-columns: 1fr;
	}

	.app-side {
		flex-direction: row;
		overflow-x: auto;
		border-right: 0;
		border-bottom: 1px solid var( --wp--custom--hairline );
		padding: 10px;
	}

	.app-side span {
		display: none;
	}

	.app-side a {
		white-space: nowrap;
	}

	.app-split {
		grid-template-columns: 1fr;
	}

	.app-drawer {
		border-left: 0;
		border-top: 1px solid var( --wp--custom--hairline );
	}

	.app-kpis {
		grid-template-columns: 1fr 1fr;
	}

	.app-kpi:nth-child( 2n ) {
		border-right: 0;
	}

	.app-kpi:nth-child( -n + 2 ) {
		border-bottom: 1px solid rgba( 255, 255, 255, 0.055 );
	}

	.steps3 {
		grid-template-columns: 1fr;
	}

	.app-scroll {
		overflow-x: auto;
	}

	.app-scroll .app-tbl {
		min-width: 660px;
	}
}

@media ( max-width: 560px ) {
	.app-kpis {
		grid-template-columns: 1fr;
	}

	.app-kpi {
		border-right: 0;
		border-bottom: 1px solid rgba( 255, 255, 255, 0.055 );
	}

	.log-row {
		grid-template-columns: 1fr;
		gap: 6px;
	}

	.log-row .dot {
		display: none;
	}
}
