@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

/* ─── CSS VARIABLES ─────────────────────────────────────────── */
:root {
	--primary:       #4da3ff;
	--primary-dim:   rgba(77, 163, 255, 0.16);
	--primary-glow:  rgba(77, 163, 255, 0.28);
	--success:       #4cc38a;
	--danger:        #ff6b6b;
	--warning:       #f5a54a;
	--muted:         #8a96a8;
	--text:          #e8edf5;
	--text-dim:      #b0bac9;

	--bg-body:       #0d1017;
	--bg-container:  rgba(17, 21, 28, 0.96);
	--bg-card:       rgba(22, 27, 36, 0.90);
	--bg-input:      rgba(14, 18, 25, 0.85);
	--bg-surface:    rgba(255, 255, 255, 0.035);

	--border:        rgba(255, 255, 255, 0.08);
	--border-strong: rgba(255, 255, 255, 0.13);

	--bg-hover:      rgba(255, 255, 255, 0.05);
	--bg-active:     rgba(77, 163, 255, 0.12);

	--radius-xs: 8px;
	--radius-sm: 10px;
	--radius-md: 12px;
	--radius-lg: 16px;
	--radius-xl: 20px;

	--shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
	--shadow-md: 0 8px 24px rgba(3, 8, 18, 0.4);
	--shadow-lg: 0 20px 50px rgba(3, 8, 18, 0.55);

	--gap-xs: 6px;
	--gap-sm: 10px;
	--gap-md: 16px;
	--gap-lg: 24px;
}

/* ─── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

/* ─── BODY ──────────────────────────────────────────────────── */
body {
	font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
	background:
		radial-gradient(ellipse 900px 420px at 15% -5%, rgba(77, 163, 255, 0.09), transparent 60%),
		linear-gradient(180deg, #0c1014 0%, #0f141c 100%);
	background-attachment: fixed;
	color: var(--text);
	line-height: 1.55;
	min-height: 100vh;
	padding: 14px;
}

/* ─── CONTAINER ─────────────────────────────────────────────── */
.container {
	width: min(1300px, calc(100vw - 28px));
	margin: 0 auto;
	background: var(--bg-container);
	padding: 24px;
	border-radius: var(--radius-xl);
	box-shadow: var(--shadow-lg);
	border: 1px solid var(--border);
	backdrop-filter: blur(12px);
	animation: fade-up 0.45s ease-out both;
}

main {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* ─── TYPOGRAPHY ────────────────────────────────────────────── */
h1 {
	font-family: 'Space Grotesk', 'IBM Plex Sans', sans-serif;
	font-size: clamp(1.45rem, 2.2vw, 2rem);
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--text);
	margin-bottom: 16px;
}

h2 {
	font-size: 1rem;
	font-weight: 600;
	color: var(--text);
	border-bottom: 1px solid var(--border);
	padding-bottom: 10px;
	margin-bottom: 16px;
}

h3 { font-size: 0.95rem; color: var(--text); margin-bottom: 12px; }
h4 { font-size: 0.9rem; color: var(--text); margin: 18px 0 10px; }
h5 { font-size: 0.85rem; color: var(--text-dim); margin: 14px 0 8px; }

/* ─── FLASH MESSAGES ────────────────────────────────────────── */
.flash {
	padding: 14px 18px;
	margin-bottom: 20px;
	border-radius: var(--radius-md);
	border-left: 4px solid;
	font-size: 0.94rem;
	animation: fade-up 0.4s ease-out both;
	box-shadow: var(--shadow-sm);
}

.flash-success {
	background: rgba(76, 195, 138, 0.1);
	border-color: var(--success);
	color: #c3f4da;
}

.flash-danger {
	background: rgba(255, 107, 107, 0.1);
	border-color: var(--danger);
	color: #ffd9d9;
}

/* ─── HEADER ────────────────────────────────────────────────── */
.main-header {
	margin-bottom: 20px;
}

.header-inner {
	display: flex;
	align-items: center;
	gap: var(--gap-sm);
	flex-wrap: wrap;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--border);
}

/* Brand */
.header-brand {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	text-decoration: none;
	color: inherit;
	flex-shrink: 0;
}

.header-brand-mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: var(--radius-sm);
	background: linear-gradient(135deg, #4da3ff 0%, #74b9ff 100%);
	color: #07111e;
	font-family: 'Space Grotesk', sans-serif;
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	box-shadow: 0 6px 18px rgba(39, 102, 168, 0.35);
	flex-shrink: 0;
}

.header-brand-copy {
	display: flex;
	flex-direction: column;
	line-height: 1.1;
}

.header-brand-copy strong {
	font-family: 'Space Grotesk', sans-serif;
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--text);
}

.header-brand-copy small {
	color: var(--muted);
	font-size: 0.7rem;
}

/* Navigation */
.navigation {
	display: flex;
	align-items: center;
	gap: 4px;
	flex: 1 1 auto;
	flex-wrap: wrap;
	padding: 4px;
	border-radius: var(--radius-md);
	background: rgba(8, 12, 18, 0.5);
	border: 1px solid var(--border);
}

.navigation .nav-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 0.92rem;
	font-weight: 600;
	color: var(--text-dim);
	text-decoration: none;
	padding: 9px 16px;
	border-radius: var(--radius-xs);
	border: 1px solid transparent;
	background: transparent;
	min-height: 38px;
	transition: color 0.18s, background 0.18s, border-color 0.18s;
	white-space: nowrap;
}

.navigation .nav-link:hover,
.navigation .nav-link.active {
	color: #fff;
	background: var(--primary-dim);
	border-color: rgba(77, 163, 255, 0.28);
}

/* Right side of header */
.header-right {
	display: flex;
	align-items: center;
	gap: var(--gap-xs);
	flex-shrink: 0;
	flex-wrap: wrap;
}

/* Bot controls */
.header-controls {
	display: flex;
	align-items: center;
	gap: var(--gap-xs);
}

.bot-control {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	border-radius: var(--radius-xs);
	border: 1px solid var(--border);
	background: rgba(8, 12, 18, 0.5);
	white-space: nowrap;
}

.bot-control-name {
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--muted);
}

.bot-control p {
	margin: 0;
	font-size: 0.82rem;
	color: var(--text);
	font-weight: 600;
}

.toggle-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 10px 0 12px;
	color: var(--text-dim);
	font-size: 0.9rem;
}

.field-help {
	margin: 6px 0 0;
	color: var(--text-dim);
	font-size: 0.92rem;
	line-height: 1.45;
}

.toggle-row input[type="checkbox"] {
	width: 16px;
	height: 16px;
	accent-color: var(--primary);
}

.status-running { color: var(--success); }
.status-stopped { color: var(--muted); }

/* Logout */
.button-logout {
	background: rgba(108, 117, 125, 0.22);
	border: 1px solid rgba(255, 255, 255, 0.1);
	color: var(--text-dim);
	padding: 7px 14px;
	font-size: 0.85rem;
	min-height: 34px;
	border-radius: var(--radius-xs);
}

.button-logout:hover {
	background: rgba(108, 117, 125, 0.38);
	color: var(--text);
}

/* Mobile nav toggle */
.mobile-nav-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 6px;
	border: 1px solid var(--border-strong);
	background: rgba(17, 21, 28, 0.85);
	color: var(--text);
	padding: 8px 13px;
	border-radius: var(--radius-xs);
	font-size: 0.88rem;
	font-weight: 600;
	cursor: pointer;
	min-height: 36px;
}

