/*
 * Kartenwerk console.
 *
 * Built on the Schichtwerke identity: near-black, one orange, and a lot of
 * paper-white space. The colour is used for exactly two things — the active
 * item in the sidebar and the primary action on screen — so that when it does
 * appear, it means "this one".
 */

:root {
	--ink:        #1a1a1a;
	--ink-soft:   #4a4a4a;
	--ink-faint:  #8a8a8a;
	--paper:      #f6f5f3;
	--card:       #ffffff;
	--line:       #e4e2de;
	--line-soft:  #efedea;

	--accent:     #E85D04;
	--accent-dim: #c94f03;
	--accent-wash:#fdf0e6;

	--ok:         #1f7a4d;
	--ok-wash:    #e8f4ee;
	--warn:       #a86800;
	--warn-wash:  #fdf4e3;
	--bad:        #b3261e;
	--bad-wash:   #fbeceb;

	--sidebar:    #1a1a1a;
	--sidebar-2:  #262626;

	--radius:     10px;
	--radius-sm:  7px;
	--shadow:     0 1px 2px rgba(26, 26, 26, .06), 0 8px 24px rgba(26, 26, 26, .05);

	--font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	--mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--accent-dim); }

.boot {
	display: grid;
	place-items: center;
	min-height: 100vh;
	color: var(--ink-faint);
	letter-spacing: .02em;
}

/* ------------------------------------------------------------------ Sign in */

.signin {
	display: grid;
	place-items: center;
	min-height: 100vh;
	padding: 24px;
}

.signin-box {
	width: 100%;
	max-width: 380px;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 34px 30px 30px;
}

.signin-mark { display: flex; justify-content: center; margin-bottom: 22px; }

.signin h1 {
	margin: 0 0 4px;
	font-size: 19px;
	font-weight: 800;
	letter-spacing: -.02em;
	text-align: center;
}

.signin .sub {
	margin: 0 0 26px;
	text-align: center;
	color: var(--ink-faint);
	font-size: 13px;
}

/* -------------------------------------------------------------------- Shell */

.shell { display: flex; min-height: 100vh; }

.sidebar {
	width: 246px;
	flex: 0 0 246px;
	background: var(--sidebar);
	color: #fff;
	display: flex;
	flex-direction: column;
	padding: 20px 14px 14px;
	position: sticky;
	top: 0;
	height: 100vh;
}

.brand {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 0 8px 20px;
}

.brand-mark {
	width: 34px; height: 34px;
	border-radius: 8px;
	background: #fff;
	display: grid;
	place-items: center;
	flex: 0 0 34px;
}

.brand-name {
	font-weight: 800;
	font-size: 14px;
	letter-spacing: .01em;
	line-height: 1.15;
}

.brand-sub {
	font-size: 10px;
	letter-spacing: .18em;
	color: #8d8d8d;
	text-transform: uppercase;
}

.nav { flex: 1; overflow-y: auto; margin: 0 -4px; }

.nav-group {
	padding: 16px 12px 6px;
	font-size: 10px;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: #7a7a7a;
}

.nav-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	border-radius: var(--radius-sm);
	color: #cfcfcf;
	cursor: pointer;
	font-size: 14px;
	user-select: none;
}

