/* pidur — mobile-first review surface. Big tap targets, high contrast, no framework. */

:root {
	--bg: #0d1117;
	--panel: #161b22;
	--line: #262d36;
	--text: #e6edf3;
	--muted: #8b949e;
	--accent: #2f81f7;
	--ok: #3fb950;
	--warn: #d29922;
	--bad: #f85149;
	--radius: 12px;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	padding-bottom: env(safe-area-inset-bottom);
}

header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	padding: 14px 16px 8px;
	position: sticky;
	top: 0;
	background: linear-gradient(var(--bg), rgba(13, 17, 23, 0.85));
	backdrop-filter: blur(8px);
	z-index: 3;
}

h1 {
	font-size: 18px;
	margin: 0;
	letter-spacing: 0.04em;
}

.health {
	font-size: 12px;
	color: var(--muted);
}

.hidden {
	display: none !important;
}

.panel {
	margin: 16px;
	padding: 18px;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

#tabs {
	display: flex;
	gap: 6px;
	padding: 0 12px 10px;
}

.tab {
	flex: 1;
	background: var(--panel);
	color: var(--muted);
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 9px 6px;
	font-size: 14px;
}

.tab.active {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
}

.tabpane {
	padding: 0 12px 28px;
}

.filters {
	display: flex;
	gap: 6px;
	overflow-x: auto;
	padding-bottom: 10px;
}

.chip {
	background: var(--panel);
	color: var(--muted);
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 6px 12px;
	font-size: 13px;
	white-space: nowrap;
}

.chip.active {
	color: var(--text);
	border-color: var(--accent);
}

.search {
	display: block;
	margin-bottom: 10px;
}

/* while searching, the inbox list would just be noise underneath the hits */
.searching .filters,
.searching #inboxList,
.searching #inboxEmpty {
	display: none;
}

mark {
	background: rgba(47, 129, 247, 0.28);
	color: var(--text);
	border-radius: 3px;
	padding: 0 1px;
}

.searchcount {
	padding: 2px 2px 0;
}