/* ─── BUTTONS ───────────────────────────────────────────────── */
.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 11px 22px;
	font-size: 0.95rem;
	font-weight: 600;
	font-family: inherit;
	text-align: center;
	cursor: pointer;
	border: none;
	border-radius: var(--radius-md);
	transition: background 0.18s, transform 0.12s, box-shadow 0.18s, opacity 0.18s;
	color: #fff;
	text-decoration: none;
	box-shadow: var(--shadow-sm);
	min-height: 42px;
	line-height: 1.25;
	white-space: normal;
}

.button:active { transform: translateY(1px) scale(0.99); }

.button:focus-visible {
	outline: 3px solid rgba(77, 171, 247, 0.55);
	outline-offset: 2px;
}

.button-primary  { background: var(--primary); }
.button-primary:hover  { background: #2f8df0; }

.button-success  { background: #22b573; }
.button-success:hover  { background: #189a60; }

.button-start    { background: #51cf66; }
.button-start:hover    { background: #3bbf56; }

.button-stop     { background: var(--warning); }
.button-stop:hover     { background: #e5963d; }

.button-warning  { background: var(--warning); }
.button-warning:hover  { background: #e5963d; }

.button-danger   { background: var(--danger); }
.button-danger:hover   { background: #f24b4b; }

.button-secondary { background: rgba(93, 102, 115, 0.7); border: 1px solid var(--border-strong); }
.button-secondary:hover { background: rgba(93, 102, 115, 0.95); }

.button-disabled { background: #444c58; cursor: not-allowed; opacity: 0.65; }

.button-wide { width: 100%; }

.button-small {
	padding: 7px 14px;
	font-size: 0.85rem;
	min-height: 34px;
	border-radius: var(--radius-xs);
}

.button-tiny {
	padding: 3px 9px;
	font-size: 0.78rem;
	min-height: 26px;
	border-radius: 6px;
	line-height: 1.4;
}

/* ─── FORMS ─────────────────────────────────────────────────── */
.form-group {
	margin-bottom: 20px;
}

.form-group label {
	display: block;
	margin-bottom: 7px;
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--text);
}

.form-group input[type='text'],
.form-group input[type='url'],
.form-group input[type='password'],
.form-group input[type='number'],
.form-group select,
.form-group textarea,
.form-control {
	width: 100%;
	padding: 11px 14px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: var(--radius-md);
	font-size: 15px;
	font-family: inherit;
	transition: border-color 0.2s, box-shadow 0.2s;
	background: var(--bg-input);
	color: var(--text);
	min-height: 44px;
}

.form-group textarea {
	min-height: 80px;
	height: auto;
	resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.18);
}

.field-hint {
	display: block;
	margin-top: 6px;
	font-size: 0.8rem;
	color: var(--muted);
	line-height: 1.45;
}

.form-group-checkbox {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 12px;
	padding: 10px 12px;
	border-radius: var(--radius-xs);
	background: var(--bg-surface);
	border: 1px solid var(--border);
}

.form-group-checkbox input[type='checkbox'] {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	accent-color: var(--primary);
	cursor: pointer;
}

.form-group-checkbox label {
	margin: 0;
	font-size: 0.88rem;
	cursor: pointer;
}

.form-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--gap-sm);
	margin-top: 16px;
}

.form-inline {
	display: flex;
	gap: var(--gap-sm);
	flex-wrap: wrap;
	align-items: flex-end;
}

.form-inline input {
	flex: 1;
	min-width: 70px;
	padding: 8px 10px !important;
	font-size: 14px !important;
	min-height: 38px;
}

.form-inline button { flex-shrink: 0; }

/* Password / copy widgets */
.password-wrapper {
	position: relative;
	display: flex;
	flex-direction: column;
}

.password-wrapper input[type='password'],
.password-wrapper input[type='text'] {
	padding-right: 104px;
}

.copy-button,
.toggle-password {
	position: absolute;
	/* Position buttons relative to the input, accounting for labels/hints */
	bottom: 0;
	height: 44px;
	width: 46px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: transparent;
	cursor: pointer;
	font-size: 1.15rem;
	padding: 0;
	color: var(--muted);
	transition: color 0.18s, background 0.18s;
	z-index: 5;
}

.copy-button {
	right: 46px;
	border-left: 1px solid var(--border);
}

.toggle-password {
	right: 0;
	border-left: 1px solid var(--border);
	border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.copy-button:hover,
.toggle-password:hover {
	color: var(--primary);
	background: var(--bg-surface);
}

.password-wrapper .field-hint {
	order: 10; /* ensure hint is below input if placed before buttons in HTML */
}

/* ─── STAT CARDS ────────────────────────────────────────────── */
.stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: var(--gap-md);
	margin-bottom: 12px;
}

.stat-card {
	background: var(--bg-card);
	border-radius: var(--radius-lg);
	padding: 18px 16px;
	border: 1px solid var(--border);
	text-decoration: none;
	display: block;
	color: inherit;
	transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

a.stat-card:hover {
	transform: translateY(-2px);
	border-color: rgba(77, 163, 255, 0.32);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.stat-card h3 {
	margin: 0 0 8px;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
}

.stat-card .stat-number {
	font-size: clamp(1.5rem, 2.2vw, 2.1rem);
	font-weight: 700;
	color: var(--text);
	line-height: 1.1;
}

.stat-card .stat-number small {
	font-size: 0.38em;
	font-weight: 400;
	color: var(--muted);
	margin-left: 2px;
}

/* ─── DASHBOARD ─────────────────────────────────────────────── */
.dashboard-page-head {
	margin-bottom: 4px;
}

.dashboard-page-head h1 {
	text-align: left;
	margin-bottom: 2px;
}

.dashboard-page-head p {
	color: var(--muted);
	font-size: 0.9rem;
	margin: 0;
}

.dashboard-container {
	display: grid;
	grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
	gap: 24px;
	align-items: start;
}

.dashboard-column-left { min-width: 0; }

.dashboard-column-right {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.dashboard-container section {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: 18px;
	padding: 18px;
}

.section-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--gap-sm);
	flex-wrap: wrap;
	margin-bottom: 4px;
}

.section-head h2 { margin-bottom: 0; border-bottom: none; padding-bottom: 0; }

/* ─── CHARTS ────────────────────────────────────────────────── */
.chart-container {
	background: rgba(12, 16, 22, 0.7);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	width: 100%;
	height: 300px;
	padding: 14px 14px 10px;
	margin-bottom: 14px;
}

.chart-container h3 {
	font-size: 0.85rem;
	color: var(--muted);
	margin-bottom: 8px;
}

canvas {
	width: 100% !important;
	height: 240px !important;
}

/* ─── ANALYTICS DASHBOARD ───────────────────────────────────── */
.analytics-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--gap-md);
	flex-wrap: wrap;
	margin-bottom: 14px;
}

.analytics-head-actions {
	display: flex;
	align-items: center;
	gap: var(--gap-xs);
	flex-wrap: wrap;
}

.analytics-kpi-grid {
	display: grid;
	grid-template-columns: repeat(6, minmax(150px, 1fr));
	gap: 12px;
}

.analytics-kpi-card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-height: 118px;
	padding: 16px;
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
		rgba(12, 16, 22, 0.68);
	color: inherit;
	text-decoration: none;
	box-shadow: var(--shadow-sm);
}

a.analytics-kpi-card:hover {
	border-color: rgba(77, 163, 255, 0.32);
	transform: translateY(-1px);
}

.analytics-kpi-card strong {
	font-size: clamp(1.35rem, 2vw, 1.95rem);
	line-height: 1.05;
	color: var(--text);
	font-weight: 700;
}

.analytics-kpi-card small,
.panel-note,
.analytics-list-row small,
.analytics-bar-row small,
.analytics-table small {
	color: var(--muted);
	font-size: 0.8rem;
}

.kpi-label {
	color: var(--text-dim);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1.3;
	text-transform: uppercase;
}

.analytics-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
	gap: 18px;
	align-items: start;
}

.analytics-panel {
	min-width: 0;
	padding: 18px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: rgba(18, 23, 31, 0.86);
	box-shadow: var(--shadow-sm);
}

.analytics-panel-wide {
	grid-column: span 1;
}

.analytics-chart {
	width: 100%;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: rgba(8, 12, 18, 0.48);
	padding: 14px;
}

.analytics-chart canvas {
	display: block;
	width: 100% !important;
}

.analytics-chart-large,
.analytics-chart-large canvas {
	height: 360px !important;
}

.analytics-chart-donut,
.analytics-chart-donut canvas {
	height: 260px !important;
}

.analytics-list {
	display: grid;
	gap: 9px;
	margin-top: 12px;
}

.analytics-list-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 5px 12px;
	align-items: center;
	padding: 11px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-xs);
	background: rgba(8, 12, 18, 0.38);
	color: inherit;
	text-decoration: none;
}

