:root {
  color-scheme: light;
  --bg: #f6f8fa;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #5d6875;
  --line: #dfe5ea;
  --steel: #2d3846;
  --blue: #1769e0;
  --blue-dark: #0c4ea8;
  --teal: #087f8c;
  --green: #168257;
  --amber: #a76500;
  --red: #b23b35;
  --shadow: 0 18px 45px rgba(30, 45, 60, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 24px;
  align-items: center;
  padding: 14px clamp(16px, 3vw, 36px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #f5f7fa, #dce4eb);
  border: 1px solid #cbd5df;
  color: var(--blue-dark);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
  white-space: nowrap;
}

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

.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topnav a {
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 7px;
}

.topnav a:hover,
.topnav a:focus-visible {
  color: var(--ink);
  background: #eef3f7;
  outline: none;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
}

main {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.workspace-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.8fr);
  min-height: 430px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.banner-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 5vw, 56px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 680px;
  margin-bottom: 16px;
  font-size: clamp(2.25rem, 4vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(1.5rem, 2.3vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.banner-text {
  max-width: 610px;
  color: var(--muted);
  font-size: 1.08rem;
}

.banner-media {
  position: relative;
  min-height: 360px;
  background:
    linear-gradient(180deg, rgba(16, 27, 35, 0.04), rgba(16, 27, 35, 0.62)),
    url("https://cdn1.npcdn.net/images/banner1_1757382126_TeO7DYtvRKko.webp?from=jpg&md5id=5c98b0539591b13b7ba78b3b614407ef&new_height=1600&new_width=1600&off_wm=1&size=max&w=-62170008925");
  background-position: center;
  background-size: cover;
}

.media-overlay {
  position: absolute;
  right: 20px;
  bottom: 20px;
  left: 20px;
  display: grid;
  gap: 8px;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.media-overlay span {
  width: max-content;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.24);
  font-weight: 800;
}

.media-overlay strong {
  max-width: 390px;
  font-size: 1.1rem;
  line-height: 1.28;
}

.quick-actions,
.card-actions,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.primary-action,
.secondary-action,
.icon-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.primary-action {
  padding: 10px 15px;
  background: var(--blue);
  color: #ffffff;
}

.primary-action:hover,
.primary-action:focus-visible {
  background: var(--blue-dark);
  outline: none;
  transform: translateY(-1px);
}

.secondary-action {
  padding: 10px 14px;
  background: #eef4f8;
  color: var(--steel);
  border-color: #d3dde6;
}

.secondary-action:hover,
.secondary-action:focus-visible {
  background: #e0eaf2;
  outline: none;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  background: #ffffff;
  color: var(--steel);
  border-color: var(--line);
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: #b7c4cf;
  background: #f3f6f8;
  outline: none;
}

svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex: 0 0 auto;
}

.full {
  width: 100%;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 36px;
}

.setup-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 420px) auto;
  gap: 18px;
  align-items: center;
  margin: -18px 0 36px;
  padding: 18px;
  border: 1px solid #f1c37d;
  border-radius: 8px;
  background: #fff9ed;
}

.setup-panel.complete {
  border-color: #abdbc5;
  background: #eef9f4;
}

.setup-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.setup-missing {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.setup-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--amber);
  border: 1px solid #f0d5a7;
  font-size: 0.78rem;
  font-weight: 900;
}

.setup-chip.ready {
  color: var(--green);
  border-color: #bfe3d2;
}

