:root {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  color: #18243b;
  background: #f3f6fb;
  font-synthesis: none;
  --accent: #4338ca;
  --muted: #53627a;
  --line: #dce3ee;
  --night: #090f1d;
  --cyan: #67e8f9;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:disabled { cursor: wait; opacity: .6; }
[hidden] { display: none !important; }
h1, h2, p { margin-top: 0; }
h1, h2 { overflow-wrap: anywhere; }
h1 { font-size: 34px; line-height: 1.18; letter-spacing: -1.1px; margin-bottom: 12px; }
h2 { font-size: 22px; line-height: 1.35; letter-spacing: -.5px; margin-bottom: 10px; }
p { line-height: 1.65; }
button:focus-visible, a:focus-visible { outline: 3px solid #0891b2; outline-offset: 4px; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 256px;
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  background: var(--night);
  color: #d6dfef;
  border-right: 1px solid #233049;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 0; max-width: 100%; }
.brand b { color: var(--cyan); }
.brand-logo { display: block; width: 210px; max-width: 100%; height: auto; border-radius: 8px; background: #010306; }
.brand small { display: block; font-size: 11px; font-weight: 650; letter-spacing: 1.8px; color: #a8b8d1; margin-top: 14px; }
.brand-icon { background: #18283f; color: var(--cyan); width: 44px; height: 44px; display: grid; place-items: center; border-radius: 11px; font-size: 25px; }
.sidebar-content { margin-top: 42px; }
.overline { font-size: 12px; font-weight: 750; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 16px; }
.sidebar .overline { color: #a8b8d1; font-size: 11px; padding-left: 14px; }
nav { display: grid; gap: 8px; }
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; border: 1px solid transparent; background: transparent; text-align: left; padding: 12px 14px; border-radius: 10px; color: #c0cce0; font-size: 15px; font-weight: 600; }
.nav-item span { font-size: 19px; color: #9cacc7; }
.nav-item:hover { background: #142037; color: #fff; }
.nav-item.selected { background: #162c43; border-color: #28516a; color: #a5f3fc; box-shadow: inset 3px 0 0 var(--cyan); }
.nav-item.selected span { color: var(--cyan); }
.sidebar :is(button, a):focus-visible { outline-color: var(--cyan); }
.sidebar-foot { margin-top: auto; font-size: 13px; color: #d6dfef; padding-top: 36px; }
.sidebar-foot p { font-size: 12px; color: #a8b8d1; margin: 10px 0 0; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 2px; background: #a5b4fc; margin-right: 7px; }
.main-shell { min-width: 0; width: calc(100% - 256px); margin-left: 256px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { min-height: 80px; background: var(--night); border-bottom: 1px solid #233049; padding: 16px 36px; display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 14px; color: #a8b8d1; }
.topbar > span { min-width: 0; }
.topbar strong { color: #edf3ff; font-weight: 600; }
.user-box { min-width: 0; display: flex; align-items: center; gap: 16px; color: #d6dfef; }
.user-box > span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-button { min-height: 44px; background: none; border: 1px solid #35445e; border-radius: 8px; color: #a5f3fc; font-weight: 650; font-size: 14px; padding: 10px 14px; }
.text-button:hover { background: #142037; }
main { min-width: 0; padding: 40px 36px; max-width: 1500px; width: 100%; margin: 0 auto; flex: 1; }
footer { padding: 24px 36px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 16px; }

.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 40px; align-items: center; max-width: 1040px; margin: 8px auto 20px; }
.auth-intro { min-width: 0; }
.auth-intro h1 { font-size: clamp(34px, 3.2vw, 46px); letter-spacing: -1.7px; margin-top: 24px; line-height: 1.13; }
.auth-intro > p { color: var(--muted); font-size: 16px; max-width: 380px; }
.pill { display: inline-block; background: #eef0ff; color: #4338ca; border: 1px solid #d5d9fb; border-radius: 20px; padding: 7px 12px; font-size: 12px; font-weight: 700; letter-spacing: .3px; line-height: 1.4; }
.auth-intro .pill { background: #e4f5fa; color: #155e75; border-color: #b8e1ed; font-size: 11px; letter-spacing: 1.1px; }
.intro-note { display: flex; gap: 14px; margin-top: 26px; }
.intro-note > span { color: var(--accent); font-size: 12px; font-weight: 750; display: grid; place-items: center; flex: 0 0 34px; height: 34px; background: #e9ecff; border-radius: 10px; }
.intro-note strong { font-size: 14px; }
.intro-note p { font-size: 14px; color: var(--muted); max-width: 340px; margin: 5px 0 0; }
.auth-links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 24px; }
.auth-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); font-size: 14px; font-weight: 650; text-decoration: underline; text-underline-offset: 4px; }
.card { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: 0 4px 18px #14213d06; }
.auth-card { padding: 30px; box-shadow: 0 14px 40px #14213d0a; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 26px; gap: 26px; }
.auth-tabs a { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; color: var(--muted); padding: 0 0 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.auth-tabs .active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.muted { color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
.auth-card > .muted { margin-bottom: 24px; }
form { display: grid; gap: 18px; }
label { min-width: 0; display: grid; gap: 8px; font-size: 14px; font-weight: 650; color: #34425c; }
input, select { min-width: 0; min-height: 48px; width: 100%; border: 1px solid #aebbd0; border-radius: 9px; background: #fff; color: #18243b; padding: 12px 14px; outline: none; font-size: 16px; }
input::placeholder { color: #66748a; opacity: 1; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #4338ca26; }
select { min-width: 160px; }
.field-hint { font-size: 13px !important; color: var(--muted); line-height: 1.65; margin-bottom: 0; overflow-wrap: anywhere; }
form > .field-hint { margin-top: -8px; }
.primary, .secondary { min-height: 48px; border-radius: 9px; padding: 12px 18px; font-size: 15px; font-weight: 650; line-height: 1.4; white-space: normal; }
.primary { border: 1px solid var(--accent); color: #fff; background: var(--accent); }
.primary:hover { background: #3730a3; }
.secondary { background: #fff; color: #3730a3; border: 1px solid #aebbd0; }
.secondary:hover { background: #eef0ff; }
.full { width: 100%; }
.auth-disclaimer { font-size: 13px; color: var(--muted); line-height: 1.7; margin: 24px 0 0; padding-top: 20px; border-top: 1px solid var(--line); }

.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.page-heading .overline { margin-bottom: 10px; }
.page-heading .muted { margin: 0; }
.page-heading .pill { flex-shrink: 0; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 26px; }
.metric { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 22px; }
.metric-label { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.metric strong { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.7px; overflow-wrap: anywhere; }
.metric .field-hint { margin: 14px 0 0; font-size: 13px !important; }
.connection { display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 22px; }
.connection > div { min-width: 0; flex: 1; }
.connection h2 { font-size: 21px; }
.connection .overline { color: #155e75; }
.connection code { display: block; font-size: 14px; background: #f3f6fb; border: 1px solid var(--line); padding: 14px; border-radius: 8px; overflow-wrap: anywhere; }
.notice { font-size: 14px; line-height: 1.8; color: #34425c; border: 1px solid #cfd8ed; background: #edf2fc; padding: 18px 20px; border-radius: 10px; overflow-wrap: anywhere; }
.pending { max-width: 860px; padding: 36px; }
.pending h2 { margin-top: 22px; font-size: 27px; }
.pending > p { font-size: 16px; max-width: 650px; }
.pending > .muted { font-size: 14px; margin-bottom: 0; }
.pending-symbol { display: grid; place-items: center; font-size: 30px; width: 56px; height: 56px; color: #805500; background: #fff2ce; border: 1px solid #e8d4a0; border-radius: 14px; }
.activation-steps { list-style: none; padding: 0; margin: 28px 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; background: #f8faff; }
.activation-steps li { min-width: 0; padding: 20px 16px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.activation-steps li + li { border-left: 1px solid var(--line); }
.activation-steps li > span { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid #aebbd0; border-radius: 50%; font-size: 13px; font-weight: 700; }
.activation-steps .complete > span { background: #e4f5fa; border-color: #9ccedc; color: #155e75; }
.activation-steps [aria-current="step"] { color: #3730a3; background: #eef0ff; }
.activation-steps [aria-current="step"] > span { background: var(--accent); border-color: var(--accent); color: #fff; }
.model-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 26px 0; }
.model { min-width: 0; display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 20px; overflow-wrap: anywhere; }
.model-icon { font-size: 24px; color: var(--accent); }
.model strong { font-size: 15px; }
.model small { font-size: 13px; color: var(--muted); }
.section-heading { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.inline-form { display: flex; align-items: end; gap: 14px; max-width: 680px; margin: 24px 0; }
.inline-form label { flex: 1; }
.table-wrap { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { font-size: 13px; color: var(--muted); font-weight: 650; padding: 16px 12px; border-bottom: 1px solid var(--line); }
td { font-size: 14px; padding: 18px 12px; border-bottom: 1px solid #e7edf5; }
th:first-child, td:first-child { padding-left: 0; }
.danger-button { min-height: 44px; background: #fff3f3; border: 1px solid #e9bcbc; color: #a12828; font-size: 14px; padding: 10px 14px; border-radius: 8px; }
.danger-button:hover { background: #ffe5e5; }
.empty { color: var(--muted); font-size: 14px; padding: 32px 12px; text-align: center; }
.secret-box { border: 1px solid #9ccedc; background: #effafe; color: #16465b; border-radius: 12px; padding: 22px; margin: 22px 0; font-size: 15px; }
.secret-box p { font-size: 14px; }
.secret-box code { display: block; overflow-wrap: anywhere; white-space: normal; padding: 16px; background: #fff; border: 1px solid #c5dfe9; border-radius: 8px; margin-bottom: 16px; user-select: all; }
.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.profile-card { max-width: 640px; }
.profile-card form { margin-top: 26px; }
.profile-card button { justify-self: start; }
#message { padding: 16px 20px; font-size: 15px; line-height: 1.65; border: 1px solid; border-radius: 10px; margin-bottom: 24px; overflow-wrap: anywhere; }
#message.error { color: #922a30; background: #fff2f2; border-color: #e9bcbc; }
#message.success { color: #155e75; background: #effafe; border-color: #9ccedc; }

@media (min-width: 1600px) {
  main { padding-top: 52px; }
  .auth-layout { margin-top: 28px; }
}

@media (max-width: 1279px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .model-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1120px) {
  main { padding: 32px 26px; }
  .topbar { padding-right: 26px; padding-left: 26px; }
  .auth-layout { grid-template-columns: minmax(0, 1fr); max-width: 540px; gap: 24px; margin-top: 0; }
  .auth-intro h1 { font-size: 36px; margin-top: 18px; }
  .auth-intro h1 br { display: none; }
  .auth-intro > p { max-width: none; margin-bottom: 0; }
  .intro-note { display: none; }
  .auth-links { margin-top: 10px; }
  .connection { align-items: flex-start; flex-direction: column; }
  .connection > div { width: 100%; }
  .compact { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 800px) {
  .shell { display: block; }
  .sidebar { position: static; width: 100%; padding: 20px; border-right: 0; border-bottom: 1px solid #233049; }
  .brand-logo { width: 180px; }
  .brand small { font-size: 10px; margin-top: 10px; }
  .sidebar-content { margin-top: 22px; }
  .sidebar-content > .overline, .sidebar-foot { display: none; }
  nav { display: flex; flex-wrap: wrap; gap: 8px; }
  .nav-item { min-height: 44px; padding: 10px 12px; font-size: 14px; }
  .nav-item span { display: none; }
  .main-shell { margin-left: 0; width: 100%; }
  .topbar { min-height: 64px; padding: 10px 20px; font-size: 13px; }
  main { padding: 28px 20px; }
  .auth-layout { max-width: 540px; gap: 22px; }
  .auth-intro h1 { font-size: 34px; }
  .auth-card { padding: 26px; }
  .page-heading h1 { font-size: 30px; }
  .page-heading { align-items: flex-start; gap: 14px; }
  .card { padding: 24px; }
  .metric { padding: 20px; }
  .metric strong { font-size: 24px; }
  footer { padding: 22px 20px; }
  .section-heading { flex-wrap: wrap; }
  .pending { padding: 28px; }
  .notice { padding: 16px; }
  .user-box { gap: 10px; }
  .user-box > span { max-width: 180px; }
}

@media (max-width: 540px) {
  .topbar { gap: 12px; }
  .user-box > span { max-width: 100px; }
  .text-button { padding: 10px; }
  main { padding: 24px 16px 32px; }
  .auth-intro h1 { font-size: 32px; letter-spacing: -1px; }
  .auth-intro > p { font-size: 15px; }
  .card { padding: 22px; border-radius: 13px; }
  .auth-tabs { gap: 24px; margin-bottom: 22px; }
  .metrics, .compact, .model-grid { grid-template-columns: minmax(0, 1fr); }
  .metrics { gap: 12px; }
  .metric strong { font-size: 26px; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .page-heading { flex-direction: column; }
  .activation-steps { grid-template-columns: minmax(0, 1fr); }
  .activation-steps li { flex-direction: row; align-items: center; padding: 16px; gap: 12px; }
  .activation-steps li + li { border-left: 0; border-top: 1px solid var(--line); }
  .activation-steps li > span { flex-shrink: 0; }
  .pending h2 { font-size: 25px; }
  .pending > p { font-size: 15px; }
  .profile-card button, .connection > button { width: 100%; }
  footer { flex-wrap: wrap; font-size: 12px; }
}

@media (prefers-reduced-motion: no-preference) {
  button, .auth-tabs a { transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
}