.analytics-list-row strong {
	font-size: 0.95rem;
	color: var(--text);
	white-space: nowrap;
}

.analytics-list-row small {
	grid-column: 1 / -1;
}

.analytics-link-row:hover {
	border-color: rgba(77, 163, 255, 0.32);
	background: rgba(77, 163, 255, 0.08);
}

.analytics-bar-list {
	display: grid;
	gap: 14px;
}

.analytics-bar-row {
	display: grid;
	gap: 7px;
}

.bar-row-head {
	display: flex;
	justify-content: space-between;
	gap: var(--gap-sm);
	font-size: 0.9rem;
}

.bar-row-head span {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bar-row-head strong {
	flex-shrink: 0;
}

.bar-track {
	height: 9px;
	overflow: hidden;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.07);
}

.bar-track span {
	display: block;
	height: 100%;
	border-radius: inherit;
	background: linear-gradient(90deg, #4da3ff, #4cc38a);
}

.subscription-state-grid,
.status-summary-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
}

.subscription-state-item,
.status-summary-item {
	padding: 13px;
	border: 1px solid var(--border);
	border-radius: var(--radius-xs);
	background: rgba(8, 12, 18, 0.38);
}

.subscription-state-item span,
.status-summary-item span {
	display: block;
	margin-bottom: 4px;
	color: var(--muted);
	font-size: 0.8rem;
}

.subscription-state-item strong,
.status-summary-item strong {
	font-size: 1.35rem;
	line-height: 1;
}

.subscription-state-item.is-active {
	border-color: rgba(76, 195, 138, 0.34);
	background: rgba(76, 195, 138, 0.08);
}

.subscription-state-item.is-expired {
	border-color: rgba(255, 107, 107, 0.32);
	background: rgba(255, 107, 107, 0.07);
}

.subscription-state-item.is-trial {
	border-color: rgba(77, 163, 255, 0.32);
	background: rgba(77, 163, 255, 0.07);
}

.empty-state {
	padding: 14px;
	border: 1px dashed var(--border-strong);
	border-radius: var(--radius-xs);
	color: var(--muted);
	background: rgba(8, 12, 18, 0.26);
	font-size: 0.9rem;
}

.analytics-table td {
	white-space: nowrap;
}

.paid-transactions-panel .section-head {
	margin-bottom: 12px;
}

.paid-transactions-panel {
	grid-column: 1 / -1;
}

.paid-transactions-scroll {
	max-height: 620px;
}

.paid-transactions-scroll table {
	min-width: 860px;
}

.tx-date {
	color: #d8e5f4;
	font-variant-numeric: tabular-nums;
}

.tx-user {
	display: grid;
	gap: 3px;
	min-width: 140px;
}

.tx-user strong {
	color: var(--text);
	font-size: 0.92rem;
	overflow-wrap: anywhere;
}

.tx-plan {
	display: inline-block;
	max-width: 260px;
	overflow: hidden;
	text-overflow: ellipsis;
	vertical-align: bottom;
	white-space: nowrap;
}

.tx-method {
	display: inline-flex;
	align-items: center;
	min-height: 28px;
	padding: 4px 10px;
	border: 1px solid rgba(77, 163, 255, 0.26);
	border-radius: 999px;
	background: rgba(77, 163, 255, 0.1);
	color: #cfe7ff;
	font-size: 0.82rem;
	font-weight: 700;
}

.tx-amount {
	text-align: right;
}

.tx-amount strong {
	color: #aef0ca;
	font-variant-numeric: tabular-nums;
}

/* ─── TABLES ────────────────────────────────────────────────── */
.table-scroll {
	position: relative;
	overflow-x: auto;
	width: 100%;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: rgba(12, 16, 22, 0.5);
	scrollbar-width: thin;
	scrollbar-color: var(--border-strong) transparent;
}

.table-scroll::-webkit-scrollbar { height: 6px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

.table-scroll table {
	margin-top: 0;
	border: none;
	min-width: 720px;
}

.table-scroll th:first-child,
.table-scroll td:first-child { border-left: none; }

.table-scroll th:last-child,
.table-scroll td:last-child { border-right: none; }

.users-table,
.transactions-table,
.keys-table {
	width: 100%;
	border-collapse: collapse;
}

.users-table th,
.users-table td,
.transactions-table th,
.transactions-table td {
	border: 1px solid rgba(255, 255, 255, 0.05);
	padding: 12px 16px;
	text-align: left;
	vertical-align: middle;
	font-size: 0.9rem;
	color: var(--text);
}

.users-table thead,
.transactions-table thead {
	background: rgba(255, 255, 255, 0.02);
}

.users-table th,
.transactions-table th {
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--muted);
	position: sticky;
	top: 0;
	z-index: 10;
	border-bottom: 2px solid var(--border);
}

.users-table tbody tr,
.transactions-table tbody tr {
	transition: background 0.15s;
}

.users-table tbody tr:hover,
.transactions-table tbody tr:hover {
	background: var(--bg-hover);
}

.users-table .actions-cell {
	min-width: 280px;
	text-align: right;
}

.actions-cell form { display: inline-block; }

.actions-wrapper {
	display: flex;
	gap: var(--gap-xs);
	flex-wrap: wrap;
	justify-content: flex-end;
	align-items: center;
}

