:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #12151a;
  --panel-2: #171b21;
  --line: #262c35;
  --text: #f4f7fb;
  --muted: #8c96a6;
  --lime: #c9ff4a;
  --lime-soft: rgba(201, 255, 74, .12);
  --orange: #ff8a52;
  --red: #ff5d68;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); line-height: 1.55; }
.eyebrow { margin: 0 0 8px; color: #778191; font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; }
h1, h2, h3, p { text-wrap: balance; }
h1 { margin: 0; font-size: clamp(27px, 4vw, 42px); line-height: 1.02; letter-spacing: -.045em; }
h2 { margin: 0 0 22px; font-size: 21px; letter-spacing: -.025em; }
h3 { margin: 0; }
code { color: var(--lime); }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 10%, #202831 0, var(--bg) 48%); }
.auth-card { width: min(100%, 430px); padding: 38px; border: 1px solid var(--line); border-radius: 28px; background: rgba(18, 21, 26, .92); box-shadow: 0 30px 100px rgba(0, 0, 0, .4); }
.auth-card h1 { margin-bottom: 12px; }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 30px; border-radius: 17px; background: var(--lime); color: #0b0d10; font-weight: 900; letter-spacing: -.08em; transform: rotate(-4deg); }
.brand-mark.small { width: 38px; height: 38px; margin: 0; border-radius: 12px; font-size: 13px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 242px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px 24px; border-right: 1px solid var(--line); background: #0d1014; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 36px; font-weight: 800; font-size: 19px; }
.nav { display: grid; gap: 7px; }
.nav-item { width: 100%; padding: 13px 14px; display: flex; align-items: center; gap: 13px; border: 0; border-radius: 13px; background: transparent; color: #939dac; text-align: left; cursor: pointer; transition: .18s ease; }
.nav-item span { color: #4d5663; font: 700 10px ui-monospace, monospace; }
.nav-item:hover { background: #15191f; color: var(--text); }
.nav-item.active { background: var(--lime-soft); color: var(--lime); }
.nav-item.active span { color: var(--lime); }
.sidebar-footer { margin-top: auto; display: grid; gap: 12px; padding: 18px 10px 0; border-top: 1px solid var(--line); }
.user-link, .text-button { color: #aab3c0; text-decoration: none; font-size: 13px; }
.text-button { padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.main { min-width: 0; padding: 34px clamp(24px, 4.5vw, 70px) 80px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 38px; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.save-state { color: var(--muted); font-size: 12px; }
.button { min-height: 43px; padding: 0 18px; border: 1px solid transparent; border-radius: 13px; font-weight: 750; font-size: 13px; cursor: pointer; transition: transform .15s ease, opacity .15s ease, background .15s ease; }
.button:active { transform: scale(.97); }
.button:disabled { opacity: .45; cursor: wait; }
.button.primary { background: var(--lime); color: #101308; }
.button.secondary { border-color: var(--line); background: #191d23; }
.button.wide { width: 100%; }
.button-row { display: flex; gap: 10px; }
.button-row .button { flex: 1; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: reveal .24s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(7px); } }
.metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.metric-card { min-height: 142px; padding: 22px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.metric-card span, .metric-card small { color: var(--muted); font-size: 12px; }
.metric-card strong { margin: auto 0 3px; font-size: 30px; letter-spacing: -.05em; }
.metric-card.accent { background: var(--lime); color: #0c0f08; border-color: var(--lime); }
.metric-card.accent span, .metric-card.accent small { color: #465325; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .75fr); gap: 14px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.span-2 { grid-column: span 2; }
.sticky-panel { align-self: start; position: sticky; top: 28px; }
.fields { display: grid; gap: 16px; margin-bottom: 17px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: grid; gap: 8px; color: #c5cbd4; font-size: 12px; }
.field small { color: var(--muted); }
input, textarea, select { width: 100%; border: 1px solid #2b323c; border-radius: 12px; background: #0e1115; color: var(--text); outline: none; transition: border .15s ease, box-shadow .15s ease; }
input, select { height: 45px; padding: 0 13px; }
textarea { padding: 13px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: #647238; box-shadow: 0 0 0 3px var(--lime-soft); }
.toggle-field { min-height: 45px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 13px; border: 1px solid #2b323c; border-radius: 12px; background: #0e1115; }
.toggle-field span { display: grid; gap: 3px; font-size: 12px; }
.toggle-field small { color: var(--muted); }
.toggle-field input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-field i { width: 38px; height: 22px; position: relative; border-radius: 99px; background: #303640; transition: .2s; }
.toggle-field i::after { content: ""; width: 16px; height: 16px; position: absolute; top: 3px; left: 3px; border-radius: 50%; background: white; transition: .2s; }
.toggle-field input:checked + i { background: var(--lime); }
.toggle-field input:checked + i::after { left: 19px; background: #111; }
.channel-list { display: grid; gap: 9px; }
.channel { min-height: 72px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; align-items: center; gap: 13px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 15px; background: #0f1217; }
.channel-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: #1e2430; color: var(--lime); font-weight: 800; }
.channel-name { min-width: 0; display: grid; gap: 4px; }
.channel-name strong, .channel-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-name small { color: var(--muted); }
.status-dot { padding: 5px 9px; border-radius: 99px; background: #222831; color: #9ba5b3; font-size: 10px; text-transform: uppercase; }
.status-dot.ok { background: var(--lime-soft); color: var(--lime); }
.status-dot.error { background: rgba(255, 93, 104, .12); color: var(--red); }
.icon-button { width: 35px; height: 35px; border: 0; border-radius: 10px; background: transparent; color: #687382; cursor: pointer; }
.icon-button:hover { background: rgba(255, 93, 104, .12); color: var(--red); }
.empty-state { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 9px; color: var(--muted); text-align: center; }
.empty-state span { width: 48px; height: 48px; display: grid; place-items: center; border: 1px dashed #47505d; border-radius: 16px; font-size: 26px; }
.empty-state h3 { color: var(--text); }
.empty-state p { margin: 0; }
.test-result { margin-top: 16px; padding: 13px; border-radius: 12px; background: #0e1115; color: #b4bdc9; font-size: 12px; line-height: 1.5; }
.callout { margin-bottom: 14px; padding: 24px 26px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-radius: var(--radius); background: linear-gradient(110deg, #273513, #11160c); border: 1px solid #405221; }
.callout h2 { margin: 0; font-size: 30px; color: var(--lime); }
.callout p:last-child { max-width: 520px; margin: 0; color: #a9b68d; line-height: 1.5; }
.timeline-panel { overflow: hidden; }
.timeline { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); list-style: none; }
.timeline li { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding-right: 18px; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; top: 16px; left: 33px; right: 0; height: 1px; background: #38404b; }
.timeline b { z-index: 1; width: 33px; height: 33px; display: grid; place-items: center; border-radius: 50%; background: var(--lime); color: #111; font: 800 10px ui-monospace, monospace; }
.timeline span { display: grid; gap: 6px; padding-top: 3px; }
.timeline small { color: var(--muted); line-height: 1.45; }
.security-list ul { display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; }
.security-list li { display: flex; gap: 13px; }
.security-list i { width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center; border-radius: 8px; background: var(--lime-soft); color: var(--lime); font-style: normal; }
.security-list span { display: grid; gap: 4px; }
.security-list small { color: var(--muted); line-height: 1.4; }
.stack { display: grid; gap: 16px; }
.form-error { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; max-width: min(420px, calc(100vw - 48px)); padding: 14px 18px; border: 1px solid #3b4530; border-radius: 14px; background: #182010; color: #dbff86; box-shadow: 0 18px 60px rgba(0, 0, 0, .4); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .22s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #5d2930; background: #271216; color: #ff9ca4; }
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { z-index: 20; width: 100%; height: auto; position: sticky; padding: 12px 16px; flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .brand { padding: 0 10px 0 0; }
  .brand > span:last-child { display: none; }
  .nav { display: flex; }
  .nav-item { width: auto; white-space: nowrap; }
  .sidebar-footer { margin: 0 0 0 auto; padding: 0 0 0 12px; border: 0; }
  .sidebar-footer .user-link { display: none; }
  .main { padding-top: 28px; }
  .fields.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .main { padding: 22px 15px 70px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { align-items: flex-end; flex-direction: column-reverse; }
  .save-state { display: none; }
  .metrics-grid, .content-grid, .form-grid, .fields.three { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .sticky-panel { position: static; }
  .callout { align-items: flex-start; flex-direction: column; }
  .timeline { grid-template-columns: 1fr; gap: 18px; }
  .timeline li:not(:last-child)::after { width: 1px; height: calc(100% + 18px); left: 16px; right: auto; }
  .channel { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .channel .status-dot { grid-column: 2; width: max-content; }
  .auth-card { padding: 28px 22px; }
}
@media (max-width: 470px) {
  .nav-item span { display: none; }
  .nav-item { padding: 11px; font-size: 12px; }
  .fields.two, .fields.four { grid-template-columns: 1fr; }
}