.nav-item:hover { background: var(--sidebar-2); color: #fff; }

.nav-item.active {
	background: var(--accent);
	color: #fff;
	font-weight: 600;
}

.nav-item svg { flex: 0 0 auto; opacity: .9; }

.sidebar-foot {
	border-top: 1px solid #303030;
	padding-top: 12px;
	margin-top: 8px;
}

.who {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 8px 10px;
	font-size: 12.5px;
}

.avatar {
	width: 28px; height: 28px;
	border-radius: 50%;
	background: var(--accent);
	display: grid;
	place-items: center;
	font-weight: 700;
	font-size: 12px;
	flex: 0 0 28px;
}

.who-name { font-weight: 600; }
.who-role { color: #8d8d8d; font-size: 11px; }

/* ------------------------------------------------------------------ Content */

.content {
	flex: 1;
	min-width: 0;
	padding: 26px 30px 60px;
	max-width: 1180px;
}

.page-head {
	display: flex;
	align-items: flex-end;
	gap: 14px;
	margin-bottom: 22px;
	flex-wrap: wrap;
}

.page-head h1 {
	margin: 0;
	font-size: 23px;
	font-weight: 800;
	letter-spacing: -.025em;
}

.page-head .lede {
	margin: 3px 0 0;
	color: var(--ink-faint);
	font-size: 13.5px;
}

.spacer { flex: 1; }

/* ------------------------------------------------------------------- Panels */

.panel {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	margin-bottom: 18px;
	overflow: hidden;
}

.panel-head {
	padding: 15px 18px;
	border-bottom: 1px solid var(--line-soft);
	display: flex;
	align-items: center;
	gap: 12px;
}

.panel-head h2 {
	margin: 0;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: -.01em;
}

.panel-head .note {
	margin: 2px 0 0;
	font-size: 12.5px;
	color: var(--ink-faint);
	font-weight: 400;
}

.panel-body { padding: 18px; }
.panel-body.tight { padding: 0; }

/* --------------------------------------------------------------------- Bits */

.stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 12px;
	margin-bottom: 20px;
}

.stat {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 14px 16px;
}

.stat-label {
	font-size: 11px;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

.stat-value {
	font-size: 27px;
	font-weight: 800;
	letter-spacing: -.03em;
	line-height: 1.15;
	margin-top: 4px;
}

.stat-hint { font-size: 12px; color: var(--ink-faint); }

/* ------------------------------------------------------------------- Tables */

table.list {
	width: 100%;
	border-collapse: collapse;
	font-size: 13.5px;
}

table.list th {
	text-align: left;
	font-size: 10.5px;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--ink-faint);
	font-weight: 600;
	padding: 11px 18px;
	border-bottom: 1px solid var(--line-soft);
	white-space: nowrap;
}

table.list td {
	padding: 11px 18px;
	border-bottom: 1px solid var(--line-soft);
	vertical-align: middle;
}

table.list tr:last-child td { border-bottom: none; }
table.list tbody tr:hover { background: #fafaf9; }
table.list tr.clickable { cursor: pointer; }

.table-scroll { overflow-x: auto; }

.strong { font-weight: 600; }
.muted { color: var(--ink-faint); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* -------------------------------------------------------------------- Chips */

.chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 2px 9px;
	border-radius: 999px;
	font-size: 11.5px;
	font-weight: 600;
	white-space: nowrap;
	border: 1px solid transparent;
}

.chip.ok    { background: var(--ok-wash);     color: var(--ok);     border-color: #cfe6da; }
.chip.warn  { background: var(--warn-wash);   color: var(--warn);   border-color: #f0e0bd; }
.chip.bad   { background: var(--bad-wash);    color: var(--bad);    border-color: #f3d3d1; }
.chip.info  { background: var(--accent-wash); color: var(--accent-dim); border-color: #f7d9bf; }
.chip.plain { background: #f2f1ef;            color: var(--ink-soft); border-color: var(--line); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------------ Buttons */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 8px 14px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
	background: var(--card);
	color: var(--ink);
	font: inherit;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

.btn:hover { background: #fafaf9; border-color: #d8d5d0; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn.primary {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
}
.btn.primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); }

.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: #000; }

.btn.danger { color: var(--bad); border-color: #f0cfcd; background: var(--bad-wash); }
.btn.danger:hover { background: #f7dedc; }

.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.block { width: 100%; }

.toolbar {
	display: flex;
	align-items: center;
	gap: 9px;
	flex-wrap: wrap;
	margin-bottom: 14px;
}

/* ------------------------------------------------------------------- Fields */

.field { margin-bottom: 15px; }

.field label {
	display: block;
	font-size: 11px;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ink-soft);
	font-weight: 600;
	margin-bottom: 5px;
}

.field input,
.field select,
.field textarea {
	width: 100%;
	padding: 9px 11px;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--card);
	color: var(--ink);
	font: inherit;
	font-size: 14px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-wash);
}

.field textarea { resize: vertical; min-height: 68px; }
.field .hint { margin-top: 5px; font-size: 12.5px; color: var(--ink-faint); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.check {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	margin-bottom: 15px;
	cursor: pointer;
}

.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }
.check .t { font-size: 14px; }
.check .h { font-size: 12.5px; color: var(--ink-faint); }

/* ------------------------------------------------------------------ Notices */

.notice {
	display: flex;
	gap: 11px;
	padding: 12px 14px;
	border-radius: var(--radius-sm);
	font-size: 13.5px;
	margin-bottom: 16px;
	border: 1px solid;
	align-items: flex-start;
}

.notice.info { background: var(--accent-wash); border-color: #f7d9bf; color: #7a3502; }
.notice.warn { background: var(--warn-wash);   border-color: #f0e0bd; color: #7a4b00; }
.notice.bad  { background: var(--bad-wash);    border-color: #f3d3d1; color: #8c1d17; }
.notice.ok   { background: var(--ok-wash);     border-color: #cfe6da; color: #145c39; }

.empty {
	padding: 34px 18px;
	text-align: center;
	color: var(--ink-faint);
	font-size: 13.5px;
}

/* ------------------------------------------------------------------- Dialog */

.backdrop {
	position: fixed;
	inset: 0;
	background: rgba(26, 26, 26, .42);
	display: grid;
	place-items: center;
	padding: 20px;
	z-index: 60;
}

.dialog {
	background: var(--card);
	border-radius: var(--radius);
	width: 100%;
	max-width: 460px;
	max-height: 88vh;
	overflow-y: auto;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

.dialog-head {
	padding: 18px 20px 4px;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: -.02em;
}

.dialog-body { padding: 14px 20px 4px; }

.dialog-foot {
	padding: 12px 20px 18px;
	display: flex;
	gap: 9px;
	justify-content: flex-end;
}

/* ------------------------------------------------------------------- Toasts */

.toasts {
	position: fixed;
	right: 18px;
	bottom: 18px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	z-index: 80;
}

.toast {
	background: var(--ink);
	color: #fff;
	padding: 11px 15px;
	border-radius: var(--radius-sm);
	font-size: 13.5px;
	box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
	max-width: 380px;
	animation: rise .18s ease-out;
}

.toast.bad { background: var(--bad); }
.toast.ok  { background: var(--ok); }

@keyframes rise {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------- Secret shown */

.secret {
	font-family: var(--mono);
	font-size: 17px;
	font-weight: 600;
	letter-spacing: .04em;
	background: var(--ink);
	color: #fff;
	padding: 13px 16px;
	border-radius: var(--radius-sm);
	text-align: center;
	user-select: all;
	margin: 4px 0 10px;
}

/* -------------------------------------------------------------- Small print */

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--ink-faint); }
.kv dd { margin: 0; }

.seg {
	display: inline-flex;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	overflow: hidden;
	background: var(--card);
}

.seg button {
	border: none;
	background: none;
	font: inherit;
	font-size: 13px;
	padding: 7px 13px;
	cursor: pointer;
	color: var(--ink-soft);
	border-right: 1px solid var(--line);
}

.seg button:last-child { border-right: none; }
.seg button.on { background: var(--ink); color: #fff; font-weight: 600; }

.search {
	flex: 1;
	min-width: 180px;
	max-width: 320px;
	padding: 8px 11px;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	font: inherit;
	font-size: 13.5px;
	background: var(--card);
}

.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }

/* -------------------------------------------------------------- Narrow view */

@media (max-width: 860px) {
	.shell { flex-direction: column; }

	.sidebar {
		width: 100%;
		flex: none;
		height: auto;
		position: static;
		padding-bottom: 8px;
	}

	.nav { display: flex; overflow-x: auto; gap: 4px; }
	.nav-group { display: none; }
	.nav-item { white-space: nowrap; }
	.sidebar-foot { display: flex; align-items: center; gap: 10px; }
	.who { padding-bottom: 6px; }

	.content { padding: 20px 16px 50px; }
	.row, .row-3 { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------- Rule editor */

/*
 * One entry in an editable list — a rule inside a product, for instance.
 * Boxed rather than a plain row: the list grows and shrinks while somebody is
 * looking at it, and a border is what makes "these three fields belong
 * together" survive that.
 */
/*
 * A rule card, inside the tinted rules area.
 *
 * The previous version was #fbfaf9 on a white dialog — one and a half percent
 * apart, with a hairline border. On a decent monitor at a decent angle it was
 * invisible, and the rule editor read as a blank space with numbers floating
 * in it. Layering fixes it: white dialog, grey area, white cards, real border.
 */
.item {
	border: 1px solid #d9d6d1;
	border-radius: var(--radius-sm);
	background: var(--card);
	margin-bottom: 8px;
	box-shadow: 0 1px 2px rgba(26, 26, 26, .04);
}

/** The area the rule cards sit in — the middle layer that makes them show. */
.rules-box {
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	padding: 14px;
	margin-top: 8px;
}

.rules-box .empty {
	padding: 16px;
	background: var(--card);
	border: 1px dashed #d9d6d1;
	border-radius: var(--radius-sm);
}

/** Inside the tinted area a white control needs its own edge. */
.rules-box select,
.rules-box .search {
	background: var(--card);
	border-color: #d9d6d1;
}

.item-head {
	display: flex;
	align-items: center;
	gap: 10px;
}

.item-head .name {
	font-weight: 600;
	font-size: 13.5px;
}

.item-head .tag {
	font-family: var(--mono);
	font-size: 11.5px;
	color: var(--ink-faint);
}

.item .field { margin-bottom: 0; }

.item input[type="number"],
.item input[type="time"] {
	padding: 7px 10px;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--card);
	color: var(--ink);
	font: inherit;
	font-size: 14px;
}

.item input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-wash);
}

/* --------------------------------------------------------------- Selection */

/*
 * Picking rows out of a list.
 *
 * Returning twenty cards used to mean typing twenty card numbers into a text
 * box, which is not a thing anybody does twice. The list itself is where the
 * cards already are.
 */
.pick { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

table.list td.pick-cell,
table.list th.pick-cell { width: 38px; padding-right: 0; }

table.list tr.picked td { background: var(--accent-wash); }

/** Floats over the table once something is selected. */
.bulk-bar {
	position: sticky;
	bottom: 16px;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-top: 14px;
	padding: 12px 16px;
	background: var(--ink);
	color: #fff;
	border-radius: var(--radius);
	box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
}

.bulk-bar .count { font-weight: 700; }
.bulk-bar .btn { border-color: #4a4a4a; background: #2a2a2a; color: #fff; }
.bulk-bar .btn:hover { background: #383838; border-color: #5a5a5a; }
.bulk-bar .btn.primary { background: var(--accent); border-color: var(--accent); }
.bulk-bar .btn.primary:hover { background: var(--accent-dim); }

/* ------------------------------------------------------------------ Hints */

/*
 * A warning inside a form, for a choice that is technically fine and often
 * the wrong one. Not an error — the user may well know exactly what they want.
 */
.caveat {
	background: var(--warn-wash);
	border: 1px solid #f0e0bd;
	border-radius: var(--radius-sm);
	padding: 11px 13px;
	font-size: 13px;
	color: #7a4b00;
	margin: -6px 0 16px;
}