/* ─── STATUS BADGES ─────────────────────────────────────────── */
.status-badge {
	display: inline-flex;
	align-items: center;
	padding: 3px 9px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.status-active  { background: rgba(76, 195, 138, 0.18); color: #9ef5c8; border: 1px solid rgba(76, 195, 138, 0.4); }
.status-trial   { background: rgba(77, 163, 255, 0.18); color: #b8dcff; border: 1px solid rgba(77, 163, 255, 0.4); }
.status-banned  { background: rgba(255, 107, 107, 0.18); color: #ffcece; border: 1px solid rgba(255, 107, 107, 0.4); }
.status-warning { background: rgba(245, 165, 74, 0.18); color: #ffd8a0; border: 1px solid rgba(245, 165, 74, 0.4); }
.status-pending { background: rgba(245, 165, 74, 0.18); color: #ffd8a0; border: 1px solid rgba(245, 165, 74, 0.4); }
.status-info    { background: rgba(77, 163, 255, 0.16); color: #b8dcff; border: 1px solid rgba(77, 163, 255, 0.35); }
.status-stopped { background: rgba(108, 117, 125, 0.18); color: #c8cdd5; border: 1px solid rgba(108, 117, 125, 0.4); }

.status-badge.status-warning { color: #2f2112; background-color: var(--warning); border: none; }
.status-badge.status-pending { color: #2f2112; background-color: var(--warning); border: none; }
.status-badge.status-info { color: #fff; background-color: #386fa4; border: none; }
.status-badge.status-stopped { color: #fff; background-color: #6c757d; border: none; }

/* ─── TABLE TOOLBAR ─────────────────────────────────────────── */
.table-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--gap-md);
	margin: 8px 0 12px;
	flex-wrap: wrap;
}

.table-tools {
	display: flex;
	align-items: center;
	gap: var(--gap-sm);
	flex-wrap: wrap;
}

.support-transcript {
	display: grid;
	gap: 12px;
}

.support-message {
	padding: 14px 16px;
	border-radius: var(--radius-md);
	border: 1px solid var(--border-color);
	background: rgba(255, 255, 255, 0.86);
}

.support-message-user_to_support {
	border-left: 4px solid var(--accent);
}

.support-message-support_to_user {
	border-left: 4px solid var(--success);
}

.support-message-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 8px;
	font-size: 0.86rem;
	color: var(--muted);
}

.support-message-body {
	white-space: pre-wrap;
	word-break: break-word;
}

.support-message-error {
	margin-top: 8px;
	color: var(--danger);
	font-size: 0.88rem;
}

.search-input {
	min-width: 200px;
	flex: 1 1 220px;
	padding: 9px 14px;
	border-radius: var(--radius-md);
	border: 1px solid rgba(255, 255, 255, 0.1);
	background: var(--bg-input);
	color: var(--text);
	font-size: 0.9rem;
	font-family: inherit;
	transition: border-color 0.2s, box-shadow 0.2s;
	min-height: 40px;
}

.search-input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.18);
}

.filter-group {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px;
	border-radius: 999px;
	background: rgba(14, 18, 24, 0.7);
	border: 1px solid var(--border);
}

.filter-chip {
	border: none;
	background: transparent;
	color: var(--muted);
	padding: 5px 12px;
	border-radius: 999px;
	font-size: 0.85rem;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.18s, color 0.18s;
}

.filter-chip.is-active {
	background: var(--primary);
	color: #fff;
}

.filter-chip:not(.is-active):hover {
	background: rgba(255, 255, 255, 0.07);
	color: var(--text);
}

.count-pill {
	display: inline-flex;
	align-items: center;
	gap: var(--gap-xs);
	padding: 5px 12px;
	border-radius: 999px;
	background: rgba(14, 18, 24, 0.7);
	border: 1px solid var(--border);
	color: var(--muted);
	font-size: 0.85rem;
	white-space: nowrap;
}

.subscription-cell {
	display: inline-flex;
	flex-direction: column;
	gap: 3px;
	min-width: 132px;
	line-height: 1.2;
}

.subscription-cell strong {
	color: var(--text);
	font-size: 0.95rem;
}

.subscription-cell small {
	color: var(--muted);
	font-size: 0.78rem;
}

.admin-summary-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 10px;
	margin: 12px 0 16px;
}

.admin-summary-card {
	padding: 13px 14px;
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
	background: rgba(14, 18, 24, 0.68);
}

.admin-summary-card span {
	display: block;
	margin-bottom: 5px;
	color: var(--muted);
	font-size: 0.78rem;
	font-weight: 700;
	line-height: 1.25;
	text-transform: uppercase;
}

.profit-panel {
	display: grid;
	gap: 16px;
	padding: 18px;
	border: 1px solid rgba(77, 163, 255, 0.22);
	border-radius: var(--radius-lg);
	background:
		linear-gradient(135deg, rgba(77, 163, 255, 0.10), rgba(76, 195, 138, 0.055)),
		rgba(18, 23, 31, 0.90);
	box-shadow: var(--shadow-sm);
}

.profit-settings-form {
	display: flex;
	align-items: end;
	gap: var(--gap-xs);
	flex-wrap: wrap;
}

.profit-settings-form label {
	display: grid;
	gap: 5px;
	min-width: 130px;
	color: var(--muted);
	font-size: 0.78rem;
	font-weight: 700;
}

.profit-settings-form input,
.profit-edit-form input {
	width: 100%;
	min-height: 34px;
	padding: 7px 9px;
	border: 1px solid var(--border);
	border-radius: var(--radius-xs);
	background: var(--bg-input);
	color: var(--text);
	font: inherit;
}

.profit-slices {
	display: grid;
	grid-template-columns: repeat(5, minmax(170px, 1fr));
	gap: 12px;
}

.profit-card {
	display: grid;
	gap: 12px;
	min-height: 168px;
	padding: 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: rgba(8, 12, 18, 0.48);
}

.profit-card-primary {
	border-color: rgba(77, 163, 255, 0.38);
	background: rgba(77, 163, 255, 0.10);
}

.profit-card-head {
	display: grid;
	gap: 5px;
}

.profit-card-head strong {
	font-size: clamp(1.25rem, 1.7vw, 1.75rem);
	line-height: 1.05;
}

.profit-partners {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
}

.profit-partners div {
	display: grid;
	gap: 3px;
	padding: 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-xs);
	background: rgba(255, 255, 255, 0.035);
}

.profit-partners span,
.profit-card small {
	color: var(--muted);
	font-size: 0.78rem;
}

.profit-partners strong {
	font-size: 1rem;
	line-height: 1.15;
}

.profit-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--gap-sm);
	flex-wrap: wrap;
	padding-top: 2px;
}

.profit-actions form {
	display: flex;
	align-items: center;
	gap: var(--gap-xs);
	flex: 1 1 760px;
	flex-wrap: wrap;
}

.profit-actions label {
	display: grid;
	gap: 5px;
	flex: 1 1 170px;
	color: var(--muted);
	font-size: 0.78rem;
	font-weight: 700;
}

.profit-actions label:first-of-type {
	flex-basis: 320px;
}

.profit-actions .form-control {
	flex: 1 1 240px;
	min-height: 38px;
	padding: 8px 10px;
}

.profit-preview {
	display: grid;
	grid-template-columns: repeat(6, minmax(110px, 1fr));
	gap: 8px;
	width: 100%;
	padding: 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: rgba(8, 12, 18, 0.42);
}

.profit-preview div {
	display: grid;
	gap: 3px;
	min-width: 0;
}

.profit-preview span {
	color: var(--muted);
	font-size: 0.74rem;
	font-weight: 700;
	text-transform: uppercase;
}

.profit-preview strong {
	color: var(--text);
	font-size: 0.92rem;
	line-height: 1.2;
	word-break: break-word;
}

.profit-status {
	display: inline-flex;
	align-items: center;
	min-height: 24px;
	padding: 3px 8px;
	border-radius: 999px;
	border: 1px solid var(--border);
	font-size: 0.76rem;
	font-weight: 700;
	white-space: nowrap;
}

.profit-status-active {
	color: #d0e9ff;
	background: rgba(77, 163, 255, 0.12);
	border-color: rgba(77, 163, 255, 0.35);
}

.profit-status-paid {
	color: #c8f5da;
	background: rgba(76, 195, 138, 0.12);
	border-color: rgba(76, 195, 138, 0.35);
}

.profit-status-void {
	color: #ffe0b2;
	background: rgba(245, 165, 74, 0.10);
	border-color: rgba(245, 165, 74, 0.30);
}

.profit-history {
	display: grid;
	gap: 8px;
}

.profit-table th,
.profit-table td {
	vertical-align: top;
}

.profit-table tr.is-void {
	opacity: 0.58;
}

.profit-edit-form {
	display: grid;
	grid-template-columns: repeat(2, minmax(110px, 1fr));
	gap: 6px;
	min-width: 250px;
}

.profit-edit-form button {
	grid-column: 1 / -1;
	justify-self: start;
}

.admin-summary-card strong {
	color: var(--text);
	font-size: 1.55rem;
	line-height: 1;
}

/* ─── PAGINATION ────────────────────────────────────────────── */
.pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	margin-top: 20px;
	gap: 4px;
	flex-wrap: wrap;
}

.pagination a {
	color: var(--text-dim);
	background: var(--bg-card);
	border: 1px solid var(--border);
	padding: 7px 13px;
	text-decoration: none;
	border-radius: var(--radius-xs);
	font-size: 0.88rem;
	transition: background 0.18s, color 0.18s;
}

.pagination a:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); cursor: default; }
.pagination a.disabled { color: #444c58; pointer-events: none; }

/* ─── PAGE HEADER ───────────────────────────────────────────── */
.page-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--gap-md);
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.page-header h1 { margin-bottom: 0; text-align: left; }