.status-strip > div {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.section-heading {
  margin: 0 0 18px;
}

.router {
  margin-bottom: 38px;
}

.router-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.router-option {
  min-height: 118px;
  padding: 18px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.router-option:hover,
.router-option:focus-visible {
  border-color: #9fb1c0;
  outline: none;
  box-shadow: 0 12px 28px rgba(38, 52, 68, 0.08);
}

.router-option span,
.router-option strong,
.router-option small {
  display: block;
}

.router-option span {
  margin-bottom: 12px;
  color: var(--ink);
  font-weight: 800;
}

.router-option strong {
  color: var(--blue-dark);
}

.router-option small {
  margin-top: 5px;
  color: var(--muted);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.profile-card {
  display: flex;
  min-height: 430px;
  flex-direction: column;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(39, 50, 64, 0.06);
}

.profile-card p {
  color: var(--muted);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}

.profile-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 8px;
  background: #e9eff5;
  color: var(--steel);
  font-size: 0.78rem;
  font-weight: 900;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
}

.pill.ready {
  color: var(--green);
  background: #e6f4ee;
}

.pill.missing {
  color: var(--amber);
  background: #fff4de;
}

.card-title span {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 6px 0 14px;
}

.tag-row span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f0f4f7;
  color: var(--steel);
  font-size: 0.78rem;
  font-weight: 800;
}

.profile-card ul {
  margin: 0 0 18px;
  padding-left: 18px;
  color: #44505e;
}

.profile-card li + li {
  margin-top: 6px;
}

.profile-card .card-actions {
  margin-top: auto;
}

.split-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 28px;
  align-items: start;
  margin: 46px 0;
  padding: 30px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.split-section p {
  color: var(--muted);
}

.command-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.command-pill {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid #d9e1e8;
  border-radius: 7px;
  background: #f7fafc;
}

.command-pill code {
  color: var(--blue-dark);
  font-weight: 900;
}

.telegram-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid #d9e1e8;
  border-radius: 8px;
  background: #f7fafc;
}

.telegram-panel span {
  color: var(--muted);
}

.qr-box {
  display: grid;
  aspect-ratio: 1;
  width: 150px;
  max-width: 100%;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.qr-box svg {
  width: 112px;
  height: 112px;
  fill: var(--steel);
}

.company-section {
  margin-top: 40px;
}

.company-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.company-grid article {
  padding: 20px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.company-grid p {
  color: var(--muted);
}

.settings-dialog {
  width: min(860px, calc(100% - 24px));
  max-height: min(780px, calc(100% - 24px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.settings-dialog::backdrop {
  background: rgba(10, 18, 25, 0.48);
}

.settings-dialog form {
  padding: 24px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.dialog-copy {
  color: var(--muted);
}

.settings-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.setting-row,
.admin-token-row {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.setting-row.active {
  border-color: var(--blue);
}

.setting-row span,
.setting-row strong,
.setting-row small,
.admin-token-row span,
.admin-token-row strong,
.admin-token-row small {
  display: block;
}

.setting-row small,
.admin-token-row small {
  color: var(--muted);
}

input,
textarea {
  width: 100%;
  border: 1px solid #ccd6df;
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
}

input {
  min-height: 42px;
  padding: 8px 10px;
}

textarea {
  resize: vertical;
  min-height: 128px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(23, 105, 224, 0.16);
}

.json-tools {
  display: grid;
  gap: 8px;
}

.json-tools label {
  font-weight: 800;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 18px;
  padding: 0;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100% - 40px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--steel);
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .topnav {
    display: none;
  }

  .workspace-banner,
  .split-section,
  .setup-panel {
    grid-template-columns: 1fr;
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .banner-media {
    min-height: 280px;
  }

  .router-grid,
  .profile-grid,
  .company-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar {
    gap: 12px;
    padding: 12px;
  }

  .brand small {
    display: none;
  }

  .brand strong {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  main {
    width: min(100% - 20px, 1200px);
    padding-top: 14px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .workspace-banner {
    min-height: 0;
  }

  .banner-copy,
  .split-section {
    padding: 20px;
  }

  .status-strip,
  .router-grid,
  .profile-grid,
  .company-grid {
    grid-template-columns: 1fr;
  }

  .profile-card {
    min-height: 0;
  }

  .setting-row,
  .admin-token-row {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    justify-content: stretch;
  }

  .dialog-actions button {
    flex: 1;
  }
}
