/* ============================================================
   Surface System v2 — data display
   Tables, key/value lists, timelines and list rows. Built for the
   operator screens but usable anywhere; every table becomes a stack
   of cards on small screens instead of a horizontal scroll.
   ============================================================ */

.s-table-wrap {
	background: var(--s-raised);
	border: 1px solid var(--s-hairline);
	border-radius: calc(var(--s-radius-md) * var(--s-radius-scale));
	box-shadow: var(--s-shadow-raised);
	overflow: hidden;
}
.s-table-wrap--scroll { overflow-x: auto; }

.s-table {
	width: 100%;
	border-collapse: collapse;
	font-size: .92rem;
}
.s-table thead th {
	position: sticky;
	top: 0;
	z-index: 2;
	background: var(--s-sunken);
	text-align: start;
	font-size: .74rem;
	font-weight: 700;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--seraj-muted);
	padding: .8rem var(--s-pad);
	white-space: nowrap;
	border-bottom: 1px solid var(--s-hairline);
}
.s-table--static thead th { position: static; }
.s-table td {
	padding: .85rem var(--s-pad);
	border-bottom: 1px solid var(--s-hairline);
	vertical-align: middle;
}
.s-table tbody tr:last-child td { border-bottom: 0; }
.s-table tbody tr { transition: background-color var(--s-fast) var(--s-ease); }
.s-table tbody tr:hover { background: var(--s-sunken); }
.s-table tbody tr.is-selected { background: var(--s-tint); }
.s-table__num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.s-table__strong { font-weight: 600; }
.s-table__muted { color: var(--seraj-muted); font-size: .86rem; }
.s-table__actions { display: flex; gap: .3rem; justify-content: flex-end; }
.s-table tfoot td {
	background: var(--s-sunken);
	font-weight: 700;
	border-top: 1px solid var(--s-hairline);
}

/* Zebra is opt-in; hover already carries the row. */
.s-table--zebra tbody tr:nth-child(even) { background: color-mix(in srgb, var(--seraj-text) 2%, transparent); }

/* --- Card-per-row on mobile -------------------------------------------
   Add data-label="Column name" to each <td> and the table restacks. */
@media (max-width: 760px) {
	.s-table--stack,
	.s-table--stack thead,
	.s-table--stack tbody,
	.s-table--stack tr,
	.s-table--stack td { display: block; width: 100%; }
	.s-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
	.s-table--stack tbody tr {
		border: 1px solid var(--s-hairline);
		border-radius: calc(var(--s-radius-sm) * var(--s-radius-scale));
		margin-bottom: var(--s-gap-sm);
		padding: .35rem 0;
		background: var(--s-raised);
	}
	.s-table--stack td {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: var(--s-gap);
		border-bottom: 0;
		padding: .45rem var(--s-pad);
		text-align: end;
	}
	.s-table--stack td::before {
		content: attr(data-label);
		flex: 0 0 auto;
		font-size: .74rem;
		font-weight: 700;
		letter-spacing: .06em;
		text-transform: uppercase;
		color: var(--seraj-muted);
		text-align: start;
	}
	.s-table--stack td:empty { display: none; }
	.s-table--stack .s-table__actions { justify-content: flex-end; }
	.s-table-wrap { border: 0; background: none; box-shadow: none; }
}

/* ---------- Key / value lists ------------------------------------------ */

.s-kv { display: grid; gap: .55rem; margin: 0; }
.s-kv > div { display: flex; justify-content: space-between; gap: var(--s-gap); align-items: baseline; }
.s-kv dt { color: var(--seraj-muted); font-size: .88rem; }
.s-kv dd { margin: 0; font-weight: 600; text-align: end; font-variant-numeric: tabular-nums; }
.s-kv--total { border-top: 1px solid var(--s-hairline); padding-top: .6rem; margin-top: .2rem; }
.s-kv--total dd { font-size: 1.1rem; }

/* ---------- List rows ---------------------------------------------------- */

.s-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.s-list__row {
	display: flex;
	align-items: center;
	gap: var(--s-gap);
	padding: .85rem var(--s-pad);
	border-bottom: 1px solid var(--s-hairline);
	transition: background-color var(--s-fast) var(--s-ease);
}
.s-list__row:last-child { border-bottom: 0; }
.s-list__row:hover { background: var(--s-sunken); }
.s-list__thumb {
	flex: 0 0 auto;
	width: 52px;
	height: 52px;
	border-radius: calc(var(--s-radius-xs) * var(--s-radius-scale));
	object-fit: cover;
	background: var(--s-sunken);
}
.s-list__main { flex: 1 1 auto; min-width: 0; }
.s-list__title { font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.s-list__meta { margin: .15rem 0 0; font-size: .85rem; color: var(--seraj-muted); }
.s-list__end { flex: 0 0 auto; display: flex; align-items: center; gap: .5rem; }

/* ---------- Timeline ------------------------------------------------------ */

.s-timeline { list-style: none; margin: 0; padding: 0 0 0 1.35rem; position: relative; }
.s-timeline::before {
	content: "";
	position: absolute;
	inset-block: .55rem;
	inset-inline-start: 4px;
	width: 2px;
	background: var(--s-hairline);
}
.s-timeline__item { position: relative; padding-bottom: 1.1rem; }
.s-timeline__item::before {
	content: "";
	position: absolute;
	inset-inline-start: -1.35rem;
	top: .45rem;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--s-raised);
	border: 2px solid var(--seraj-primary);
}
.s-timeline__item--done::before { background: var(--seraj-primary); }
.s-timeline__item--muted::before { border-color: var(--s-line); }
.s-timeline__title { font-weight: 600; }
.s-timeline__time { display: block; font-size: .8rem; color: var(--seraj-muted); }

/* ---------- Progress ------------------------------------------------------- */

.s-progress { height: 8px; border-radius: var(--s-radius-pill); background: var(--s-sunken); overflow: hidden; }
.s-progress__bar { height: 100%; border-radius: inherit; background: var(--seraj-primary); transition: width var(--s-slow) var(--s-ease); }