.page-actions {
	display: flex;
	gap: var(--gap-sm);
	flex-wrap: wrap;
	align-items: center;
}

/* ─── MODAL ─────────────────────────────────────────────────── */
.modal {
	display: none;
	position: fixed;
	z-index: 1000;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(6px);
	overflow: auto;
}

.modal-content {
	background: rgba(22, 27, 36, 0.98);
	color: var(--text);
	margin: 8% auto;
	padding: 26px;
	border: 1px solid var(--border-strong);
	width: min(560px, 92%);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-lg);
}

.modal .close {
	color: var(--muted);
	float: right;
	font-size: 26px;
	font-weight: 600;
	cursor: pointer;
	transition: color 0.18s;
}

.modal .close:hover { color: #fff; }

/* ─── SETTINGS PAGE ─────────────────────────────────────────── */
.settings-container {
	display: flex;
	flex-wrap: wrap;
	gap: 28px;
	align-items: flex-start;
	min-width: 0;
}

.settings-column-left {
	flex: 0 0 380px;
	min-width: 280px;
	max-width: 100%;
}

.settings-column-right {
	flex: 1 1 360px;
	min-width: 280px;
	max-width: 100%;
}

.settings-section { margin-bottom: 36px; }

.settings-quicknav {
	display: flex;
	flex-wrap: wrap;
	gap: var(--gap-xs);
	margin-bottom: 16px;
	padding: 10px;
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
	background: rgba(10, 14, 20, 0.5);
}

.settings-quicknav a {
	text-decoration: none;
	color: var(--muted);
	border: 1px solid var(--border);
	background: var(--bg-surface);
	padding: 6px 12px;
	border-radius: 999px;
	font-size: 0.82rem;
	transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.settings-quicknav a:hover {
	color: #fff;
	border-color: var(--primary);
	background: var(--primary-dim);
}

.settings-save-bar {
	position: sticky;
	bottom: 0;
	padding-top: 10px;
	margin-top: 8px;
	background: linear-gradient(180deg, rgba(17, 21, 28, 0) 0%, rgba(17, 21, 28, 0.96) 36%);
}

.settings-save-bar .button { width: 100%; }

/* ─── HOST CARDS ────────────────────────────────────────────── */
.host-card {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 18px;
	margin-bottom: 16px;
	min-width: 0;
	max-width: 100%;
}

.host-card-global { border-color: rgba(245, 165, 74, 0.45); }

.host-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: var(--gap-sm);
	border-bottom: 1px solid var(--border);
	padding-bottom: 10px;
	margin-bottom: 14px;
	flex-wrap: wrap;
}

.host-header h3 {
	margin: 0;
	font-size: 0.95rem;
	min-width: 0;
	overflow-wrap: anywhere;
}

.host-actions {
	display: flex;
	gap: var(--gap-xs);
	flex-wrap: wrap;
}

.host-status-badge { margin-left: 8px; }
.host-disabled-label { color: #ff8787; font-weight: 700; font-size: 0.82rem; }

.promo-card {
	display: grid;
	gap: 16px;
}

.promo-card-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--border);
}

.promo-card-head h3 {
	margin: 0 0 6px;
	font-size: 1rem;
}

.promo-card-note {
	max-width: 820px;
	margin: 0;
	color: var(--text-dim);
	font-size: 0.88rem;
	line-height: 1.55;
}

.promo-toggle-form,
.promo-item-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	flex-wrap: wrap;
	flex-shrink: 0;
}

.promo-create-form,
.promo-edit-form {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: 10px;
	align-items: end;
	padding: 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: rgba(8, 12, 18, 0.34);
}

.promo-create-form label,
.promo-edit-form label {
	display: grid;
	gap: 6px;
	margin: 0;
	min-width: 0;
}

.promo-create-form label span,
.promo-edit-form label span,
.promo-usage span {
	color: var(--muted);
	font-size: 0.74rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.promo-create-form input,
.promo-edit-form input {
	width: 100%;
	min-width: 0;
	padding: 9px 11px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: var(--radius-xs);
	background: var(--bg-input);
	color: var(--text);
	font-family: inherit;
	font-size: 0.9rem;
	min-height: 38px;
}

.promo-create-form input:focus,
.promo-edit-form input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.18);
}

.promo-list {
	display: grid;
	gap: 10px;
}

.promo-item {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 10px;
	align-items: stretch;
	padding: 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: rgba(12, 16, 22, 0.58);
}

.promo-edit-form {
	grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
	padding: 0;
	border: none;
	background: transparent;
}

.promo-code-field {
	grid-column: span 2;
}

.promo-active-toggle {
	align-self: stretch;
	display: flex !important;
	flex-direction: row;
	align-items: center;
	gap: 8px !important;
	padding: 8px 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-xs);
	background: rgba(8, 12, 18, 0.32);
}

.promo-active-toggle input {
	width: 16px;
	height: 16px;
	min-height: 0;
	accent-color: var(--success);
}

.promo-usage {
	display: grid;
	align-content: center;
	gap: 4px;
	min-width: 0;
	padding: 8px 10px;
	border: 1px solid rgba(77, 163, 255, 0.22);
	border-radius: var(--radius-xs);
	background: rgba(77, 163, 255, 0.08);
}

.promo-usage strong {
	color: var(--text);
	font-variant-numeric: tabular-nums;
}

.host-url {
	overflow-wrap: anywhere;
	word-break: break-word;
}

.plan-list {
	list-style: none;
	padding: 0;
	margin-bottom: 14px;
}

.plan-list li {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 10px;
	border-bottom: 1px solid var(--border);
	font-size: 0.88rem;
	gap: var(--gap-sm);
}

.plan-list li:last-child { border-bottom: none; }

.plans-section h4,
.plans-section h5 { border: none; }

.plans-section,
.payment-rules-section {
	min-width: 0;
	max-width: 100%;
}

/* ─── BACKUP CARD ───────────────────────────────────────────── */
.backup-card {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 20px;
	box-shadow: var(--shadow-sm);
}

.backup-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: var(--gap-sm);
	margin-bottom: 16px;
}

.backup-header p {
	margin: 4px 0 0;
	color: var(--text-dim);
	font-size: 0.88rem;
}

