:root {
    color-scheme: light;
    --background: #f4f7fb;
    --surface: #ffffff;
    --text: #172033;
    --muted: #68758b;
    --border: #e2e8f0;
    --primary: #3659d9;
    --primary-dark: #2948bd;
    --green: #087a56;
    --green-bg: #e8f7f0;
    --amber: #996000;
    --amber-bg: #fff5d9;
    --red: #b42336;
    --red-bg: #fff0f1;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--background); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100% - 1180px) / 2)); background: var(--surface); border-bottom: 1px solid var(--border); }
.wordmark, .topbar-actions { display: flex; align-items: center; gap: 14px; }
.wordmark { color: var(--text); font-weight: 750; letter-spacing: -.02em; }
.topbar-actions form { margin: 0; }
.user-label { color: var(--muted); font-size: 14px; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: #e9edff; color: var(--primary); font-weight: 800; }
.brand-mark.small { width: 34px; height: 34px; border-radius: 11px; font-size: 13px; }
.container { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 44px 0 64px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 30px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 38px); letter-spacing: -.04em; }
h2 { margin-bottom: 8px; font-size: 19px; letter-spacing: -.02em; }
.eyebrow { margin-bottom: 8px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .13em; }
.muted { color: var(--muted); line-height: 1.55; }
.button { min-height: 40px; display: inline-flex; justify-content: center; align-items: center; padding: 0 15px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.button:hover { text-decoration: none; filter: brightness(.97); }
.button.primary { color: #fff; background: var(--primary); }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { color: var(--primary); background: #eef1ff; }
.button.subtle { color: #48556a; background: transparent; border-color: var(--border); }
.button.warning { color: #fff; background: #b77800; }
.button.danger { color: var(--red); background: #fff; border-color: #f1c8cd; }
.full-width { width: 100%; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 24px; }
.stat-card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: 15px; box-shadow: 0 5px 18px rgba(24, 39, 75, .035); }
.stat-card { padding: 22px 24px; }
.stat-label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.stat-card strong { font-size: 32px; letter-spacing: -.04em; }
.welcome-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 27px; }
.welcome-panel p:last-child { margin-bottom: 0; }
.control-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; align-items: start; }
.panel { padding: 24px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.section-heading p { margin-bottom: 0; font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 12px 10px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
td { padding: 15px 10px; border-top: 1px solid var(--border); vertical-align: middle; font-size: 13px; }
.client-url { display: inline-block; max-width: 270px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-block; padding: 6px 9px; border-radius: 99px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.status.online { color: var(--green); background: var(--green-bg); }
.status.maintenance { color: var(--amber); background: var(--amber-bg); }
.actions-cell { display: flex; gap: 7px; }
.inline-form { display: inline-flex; margin: 0; }
.inline-form .button { min-height: 34px; padding: 0 10px; font-size: 12px; }
.add-client-panel .muted { font-size: 13px; }
label { display: block; margin: 17px 0 7px; font-size: 13px; font-weight: 700; }
input { width: 100%; height: 43px; padding: 0 12px; border: 1px solid #d6deea; border-radius: 8px; outline: none; background: #fff; color: var(--text); }
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(54, 89, 217, .12); }
.add-client-panel .button { margin-top: 20px; }
.alert { margin-bottom: 20px; padding: 14px 16px; border: 1px solid transparent; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.alert.success { color: #086647; background: var(--green-bg); border-color: #c8ebdc; }
.alert.error { color: var(--red); background: var(--red-bg); border-color: #f4d1d5; }
.alert p { margin: 4px 0 10px; }
.token-row { display: flex; align-items: center; gap: 10px; }
.token-row code { min-width: 0; overflow-wrap: anywhere; padding: 8px; border-radius: 6px; background: rgba(255,255,255,.7); font-size: 12px; }
.empty-state { padding: 44px 16px; text-align: center; }
.empty-state p { margin: 8px 0 0; font-size: 13px; }
.auth-page { display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); padding: 36px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: 0 16px 50px rgba(24, 39, 75, .08); }
.auth-card .brand-mark { margin-bottom: 23px; }
.auth-card h1 { font-size: 30px; }
.auth-card .muted { margin-bottom: 24px; font-size: 14px; }
.auth-card .button { margin-top: 23px; }
@media (max-width: 850px) {
    .control-layout { grid-template-columns: 1fr; }
    .actions-cell { flex-wrap: wrap; }
}
@media (max-width: 600px) {
    .topbar { height: 62px; padding: 0 16px; }
    .topbar-actions { gap: 6px; }
    .user-label { display: none; }
    .container { width: min(100% - 28px, 1180px); padding-top: 30px; }
    .page-heading, .welcome-panel { align-items: flex-start; flex-direction: column; }
    .stats-grid { grid-template-columns: 1fr; gap: 10px; }
    .stat-card { padding: 17px 19px; }
    .stat-card strong { font-size: 26px; }
    .panel { padding: 17px; }
    .auth-card { padding: 28px 22px; }
}
