/* BWP Experts Billing — X-inspired dark interface.
   Palette: pure black app, compact sidebar, thin grey borders, blue only for
   active navigation, links and selected controls. */

@font-face {
	font-family: "Mona Sans";
	src: url("../fonts/MonaSansVF.woff2") format("woff2");
	font-weight: 200 900;
	font-style: normal;
	font-display: swap;
}

:root {
	--bg: #000000;
	--sidebar: #0A0A0A;
	--card: #16181C;
	--card-2: #202327;
	--border: #2F3336;
	--text: #F2F2F2;
	--muted: #71767B;
	--btn: #EFF3F4;
	--btn-hover: #D7DBDC;
	--btn-text: #0F1419;
	--accent: #1D9BF0;
	--success: #00BA7C;
	--warning: #FFD400;
	--danger: #F4212E;

	--row-hover: rgba(239, 243, 244, 0.035);
	--soft: rgba(239, 243, 244, 0.08);
	--backdrop: rgba(91, 112, 131, 0.4);

	--radius-lg: 16px;
	--radius: 12px;
	--radius-sm: 8px;
	--pill: 9999px;

	--font: "Mona Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--sidebar-w: 248px;
	--topbar-h: 60px;
	color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.45;
	font-optical-sizing: auto;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
	position: absolute; left: 12px; top: -48px; z-index: 100;
	background: var(--btn); color: var(--btn-text); padding: 8px 14px; border-radius: var(--pill); font-weight: 700;
}
.skip-link:focus { top: 12px; }

