@font-face {
  font-family: Geist;
  src: url('/geist-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0a0a0b;
  --surface: #101011;
  --panel: #151516;
  --panel-strong: #1b1b1d;
  --hover: #202023;
  --line: rgba(247, 246, 242, .1);
  --line-strong: rgba(247, 246, 242, .18);
  --text: #f7f6f2;
  --muted: #c0bfba;
  --quiet: #92918c;
  --inverse: #0a0a0a;
  --green: #6ee7a8;
  --green-soft: rgba(110, 231, 168, .1);
  --blue: #8aa8ff;
  --blue-soft: rgba(138, 168, 255, .1);
  --red: #ff8585;
  --red-soft: rgba(255, 133, 133, .1);
  --amber: #f5c66f;
  --shadow: 0 24px 64px rgba(0, 0, 0, .26);
  --radius: 12px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f4f0;
  --surface: #ecebe6;
  --panel: #ffffff;
  --panel-strong: #e9e8e3;
  --hover: #e4e3de;
  --line: rgba(17, 17, 17, .12);
  --line-strong: rgba(17, 17, 17, .24);
  --text: #111111;
  --muted: #4f4e4a;
  --quiet: #74736e;
  --inverse: #f7f6f2;
  --green: #087b43;
  --green-soft: rgba(8, 123, 67, .08);
  --blue: #315fd1;
  --blue-soft: rgba(49, 95, 209, .08);
  --red: #c83333;
  --red-soft: rgba(200, 51, 51, .08);
  --amber: #906017;
  --shadow: 0 28px 70px rgba(35, 34, 31, .1);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 76% -12%, color-mix(in srgb, var(--blue) 7%, transparent), transparent 36rem),
    var(--bg);
  color: var(--text);
  font-family: Geist, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(16px, .18vw + 15px, 18px);
  line-height: 1.45;
  letter-spacing: -.014em;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.icon { display: inline-flex; width: 19px; height: 19px; flex: none; color: currentColor; }
.icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.boot .brand-mascot { width: 74px; animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.035); opacity: .82; } }

.brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.brand strong { font-size: 18px; font-weight: 660; letter-spacing: -.035em; }
.brand-mascot { display: block; width: 42px; height: auto; }
.brand-mascot.light-art { display: none; }
:root[data-theme="light"] .brand-mascot.dark-art { display: none; }
:root[data-theme="light"] .brand-mascot.light-art { display: block; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 28px;
}
.auth-head, .auth-foot { display: flex; align-items: center; justify-content: space-between; }
.auth-foot { color: var(--quiet); font-size: 13px; }
.auth-center { display: grid; place-items: center; padding: 48px 0; }
.auth-card { width: min(100%, 430px); }
.auth-presence { min-height: 190px; display: grid; place-items: center; margin-bottom: 22px; }
.auth-presence .brand-mascot { width: 158px; }
.auth-card h1 { margin: 0 0 28px; text-align: center; font-size: clamp(34px, 5vw, 54px); line-height: 1; letter-spacing: -.06em; font-weight: 610; }
.auth-card .notice { margin-bottom: 16px; }
.auth-result:empty { display: none; }
.auth-result { margin-top: 14px; color: var(--muted); text-align: center; font-size: 14px; }

.field { display: grid; gap: 8px; margin-bottom: 14px; }
.field label { color: var(--muted); font-size: 14px; font-weight: 520; }
.input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 15px;
  background: var(--panel);
  color: var(--text);
}
.input:hover { border-color: var(--line-strong); }
.input::placeholder { color: var(--quiet); }
select.input { appearance: auto; }
.button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-weight: 580;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.button:hover { background: var(--hover); border-color: var(--line-strong); transform: translateY(-1px); }
.button.primary { background: var(--text); color: var(--inverse); border-color: var(--text); }
.button.primary:hover { opacity: .9; }
.button.danger { color: var(--red); }
.button.ghost { background: transparent; }
.button.small { min-height: 36px; border-radius: 9px; padding: 0 12px; font-size: 14px; }
.button.full { width: 100%; }
.button:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: transparent;
  cursor: pointer;
}
.icon-button:hover { background: var(--hover); }

.shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px 18px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  display: flex;
  flex-direction: column;
}
.sidebar .brand { padding: 0 9px 28px; }
.sidebar .brand-mascot { width: 35px; }
.nav { display: grid; gap: 4px; }
.nav button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}
.nav button:hover { background: var(--panel); color: var(--text); }
.nav button.active { background: var(--panel-strong); color: var(--text); }
.nav button[data-tone="green"]:not(.active) .icon { color: var(--green); }
.sidebar-foot { margin-top: auto; padding: 18px 9px 2px; }
.account-mini { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: center; }
.avatar { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 650; }
.account-mini strong, .account-mini span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-mini strong { font-size: 14px; }
.account-mini span { color: var(--quiet); font-size: 13px; }

