:root {
	color-scheme: light;
	--ink: #08172c;
	--ink-soft: #263d5a;
	--muted: #66788f;
	--line: #d8e0ea;
	--line-strong: #b6c4d6;
	--paper: #f3f6fa;
	--surface: #ffffff;
	--surface-alt: #f7f9fc;
	--navy: #08172c;
	--navy-hover: #17345b;
	--blue: #315d91;
	--blue-wash: #e8eef6;
	--coral: #c0523a;
	--coral-wash: #fff0ec;
	--amber: #805d18;
	--amber-wash: #fff6dd;
	--shadow: 0 24px 70px rgb(23 53 47 / 12%);
}

* { box-sizing: border-box; }

body {
	margin: 0;
	min-width: 320px;
	min-height: 100vh;
	background: var(--paper);
	color: var(--ink);
	font-family: "Avenir Next", "Segoe UI", sans-serif;
	font-size: 15px;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-view {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 28px;
	background-color: var(--paper);
	background-image: linear-gradient(90deg, rgb(12 118 94 / 4%) 1px, transparent 1px), linear-gradient(rgb(12 118 94 / 4%) 1px, transparent 1px);
	background-size: 32px 32px;
}

.login-panel {
	width: min(100%, 430px);
	padding: 38px;
	background: var(--surface);
	border: 1px solid var(--line);
	box-shadow: var(--shadow);
	animation: appear 280ms ease-out both;
}

.brand-lockup {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--ink);
	font-size: 20px;
	font-weight: 800;
	line-height: 1;
	text-decoration: none;
}
.brand-lockup img { width: 38px; height: 38px; border-radius: 4px; object-fit: cover; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.login-panel .eyebrow { margin-top: 40px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 26px; font-size: 30px; font-weight: 700; line-height: 1.18; }
h2 { margin: 0; font-size: 22px; line-height: 1.25; }
h3 { margin: 8px 0 2px; font-size: 15px; }

.form-stack, .dialog-form { display: flex; flex-direction: column; }
.form-stack { gap: 10px; }
label { color: var(--ink-soft); font-size: 13px; font-weight: 700; }
input, select {
	width: 100%;
	min-height: 44px;
	padding: 10px 12px;
	border: 1px solid var(--line-strong);
	border-radius: 3px;
	background: var(--surface);
	color: var(--ink);
	outline: none;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(49 93 145 / 14%); }
input::placeholder { color: #82948d; }

.button {
	min-height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 9px 14px;
	border: 1px solid transparent;
	border-radius: 3px;
	font-size: 13px;
	font-weight: 750;
	white-space: nowrap;
	transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.button:disabled { cursor: wait; opacity: .65; }
.button-primary { background: var(--navy); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--navy-hover); }
.button-quiet { border-color: var(--line); background: transparent; color: var(--ink-soft); }
.button-quiet:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-alt); color: var(--ink); }
.button-danger { border-color: #efc9c0; background: var(--coral-wash); color: #9c3925; }
.button-danger:hover:not(:disabled) { background: #ffe2da; }
.form-stack .button { margin-top: 12px; min-height: 46px; }
.form-error { margin: 4px 0 0; color: #a63d2b; font-size: 13px; font-weight: 650; }
.success-message { margin: 0; color: var(--blue); font-size: 13px; font-weight: 700; }
.notice { margin: 12px 0; color: var(--muted); line-height: 1.5; }

.topbar {
	height: 66px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 30px;
	border-bottom: 1px solid var(--line);
	background: var(--surface);
}
.topbar-account { display: flex; align-items: center; gap: 18px; color: var(--ink-soft); font-size: 13px; font-weight: 650; }
.workspace { min-height: calc(100vh - 66px); display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { padding: 28px 14px; border-right: 1px solid var(--line); background: #e9eef5; }
.sidebar .eyebrow { padding: 0 12px; }
.nav-button {
	width: 100%;
	min-height: 42px;
	padding: 10px 12px;
	border: 0;
	border-radius: 3px;
	background: transparent;
	color: var(--ink-soft);
	text-align: left;
	font-weight: 650;
}
.nav-button:hover, .nav-button[aria-current="page"] { background: var(--surface); color: var(--navy); }
.content { min-width: 0; padding: 36px clamp(20px, 4vw, 58px) 60px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading .eyebrow { margin-bottom: 6px; }
.page-heading h1 { margin: 0; font-size: 28px; }
.table-toolbar { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.table-toolbar label { min-width: 130px; }
.table-toolbar input { max-width: 340px; min-height: 38px; }
.table-wrap { width: 100%; overflow-x: auto; border-top: 1px solid var(--line-strong); }
table { width: 100%; min-width: 720px; border-collapse: collapse; background: var(--surface); }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
td { color: var(--ink-soft); font-size: 13px; }
td:first-child { color: var(--ink); font-weight: 700; }
tbody tr:hover { background: #f8fbf9; }
.tenant-id { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--blue); font-size: 12px; font-weight: 750; }
.status::before { width: 7px; height: 7px; border-radius: 50%; background: #4775aa; content: ""; }
.status-disabled { color: #9c3925; }
.status-disabled::before { background: var(--coral); }
.status-suspended { color: var(--amber); }
.status-suspended::before { background: #c18b26; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-actions .button { min-height: 32px; padding: 6px 9px; font-size: 12px; }
.empty-state { padding: 30px 0; color: var(--muted); }

.dialog {
	width: min(calc(100vw - 32px), 510px);
	max-height: min(90vh, 820px);
	padding: 0;
	border: 1px solid var(--line-strong);
	border-radius: 4px;
	background: var(--surface);
	color: var(--ink);
	box-shadow: var(--shadow);
}
.dialog-wide { width: min(calc(100vw - 32px), 650px); }
.dialog::backdrop { background: rgb(16 38 32 / 45%); backdrop-filter: blur(2px); }
.dialog-form { max-height: 90vh; overflow-y: auto; gap: 9px; padding: 24px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 8px; }
.dialog-heading .eyebrow { margin-bottom: 5px; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: var(--ink-soft); font-size: 21px; line-height: 1; }
.icon-button:hover { background: var(--surface-alt); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row > div { display: flex; flex-direction: column; gap: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.license-key { display: block; padding: 14px; border: 1px dashed var(--line-strong); background: var(--surface-alt); color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; user-select: all; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: min(420px, calc(100vw - 32px)); padding: 13px 16px; border-left: 4px solid #6f94bf; background: var(--ink); color: #fff; box-shadow: var(--shadow); font-size: 13px; animation: appear 180ms ease-out both; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes appear { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
	.login-panel { padding: 28px 22px; }
	.topbar { height: 60px; padding: 0 16px; }
	.topbar-account { gap: 8px; }
	.workspace { min-height: calc(100vh - 60px); grid-template-columns: 1fr; }
	.sidebar { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
	.sidebar .eyebrow { margin: 0 6px 0 0; padding: 0; }
	.nav-button { width: auto; min-height: 36px; }
	.content { padding: 26px 16px 42px; }
	.page-heading { align-items: start; flex-direction: column; margin-bottom: 18px; }
	.page-heading .button { width: 100%; }
	.table-toolbar { align-items: stretch; flex-direction: column; gap: 8px; }
	.table-toolbar input { max-width: none; }
}

@media (max-width: 480px) {
	.form-row { grid-template-columns: 1fr; gap: 9px; }
	.dialog-form { padding: 20px 16px; }
	.topbar-account > span { max-width: 125px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}