/* Gruber Schanksysteme: black / gray / white with the brand contrast red. */
:root {
	--bg: #f1f1f1;
	--surface: #ffffff;
	--fg: #161616;
	--muted: #6c6c6c;
	--border: #d8d8d8;
	--accent: #e1001a;
	--accent-hover: #b80016;
	--ink: #111111;
}

* {
	box-sizing: border-box;
}

/* Any author display wins over the UA [hidden] rule -- #posFields is a grid and
   stayed visible while the script thought it had hidden it. */
[hidden] {
	/* biome-ignore lint/complexity/noImportantStyles: hidden has to beat every author display rule */
	display: none !important;
}

body {
	margin: 0;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	background: var(--bg);
	color: var(--fg);
	line-height: 1.5;
}

main {
	margin: 2.5rem auto;
	padding: 0 1rem;
}
main.narrow {
	max-width: 640px;
}
main.wide {
	max-width: 1100px;
}

h1 {
	font-size: 1.6rem;
	margin: 0.25rem 0 0.8rem;
	letter-spacing: -0.01em;
}
h2 {
	font-size: 1.05rem;
	margin: 0 0 0.6rem;
}
h2 small {
	color: var(--muted);
	font-weight: 400;
	font-size: 0.8rem;
}
h3 {
	font-size: 1rem;
	margin: 0 0 0.6rem;
}
h3 small {
	color: var(--muted);
	font-weight: 400;
	font-size: 0.8rem;
}

h2.section {
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
	margin: 1.3rem 0 0.6rem;
	padding-bottom: 0.3rem;
	border-bottom: 1px solid var(--border);
}

.eyebrow {
	color: var(--accent);
	font-size: 0.74rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	margin: 0;
}

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 1rem 1.1rem;
	margin-bottom: 1rem;
}

.card.warn {
	border-left: 4px solid var(--accent);
}

/* Two columns, never three: the sections hold two or four cards, and a third
   would leave a lone card on the second row. */
.grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem;
}
@media (max-width: 720px) {
	.grid {
		grid-template-columns: 1fr;
	}
}

.row {
	display: flex;
	gap: 1rem;
	flex-wrap: wrap;
}
.row > div {
	flex: 1 1 200px;
}

.steps {
	list-style: none;
	margin: 0.3rem 0 0;
	padding: 0;
}
.steps li {
	display: flex;
	align-items: baseline;
	gap: 0.5rem;
	padding: 0.15rem 0;
	color: var(--muted);
}
.steps li::before {
	content: "○";
	width: 1rem;
	flex: none;
	text-align: center;
}
.steps li.done {
	color: var(--ink);
}
.steps li.done::before {
	content: "●";
	color: var(--accent);
}
.steps .when {
	margin-left: auto;
	font-size: 0.8rem;
	color: var(--muted);
}

/* Marks a heading as belonging to an optional part of the contract. */
.tag {
	display: inline-block;
	vertical-align: middle;
	margin-left: 0.4rem;
	padding: 0.1rem 0.4rem;
	border: 1px solid var(--border);
	border-radius: 3px;
	background: #f3f3f3;
	color: var(--muted);
	font-size: 0.7rem;
	font-weight: 500;
	letter-spacing: 0.02em;
	text-transform: none;
}

/* Generic rules first, then ascending specificity (noDescendingSpecificity).
   .caption captions an output; a bare <label> announces nothing. */
label,
.caption {
	display: block;
	font-size: 0.8rem;
	color: var(--muted);
	margin-top: 0.6rem;
}

input,
select,
button {
	font: inherit;
	padding: 0.45rem 0.6rem;
	border: 1px solid var(--border);
	border-radius: 3px;
	width: 100%;
	margin-top: 0.2rem;
	background: #fff;
	color: var(--fg);
}
input:focus,
select:focus {
	outline: 2px solid var(--ink);
	outline-offset: -1px;
	border-color: var(--ink);
}

/* Outline only: the primary is set apart by a black hairline, not by a fill. */
button {
	width: auto;
	margin-top: 1rem;
	cursor: pointer;
	background: #fff;
	border-color: #8a8a8a;
	color: var(--fg);
	font-weight: 600;
}
button:hover {
	background: #f2f2f2;
	border-color: var(--ink);
}
button.primary {
	border-color: var(--ink);
}
button.primary:hover {
	background: #f2f2f2;
}
input[type="checkbox"] {
	width: auto;
	margin: 0 0.4rem 0 0;
	vertical-align: middle;
}

/* auto-fit wraps on narrow screens; the label margin gives the row gap. */
.fields {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
	gap: 0 0.8rem;
}
/* Wraps: the grid columns go down to 280px, which two buttons do not share. */
.fieldrow {
	display: flex;
	align-items: flex-end;
	flex-wrap: wrap;
	gap: 0.8rem;
	margin-top: 0.6rem;
}
.fieldrow > .fields {
	flex: 1;
}
.fieldrow .field label {
	margin-top: 0;
}
.fieldrow > button {
	margin-top: 0;
	white-space: nowrap;
}

pre.mono,
.mono {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	background: #f3f3f3;
	border: 1px solid var(--border);
	padding: 0.5rem 0.7rem;
	border-radius: 3px;
	/* A token or SPKI pin outruns the card column; a scrollbar would hide it. */
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	font-size: 0.85rem;
}

.tablewrap {
	max-height: 260px;
	overflow-y: auto;
}
table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}
th,
td {
	text-align: left;
	padding: 0.35rem 0.5rem;
	border-bottom: 1px solid var(--border);
}
th {
	color: var(--ink);
	font-weight: 700;
}
.tablewrap th {
	position: sticky;
	top: 0;
	background: var(--surface);
}
td.muted,
.muted {
	color: var(--muted);
}
tr.fetched td {
	color: var(--muted);
} /* transactions a Kasse has already pulled */

.catalog td {
	padding: 0.25rem 0.4rem;
}
.catalog input {
	margin-top: 0;
	padding: 0.3rem 0.45rem;
}
.catalog td:last-child {
	width: 1%;
	white-space: nowrap;
}
.rowdel {
	margin-top: 0;
	padding: 0.2rem 0.55rem;
	line-height: 1;
	color: var(--muted);
}
.rowdel:hover {
	color: var(--accent);
	border-color: var(--accent);
}

.hint {
	color: var(--muted);
	font-size: 0.85rem;
}
/* Checkbox and text on one line, unlike the stacked form labels above. */
.toggle {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin-top: 0;
}
.toggle input {
	margin: 0;
}
a {
	color: var(--ink);
	text-decoration: underline;
}
a:hover {
	color: #000;
}

/* The column shrinks to its content, so the columns left of it get the width.
   Below the link rules on purpose -- the link margin must win. */
td.actions {
	width: 1%;
	white-space: nowrap;
	text-align: right;
}
/* Weighted like a button next to the muted delete: opening the management page
   is what a partner comes back for. */
td.actions a {
	margin-right: 0.7rem;
	padding: 0.2rem 0.55rem;
	border: 1px solid var(--ink);
	border-radius: 3px;
	text-decoration: none;
	font-weight: 600;
}
td.actions a:hover {
	background: #f2f2f2;
}

.toast {
	position: fixed;
	top: 1rem;
	left: 50%;
	transform: translateX(-50%);
	max-width: 92%;
	background: var(--ink);
	color: #fff;
	padding: 0.6rem 1rem;
	border-radius: 4px;
	border-left: 4px solid transparent;
	font-size: 0.9rem;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
	z-index: 1000;
}
.toast.err {
	border-left-color: var(--accent);
}
