/* Marchés en direct — server-rendered, self-contained widget. */

.marches-widget {
	--mw-bg: #ffffff;
	--mw-fg: #0f172a;
	--mw-muted: #64748b;
	--mw-border: #e2e8f0;
	--mw-up: #16a34a;
	--mw-down: #dc2626;
	--mw-flat: #64748b;
	--mw-hover: #f8fafc;
	--mw-tab-bg: #f1f5f9;
	--mw-tab-active: #ffffff;

	background: var(--mw-bg);
	color: var(--mw-fg);
	border: 1px solid var(--mw-border);
	border-radius: 12px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	overflow: hidden;
	margin: 0 0 1.5em;
}

.marches-widget--dark,
.marches-widget--auto {
	color-scheme: light dark;
}
.marches-widget--dark {
	--mw-bg: #0f172a;
	--mw-fg: #e2e8f0;
	--mw-muted: #94a3b8;
	--mw-border: #1e293b;
	--mw-hover: #1e293b;
	--mw-tab-bg: #1e293b;
	--mw-tab-active: #0f172a;
}
@media (prefers-color-scheme: dark) {
	.marches-widget--auto {
		--mw-bg: #0f172a;
		--mw-fg: #e2e8f0;
		--mw-muted: #94a3b8;
		--mw-border: #1e293b;
		--mw-hover: #1e293b;
		--mw-tab-bg: #1e293b;
		--mw-tab-active: #0f172a;
	}
}

/* Tabs */
.marches-widget__tabs {
	display: flex;
	gap: 2px;
	background: var(--mw-tab-bg);
	padding: 4px;
	border-bottom: 1px solid var(--mw-border);
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
.marches-widget__tab {
	flex: 1 1 auto;
	min-width: max-content;
	padding: 8px 12px;
	background: transparent;
	border: 0;
	border-radius: 8px;
	font: inherit;
	color: var(--mw-muted);
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s, color 0.15s;
}
.marches-widget__tab:hover { color: var(--mw-fg); }
.marches-widget__tab.is-active {
	background: var(--mw-tab-active);
	color: var(--mw-fg);
	font-weight: 600;
	box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* Panels */
.marches-widget__panel { display: none; }
.marches-widget__panel.is-active { display: block; }

.marches-widget__group-title {
	margin: 12px 12px 4px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--mw-muted);
}

/* Rows */
.marches-widget__list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.marches-widget__row {
	display: grid;
	grid-template-columns: 1fr auto auto;
	column-gap: 12px;
	align-items: baseline;
	padding: 10px 14px;
	border-bottom: 1px solid var(--mw-border);
	transition: background 0.15s;
}
.marches-widget__row:last-child { border-bottom: 0; }
.marches-widget__row:hover { background: var(--mw-hover); }

.marches-widget__name {
	font-weight: 600;
	color: var(--mw-fg);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.marches-widget__price {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	color: var(--mw-fg);
}
.marches-widget__chg {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	font-variant-numeric: tabular-nums;
	font-size: 12.5px;
	color: var(--mw-flat);
}
.marches-widget__chg-abs { opacity: 0.75; }

.marches-widget__row.is-up    .marches-widget__chg { color: var(--mw-up);   }
.marches-widget__row.is-down  .marches-widget__chg { color: var(--mw-down); }
.marches-widget__row.is-flat  .marches-widget__chg { color: var(--mw-flat); }

.marches-widget__row--error .marches-widget__price,
.marches-widget__row--error .marches-widget__chg { color: var(--mw-muted); font-style: italic; }

/* Footer */
.marches-widget__footer {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 14px;
	font-size: 11px;
	color: var(--mw-muted);
	border-top: 1px solid var(--mw-border);
	background: var(--mw-tab-bg);
	flex-wrap: wrap;
}

.marches-widget--empty {
	padding: 16px;
	color: var(--mw-muted);
	font-size: 14px;
}

/* Refresh transition */
.marches-widget.is-refreshing { opacity: 0.6; transition: opacity 0.2s; }
