
/* /src/styles.css */
:root {
	color: #111827;
	background: #f8fafc;
	font-family:
		Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
		sans-serif;
}

body {
	margin: 0;
}

a {
	color: inherit;
	text-decoration: none;
}

.topbar {
	align-items: center;
	background: #ffffff;
	border-bottom: 1px solid #e5e7eb;
	display: flex;
	height: 64px;
	justify-content: space-between;
	padding: 0 32px;
}

.brand {
	font-size: 18px;
	font-weight: 700;
}

nav {
	display: flex;
	gap: 20px;
}

nav a {
	color: #475569;
	font-size: 14px;
}

nav a.active {
	color: #0f766e;
	font-weight: 700;
}

.shell {
	margin: 0 auto;
	max-width: 1280px;
	padding: 40px 24px;
}

.panel,
.card,
.surface {
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.panel {
	align-items: center;
	display: flex;
	justify-content: space-between;
	padding: 32px;
}

.stack {
	display: grid;
	gap: 20px;
}

.two-column {
	align-items: start;
	display: grid;
	gap: 20px;
	grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
}

.section-heading h1,
.panel h1 {
	font-size: 32px;
	line-height: 1.1;
	margin: 0;
}

.section-heading h2,
.surface h2 {
	font-size: 20px;
	line-height: 1.2;
	margin: 0;
}

.section-heading.compact p {
	margin-bottom: 6px;
}

.section-heading p,
.panel p {
	color: #64748b;
	line-height: 1.6;
	max-width: 680px;
}

.eyebrow {
	color: #0f766e;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0;
	margin: 0 0 8px;
	text-transform: uppercase;
}

.button {
	background: #0f766e;
	border: 1px solid #0f766e;
	border-radius: 6px;
	color: #ffffff;
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	font-weight: 700;
	justify-content: center;
	padding: 10px 14px;
}

.button.secondary {
	background: #ffffff;
	border-color: #cbd5e1;
	color: #0f172a;
}

.button.ghost {
	background: #eef6ff;
	border-color: #bfdbfe;
	color: #1d4ed8;
}

.button.danger {
	background: #be123c;
	border-color: #be123c;
	color: #ffffff;
}

.button.small {
	font-size: 13px;
	padding: 8px 10px;
}

.button:disabled {
	cursor: not-allowed;
	opacity: 0.55;
}

.card {
	align-items: center;
	display: flex;
	justify-content: space-between;
	padding: 20px;
}

.surface {
	padding: 20px;
}

.form-grid {
	display: grid;
	gap: 16px;
}

.form-grid label {
	display: grid;
	gap: 7px;
}

.form-grid label span {
	color: #334155;
	font-size: 13px;
	font-weight: 700;
}

input,
select {
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	box-sizing: border-box;
	color: #0f172a;
	font: inherit;
	min-height: 42px;
	padding: 9px 11px;
	width: 100%;
}

select {
	min-width: 260px;
}

input:focus,
select:focus {
	border-color: #0f766e;
	box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
	outline: none;
}

.search-input {
	min-width: min(320px, 100%);
	width: 320px;
}

.toolbar {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.toolbar.spread {
	justify-content: space-between;
}

.alert {
	border-radius: 8px;
	font-weight: 700;
	padding: 12px 14px;
}

.alert-error {
	background: #fff1f2;
	border: 1px solid #fecdd3;
	color: #be123c;
}

.muted {
	color: #64748b;
	margin: 0;
}

.account-list {
	display: grid;
	gap: 10px;
}

.account-row {
	align-items: center;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	display: grid;
	gap: 12px;
	grid-template-columns: minmax(0, 1fr) auto;
	padding: 10px;
}

.account-select {
	background: transparent;
	border: 0;
	border-radius: 6px;
	color: inherit;
	cursor: pointer;
	display: grid;
	font: inherit;
	gap: 3px;
	padding: 8px;
	text-align: left;
}

.account-select.active {
	background: #f0fdfa;
}

.account-select span {
	color: #64748b;
	font-size: 13px;
	overflow-wrap: anywhere;
}

.account-select strong {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.row-actions {
	display: flex;
	gap: 8px;
}

.row-result {
	grid-column: 1 / -1;
}

.status-pill {
	background: #f1f5f9;
	border: 1px solid #cbd5e1;
	border-radius: 999px;
	color: #475569;
	display: inline-flex;
	font-size: 12px;
	font-weight: 800;
	margin-left: 8px;
	padding: 2px 8px;
	vertical-align: middle;
}

.observability-metrics {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 0.8rem;
}

.observability-metrics > div {
	display: grid;
	gap: 0.35rem;
	padding: 1rem;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: color-mix(in srgb, var(--surface) 88%, var(--accent) 12%);
}

.observability-metrics span,
.observability-table small {
	display: block;
	color: var(--muted);
}

.health-healthy { color: #15803d; }
.health-warning { color: #b45309; }
.health-critical { color: #b91c1c; }
.health-paused,
.health-unknown { color: var(--muted); }

.observability-table-wrap { overflow-x: auto; }
.observability-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.observability-table th,
.observability-table td { padding: 0.75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.observability-table th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.observability-table code { font-size: 0.78rem; overflow-wrap: anywhere; }

.activity-pagination {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.75rem;
}

.activity-pagination .muted {
	min-width: 7rem;
	text-align: center;
}

@media (max-width: 800px) {
	.observability-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.activity-pagination { justify-content: center; flex-wrap: wrap; }
}

.result-panel {
	border-radius: 8px;
	display: grid;
	gap: 4px;
	padding: 12px 14px;
}

.result-panel.neutral {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	color: #64748b;
}

.result-panel.passed {
	background: #ecfdf5;
	border: 1px solid #99f6e4;
	color: #0f766e;
}

.result-panel.failed {
	background: #fff1f2;
	border: 1px solid #fecdd3;
	color: #be123c;
}

.quality-chip {
	display: inline-flex;
	font-size: 13px;
	font-weight: 700;
	margin-right: 12px;
	overflow-wrap: anywhere;
}

.definition-grid {
	display: grid;
	gap: 10px 18px;
	grid-template-columns: 140px minmax(0, 1fr);
}

.definition-grid span {
	color: #64748b;
}

.definition-grid strong {
	overflow-wrap: anywhere;
}

.webhook-definition strong {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.webhook-instructions {
	margin: 0;
	padding-left: 1.25rem;
	display: grid;
	gap: 0.35rem;
}

.schedule-controls {
	align-items: end;
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.schedule-controls label {
	display: grid;
	gap: 7px;
	width: 180px;
}

.schedule-controls label span {
	color: #334155;
	font-size: 13px;
	font-weight: 700;
}

.toggle-control {
	align-items: center;
	display: inline-flex;
	gap: 8px;
	font-weight: 800;
}

.toggle-control input {
	accent-color: #0f766e;
	min-height: auto;
	width: auto;
}

.stream-picker {
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	display: grid;
	gap: 12px;
	padding: 12px;
}

.backfill-timeframe {
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	display: grid;
	gap: 12px;
	padding: 12px;
}

.backfill-timeframe p,
.sync-run-window {
	margin: 0;
}

.backfill-date-grid {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.backfill-date-grid label {
	display: grid;
	font-size: 13px;
	font-weight: 700;
	gap: 7px;
}

.sync-run-window {
	color: #475569;
	font-size: 12px;
}

.history-mode {
	display: grid;
	gap: 3px;
}

.stream-checkbox-grid {
	display: grid;
	gap: 8px;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.checkbox-control {
	align-items: center;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	display: flex;
	gap: 8px;
	min-width: 0;
	padding: 8px 10px;
}

.checkbox-control input {
	accent-color: #0f766e;
	min-height: auto;
	width: auto;
}

.checkbox-control span {
	overflow-wrap: anywhere;
}

.sync-status {
	align-items: center;
	border-radius: 8px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: space-between;
	padding: 12px 14px;
}

.sync-status-actions {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: flex-end;
	min-width: 0;
}

.sync-status-actions span {
	overflow-wrap: anywhere;
}

.sync-status.queued,
.sync-status.running {
	background: #fffbeb;
	border: 1px solid #fde68a;
	color: #92400e;
}

.sync-status.succeeded {
	background: #ecfdf5;
	border: 1px solid #99f6e4;
	color: #0f766e;
}

.sync-status.failed {
	background: #fff1f2;
	border: 1px solid #fecdd3;
	color: #be123c;
}

.stream-table {
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	overflow: hidden;
}

.stream-row {
	display: grid;
	gap: 10px;
	grid-template-columns: minmax(120px, 1fr) repeat(3, minmax(70px, 0.4fr));
	padding: 10px 12px;
}

.stream-row + .stream-row {
	border-top: 1px solid #e2e8f0;
}

.stream-row.header {
	background: #f8fafc;
	color: #475569;
	font-size: 12px;
	font-weight: 800;
	text-transform: uppercase;
}

.stream-row.clickable {
	background: transparent;
	border-left: 0;
	border-right: 0;
	border-bottom: 0;
	border-top: 1px solid #e2e8f0;
	color: inherit;
	cursor: pointer;
	font: inherit;
	text-align: left;
	width: 100%;
}

.stream-row.clickable:hover {
	background: #f8fafc;
}

.operation-progress {
	display: grid;
	gap: 4px;
}

.operation-progress progress {
	accent-color: #0f766e;
	height: 8px;
	max-width: 180px;
	width: 100%;
}

.operation-progress small {
	color: #64748b;
	font-size: 12px;
}

.summary-grid {
	display: grid;
	gap: 10px;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.summary-tile {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	color: #0f172a;
	cursor: pointer;
	display: grid;
	font: inherit;
	gap: 6px;
	padding: 12px;
	text-align: left;
}

.summary-tile span {
	color: #64748b;
	font-size: 12px;
	font-weight: 800;
	text-transform: uppercase;
}

.summary-tile strong {
	font-size: 22px;
	line-height: 1.1;
}

.summary-tile.active {
	background: #f0fdfa;
	border-color: #5eead4;
	color: #0f766e;
}

.commerce-workspace {
	display: grid;
	gap: 20px;
}

.commerce-summary-grid {
	display: grid;
	gap: 10px;
	grid-template-columns: repeat(6, minmax(0, 1fr));
}

.commerce-stat {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	display: grid;
	gap: 6px;
	min-width: 0;
	padding: 12px;
}

.commerce-stat span {
	color: #64748b;
	font-size: 12px;
	font-weight: 800;
	text-transform: uppercase;
}

.commerce-stat strong {
	color: #0f172a;
	font-size: 22px;
	line-height: 1.1;
}

.commerce-tabs {
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px;
	padding: 4px;
	width: fit-content;
}

.commerce-tabs button {
	background: transparent;
	border: 0;
	border-radius: 6px;
	color: #475569;
	cursor: pointer;
	font: inherit;
	font-weight: 800;
	padding: 8px 12px;
}

.commerce-tabs button.active {
	background: #ffffff;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
	color: #0f766e;
}

.commerce-layout {
	align-items: start;
	display: grid;
	gap: 20px;
	grid-template-columns: minmax(0, 1.35fr) minmax(380px, 0.85fr);
}

.commerce-list-panel {
	min-width: 0;
}

.commerce-table-wrap {
	max-height: 720px;
}

.commerce-table tbody tr {
	cursor: pointer;
}

.commerce-table tbody tr:hover td {
	background: #f8fafc;
}

.commerce-table tbody tr.selected td {
	background: #ecfdf5;
}

.commerce-detail-panel {
	display: grid;
	gap: 16px;
	min-width: 0;
	position: sticky;
	top: 84px;
}

.detail-header {
	align-items: flex-start;
	display: flex;
	gap: 12px;
	justify-content: space-between;
	min-width: 0;
}

.detail-header h2 {
	font-size: 24px;
	line-height: 1.15;
	margin: 0;
	overflow-wrap: anywhere;
}

.status-stack {
	align-items: flex-end;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: flex-end;
}

.status-badge {
	background: #eef2ff;
	border: 1px solid #c7d2fe;
	border-radius: 999px;
	color: #3730a3;
	display: inline-flex;
	font-size: 12px;
	font-weight: 800;
	max-width: 100%;
	overflow-wrap: anywhere;
	padding: 5px 8px;
	text-transform: uppercase;
}

.status-badge.paid,
.status-badge.fulfilled,
.status-badge.active {
	background: #ecfdf5;
	border-color: #99f6e4;
	color: #0f766e;
}

.status-badge.pending,
.status-badge.partially_fulfilled,
.status-badge.unfulfilled,
.status-badge.draft {
	background: #fffbeb;
	border-color: #fde68a;
	color: #92400e;
}

.status-badge.voided,
.status-badge.refunded,
.status-badge.cancelled,
.status-badge.canceled,
.status-badge.archived {
	background: #fff1f2;
	border-color: #fecdd3;
	color: #be123c;
}

.copy-token {
	align-items: center;
	display: inline-flex;
	gap: 6px;
	max-width: 100%;
	min-width: 0;
}

.copy-token code {
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	color: #334155;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
	font-size: 12px;
	line-height: 1.4;
	overflow: hidden;
	padding: 3px 6px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.copy-token button {
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	color: #475569;
	cursor: pointer;
	font: inherit;
	font-size: 12px;
	font-weight: 800;
	padding: 3px 6px;
}

.copy-token button:hover {
	border-color: #0f766e;
	color: #0f766e;
}

.detail-metrics {
	display: grid;
	gap: 10px;
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-tile {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	display: grid;
	gap: 4px;
	min-width: 0;
	padding: 10px;
}

.metric-tile span {
	color: #64748b;
	font-size: 12px;
	font-weight: 800;
	text-transform: uppercase;
}

.metric-tile strong {
	color: #0f172a;
	line-height: 1.25;
	overflow-wrap: anywhere;
}

.compact-grid {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 12px;
}

.mini-table-block {
	display: grid;
	gap: 10px;
	min-width: 0;
}

.mini-table-block h3 {
	font-size: 16px;
	margin: 0;
}

.mini-table {
	font-size: 13px;
	min-width: 640px;
}

.mini-table th,
.mini-table td {
	max-width: 220px;
	padding: 8px 10px;
}

.raw-json {
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	overflow: hidden;
}

.raw-json summary {
	background: #f8fafc;
	color: #475569;
	cursor: pointer;
	font-weight: 800;
	padding: 10px 12px;
}

.raw-json pre {
	background: #0f172a;
	color: #e2e8f0;
	font-size: 12px;
	line-height: 1.5;
	margin: 0;
	max-height: 360px;
	overflow: auto;
	padding: 12px;
}

.data-table-wrap {
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	overflow: auto;
}

.data-table {
	border-collapse: collapse;
	font-size: 14px;
	min-width: 900px;
	width: 100%;
}

.data-table th,
.data-table td {
	border-bottom: 1px solid #e2e8f0;
	max-width: 360px;
	padding: 10px 12px;
	text-align: left;
	vertical-align: top;
}

.data-table th {
	background: #f8fafc;
	color: #475569;
	font-size: 12px;
	font-weight: 800;
	text-transform: uppercase;
	white-space: nowrap;
}

.data-table td {
	color: #0f172a;
	overflow-wrap: anywhere;
}

.data-table tbody tr:last-child td {
	border-bottom: 0;
}

.log-panel {
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	display: grid;
	max-height: 320px;
	overflow: auto;
}

.log-row {
	align-items: start;
	display: grid;
	gap: 10px;
	grid-template-columns: 92px minmax(120px, 0.35fr) minmax(0, 1fr);
	padding: 10px 12px;
}

.log-row + .log-row {
	border-top: 1px solid #e2e8f0;
}

.log-row span {
	color: #64748b;
	font-variant-numeric: tabular-nums;
}

.log-row strong {
	color: #334155;
	overflow-wrap: anywhere;
}

.log-row p {
	margin: 0;
	overflow-wrap: anywhere;
}

.log-row small {
	color: #64748b;
	display: block;
	font-size: 12px;
	line-height: 1.5;
	margin-top: 4px;
}

.log-row.error p,
.log-row.error strong {
	color: #be123c;
}

.log-row.warn p,
.log-row.warn strong {
	color: #92400e;
}

.card h2 {
	font-size: 20px;
	margin: 0 0 6px;
}

.card p {
	color: #64748b;
	margin: 0;
}

.status {
	background: #ecfdf5;
	border: 1px solid #99f6e4;
	border-radius: 999px;
	color: #0f766e;
	font-size: 12px;
	font-weight: 800;
	padding: 6px 10px;
}

@media (max-width: 700px) {
	.topbar,
	.panel,
	.card,
	.toolbar.spread {
		align-items: flex-start;
		flex-direction: column;
		gap: 16px;
	}

	.topbar {
		height: auto;
		padding: 18px 20px;
	}

	.two-column,
	.account-row,
	.definition-grid,
	.stream-row,
	.log-row {
		grid-template-columns: 1fr;
	}

	.row-actions {
		width: 100%;
	}

	.row-actions .button {
		flex: 1;
	}
}

@media (max-width: 1050px) {
	.commerce-summary-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.commerce-layout {
		grid-template-columns: 1fr;
	}

	.commerce-detail-panel {
		position: static;
	}
}

@media (max-width: 700px) {
	.commerce-summary-grid,
	.detail-metrics {
		grid-template-columns: 1fr;
	}

	.commerce-tabs,
	.commerce-tabs button {
		width: 100%;
	}

	.commerce-tabs button {
		text-align: left;
	}

	.detail-header {
		display: grid;
	}

	.status-stack {
		align-items: flex-start;
		justify-content: flex-start;
	}
}