.icon { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.nowrap { white-space: nowrap; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.right { text-align: right; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------- App shell ---------- */

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
	position: sticky; top: 0; height: 100vh;
	display: flex; flex-direction: column;
	background: var(--sidebar);
	border-right: 1px solid var(--border);
	padding: 10px 10px 12px;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: var(--border) transparent;
}

.brand { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 14px; }
.brand-link { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-link:hover { text-decoration: none; }
.brand-mark svg { width: 32px; height: 32px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { color: var(--muted); font-size: 13px; }
.brand .sidebar-close { display: none; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.nav-section { color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 12px 12px 4px; }
.nav-item {
	display: flex; align-items: center; gap: 14px;
	min-height: 40px; padding: 0 12px;
	border-radius: var(--pill);
	color: var(--text); font-size: 15px; font-weight: 500;
	transition: background-color .15s ease;
}
.nav-item .icon { width: 22px; height: 22px; }
.nav-item:hover { background: var(--soft); text-decoration: none; }
.nav-item.active { color: var(--accent); font-weight: 700; }
.nav-label { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-count {
	min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--pill);
	background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
	display: inline-flex; align-items: center; justify-content: center;
}

.sidebar-user {
	display: flex; align-items: center; gap: 10px;
	margin-top: 12px; padding: 10px 8px 4px;
	border-top: 1px solid var(--border);
}
.sidebar-user-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.25; }
.sidebar-user-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.code-chip { border: 1px solid var(--border); border-radius: 6px; padding: 0 5px; font-size: 11.5px; color: var(--text); font-variant-numeric: tabular-nums; }

.avatar {
	width: 36px; height: 36px; flex: none; border-radius: 50%;
	background: var(--card-2); border: 1px solid var(--border);
	display: inline-flex; align-items: center; justify-content: center;
	font-weight: 700; font-size: 13px; color: var(--text);
}
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
	position: sticky; top: 0; z-index: 20;
	height: var(--topbar-h);
	display: flex; align-items: center; gap: 12px;
	padding: 0 24px;
	background: rgba(0, 0, 0, 0.72);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.topbar-title > div { min-width: 0; }
.topbar-title .back-btn { flex: none; }
.page-title { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-subtitle { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .menu-btn, .topbar .search-btn { display: none; }

.topbar-search { position: relative; width: min(340px, 34vw); }
.topbar-search input {
	width: 100%; height: 40px; padding: 0 16px 0 42px;
	background: var(--card); border: 1px solid var(--border); border-radius: var(--pill);
	color: var(--text); outline: none;
}
.topbar-search input::placeholder { color: var(--muted); }
.topbar-search input:focus { background: var(--bg); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.topbar-search .search-icon { position: absolute; left: 14px; top: 10px; color: var(--muted); }

.bell { position: relative; }
.bell-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }

.content { padding: 20px 24px 64px; width: 100%; max-width: 1280px; }
.content-wide { max-width: none; }
.content:focus { outline: none; }
.page-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.drawer-backdrop { display: none; }

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

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	height: 36px; padding: 0 16px;
	border-radius: var(--pill); border: 1px solid transparent;
	font-size: 14px; font-weight: 700; line-height: 1; white-space: nowrap;
	cursor: pointer; text-decoration: none;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { text-decoration: none; }
.btn .icon { width: 18px; height: 18px; }
.btn[disabled], .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--btn); color: var(--btn-text); }
.btn-primary:hover { background: var(--btn-hover); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--soft); }
.btn-success { background: var(--success); color: var(--btn-text); }
.btn-success:hover { background: #00a56e; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc1e2a; }
.btn-danger-outline { background: transparent; color: var(--danger); border-color: rgba(244, 33, 46, .5); }
.btn-danger-outline:hover { background: rgba(244, 33, 46, .1); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--soft); }
.btn-link { background: none; border: 0; padding: 0; height: auto; color: var(--accent); font-weight: 600; }
.btn-link:hover { text-decoration: underline; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }

.btn-icon {
	display: inline-flex; align-items: center; justify-content: center;
	width: 38px; height: 38px; flex: none;
	border-radius: 50%; border: 0; background: transparent; color: var(--text);
	cursor: pointer; transition: background-color .15s ease;
}
.btn-icon:hover { background: var(--soft); text-decoration: none; }

/* ---------- Cards ---------- */

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card + .card, .card + .grid, .grid + .card, .grid + .grid,
.kpis + .card, .kpis + .grid, .card + .kpis, .grid + .kpis, .kpis + .kpis { margin-top: 16px; }
.card-head {
	display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
	padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-body { padding: 18px 20px; }
.card-body-flush { padding: 0; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); }
.card-elevated { background: var(--card-2); }

.grid { display: grid; gap: 12px; }
.grid > .card { margin-top: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

.kpi {
	background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
	padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.kpi-label { color: var(--muted); font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.kpi-label .icon { width: 18px; height: 18px; }
.kpi-value { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.2; }
.kpi-value .money-line { font-size: 22px; font-variant-numeric: normal; }
.kpi-value .money-line + .money-line { font-size: 16px; color: var(--text); opacity: .9; }
.kpi-foot { color: var(--muted); font-size: 12.5px; }
.kpi-success .kpi-label .icon { color: var(--success); }
.kpi-warning .kpi-label .icon { color: var(--warning); }
.kpi-danger .kpi-label .icon { color: var(--danger); }
a.kpi { color: inherit; transition: border-color .15s ease; }
a.kpi:hover { text-decoration: none; border-color: #3e4246; }

.section-title { font-size: 17px; font-weight: 800; margin: 28px 0 12px; letter-spacing: -0.01em; }
.section-title:first-child { margin-top: 0; }

/* Money lines (multi-currency totals) */
.money-lines { display: inline-flex; flex-direction: column; gap: 2px; }
.money-line { display: inline-flex; gap: 8px; align-items: baseline; white-space: nowrap; font-variant-numeric: tabular-nums; }
.money-line .cur { color: var(--muted); font-size: .72em; font-weight: 600; min-width: 2.6em; }
.money-line.conv { color: var(--muted); font-size: 12.5px; font-weight: 500; }

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

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th {
	text-align: left; font-weight: 500; font-size: 13px; color: var(--muted);
	padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th a { color: var(--muted); }
.table th a.sorted { color: var(--text); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td, .table tbody tr:last-child th { border-bottom: 0; }
.table tbody tr { transition: background-color .12s ease; }
.table tbody tr:hover { background: var(--row-hover); }
.table tr[data-href] { cursor: pointer; }
.table .num, .table .right { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 700; }
.table td .sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.table td .sub.sm-only { display: none; }
.table a.row-link { color: var(--text); font-weight: 700; }
.table a.row-link:hover { color: var(--accent); text-decoration: none; }
.table-compact td, .table-compact th { padding: 9px 14px; }
.table tfoot td { border-top: 1px solid var(--border); border-bottom: 0; font-weight: 700; }

/* ---------- Badges ---------- */

.badge {
	display: inline-flex; align-items: center; gap: 6px;
	height: 24px; padding: 0 10px; border-radius: var(--pill);
	font-size: 12.5px; font-weight: 650; white-space: nowrap;
	border: 1px solid var(--border); background: var(--card-2); color: var(--text);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge .icon { width: 14px; height: 14px; }
.badge-success { color: var(--success); background: rgba(0, 186, 124, .1); border-color: rgba(0, 186, 124, .35); }
.badge-warning { color: var(--warning); background: rgba(255, 212, 0, .08); border-color: rgba(255, 212, 0, .35); }
.badge-danger { color: var(--danger); background: rgba(244, 33, 46, .1); border-color: rgba(244, 33, 46, .4); }
.badge-neutral { color: var(--text); }
.badge-muted { color: var(--muted); background: transparent; }
.badge-outline { background: transparent; }

.days { font-variant-numeric: tabular-nums; white-space: nowrap; }
.days-warning { color: var(--warning); }
.days-danger { color: var(--danger); }
.days-muted { color: var(--text); }

/* ---------- Tabs ---------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
	position: relative; display: inline-flex; align-items: center; gap: 8px;
	padding: 14px 16px; color: var(--muted); font-weight: 600; white-space: nowrap;
	transition: background-color .15s ease, color .15s ease;
}
.tab:hover { background: var(--soft); color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); font-weight: 750; }
.tab.active::after {
	content: ""; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
	width: calc(100% - 24px); min-width: 40px; height: 4px; border-radius: var(--pill); background: var(--accent);
}
.tab-count { font-size: 12px; color: var(--muted); background: var(--card-2); border-radius: var(--pill); padding: 1px 8px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card > .tabs { padding: 0 8px; }

/* Segmented choice (period / currency pickers) */
.segmented { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.segmented a, .segmented button {
	display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: var(--pill);
	border: 1px solid var(--border); color: var(--text); background: transparent; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.segmented a:hover, .segmented button:hover { background: var(--soft); text-decoration: none; }
.segmented .selected { border-color: var(--accent); color: var(--accent); background: rgba(29, 155, 240, .08); }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label, .field-row > label { color: var(--muted); font-size: 13.5px; font-weight: 550; }
#subscription-fields { margin-top: 16px; }
.calc-status { min-height: 44px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prev-label { margin-top: 16px; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.optional { color: var(--muted); font-weight: 400; }
.help { color: var(--muted); font-size: 12.5px; }
.card + .help { margin-top: 10px; }
.field-error { color: var(--danger); font-size: 13px; }

.input, .select, .textarea {
	width: 100%; min-height: 44px; padding: 0 12px;
	background: var(--bg); color: var(--text);
	border: 1px solid var(--border); border-radius: var(--radius-sm);
	outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { padding: 10px 12px; min-height: 92px; resize: vertical; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:hover, .select:hover, .textarea:hover { border-color: #3e4246; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input[readonly], .input:disabled, .select:disabled { background: var(--card); color: var(--muted); cursor: not-allowed; }
.input-code { font-size: 22px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.select {
	appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371767B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
.select option { background: var(--card); color: var(--text); }
input[type="date"].input, input[type="time"].input { color-scheme: dark; }
input[type="file"].input { padding: 9px 12px; }
input[type="file"]::file-selector-button {
	margin-right: 12px; height: 28px; padding: 0 12px; border-radius: var(--pill);
	border: 1px solid var(--border); background: var(--card-2); color: var(--text); font-weight: 600; cursor: pointer;
}

.input-group { position: relative; display: flex; }
.input-group .input { padding-right: 48px; }
.input-addon {
	position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
	width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; color: var(--muted);
	display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.input-addon:hover { background: var(--soft); color: var(--text); }
.input-prefix { position: relative; }
.input-prefix .prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-variant-numeric: tabular-nums; }
.input-prefix .input { padding-left: 44px; }

.check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14.5px; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.check .help { display: block; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }

fieldset.section {
	border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card);
	padding: 0; margin: 0; min-width: 0;
}
fieldset.section + fieldset.section { margin-top: 16px; }
fieldset.section > legend {
	float: left; width: 100%; padding: 14px 20px; margin: 0; border-bottom: 1px solid var(--border);
	font-size: 17px; font-weight: 800; letter-spacing: -0.01em;
}
fieldset.section > legend + * { clear: both; }
.section-body { padding: 18px 20px 20px; }
.section-note { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 8px; }
.form-actions {
	position: sticky; bottom: 0; z-index: 5;
	display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
	margin-top: 16px; padding: 14px 0;
	background: var(--bg);
	border-top: 1px solid var(--border);
}
.locked-note { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.locked-note .icon { width: 14px; height: 14px; }

/* ---------- Alerts and panels ---------- */

.alert {
	display: flex; gap: 10px; align-items: flex-start;
	padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border);
	background: var(--card-2); font-size: 14px;
}
.alert .icon { margin-top: 1px; }
.alert-error, .alert-danger { border-color: rgba(244, 33, 46, .45); background: rgba(244, 33, 46, .08); }
.alert-error .icon, .alert-danger .icon { color: var(--danger); }
.alert-warning { border-color: rgba(255, 212, 0, .4); background: rgba(255, 212, 0, .06); }
.alert-warning .icon { color: var(--warning); }
.alert-success { border-color: rgba(0, 186, 124, .4); background: rgba(0, 186, 124, .07); }
.alert-success .icon { color: var(--success); }
.alert-info .icon { color: var(--text); }
.alert-title { font-weight: 750; }
.alert + .alert { margin-top: 8px; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- Definition lists ---------- */

.dl { margin: 0; display: flex; flex-direction: column; }
.dl-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.dl-row:last-child { border-bottom: 0; }
.dl dt { color: var(--muted); font-size: 14px; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.dl dd .sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }

/* ---------- Ledger header (payment detail) ---------- */

.ledger { padding: 22px 22px 20px; }
.ledger-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ledger-ref { color: var(--muted); font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; }
.ledger-amount { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-top: 6px; }
.ledger-meta { color: var(--muted); margin-top: 6px; font-size: 14px; }
.ledger-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.seal {
	display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
	margin-top: 18px; padding: 12px 14px;
	border: 1px solid rgba(0, 186, 124, .35); border-radius: var(--radius);
	background: rgba(0, 186, 124, .06);
}
.seal .icon { width: 26px; height: 26px; color: var(--success); }
.seal-title { font-weight: 750; }
.seal-text { color: var(--muted); font-size: 13px; }
.seal-print { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .12em; color: var(--success); border: 1px dashed rgba(0,186,124,.5); border-radius: 8px; padding: 4px 10px; font-size: 13px; }
.seal-broken { border-color: rgba(244, 33, 46, .45); background: rgba(244, 33, 46, .07); }
.seal-broken .icon, .seal-broken .seal-print { color: var(--danger); border-color: rgba(244,33,46,.5); }
.final-value { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.final-value strong { color: var(--text); font-size: 18px; font-variant-numeric: tabular-nums; }

/* ---------- Timeline ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 68px 16px minmax(0, 1fr); gap: 10px; padding: 0 0 16px; }
.timeline li:last-child { padding-bottom: 0; }
.tl-time { color: var(--muted); font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; line-height: 1.3; padding-top: 1px; }
.tl-dot { position: relative; display: flex; justify-content: center; }
.tl-dot::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); margin-top: 4px; box-shadow: 0 0 0 3px var(--card); z-index: 1; }
.timeline li:not(:last-child) .tl-dot::after { content: ""; position: absolute; top: 14px; bottom: -14px; width: 1px; background: var(--border); }
.tl-success .tl-dot::before { background: var(--success); }
.tl-warning .tl-dot::before { background: var(--warning); }
.tl-danger .tl-dot::before { background: var(--danger); }
.tl-text { font-size: 14px; }
.tl-text .sub { display: block; color: var(--muted); font-size: 12.5px; }

/* ---------- Lists ---------- */

.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item.unread { background: rgba(29, 155, 240, .05); }
.list-item .grow .title { font-weight: 700; }
.list-item .grow .text { color: var(--muted); font-size: 13.5px; }

.expiry-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); align-items: center; }
.expiry-item:last-child { border-bottom: 0; }
.expiry-name { font-weight: 700; }
.expiry-meta { color: var(--muted); font-size: 13px; }
.expiry-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-start; }

/* ---------- Filters ---------- */

.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.filters .field > label { font-size: 12.5px; }
.filters .input, .filters .select { min-height: 38px; font-size: 14px; }
.filter-actions { display: flex; align-items: flex-end; gap: 8px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.toolbar-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.toolbar-search .input { min-height: 38px; padding-left: 38px; border-radius: var(--pill); }
.toolbar-search .icon { position: absolute; left: 12px; top: 9px; color: var(--muted); }
.toolbar .row > .select { width: auto; min-height: 38px; font-size: 14px; }
details.more-filters > summary { list-style: none; cursor: pointer; }
details.more-filters > summary::-webkit-details-marker { display: none; }

/* ---------- Pagination ---------- */

.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; padding: 14px; flex-wrap: wrap; }
.page-link {
	min-width: 36px; height: 36px; padding: 0 10px; border-radius: var(--pill);
	display: inline-flex; align-items: center; justify-content: center;
	color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums;
}
.page-link:hover { background: var(--soft); text-decoration: none; }
.page-link.current { color: var(--accent); background: rgba(29, 155, 240, .1); }
.page-link.disabled { color: var(--muted); opacity: .5; }
.page-gap { color: var(--muted); padding: 0 4px; }
.result-count { color: var(--muted); font-size: 13px; padding: 10px 20px; border-top: 1px solid var(--border); }

/* ---------- Empty / error ---------- */

.empty { text-align: center; padding: 48px 20px; }
.empty-icon { width: 36px; height: 36px; color: var(--muted); margin: 0 auto 12px; }
.empty-title { font-weight: 800; font-size: 17px; }
.empty-text { color: var(--muted); margin-top: 4px; max-width: 46ch; margin-left: auto; margin-right: auto; }
.empty .btn { margin-top: 16px; }

.error-card { max-width: 520px; margin: 40px auto; padding: 32px; text-align: center; }
.error-code { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.error-title { font-size: 24px; font-weight: 800; margin-top: 4px; }
.error-text { color: var(--muted); margin-top: 8px; }
.error-actions { margin-top: 20px; display: flex; justify-content: center; }

/* ---------- Modal ---------- */

.modal {
	width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
	padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg);
	background: var(--bg); color: var(--text);
}
.modal::backdrop { background: var(--backdrop); }
.modal[open] { animation: modal-in .16s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-inner { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }

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

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
	pointer-events: auto; display: flex; align-items: center; gap: 10px;
	padding: 12px 18px; border-radius: var(--radius); font-weight: 600; font-size: 14.5px;
	background: var(--btn); color: var(--btn-text);
	box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 8px 24px rgba(0,0,0,.5);
	animation: toast-in .2s ease-out;
}
.toast-success .icon { color: #008a5c; }
.toast-error { background: var(--danger); color: #fff; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s ease, transform .2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast-note { flex-direction: column; align-items: flex-start; gap: 1px; max-width: min(420px, calc(100vw - 32px)); color: var(--btn-text); }
.toast-note:hover { text-decoration: none; background: var(--btn-hover); }
.toast-note span { font-size: 12px; font-weight: 600; opacity: .65; }
.toast-note strong { font-weight: 750; overflow-wrap: anywhere; }
.copy-btn.is-copied, .btn.is-copied { color: var(--success); }

/* ---------- Charts ---------- */

.chart { width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-family: var(--font); font-size: 11px; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .bar { transition: opacity .12s ease; }
.chart .bar:hover { opacity: .8; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 13.5px; }
.hbar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 10px; border-radius: var(--pill); background: var(--card-2); overflow: hidden; }
.hbar-fill { display: block; height: 100%; width: 0; border-radius: var(--pill); background: var(--text); }
.hbar-fill.success { background: var(--success); }
.hbar-fill.warning { background: var(--warning); }
.hbar-fill.danger { background: var(--danger); }
.hbar-fill.neutral { background: var(--muted); }
.hbar-value { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.stackbar { display: flex; height: 12px; border-radius: var(--pill); overflow: hidden; background: var(--card-2); gap: 2px; }
.stackbar span { display: block; height: 100%; width: 0; }
.stackbar .s-success { background: var(--success); }
.stackbar .s-warning { background: var(--warning); }
.stackbar .s-danger { background: var(--danger); }
.stackbar .s-neutral { background: var(--muted); }

/* ---------- Proof viewer ---------- */

.proof { display: block; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.proof img { width: 100%; max-height: 520px; object-fit: contain; background: #0a0a0a; }
.proof-file { display: flex; align-items: center; gap: 12px; padding: 14px; }
.proof-file .icon { width: 28px; height: 28px; color: var(--muted); }

/* ---------- Autocomplete ---------- */

.ac { position: relative; }
.ac-list {
	position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
	list-style: none; margin: 0; padding: 6px; max-height: 280px; overflow-y: auto;
	background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
	box-shadow: 0 0 15px rgba(255, 255, 255, .06), 0 0 3px 1px rgba(255, 255, 255, .08);
}
.ac-list li { padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.ac-list li[aria-selected="true"], .ac-list li:hover { background: var(--soft); }
.ac-list .ac-sub { display: block; color: var(--muted); font-size: 12.5px; }

/* ---------- Duplicate warning ---------- */

.dup-box { margin-top: 10px; }
.dup-list { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }

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

.auth-body { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; overflow-x: hidden; }
.auth { position: relative; z-index: 1; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 22px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.auth-portal { font-size: 31px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; }
.auth-tagline { color: var(--muted); font-size: 16px; }
.auth-main { display: flex; flex-direction: column; }
.auth-card {
	border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px;
	display: flex; flex-direction: column; gap: 16px;
	background: rgba(0, 0, 0, .78);
	-webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.auth-head { display: flex; flex-direction: column; gap: 4px; }
.auth-title { font-size: 20px; font-weight: 800; }
.auth-text { color: var(--muted); font-size: 14.5px; }
.auth-alt { text-align: center; font-size: 14px; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 13px; }
.auth-foot .icon { width: 16px; height: 16px; }
.input.input-lg { min-height: 50px; font-size: 16px; }
.auth-user {
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
	padding: 8px 14px 8px 8px; border: 1px solid var(--border); border-radius: var(--pill);
}
.auth-user .avatar { background: rgba(29, 155, 240, .14); border-color: rgba(29, 155, 240, .45); color: var(--accent); }
.auth-user-name { flex: 1 1 auto; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }

/* Emblem: guilloche seal around the B mark */
.auth-emblem { position: relative; z-index: 0; width: 184px; height: 184px; margin: 0 auto 12px; }
.auth-emblem::before {
	content: ""; position: absolute; inset: -55%; z-index: -1; border-radius: 50%;
	background: radial-gradient(circle, rgba(29, 155, 240, .20) 0%, rgba(29, 155, 240, .07) 34%, rgba(29, 155, 240, 0) 66%);
}
.auth-quick .auth-emblem { width: 92px; height: 92px; margin-bottom: 8px; }
.auth-quick .auth-emblem::before { inset: -45%; opacity: .7; }
.emblem { width: 100%; height: 100%; overflow: visible; }
.emblem-line { fill: none; stroke-width: 1; stroke-linejoin: round; }
.emblem-hair { stroke: #3E4246; }
.emblem-band { stroke-width: 1.15; }
.emblem-braid { stroke: rgba(239, 243, 244, .5); }
.emblem-rose { stroke: #1D9BF0; stroke-opacity: .8; }
.emblem-spin { transform-box: view-box; transform-origin: 50% 50%; }
.emblem-core, .emblem-badge { transform-box: fill-box; transform-origin: 50% 50%; }

/* Background lines */
.auth-scene {
	position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
	-webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22%, #000 78%, transparent 100%);
	mask-image: linear-gradient(90deg, transparent 0, #000 22%, #000 78%, transparent 100%);
}
.auth-waves { position: absolute; left: -480px; right: -480px; bottom: 6vh; height: 300px; background-repeat: repeat-x; background-size: 480px 300px; will-change: transform; }
.auth-waves-a { background-image: url("../img/waves-a.svg"); }
.auth-waves-b { background-image: url("../img/waves-b.svg"); bottom: calc(6vh + 54px); }

/* The welcome sequence: lines draw, the mark lands, the badge pops, the form rises. */
@keyframes emblem-draw {
	0% { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
	99.9% { stroke-dasharray: 1 1; stroke-dashoffset: 0; }
	100% { stroke-dasharray: none; stroke-dashoffset: 0; }
}
@keyframes emblem-pop { 0% { opacity: 0; transform: scale(.5); } 70% { opacity: 1; transform: scale(1.07); } 100% { opacity: 1; transform: scale(1); } }
@keyframes emblem-turn { to { transform: rotate(360deg); } }
@keyframes emblem-turn-back { to { transform: rotate(-360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes glow-in { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes wave-left { from { transform: translateX(0); } to { transform: translateX(-480px); } }
@keyframes wave-right { from { transform: translateX(0); } to { transform: translateX(480px); } }

.auth-intro .emblem-line { animation: emblem-draw 1.5s cubic-bezier(.65, 0, .35, 1) both; }
.auth-intro .emblem-hair { animation-duration: 1.1s; }
.auth-intro .emblem-line.d1 { animation-delay: .1s; }
.auth-intro .emblem-line.d2 { animation-delay: .2s; }
.auth-intro .emblem-line.d3 { animation-delay: .25s; }
.auth-intro .emblem-line.d4 { animation-delay: .35s; }
.auth-intro .emblem-line.d5 { animation-delay: .4s; }
.auth-intro .emblem-line.d6 { animation-delay: .5s; }
.auth-intro .emblem-core { animation: emblem-pop .7s cubic-bezier(.34, 1.4, .64, 1) .85s both; }
.auth-intro .emblem-badge { animation: emblem-pop .5s cubic-bezier(.34, 1.56, .64, 1) 1.5s both; }
.auth-intro .emblem-spin-a { animation: emblem-turn 150s linear 1.7s infinite; }
.auth-intro .emblem-spin-b { animation: emblem-turn-back 190s linear 1.7s infinite; }
.auth-intro .auth-emblem::before { animation: glow-in 1.4s ease-out .3s both; }
.auth-intro .rise { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; }
.auth-intro .r1 { animation-delay: .7s; }
.auth-intro .r2 { animation-delay: .8s; }
.auth-intro .r3 { animation-delay: .95s; }
.auth-intro .r4 { animation-delay: 1.15s; }
.auth-intro .auth-scene { animation: fade-in 1.8s ease-out .2s both; }
.auth-intro .auth-waves-a { animation: wave-left 46s linear infinite; }
.auth-intro .auth-waves-b { animation: wave-right 62s linear infinite; }
.auth-quick .auth-main { animation: rise .35s ease-out both; }

@media (prefers-reduced-motion: reduce) {
	.auth-intro .emblem-line, .auth-intro .emblem-core, .auth-intro .emblem-badge, .auth-intro .emblem-spin-a, .auth-intro .emblem-spin-b,
	.auth-intro .auth-emblem::before, .auth-intro .rise, .auth-intro .auth-scene, .auth-intro .auth-waves-a, .auth-intro .auth-waves-b,
	.auth-quick .auth-main { animation: none !important; }
}
.link { color: var(--accent); }
.qr-box { display: inline-block; padding: 10px; background: #fff; border-radius: var(--radius); }
.qr-box svg { width: 180px; height: 180px; }
.secret { font-variant-numeric: tabular-nums; letter-spacing: .12em; font-weight: 700; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .08em; }
.codes span { border: 1px dashed var(--border); border-radius: 8px; padding: 8px; text-align: center; }

/* ---------- Misc ---------- */

.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: var(--pill); padding: 2px 10px; font-size: 12.5px; color: var(--muted); }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }
.kv { display: flex; gap: 6px; align-items: baseline; }
.copy-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 6px; display: inline-flex; }
.copy-btn:hover { color: var(--text); background: var(--soft); }
.copy-btn .icon { width: 16px; height: 16px; }
.perm-table td:first-child { width: 55%; }
.perm-choice { display: inline-flex; gap: 4px; }
.perm-choice label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: var(--pill); padding: 4px 10px; cursor: pointer; font-size: 13px; }
.perm-choice input { accent-color: var(--accent); }
.list-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-input { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: var(--pill); padding: 4px 6px 4px 12px; }
.chip-input button { border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 50%; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.chip-input button:hover { color: var(--danger); background: rgba(244,33,46,.1); }
.chip-input .icon { width: 14px; height: 14px; }


/* ---------- Dashboard additions ---------- */

.filter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 24px 0 12px; }
.filter-label { color: var(--muted); font-size: 13.5px; font-weight: 550; }
.dash-grid { margin-top: 16px; }
.alert-link { margin-top: 12px; color: var(--text); }
.alert-link:hover { text-decoration: none; border-color: rgba(255, 212, 0, .6); }
.chart-wrap { overflow-x: auto; }
.chart-wrap .chart { min-width: 480px; }
.chart-compact { display: none; }
.chart-compact .chart { min-width: 0; }
.chart .hit { cursor: default; }
.chart .hit:hover + .bar, .chart .hit:focus + .bar { fill: #FFFFFF; }
.chart .hit:focus { outline: none; }
.chart .axis { stroke: #3e4246; }
.chart-table { margin-top: 12px; }
.chart-table > summary { cursor: pointer; color: var(--muted); font-size: 13px; width: max-content; }
.chart-table > summary:hover { color: var(--text); }
.chart-table[open] > summary { margin-bottom: 8px; }
.hbars { display: flex; flex-direction: column; gap: 2px; }
.hbar { border-radius: 8px; padding: 6px 6px; margin: 0 -6px; outline-offset: 0; }
.hbar:hover, .hbar:focus-visible { background: var(--row-hover); }
.hbar .hbar-fill { background: #EFF3F4; height: 10px; border-radius: 0 4px 4px 0; }
.hbar-track { background: transparent; border-radius: 0; }
.status-legend { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.status-legend li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto 48px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.status-legend li:last-child { border-bottom: 0; }
.status-legend .key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.status-legend .lg-value { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.status-legend .lg-pct { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.key.s-success, .stackbar .s-success { background: var(--success); }
.key.s-warning, .stackbar .s-warning { background: var(--warning); }
.key.s-neutral, .stackbar .s-neutral { background: var(--muted); }
.key.s-danger, .stackbar .s-danger { background: var(--danger); }
.stackbar { height: 14px; border-radius: 4px; background: transparent; }
.stackbar span:first-child { border-radius: 4px 0 0 4px; }
.stackbar span:last-child { border-radius: 0 4px 4px 0; }
.stackbar span:only-child { border-radius: 4px; }
.stackbar span:hover, .stackbar span:focus-visible { filter: brightness(1.15); outline: none; }
.chart-tip {
	position: fixed; z-index: 300; pointer-events: none;
	background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
	padding: 8px 12px; font-size: 13px; line-height: 1.3; max-width: 260px;
	box-shadow: 0 0 15px rgba(255, 255, 255, .08), 0 0 3px 1px rgba(255, 255, 255, .1);
}
.chart-tip strong { display: block; font-size: 15px; font-weight: 750; }
.chart-tip span { color: var(--muted); }
.expiry-list .expiry-item p + p { margin-top: 2px; }

/* ---------- Sub navigation (reports, security) ---------- */

.subnav { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { position: relative; padding: 12px 14px; color: var(--muted); font-weight: 600; white-space: nowrap; transition: background-color .15s ease, color .15s ease; }
.subnav a:hover { color: var(--text); background: var(--soft); text-decoration: none; }
.subnav a.active { color: var(--text); font-weight: 750; }
.subnav a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 4px; border-radius: var(--pill); background: var(--accent); }

/* ---------- Period bar (reports) ---------- */

.period-bar { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin: 0 0 16px; }
.kpis + .period-bar { margin-top: 16px; }
.custom-range { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.input.input-sm, .select.input-sm { min-height: 32px; height: 32px; width: auto; padding: 0 10px; font-size: 13.5px; border-radius: var(--pill); }
.select.input-sm { padding-right: 32px; background-position: right 8px center; background-size: 16px; }
.input.input-sm[type="date"] { padding: 0 8px 0 12px; }
.row .input.input-sm.grow { flex: 1 1 180px; border-radius: var(--radius-sm); height: 36px; min-height: 36px; }
.input.input-xs { width: 76px; min-height: 36px; height: 36px; padding: 0 10px; }
.btn.is-selected { border-color: var(--accent); color: var(--accent); background: rgba(29, 155, 240, .08); }

/* ---------- Sales overview (dashboard) ---------- */

.kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis-3 + .card { margin-top: 12px; }
.kpis.kpis-subs { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi-compare {
	display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
	margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--border);
	color: var(--muted); font-size: 12.5px;
}
.kpi-compare .icon { width: 16px; height: 16px; color: var(--text); }
.kpi-compare strong { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-caption { font-size: 14px; margin-bottom: 10px; display: flex; gap: 4px 8px; flex-wrap: wrap; align-items: baseline; }
.chart-caption .strong { font-weight: 700; }
.chart .bar-partial { fill-opacity: .4; }
.chart .hit:hover + .bar-partial, .chart .hit:focus + .bar-partial { fill-opacity: .6; }
.card-note { margin-top: 12px; font-size: 13px; }
.card > .card-note { margin: 0; padding: 12px 20px 14px; border-top: 1px solid var(--border); color: var(--muted); }

/* ---------- Notifications ---------- */

.notif-link { display: flex; flex-direction: column; min-width: 0; color: var(--text); }
.notif-link:hover { text-decoration: none; }
.notif-link:hover .title { color: var(--accent); }
.notif-link .title { font-weight: 700; }
.notif-link .text { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.list-item > span:first-child .icon { color: var(--muted); }
.list-item > span.text-success .icon { color: var(--success); }
.list-item > span.text-warning .icon { color: var(--warning); }
.list-item > span.text-danger .icon { color: var(--danger); }

/* ---------- Search page, profile ---------- */

.search-page-form { margin-bottom: 16px; }
.search-page-form .toolbar-search { max-width: none; }
details.more { margin-top: 16px; }
details.more > summary { cursor: pointer; width: max-content; font-size: 14px; }
details.more[open] > summary { margin-bottom: 12px; }
.steps { margin: 0 0 12px; padding-left: 20px; }
.steps li + li { margin-top: 4px; }
.back-btn { margin-left: -6px; }

/* ---------- Sales: line items, order summary ---------- */

.section-body > .section-note, .row-between > .section-note { margin: 0 0 12px; }
.lines { display: flex; flex-direction: column; gap: 12px; }
.line {
	border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-2);
	padding: 12px 16px 16px;
}
.line-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 38px; }
.line-kind { display: inline-flex; align-items: center; gap: 6px; font-weight: 750; font-size: 14px; }
.line-kind .icon { width: 18px; height: 18px; color: var(--muted); }
.line-head .line-total { margin-left: auto; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.line-head .btn-icon { margin-right: -8px; color: var(--muted); }
.line-head .btn-icon:hover { color: var(--danger); }
.line-body { margin-top: 10px; }
.line-meta { margin-top: 4px; }
.line-more { border-top: 1px solid var(--border); padding-top: 10px; }
.line-more > summary { cursor: pointer; color: var(--muted); font-size: 13.5px; font-weight: 600; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.line-more > summary::-webkit-details-marker { display: none; }
.line-more > summary::before { content: "+"; display: inline-block; width: 14px; text-align: center; font-weight: 800; }
.line-more[open] > summary::before { content: "−"; }
.line-more > .form-grid { margin-top: 12px; }
.line-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.lines-empty { padding: 16px; border: 1px dashed var(--border); border-radius: var(--radius); text-align: center; }
.credits-display, .amount-display { margin: 0; min-height: 40px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.credits-display strong, .amount-display strong { font-size: 16px; font-variant-numeric: tabular-nums; }

.summary-grid { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 20px; align-items: start; }
.summary-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.summary-table td, .summary-table th { padding: 7px 0; border-bottom: 1px solid var(--border); text-align: left; font-weight: 500; }
.summary-table td.num { text-align: right; font-variant-numeric: tabular-nums; padding-left: 12px; }
.summary-table tfoot th { color: var(--muted); font-weight: 500; }
.summary-table tr.summary-total th, .summary-table tr.summary-total td { color: var(--text); font-size: 18px; font-weight: 800; border-bottom: 0; padding-top: 12px; }
.summary-table tbody td { color: var(--text); }

/* ---------- Refunds ---------- */

.refund-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.refund-strip > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.refund-strip strong { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.refund-total { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); }
.refund-total > span:first-child { color: var(--muted); }
.refund-total strong { font-size: 22px; font-weight: 800; }
.ledger-order { color: var(--muted); font-size: 13px; margin-top: 2px; }
.list-plain { margin: 10px 0 0; padding-left: 18px; }
.list-plain li + li { margin-top: 4px; }

/* ---------- Statements (revenue, profit & loss) ---------- */

.table.statement th[scope="row"] { color: var(--text); font-size: 14.5px; font-weight: 500; border-bottom: 1px solid var(--border); white-space: normal; }
.table.statement th[scope="row"] .sub { display: block; color: var(--muted); font-size: 12.5px; }
.table.statement td.num { white-space: nowrap; }
.table.statement tbody tr:last-child th[scope="row"] { border-bottom: 0; }
.table.statement tr.statement-sum th, .table.statement tr.statement-sum td { font-weight: 750; border-top: 1px solid #3e4246; }
.table.statement tr.statement-total th, .table.statement tr.statement-total td { font-weight: 800; font-size: 16px; border-top: 2px solid var(--text); }
.table tr.row-removed td { color: var(--muted); }
.table tr.row-removed td .strong { text-decoration: line-through; font-weight: 600; }
.table td.show-sm-only, .table th.show-sm-only { display: none; }
.kpis.kpis-credits { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

/* ---------- Shared form pieces (v1.2) ---------- */

.text-accent { color: var(--accent); }
.push-right { margin-left: auto; }
.change-link { margin-left: 6px; font-weight: 600; white-space: nowrap; }
.help .change-link { margin-left: 0; }
.form-narrow { max-width: 880px; }
.fieldset-plain { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.fieldset-plain > legend { padding: 0; margin-bottom: 2px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 18px; }
.check .code-chip { margin-left: 4px; }
.card-section { border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 16px; }
.card-body-tight { padding-bottom: 0; }
.inline-form { display: inline-flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.page-help { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; }
.page-help .icon { width: 16px; height: 16px; }
.alert-spaced, .card-spaced, .grid-spaced { margin-top: 16px; }
.alert-flush { border-radius: 0; border-width: 0 0 1px; }

.choice-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice-cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-card {
	position: relative; display: flex; flex-direction: column; gap: 4px;
	padding: 14px 16px 14px 44px; border: 1px solid var(--border); border-radius: var(--radius);
	cursor: pointer; transition: border-color .15s ease, background-color .15s ease;
}
.choice-card:hover { border-color: #3e4246; background: var(--row-hover); }
.choice-card input { position: absolute; left: 16px; top: 16px; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.choice-card:has(input:checked) { border-color: var(--accent); background: rgba(29, 155, 240, .06); }
.choice-card:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.choice-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-title { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.choice-title .icon { width: 18px; height: 18px; color: var(--muted); }
.choice-text { color: var(--muted); font-size: 13px; }

.input-suffix { position: relative; }
.input-suffix .input { padding-right: 40px; }
.input-suffix .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-weight: 600; }

/* ---------- Partners ---------- */

.kpi-hero { border-color: rgba(29, 155, 240, .45); background: linear-gradient(180deg, rgba(29, 155, 240, .10), rgba(29, 155, 240, .02)); }
.kpi-hero .kpi-label .icon { color: var(--accent); }
.kpi-hero .kpi-value { font-size: 28px; }
.kpi-balance .kpi-label .icon { color: var(--accent); }
.kpis.kpis-statement { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.splitbar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; }
.splitbar-part { display: block; height: 100%; width: 0; background: var(--accent); outline: none; transition: filter .12s ease; }
.splitbar-part:first-child { border-radius: 4px 0 0 4px; }
.splitbar-part:last-child { border-radius: 0 4px 4px 0; }
.splitbar-part:only-child { border-radius: 4px; }
.splitbar-part:nth-child(even) { background: #8ED0FF; }
.splitbar-part.splitbar-owner { background: #3E4246; }
.splitbar-part:hover, .splitbar-part:focus-visible { filter: brightness(1.2); }
.split-legend { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 24px; }
.split-legend li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.split-legend strong { font-variant-numeric: tabular-nums; }
.split-legend .key { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.split-legend li:nth-child(odd) .key-partner { background: var(--accent); }
.split-legend li:nth-child(even) .key-partner { background: #8ED0FF; }
.split-legend .key-owner { background: #3E4246; }

.picker-card .card-body { padding-top: 14px; padding-bottom: 14px; }
.calc-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 44px; }
.calc-line strong { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.split-table td { vertical-align: middle; }
.split-table .input-amount { width: 140px; min-height: 38px; text-align: right; font-variant-numeric: tabular-nums; margin-left: auto; display: block; }
.split-table .field-error { text-align: right; }
.split-table tfoot td { font-weight: 700; }
.split-table tfoot tr + tr td { border-top: 0; color: var(--muted); font-weight: 600; }
.split-table [data-split-change].is-up { color: var(--success); }
.split-table [data-split-change].is-down { color: var(--danger); }
[data-split-msg].text-danger { color: var(--danger); }

/* ---------- Announcements ---------- */

.banners { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.banner {
	display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start;
	padding: 14px 14px 14px 16px; border-radius: var(--radius-lg);
	border: 1px solid rgba(29, 155, 240, .45);
	background: linear-gradient(180deg, rgba(29, 155, 240, .10), rgba(29, 155, 240, .03));
}
.banner-icon { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(29, 155, 240, .16); color: var(--accent); }
.banner-title { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.banner-body { margin-top: 2px; font-size: 14.5px; overflow-wrap: anywhere; }
.banner-meta { margin-top: 6px; color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.banner-meta .icon { width: 14px; height: 14px; }
.banner-actions { display: flex; align-items: center; gap: 4px; }
.banner-actions .btn-icon { color: var(--muted); }

.ann-icon { width: 36px; height: 36px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--card-2); color: var(--muted); }
.list-item.unread .ann-icon { background: rgba(29, 155, 240, .14); color: var(--accent); }
.notif-link .text .icon { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }

.announcement-body { font-size: 15.5px; line-height: 1.6; overflow-wrap: anywhere; max-width: 72ch; }
.announcement-body p + p { margin-top: 12px; }
.announcement-file { border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.announcement-file .row a { display: inline-flex; align-items: center; gap: 6px; }
.announcement-file .row .icon { width: 16px; height: 16px; }
.read-meter { display: inline-flex; align-items: center; gap: 10px; }
.read-meter-bar { width: 72px; height: 6px; border-radius: var(--pill); background: var(--card-2); overflow: hidden; }
.read-meter-bar span { display: block; height: 100%; width: 0; border-radius: var(--pill); background: var(--accent); }
.recipients .list-item { padding: 10px 16px; }
.recipients .avatar { width: 32px; height: 32px; font-size: 12px; }
.strong-text { display: block; font-weight: 700; font-size: 14px; }
.read-state { color: var(--muted); font-size: 12.5px; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.read-state .icon { width: 14px; height: 14px; }
.read-yes { color: var(--success); }
.people-picker { display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }

/* ---------- Credentials: panel logins and bank details ---------- */

.panel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; align-items: start; }
.panel-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; }
.panel-card.is-inactive { opacity: .65; }
.panel-card.is-revealed { border-color: rgba(29, 155, 240, .55); }
.panel-card-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-icon, .pay-icon { width: 38px; height: 38px; flex: none; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--card-2); border: 1px solid var(--border); color: var(--text); }
.panel-name { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.panel-sub { color: var(--muted); font-size: 13px; }
.panel-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--border); }
.panel-given { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.panel-given .icon { width: 16px; height: 16px; color: var(--muted); }

.cred { margin: 0; padding: 6px 16px 10px; display: flex; flex-direction: column; }
.cred-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cred-row:last-child { border-bottom: 0; }
.cred dt { color: var(--muted); font-size: 13px; }
.cred dd { margin: 0; display: flex; align-items: center; gap: 8px; min-width: 0; }
.cred-value { flex: 1 1 auto; min-width: 0; font-weight: 650; overflow-wrap: anywhere; }
.cred-link { color: var(--text); }
.cred-link:hover { color: var(--accent); }
.cred-mono, .cred-secret { font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.cred-secret { color: var(--accent); }
.cred-dots { color: var(--muted); letter-spacing: .12em; }
.cred-actions { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.cred-actions .copy-btn { width: 30px; height: 30px; align-items: center; justify-content: center; }
.cred-note { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; padding: 8px 0 0; }
.cred-note .icon { width: 14px; height: 14px; }
.cred-notes dd { font-weight: 400; color: var(--text); font-size: 14px; display: block; }

.pay-card { border-color: rgba(29, 155, 240, .45); margin-bottom: 16px; }
.pay-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; padding: 14px; }
.pay-account { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); display: flex; flex-direction: column; }
.pay-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.pay-icon { color: var(--accent); background: rgba(29, 155, 240, .1); border-color: rgba(29, 155, 240, .35); }
.pay-name { font-size: 16px; font-weight: 800; }
.pay-sub { color: var(--muted); font-size: 13px; }
.pay-account .cred { padding: 4px 14px 8px; }
.pay-note { display: flex; gap: 8px; align-items: flex-start; margin: 0 14px 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--card-2); font-size: 13.5px; }
.pay-note .icon { width: 16px; height: 16px; color: var(--accent); margin-top: 2px; }

/* ---------- Support tickets ---------- */

.scope-switch { margin-bottom: 14px; }
.ticket-table tr.is-unread .row-link { font-weight: 800; }
.ticket-table .row-link .unread-dot { display: inline-block; margin-right: 8px; vertical-align: 2px; }
.ticket-state { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.ticket-thread { overflow: hidden; }
.thread { list-style: none; margin: 0; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; flex-direction: column; gap: 6px; max-width: min(680px, 88%); }
.msg-mine { align-self: flex-end; align-items: flex-end; }
.msg-theirs { align-self: flex-start; }
.msg-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.msg-mine .msg-head { flex-direction: row-reverse; }
.msg-head .avatar { width: 28px; height: 28px; font-size: 11px; }
.msg-name { color: var(--text); font-weight: 700; }
.msg-tag { font-size: 11.5px; font-weight: 700; color: var(--accent); border: 1px solid rgba(29, 155, 240, .45); border-radius: var(--pill); padding: 0 8px; line-height: 18px; }
.msg-bubble {
	padding: 12px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--card-2);
	line-height: 1.55; overflow-wrap: anywhere; max-width: 100%;
}
.msg-theirs .msg-bubble { border-top-left-radius: 6px; }
.msg-mine .msg-bubble { border-top-right-radius: 6px; background: rgba(29, 155, 240, .12); border-color: rgba(29, 155, 240, .38); }
.msg-bubble p + p { margin-top: 8px; }
.msg-note .msg-bubble { background: rgba(255, 212, 0, .06); border: 1px dashed rgba(255, 212, 0, .45); }
.msg-note-label { display: flex; align-items: center; gap: 6px; color: var(--warning); font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.msg-note-label .icon { width: 14px; height: 14px; }
.msg-file { margin-top: 10px; }
.msg-image img { max-height: 260px; width: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); background: #0a0a0a; }
.msg-pdf { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.msg-pdf:hover { text-decoration: none; border-color: #3e4246; }
.msg-pdf .icon { width: 18px; height: 18px; color: var(--muted); }
.thread-event { align-self: center; display: inline-flex; align-items: center; gap: 6px; max-width: 92%; text-align: center; color: var(--muted); font-size: 12.5px; }
.thread-event .icon { width: 14px; height: 14px; flex: none; }
.thread-event.is-internal { color: var(--warning); }
.reply-card .textarea { min-height: 110px; }
.reply-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.reply-tools .field { min-width: 200px; }
.reply-tools .select { min-width: 230px; }
.reply-foot { margin-top: 4px; }

/* ---------- Profile: notification sound ---------- */

.sound-form { display: flex; flex-direction: column; gap: 8px; }
.sound-label { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.sound-label .icon { width: 18px; height: 18px; color: var(--muted); }

/* ---------- Responsive ---------- */

@media (max-width: 1500px) {
	.hide-md { display: none; }
}
@media (max-width: 1100px) {
	.grid-main { grid-template-columns: minmax(0, 1fr); }
	.grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
	.kpis.kpis-3 { grid-template-columns: minmax(0, 1fr); }
	.app { grid-template-columns: minmax(0, 1fr); }
	.sidebar {
		position: fixed; left: 0; top: 0; bottom: 0; z-index: 60;
		width: min(300px, 86vw); height: 100%;
		transform: translateX(-102%); transition: transform .2s ease;
	}
	.drawer-open .sidebar { transform: none; }
	.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 50; background: var(--backdrop); }
	.brand .sidebar-close { display: inline-flex; }
	.topbar .menu-btn { display: inline-flex; margin-left: -8px; }
	.topbar { padding: 0 16px; }
	.topbar-search { display: none; }
	.topbar .search-btn { display: inline-flex; }
	.content { padding: 16px 16px 64px; }
	.grid-2, .grid-3, .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
	.span-2 { grid-column: auto; }
	.hide-sm { display: none; }
	.dl-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
	.ledger-amount { font-size: 32px; }
	.timeline li { grid-template-columns: 56px 16px minmax(0, 1fr); }
	.table td.show-sm-only, .table th.show-sm-only { display: table-cell; }
	.table td .sub.sm-only { display: block; white-space: normal; }
	.table td .sub.hide-sm { display: none; }
	.table td .sub.sm-only .badge { margin-top: 4px; }
	.summary-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
	.refund-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.choice-cards-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
	.chart-wide { display: none; }
	.chart-compact { display: block; }
}

@media (max-width: 560px) {
	.page-title { font-size: 17px; }
	.kpis, .kpis.kpis-subs, .kpis.kpis-credits { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
	.line { padding: 10px 12px 14px; }
	.kpis.kpis-3 { grid-template-columns: minmax(0, 1fr); }
	.period-bar .segmented { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; padding-bottom: 2px; }
	.period-bar .segmented::-webkit-scrollbar { display: none; }
	.period-bar .segmented button { flex: none; }
	.kpi { padding: 12px 12px 14px; }
	.kpi-value { font-size: 19px; }
	.kpi-value .money-line { font-size: 18px; }
	.table { font-size: 14px; }
	.table th, .table td { padding: 11px 12px; }
	.hide-xs { display: none; }
	.card-head, .card-body, .section-body, .toolbar, .filters { padding-left: 14px; padding-right: 14px; }
	fieldset.section > legend { padding-left: 14px; padding-right: 14px; }
	.auth-portal { font-size: 26px; }
	.auth-card { padding: 20px 16px; }
	.auth-emblem { width: 140px; height: 140px; }
	.auth-quick .auth-emblem { width: 80px; height: 80px; }
	.auth-body { padding: 24px 16px; }
	.page-actions { justify-content: stretch; }
	.page-actions .btn { flex: 1 1 auto; }
	.choice-cards, .choice-cards-3 { grid-template-columns: minmax(0, 1fr); }
	.panel-grid, .pay-list { grid-template-columns: minmax(0, 1fr); }
	.pay-list { padding: 10px; }
	.cred-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
	.banner { grid-template-columns: minmax(0, 1fr) auto; padding: 12px; }
	.banner-icon { display: none; }
	.kpi-hero { grid-column: 1 / -1; }
	.kpis.kpis-statement { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.split-table .input-amount { width: 110px; }
	.thread { padding: 14px 12px; }
	.msg { max-width: 94%; }
	.reply-tools .field, .reply-tools .select { min-width: 0; width: 100%; }
}

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

@media print {
	.sidebar, .topbar, .page-actions, .ledger-actions, .toasts, .form-actions { display: none !important; }
	.app { display: block; }
	body { background: #fff; color: #000; }
	.card { border-color: #ccc; background: #fff; }
}
