/* Club Manager CP: same palette as the app's UI v2 (css/theme.css) */
:root {
	--brand: #1d6fd8;
	--brand-hover: #175bb3;
	--brand-soft: #e8f1fc;
	--ink: #0f172a;
	--ink-2: #334155;
	--muted: #64748b;
	--bg: #f4f6f9;
	--surface: #ffffff;
	--surface-2: #f8fafc;
	--border: #e2e8f0;
	--border-strong: #cbd5e1;
	--ok: #15803d;
	--ok-soft: #dcfce7;
	--danger: #dc2626;
	--danger-soft: #fef2f2;
	--nav-bg: #0f172a;
	--radius: 12px;
	--radius-sm: 8px;
	--shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
	--font: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	font-family: var(--font);
	font-size: 14px;
	line-height: 1.5;
	color: var(--ink);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { margin: 0 0 14px; font-size: 13px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono, code { font-family: var(--mono); font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }

.wrap {
	max-width: 1200px;
	margin: 0 auto;
	padding-left: max(16px, env(safe-area-inset-left, 0px));
	padding-right: max(16px, env(safe-area-inset-right, 0px));
}
main.wrap { padding-block: 24px 64px; }

/* top bar */
.topbar { background: var(--nav-bg); color: #cbd5e1; }
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 56px; }
.brand { color: #fff; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand span, .login h1 span {
	margin-left: 4px; padding: 2px 8px; font-size: 11px; font-weight: 600;
	color: #93c5fd; background: rgba(147, 197, 253, 0.14); border-radius: 999px; vertical-align: 2px;
}
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { color: #94a3b8; padding: 8px 12px; border-radius: var(--radius-sm); font-weight: 600; }
.topbar nav a:hover { color: #fff; text-decoration: none; }
.topbar nav a.current { color: #fff; background: rgba(255, 255, 255, 0.08); }
.user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; }
.user a { color: #cbd5e1; }

/* blocks */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.back { display: inline-block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 20px;
	margin-bottom: 20px;
	min-width: 0;
}
.empty { color: var(--muted); }
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-weight: 500; background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--danger-soft); color: var(--danger); }

.pill {
	display: inline-block; padding: 2px 9px; margin: 1px 2px 1px 0;
	font-size: 11.5px; font-weight: 600; line-height: 1.6;
	color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
	white-space: nowrap;
}
h1 .pill { font-size: 12px; }
.pill.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.pill.off { color: var(--muted); background: var(--surface-2); }
.pill.accent { color: var(--brand); background: var(--brand-soft); border-color: transparent; }

/* forms */
label { font-weight: 500; color: var(--ink-2); }
input, select, textarea {
	width: 100%;
	font: inherit;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	padding: 8px 10px;
	min-height: 38px;
}
textarea { resize: vertical; line-height: 1.5; }
input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--brand); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29, 111, 216, 0.15); }
button {
	font: inherit; font-weight: 600; cursor: pointer;
	min-height: 38px; padding: 0 16px;
	color: var(--ink-2); background: var(--surface);
	border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
button:hover { background: var(--surface-2); }
button.primary { color: #fff; background: var(--brand); border-color: var(--brand); }
button.primary:hover { background: var(--brand-hover); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack button { margin-top: 6px; align-self: flex-start; }
.check { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.hint { font-size: 12px; font-weight: 400; color: var(--muted); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; align-items: end; }
.grid-form label { display: block; margin-bottom: 6px; }
.affix { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.affix input { border: 0; min-width: 0; }
.affix input:focus { box-shadow: none; }
.affix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29, 111, 216, 0.15); }
.affix span { padding-right: 10px; color: var(--muted); white-space: nowrap; font-size: 13px; }

/* tables */
.table-wrap { padding: 0; overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
.list th {
	text-align: left; padding: 10px 16px;
	font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
	color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.list td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.list tr:last-child td { border-bottom: 0; }
.list tbody tr:hover td { background: var(--surface-2); }
.list .num { text-align: right; font-variant-numeric: tabular-nums; }
.clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* tenant page */
.columns { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.setting {
	display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; gap: 8px 16px; align-items: start;
	padding: 12px 0; border-top: 1px solid var(--border);
}
.setting:first-of-type { border-top: 0; padding-top: 0; }
.setting-label { display: flex; flex-direction: column; gap: 2px; padding-top: 8px; }
.setting-label code { color: var(--muted); font-size: 11.5px; word-break: break-all; }
.setting .delete { display: flex; align-items: center; gap: 6px; padding-top: 9px; font-size: 12px; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; }
.setting.to-delete .setting-label, .setting.to-delete .setting-input { opacity: 0.4; text-decoration: line-through; }
.setting.to-delete .delete { color: var(--danger); }
.savebar {
	position: sticky; bottom: 0; z-index: 5;
	display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
	padding: 12px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
	background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(6px);
	border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.history li { display: flex; flex-direction: column; }

/* login */
.login { max-width: 380px; margin: 10vh auto 0; }
.login h1 { justify-content: center; }
.login > p { text-align: center; margin: 6px 0 20px; }
.login .stack button { align-self: stretch; }

@media (max-width: 900px) {
	.columns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
	.topbar-inner { gap: 12px; }
	.user span { display: none; }
	.setting { grid-template-columns: minmax(0, 1fr) auto; }
	.setting-label { grid-column: 1 / -1; padding-top: 0; }
	.setting .delete { padding-top: 9px; }
	.list th:nth-child(2), .list td:nth-child(2), .list th:nth-child(5), .list td:nth-child(5) { display: none; }
}

/* roles */
.role {
	margin-left: 4px; padding: 1px 7px; font-size: 11px; font-weight: 600;
	color: #cbd5e1; background: rgba(255, 255, 255, 0.08); border-radius: 999px;
}
.label { font-weight: 500; color: var(--ink-2); }
.readonly {
	display: block; padding: 8px 10px; color: var(--ink-2);
	background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
}