.backup-actions {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.import-form {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.file-drop {
	border: 1px dashed rgba(255, 255, 255, 0.2);
	border-radius: var(--radius-sm);
	padding: 14px;
	text-align: center;
	background: var(--bg-surface);
	color: var(--text-dim);
	cursor: pointer;
	transition: border-color 0.2s, background 0.2s;
	font-size: 0.88rem;
}

.file-drop input[type='file'] { display: none; }

.file-drop:hover {
	border-color: var(--primary);
	background: var(--primary-dim);
}

.warning-text {
	color: #ffa8a8;
	font-size: 0.82rem;
	margin: 0;
}

.chip {
	display: inline-flex;
	align-items: center;
	padding: 5px 10px;
	border-radius: 999px;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	border: 1px solid #4dabf7;
	color: #d0e9ff;
	background: rgba(77, 171, 247, 0.1);
	white-space: nowrap;
}

.chip-safe {
	border-color: var(--success);
	color: #d5f5e6;
	background: rgba(76, 195, 138, 0.1);
}

/* ─── KEYS PAGE ─────────────────────────────────────────────── */
.maintenance-hint {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 20px;
	margin: 12px 0 20px;
	padding: 16px 20px;
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
	background: rgba(14, 18, 24, 0.4);
	color: var(--text-dim);
	font-size: 0.88rem;
	line-height: 1.6;
}

.maintenance-hint strong,
.maintenance-hint b { color: var(--primary); }

.task-status-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: var(--gap-md);
	margin: 10px 0 24px;
}

.task-status-card {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 18px;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.task-status-card:hover {
	border-color: var(--border-strong);
	box-shadow: var(--shadow-md);
}

.task-status-card h3 {
	margin: 0 0 10px;
	font-size: 0.82rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--muted);
}

.task-status-pill {
	display: inline-flex;
	align-items: center;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: 6px;
	border: 1px solid transparent;
}

.task-status-pill.is-idle    { background: rgba(108, 117, 125, 0.16); border-color: rgba(108, 117, 125, 0.45); color: #c8cdd5; }
.task-status-pill.is-running { background: rgba(245, 165, 74, 0.18); border-color: rgba(245, 165, 74, 0.5); color: #ffe0b2; }
.task-status-pill.is-success { background: rgba(76, 195, 138, 0.18); border-color: rgba(76, 195, 138, 0.5); color: #c8f5da; }
.task-status-pill.is-error   { background: rgba(255, 107, 107, 0.18); border-color: rgba(255, 107, 107, 0.5); color: #ffcece; }

.task-status-message {
	margin: 0;
	font-size: 0.82rem;
	color: var(--muted);
}

.key-user-group-row { background: rgba(255, 255, 255, 0.03); border-bottom: 2px solid var(--border); }
.key-user-group-cell { padding: 9px 14px; }
.key-user-name { font-size: 1rem; color: var(--primary); }
.key-user-name a { color: inherit; text-decoration: none; }
.key-user-id { color: var(--muted); margin-left: 10px; font-size: 0.82rem; }

.key-row-global { background: rgba(77, 163, 255, 0.06); border-left: 3px solid var(--primary); }

.key-email-cell { max-width: 320px; word-break: break-word; font-size: 0.85rem; }
.key-link-cell { min-width: 280px; }
.key-copy-tools {
	display: flex;
	flex-wrap: wrap;
	gap: var(--gap-xs);
	align-items: center;
}
.secret-value {
	margin-top: 8px;
	padding: 10px 12px;
	border-radius: var(--radius-sm);
	background: rgba(8, 12, 18, 0.72);
	border: 1px solid var(--border);
	max-width: 420px;
}
.secret-value code {
	display: block;
	word-break: break-all;
	white-space: pre-wrap;
	font-size: 0.78rem;
	color: #d8ecff;
}
.secret-hint {
	display: block;
	margin-top: 6px;
	font-size: 0.74rem;
	color: var(--muted);
}
.secret-empty {
	display: inline-block;
	font-size: 0.8rem;
	color: var(--muted);
	max-width: 240px;
	line-height: 1.45;
}
.keys-table .keys-actions-head { text-align: right; min-width: 260px; }

.duration-form {
	display: flex;
	gap: var(--gap-xs);
	justify-content: flex-end;
	align-items: flex-end;
	flex-wrap: wrap;
}

.actions-cell form.duration-form { display: flex; margin: 0; }

.duration-input-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
}

.duration-input-wrap span {
	font-size: 0.7rem;
	color: var(--muted);
	line-height: 1;
}

.duration-input-wrap input {
	width: 58px;
	padding: 4px 6px !important;
	text-align: center;
	font-size: 0.88rem !important;
	min-height: 34px;
}

.duration-submit { display: none; }

/* ─── UPDATES PAGE ──────────────────────────────────────────── */
.update-card {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 24px;
	box-shadow: var(--shadow-sm);
}

.update-container { text-align: center; }
.current-version h3 { margin-bottom: 10px; }

.badge {
	display: inline-flex;
	padding: 5px 12px;
	border-radius: 999px;
	font-weight: 700;
}

.badge-primary {
	background: rgba(77, 171, 247, 0.14);
	color: #d0e9ff;
	border: 1px solid #4dabf7;
}

.update-actions { margin: 24px 0; }

.hidden { display: none; }

.alert {
	padding: 12px 16px;
	border-radius: var(--radius-sm);
	margin-top: 16px;
	text-align: left;
	border: 1px solid transparent;
	font-size: 0.9rem;
}

.alert-info    { background: rgba(77, 171, 247, 0.12); color: #d0e9ff; border-color: rgba(77, 171, 247, 0.4); }
.alert-success { background: rgba(76, 195, 138, 0.12); color: #c8f5da; border-color: rgba(76, 195, 138, 0.38); }
.alert-danger  { background: rgba(255, 107, 107, 0.12); color: #ffcece; border-color: rgba(255, 107, 107, 0.38); }
.alert-warning { background: rgba(245, 165, 74, 0.12); color: #ffe0b2; border-color: rgba(245, 165, 74, 0.42); }

.terminal-log {
	background: rgba(7, 11, 17, 0.92);
	color: #7effc4;
	font-family: ui-monospace, 'Fira Code', 'Cascadia Code', Consolas, monospace;
	font-size: 0.85rem;
	padding: 14px 16px;
	text-align: left;
	margin-top: 16px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	white-space: pre-wrap;
	word-break: break-all;
	max-height: 400px;
	overflow-y: auto;
}

/* ─── DIAGNOSTICS ───────────────────────────────────────────── */
.diagnostic-summary {
	display: flex;
	flex-wrap: wrap;
	gap: var(--gap-sm);
	margin-bottom: 12px;
}

.diagnostics-table td { vertical-align: top; }

.diag-issue {
	color: #ffd9d9;
	background: rgba(255, 107, 107, 0.1);
	border: 1px solid rgba(255, 107, 107, 0.3);
	border-radius: var(--radius-xs);
	padding: 5px 8px;
	margin-bottom: 4px;
	font-size: 0.8rem;
}

/* ─── LOGIN PAGE ────────────────────────────────────────────── */
body.login-page {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: 20px;
}

.login-container {
	width: 100%;
	max-width: 400px;
	padding: 36px 32px;
	background: rgba(19, 24, 32, 0.97);
	border-radius: var(--radius-xl);
	box-shadow: var(--shadow-lg);
	border: 1px solid var(--border-strong);
	backdrop-filter: blur(14px);
}

.login-container h1 {
	text-align: center;
	margin-bottom: 28px;
	font-size: 1.5rem;
}

/* ─── USER SESSION CONTROLS (legacy compat) ─────────────────── */
.user-session-controls {
	display: flex;
	align-items: center;
}

/* ─── ANIMATIONS ────────────────────────────────────────────── */
@keyframes fade-up {
	from { opacity: 0; transform: translateY(10px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ─── SETTINGS SUBSECTION HEADERS ───────────────────────────── */
.settings-sub-h {
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--text);
	padding: 8px 0 8px;
	margin: 20px 0 14px;
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	gap: 8px;
}

/* ─── RESPONSIVE: ≤ 1100px ──────────────────────────────────── */
@media (max-width: 1100px) {
	.container { width: min(1100px, 96vw); padding: 20px; }

	.analytics-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.profit-slices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.promo-create-form,
	.promo-edit-form {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.promo-item {
		grid-template-columns: 1fr;
	}
	.promo-item-actions {
		justify-content: flex-start;
	}

	.settings-column-left { flex: 0 0 320px; min-width: 260px; }
}

/* ─── RESPONSIVE: ≤ 900px ───────────────────────────────────── */
@media (max-width: 900px) {
	.dashboard-container { grid-template-columns: 1fr; }
	.analytics-layout { grid-template-columns: 1fr; }
	.promo-card-head {
		flex-direction: column;
	}
	.promo-toggle-form {
		justify-content: flex-start;
	}

	.settings-column-left,
	.settings-column-right {
		flex: 0 0 100%;
		min-width: 0;
		width: 100%;
		max-width: 100%;
	}

	.settings-container {
		flex-direction: column;
		width: 100%;
		max-width: 100%;
		overflow-x: hidden;
	}
}

/* ─── RESPONSIVE: ≤ 768px ───────────────────────────────────── */
@media (max-width: 768px) {
	body { padding: 10px; }

	.container { width: 100%; padding: 16px; border-radius: 18px; }

	/* Header: compact mobile layout */
	.header-inner { gap: var(--gap-xs); }

	.navigation {
		display: flex;
		visibility: hidden;
		opacity: 0;
		max-height: 0;
		width: 100%;
		order: 10; /* push below everything */
		flex-direction: column;
		align-items: stretch;
		padding: 0;
		gap: 0;
		margin: 0;
		overflow: hidden;
		transition: max-height 0.3s ease-in-out, opacity 0.25s ease-in-out, margin 0.3s ease-in-out, padding 0.3s ease-in-out;
		background: rgba(8, 12, 18, 0.7);
		border-color: transparent;
	}

	.navigation.is-open {
		visibility: visible;
		opacity: 1;
		max-height: 500px;
		padding: 8px;
		margin-top: 10px;
		gap: 4px;
		border-color: var(--border);
	}

	.navigation .nav-link {
		padding: 11px 14px;
		justify-content: flex-start;
	}

	.mobile-nav-toggle { display: inline-flex; }

	.header-right {
		margin-left: auto;
		gap: 6px;
	}

	/* Bot controls: compact on mobile */
	.bot-control p { display: none; } /* hide "Запущен/Остановлен" text */

	.bot-control .button-small {
		padding: 5px 10px;
		font-size: 0.78rem;
		min-height: 30px;
	}

	.table-toolbar { flex-direction: column; align-items: stretch; }
	.table-tools   { flex-direction: column; align-items: stretch; }

	.search-input {
		flex: 0 0 auto;
		min-width: 0;
		width: 100%;
	}

	.filter-group {
		width: 100%;
		flex-wrap: wrap;
		border-radius: var(--radius-md);
		padding: 6px;
	}

	.filter-chip {
		flex: 1 1 calc(50% - 4px);
		text-align: center;
		min-width: 0;
	}

	.count-pill { width: 100%; justify-content: center; }

	.page-actions { width: 100%; }

	.analytics-head { align-items: stretch; }
	.analytics-head > div,
	.analytics-head-actions { width: 100%; }
	.analytics-head-actions .button { flex: 1 1 160px; }
	.analytics-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.analytics-kpi-card { min-height: 108px; }
	.profit-slices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.profit-actions form { flex-direction: column; align-items: stretch; }
	.profit-settings-form { width: 100%; }
	.profit-settings-form label { flex: 1 1 150px; }
	.profit-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.analytics-chart-large,
	.analytics-chart-large canvas { height: 300px !important; }
	.analytics-chart-donut,
	.analytics-chart-donut canvas { height: 230px !important; }

	.host-header { flex-direction: column; align-items: flex-start; gap: 10px; }

	.plan-list li { flex-direction: column; align-items: flex-start; gap: 6px; }

	.chart-container { height: 260px; }

	.keys-table .keys-actions-head { min-width: 220px; }

	.table-scroll table { min-width: 620px; }

	.modal-content { margin: 14% auto; }

	.form-inline { flex-direction: column; }
	.form-inline input {
		flex: 0 0 auto;
		min-width: 0;
		width: 100%;
	}

	.form-inline button,
	.host-actions .button,
	.pay-item-form,
	.pay-method-btn {
		max-width: 100%;
	}

	.pay-methods-grid,
	.plan-pay-methods {
		width: 100%;
		max-width: 100%;
		min-width: 0;
	}
}

/* ─── RESPONSIVE: ≤ 480px ───────────────────────────────────── */
@media (max-width: 480px) {
	.container { padding: 14px; border-radius: 14px; }

	h1 { font-size: 1.3rem; margin-bottom: 12px; }
	h2 { font-size: 0.92rem; }

	.stat-card { padding: 14px 12px; }
	.stat-card .stat-number { font-size: 1.5rem; }

	.chart-container { height: 220px; }
	canvas { height: 180px !important; }
	.analytics-kpi-grid { grid-template-columns: 1fr; }
	.analytics-kpi-card { min-height: 96px; }
	.profit-panel { padding: 14px; }
	.profit-slices { grid-template-columns: 1fr; }
	.profit-partners { grid-template-columns: 1fr; }
	.profit-settings-form { flex-direction: column; align-items: stretch; }
	.profit-preview { grid-template-columns: 1fr; }
	.profit-edit-form { grid-template-columns: 1fr; min-width: 220px; }
	.analytics-panel { padding: 14px; }
	.analytics-chart { padding: 10px; }
	.analytics-chart-large,
	.analytics-chart-large canvas { height: 260px !important; }
	.analytics-chart-donut,
	.analytics-chart-donut canvas { height: 210px !important; }
	.subscription-state-grid,
	.status-summary-grid { grid-template-columns: 1fr; }

	.button { padding: 10px 18px; font-size: 0.88rem; }
	.button-small { padding: 6px 11px; font-size: 0.8rem; }
	.button-tiny { padding: 2px 7px; font-size: 0.72rem; }

	.login-container { padding: 24px 18px; }

	/* Bot controls minimal on very small screens */
	.bot-control-name { display: none; }
	.bot-control { padding: 4px 6px; }

	.host-card { padding: 14px; }

	.pay-method-btn {
		white-space: normal;
		justify-content: center;
		text-align: center;
	}

	.plan-pay-methods { margin-left: 0; }
}

/* ─── PAYMENT RULES ─────────────────────────────────────────── */
.payment-rules-section {
	margin-top: 16px;
	border-top: 1px dashed var(--border);
	padding-top: 14px;
}

.payment-rules-section h4 {
	font-size: 0.82rem;
	color: var(--muted);
	margin: 0 0 10px;
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
}

.pay-methods-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.pay-item-form { margin: 0; }

.pay-method-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.76rem;
	font-weight: 600;
	padding: 5px 12px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-xs);
	background: var(--bg-surface);
	color: var(--text-dim);
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
	font-family: inherit;
	transition: all 0.2s;
}

.pay-method-btn:hover {
	background: var(--bg-hover);
	border-color: var(--primary-glow);
	color: var(--text);
}

.pay-method-btn.is-on {
	background: rgba(76, 195, 138, 0.12);
	border-color: rgba(76, 195, 138, 0.35);
	color: #9ef5c8;
}

.pay-method-btn.is-on:hover {
	background: rgba(76, 195, 138, 0.22);
}

.pay-method-btn.is-off {
	background: rgba(255, 107, 107, 0.1);
	border-color: rgba(255, 107, 107, 0.3);
	color: #ffcece;
	opacity: 0.7;
}

.pay-method-btn.is-off:hover {
	opacity: 1;
	background: rgba(255, 107, 107, 0.2);
}

.pay-method-btn.inherited {
	font-style: italic;
	opacity: 0.75;
}

.plan-pay-methods {
	margin: 8px 0 4px 16px;
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
}

.plan-pay-methods .pay-method-btn {
	font-size: 0.7rem;
	padding: 4px 10px;
}

/* ─── UI POLISH OVERRIDES ───────────────────────────────────── */
body {
	overflow-x: hidden;
}

main,
.header-right,
.host-card,
.settings-section,
.analytics-panel,
.profit-panel {
	min-width: 0;
}

h1 {
	letter-spacing: 0;
}

.navigation {
	flex: 1 1 420px;
}

.navigation .nav-link,
.header-right,
.bot-control {
	min-width: 0;
}

.header-right {
	flex: 0 1 auto;
	justify-content: flex-end;
}

.bot-control .status-running,
.bot-control .status-stopped {
	padding: 0;
	border: 0;
	background: transparent;
}

.bot-control .status-stopped {
	color: var(--muted);
}

.button {
	max-width: 100%;
	border: 1px solid transparent;
	transition: background 0.18s, border-color 0.18s, transform 0.12s, box-shadow 0.18s, opacity 0.18s;
}

.button:disabled,
.button-disabled {
	box-shadow: none;
}

.button-primary {
	color: #06111d;
}

.button-secondary {
	border-color: var(--border-strong);
}

.form-group input[type='email'],
.form-group input[type='date'],
.form-group input[type='datetime-local'] {
	width: 100%;
	padding: 11px 14px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: var(--radius-md);
	font-size: 15px;
	font-family: inherit;
	transition: border-color 0.2s, box-shadow 0.2s;
	background: var(--bg-input);
	color: var(--text);
	min-height: 44px;
}

.form-group input::placeholder,
.form-group textarea::placeholder,
.form-control::placeholder,
.search-input::placeholder {
	color: rgba(176, 186, 201, 0.62);
}

.form-inline {
	width: 100%;
}

.form-inline input {
	min-width: 110px;
}

.password-wrapper input[type='password'],
.password-wrapper input[type='text'] {
	padding-right: 58px;
}

.password-wrapper:has(.copy-button) input[type='password'],
.password-wrapper:has(.copy-button) input[type='text'] {
	padding-right: 104px;
}

.table-toolbar {
	padding: 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: rgba(8, 12, 18, 0.34);
}

.table-scroll {
	box-shadow: inset -18px 0 18px -22px rgba(232, 237, 245, 0.32);
}

.users-table th,
.users-table td,
.transactions-table th,
.transactions-table td {
	max-width: 420px;
}

.users-table .actions-cell {
	min-width: 260px;
}

.actions-wrapper .button {
	white-space: nowrap;
}

.status-badge {
	line-height: 1.2;
	white-space: nowrap;
}

.search-input {
	min-width: min(260px, 100%);
}

.filter-chip {
	min-height: 30px;
}

.admin-summary-card {
	min-width: 0;
}

.section-description {
	margin: -8px 0 16px;
	color: var(--text-dim);
	font-size: 0.88rem;
}

.modal {
	padding: 24px 12px;
}

.modal[hidden] {
	display: none !important;
}

.modal-content {
	position: relative;
	margin: 5vh auto;
	outline: none;
}

.modal-close,
.modal .close {
	position: absolute;
	top: 14px;
	right: 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border: 1px solid var(--border);
	border-radius: var(--radius-xs);
	background: rgba(255, 255, 255, 0.04);
	color: var(--muted);
	font-size: 24px;
	font-weight: 600;
	cursor: pointer;
	transition: color 0.18s, background 0.18s;
}

.modal-close:hover,
.modal .close:hover {
	color: #fff;
	background: rgba(255, 255, 255, 0.08);
}

.modal-user-line {
	margin: -6px 0 18px;
	color: var(--text-dim);
}

.modal-user-line span {
	color: var(--text);
	font-weight: 700;
}

.modal-user-line small {
	margin-left: 6px;
	color: var(--muted);
}

.settings-container {
	flex-wrap: nowrap;
	gap: 24px;
}

.settings-column-left {
	flex: 0 1 480px;
	min-width: 360px;
}

.settings-column-right {
	flex: 1 1 620px;
	min-width: 0;
}

.settings-section {
	margin-bottom: 24px;
}

.settings-quicknav {
	position: sticky;
	top: 0;
	z-index: 20;
	backdrop-filter: blur(10px);
}

.settings-save-bar {
	padding: 14px 0 2px;
}

.service-divider {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 16px;
	color: #8ebfff;
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.service-divider::before,
.service-divider::after {
	content: '';
	flex: 1;
	border-top: 1px solid rgba(77, 163, 255, 0.38);
}

.service-divider-alt {
	margin-top: 32px;
	color: #85d6e8;
}

.service-divider-alt::before,
.service-divider-alt::after {
	border-color: rgba(34, 211, 238, 0.34);
}

.service-section {
	padding-left: 16px;
	border-left: 3px solid rgba(77, 163, 255, 0.58);
}

.service-section-alt {
	border-left-color: rgba(34, 211, 238, 0.58);
}

.host-card {
	overflow: hidden;
}

.host-header h3 {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.host-actions {
	justify-content: flex-end;
}

.plan-list li {
	min-width: 0;
}

.plan-list li > span,
.plan-list li > form:first-child {
	min-width: 0;
	overflow-wrap: anywhere;
}

.key-link-cell {
	min-width: 260px;
}

.duration-form {
	min-width: 220px;
}

.duration-input-wrap input {
	width: 64px;
}

.payment-rules-head {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 10px;
}

.payment-rules-head h4 {
	margin: 0;
	border: none;
	padding: 0;
	font-size: 0.82rem;
	color: var(--muted);
}

.payment-rules-head form,
.plan-rules-title form {
	margin: 0;
}

.payment-rules-note {
	color: var(--muted);
	font-size: 0.74rem;
	font-style: italic;
	margin-right: auto;
}

.pay-item-form {
	min-width: 0;
}

.pay-method-btn {
	max-width: 100%;
}

.plan-pay-methods {
	margin-left: 0;
}

.plan-rules-list {
	display: grid;
	gap: 10px;
	margin-top: 12px;
}

.plan-rules-item {
	min-width: 0;
	padding: 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-xs);
	background: rgba(255, 255, 255, 0.025);
}

.plan-rules-title {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
	margin-bottom: 6px;
	color: var(--text-dim);
	font-size: 0.78rem;
}

.plan-rules-title b {
	color: var(--text);
	overflow-wrap: anywhere;
}

.plan-rules-title span {
	color: var(--muted);
}

@media (max-width: 1100px) {
	.settings-container {
		flex-wrap: wrap;
	}

	.settings-column-left,
	.settings-column-right {
		flex: 1 1 100%;
		min-width: 0;
	}
}

@media (max-width: 768px) {
	.header-controls {
		order: 5;
		width: 100%;
		justify-content: space-between;
	}

	.header-controls .bot-control {
		flex: 1 1 calc(50% - 4px);
		justify-content: space-between;
	}

	.user-session-controls {
		margin-left: auto;
	}

	.table-toolbar {
		padding: 8px;
	}

	.table-scroll table {
		min-width: 680px;
	}

	.modal-content {
		margin: 4vh auto;
		padding: 22px;
	}
}

@media (max-width: 480px) {
	.header-controls {
		gap: 6px;
	}

	.bot-control-name {
		display: inline;
		font-size: 0.68rem;
	}

	.service-section {
		padding-left: 10px;
	}

	.promo-create-form,
	.promo-edit-form {
		grid-template-columns: 1fr;
	}

	.promo-code-field {
		grid-column: span 1;
	}

	.promo-item-actions form,
	.promo-item-actions .button,
	.promo-create-form .button,
	.promo-edit-form .button {
		width: 100%;
	}

	.payment-rules-head {
		align-items: flex-start;
	}

	.payment-rules-note {
		width: 100%;
	}
}