.workspace { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 72px;
  padding: 0 clamp(22px, 4vw, 62px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(24px) saturate(125%);
}
.page-title { font-size: 17px; font-weight: 630; letter-spacing: -.03em; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.main { width: min(100%, 1360px); margin: 0 auto; padding: clamp(30px, 4vw, 62px); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 30px; }
.page-head h1 { margin: 0; font-size: clamp(38px, 4vw, 66px); line-height: .98; letter-spacing: -.065em; font-weight: 610; }
.page-head .actions { display: flex; gap: 9px; flex-wrap: wrap; }
.section-title { margin: 0 0 16px; font-size: 14px; color: var(--quiet); font-weight: 560; letter-spacing: .04em; text-transform: uppercase; }
.eyebrow { margin-bottom: 11px; color: var(--quiet); font-size: 13px; font-weight: 620; letter-spacing: .08em; text-transform: uppercase; }
.presence { min-height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 14px; font-weight: 560; }
.presence.live { color: var(--text); }
.body-copy { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; }
.span-12 { grid-column: span 12; }
.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(22px, 2.1vw, 30px);
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .025) inset;
}
.card.flat { background: transparent; }
.card.accent { border-color: var(--line-strong); }
.card.quiet-card { background: color-mix(in srgb, var(--panel) 62%, transparent); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.card h2, .card h3 { margin: 0; letter-spacing: -.035em; }
.card h2 { font-size: 24px; }
.card h3 { font-size: 17px; }
.card-copy { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.card-icon { color: var(--quiet); }
.card-icon.messages { color: var(--green); }
.card-icon.billing { color: var(--blue); }
.metric { font-size: clamp(36px, 4vw, 62px); line-height: .92; letter-spacing: -.065em; font-weight: 620; font-variant-numeric: tabular-nums; }
.metric.compact { font-size: clamp(30px, 3vw, 46px); }
.metric-label { margin-top: 10px; color: var(--quiet); font-size: 14px; }
.metric-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.status-line { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--quiet); }
.dot.live { background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.dot.warn { background: var(--amber); }
.split { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.badge { display: inline-flex; align-items: center; min-height: 28px; border: 1px solid var(--line); border-radius: 8px; padding: 0 9px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.badge.live { border-color: transparent; background: var(--green-soft); color: var(--green); }
.badge.failed { border-color: transparent; background: var(--red-soft); color: var(--red); }

.list { display: grid; }
.list-row { min-width: 0; padding: 15px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.list-row:first-child { padding-top: 0; }
.list-row:last-child { padding-bottom: 0; border-bottom: 0; }
.list-title { font-weight: 570; }
.list-meta { margin-top: 3px; color: var(--quiet); font-size: 13px; }
.list-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.empty { min-height: 170px; display: grid; place-items: center; color: var(--quiet); text-align: center; }
.empty strong { display: block; margin-bottom: 5px; color: var(--text); font-size: 17px; }
.code-box { padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: center; font-size: clamp(25px, 4vw, 42px); letter-spacing: .16em; font-weight: 650; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input { width: min(310px, 100%); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.form-grid .full { grid-column: 1 / -1; }
.divider { height: 1px; margin: 22px 0; background: var(--line); }

.plan-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; }
.plan-name { font-size: clamp(30px, 4vw, 52px); line-height: 1; letter-spacing: -.055em; font-weight: 620; }
.plan-price { margin-top: 12px; font-size: 18px; color: var(--muted); }
.plan-price strong { color: var(--text); font-size: 30px; letter-spacing: -.04em; }
.plan-features { display: flex; gap: 10px 20px; flex-wrap: wrap; margin-top: 20px; color: var(--muted); font-size: 14px; }
.plan-features span { display: inline-flex; align-items: center; gap: 7px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; min-width: 760px; font-size: 14px; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--quiet); background: var(--surface); font-weight: 540; position: sticky; top: 0; }
td { color: var(--muted); }
td strong { color: var(--text); }
tr:last-child td { border-bottom: 0; }

.notice { border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; display: flex; align-items: center; gap: 10px; background: var(--panel); color: var(--muted); font-size: 14px; }
.notice.error { border-color: var(--red-soft); color: var(--red); }
.notice.success { border-color: var(--green-soft); color: var(--green); }
.danger-text { color: var(--red); }
.success-text { color: var(--green); }

#toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: grid; gap: 8px; }
.toast { max-width: 370px; border: 1px solid var(--line); border-radius: 11px; padding: 12px 15px; background: var(--text); color: var(--inverse); box-shadow: var(--shadow); font-size: 14px; }
.toast.error { background: var(--red); color: #fff; border-color: transparent; }
.mobile-nav { display: none; }

@media (max-width: 1040px) {
  .shell { grid-template-columns: 210px minmax(0, 1fr); }
  .span-3, .span-4 { grid-column: span 6; }
}

@media (max-width: 780px) {
  .auth-shell { padding: 20px; }
  .auth-foot { justify-content: center; }
  .shell { display: block; }
  .sidebar { display: none; }
  .topbar { height: 64px; padding: 0 18px; }
  .main { padding: 28px 18px 100px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 43px; }
  .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-9 { grid-column: span 12; }
  .mobile-nav { position: fixed; z-index: 40; bottom: 12px; left: 50%; transform: translateX(-50%); width: min(calc(100% - 24px), 580px); min-height: 62px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; display: flex; background: color-mix(in srgb, var(--panel) 94%, transparent); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
  .mobile-nav button { flex: 1; border: 0; border-radius: 9px; display: grid; place-items: center; background: transparent; color: var(--quiet); cursor: pointer; }
  .mobile-nav button.active { background: var(--text); color: var(--inverse); }
}

@media (max-width: 560px) {
  .auth-head .brand strong { display: none; }
  .auth-presence { min-height: 150px; }
  .auth-presence .brand-mascot { width: 126px; }
  .page-head { display: block; }
  .page-head .actions { margin-top: 18px; }
  .grid { gap: 10px; }
  .card { padding: 20px; }
  .plan-card { display: block; }
  .plan-card .button { width: 100%; margin-top: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .top-actions .button:not(.keep-label) span { display: none; }
}

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