.list {	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.card {
	background: var(--panel);
	border: 1px solid var(--line);
	border-left: 4px solid var(--line);
	border-radius: var(--radius);
	padding: 12px 14px;
}

.card.status-pending_approval {
	border-left-color: var(--warn);
}
.card.status-filed {
	border-left-color: var(--ok);
}
.card.status-quarantined,
.card.status-failed {
	border-left-color: var(--bad);
}

.row {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.badge {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	padding: 2px 8px;
	border-radius: 999px;
	background: #21262d;
	color: var(--muted);
}

.badge-pending_approval {
	background: rgba(210, 153, 34, 0.16);
	color: var(--warn);
}
.badge-filed,
.badge-verified {
	background: rgba(63, 185, 80, 0.16);
	color: var(--ok);
}
.badge-quarantined,
.badge-fail,
.badge-failed {
	background: rgba(248, 81, 73, 0.16);
	color: var(--bad);
}

.muted {
	color: var(--muted);
}
.small {
	font-size: 12px;
}
.error {
	color: var(--bad);
	white-space: pre-wrap;
}
.reason {
	font-size: 13px;
	color: var(--warn);
	margin-top: 6px;
}
.gaps {
	margin: 8px 0 0;
	padding-left: 18px;
	font-size: 13px;
	color: var(--muted);
}
.empty {
	text-align: center;
	padding: 40px 10px;
}

button {
	font: inherit;
	border-radius: 10px;
	border: 1px solid var(--line);
	background: var(--panel);
	color: var(--text);
	padding: 12px 16px;
}

button.primary {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
	font-weight: 600;
}

button.danger {
	background: rgba(248, 81, 73, 0.14);
	border-color: var(--bad);
	color: var(--bad);
}

button.ghost {
	background: transparent;
}

button.small-button {
	padding: 4px 10px;
	font-size: 12px;
	margin-left: auto;
}

button:disabled {
	opacity: 0.5;
}

input,
textarea,
select {
	width: 100%;
	background: #0b0f14;
	color: var(--text);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 12px;
	font: inherit;
	margin: 6px 0 12px;
}

.field span {
	font-size: 13px;
	color: var(--muted);
}

.result {
	background: #0b0f14;
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 10px;
	font-size: 12px;
	overflow-x: auto;
	white-space: pre-wrap;
	word-break: break-word;
}

/* ------------------------------- detail sheet ------------------------------- */

.sheet {
	position: fixed;
	inset: 0;
	background: rgba(1, 4, 9, 0.72);
	display: flex;
	align-items: flex-end;
	z-index: 10;
}

.sheet-body {
	background: var(--bg);
	width: 100%;
	max-height: 92vh;
	overflow-y: auto;
	border-top-left-radius: 16px;
	border-top-right-radius: 16px;
	border-top: 1px solid var(--line);
	/* leave room so the last rows can scroll clear of the sticky action bar */
	padding: 14px 16px 120px;
}

.close {
	position: sticky;
	top: 0;
	float: right;
	background: var(--panel);
}

.block {
	border-top: 1px solid var(--line);
	padding: 12px 0;
}

.block h3,
.block h4 {
	margin: 6px 0;
}

.recon {
	border-radius: 10px;
	padding: 10px;
	margin: 8px 0;
	background: #0b0f14;
	border: 1px solid var(--line);
}

.recon-fail {
	border-color: var(--bad);
}

.check {
	font-size: 13px;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	padding: 2px 0;
	word-break: break-word;
}

.check.pass {
	color: var(--ok);
}
.check.fail {
	color: var(--bad);
}

.fieldrow {
	display: grid;
	grid-template-columns: 130px 1fr;
	gap: 10px;
	padding: 8px 0;
	border-bottom: 1px dashed var(--line);
}

.fieldname {
	font-size: 13px;
	color: var(--muted);
	word-break: break-word;
}

.fieldvalue .value {
	font-weight: 600;
	word-break: break-word;
}

/* lists of records (holdings, line items): one block per row — a wide table cannot survive 430 px */
.rows {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 4px 0;
}

.listrow {
	background: #0b0f14;
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 8px 10px;
}

.listheading {
	display: flex;
	gap: 8px;
	align-items: baseline;
	flex-wrap: wrap;
}

.listname {
	color: var(--muted);
	font-size: 13px;
}

.figures {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	margin-top: 4px;
}

.figure {
	display: flex;
	gap: 6px;
	align-items: baseline;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12px;
}

.figlabel {
	color: var(--muted);
	text-transform: lowercase;
}

.figvalue {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.valuelist {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.valueitem {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12px;
	font-weight: 400;
	word-break: break-word;
}

.evidence {
	font-size: 12px;
	color: var(--muted);
	font-style: italic;
	margin-top: 2px;
	word-break: break-word;
}

.computed {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12px;
	color: var(--ok);
	padding: 2px 0;
}

.gap {
	font-size: 13px;
	padding: 4px 0;
	color: var(--muted);
}

.gap.blocking {
	color: var(--warn);
}

.action {
	display: block;
	padding: 4px 0;
	font-size: 13px;
	word-break: break-all;
}

code {
	background: #0b0f14;
	border: 1px solid var(--line);
	border-radius: 6px;
	padding: 1px 6px;
	font-size: 12px;
}

.controls {
	display: flex;
	gap: 10px;
	margin: 14px -16px 0;
	padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
	position: sticky;
	bottom: 0;
	/* opaque, with a border: a translucent bar over scrolling text reads as one garbled line */
	background: var(--panel);
	border-top: 1px solid var(--line);
}

.controls button {
	flex: 1;
}

.effectrow {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 0;
	font-size: 13px;
	flex-wrap: wrap;
}

.auditline {
	padding: 2px 0;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.warn {
	border-left: 3px solid var(--bad);
	padding-left: 10px;
}
