/* ── 1C MCP Cloud — кабинет (server-rendered). Тёмная тема в эстетике Linear/Vercel/Cursor.
   Перенос из прежнего Next.js globals.css; адаптивная вёрстка без внешних зависимостей. ── */
:root {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.178 0 0);
  --muted: oklch(0.22 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --border: oklch(0.27 0 0);
  --input: oklch(0.27 0 0);
  --primary: oklch(0.62 0.19 280);
  --primary-foreground: oklch(0.985 0 0);
  --accent: oklch(0.24 0.02 280);
  --destructive: oklch(0.58 0.22 27);
  --success: oklch(0.7 0.17 150);
  --ring: oklch(0.62 0.19 280);
  --radius: 0.625rem;
  --font-mono: ui-monospace, "JetBrains Mono", "Cascadia Code", monospace;
}

* { box-sizing: border-box; border-color: var(--border); }
html, body { margin: 0; padding: 0; }
body {
  background: var(--background);
  color: var(--foreground);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
a.link { color: var(--primary); }
a.link:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--font-mono); }
code { color: var(--foreground); }
h1, h2, h3 { margin: 0; font-weight: 600; }

.grid-bg {
  background-image:
    linear-gradient(to right, oklch(1 0 0 / 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, oklch(1 0 0 / 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
}

/* ── Каркас кабинета ─────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 15rem; flex-shrink: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background: color-mix(in oklch, var(--card) 40%, transparent);
  padding: 1rem;
}
.brand {
  display: flex; align-items: center; gap: .5rem; padding: 0 .5rem 0 .5rem;
  margin-bottom: 1.5rem; font-family: var(--font-mono); font-weight: 600;
}
.brand svg { color: var(--primary); }
.nav { display: flex; flex-direction: column; gap: .25rem; }
.nav a {
  display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem;
  border-radius: var(--radius); color: var(--muted-foreground); transition: background .15s, color .15s;
}
.nav a:hover { background: var(--accent); color: var(--foreground); }
.nav a.active { background: var(--accent); color: var(--foreground); }

.content { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 3.5rem; border-bottom: 1px solid var(--border); padding: 0 1.5rem; gap: 1rem;
}
.topbar h1 { font-size: .875rem; }
.main { flex: 1; padding: 1.5rem; }
.main.narrow { max-width: 56rem; }

.menu-btn {
  display: none; align-items: center; justify-content: center;
  height: 2.25rem; width: 2.25rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: transparent; color: var(--foreground); cursor: pointer;
}
.scrim { display: none; }

@media (max-width: 768px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50; transform: translateX(-100%);
    transition: transform .2s ease; background: var(--card);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
  .scrim.show { display: block; position: fixed; inset: 0; z-index: 40; background: oklch(0 0 0 / .5); }
}

/* ── Профиль-меню ────────────────────────────────────────────────────────── */
.profile { position: relative; }
.profile-btn {
  display: flex; align-items: center; gap: .5rem; padding: .375rem .625rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: transparent;
  color: var(--foreground); cursor: pointer; font-size: .875rem; transition: background .15s;
}
.profile-btn:hover, .profile-btn.open { background: var(--accent); }
.avatar {
  display: flex; height: 1.5rem; width: 1.5rem; align-items: center; justify-content: center;
  border-radius: 9999px; background: color-mix(in oklch, var(--primary) 15%, transparent); color: var(--primary);
}
.profile-email { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .profile-email { display: none; } }
.profile-menu {
  position: absolute; right: 0; z-index: 50; margin-top: .5rem; width: 15rem; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
  box-shadow: 0 10px 30px oklch(0 0 0 / .5); display: none;
}
.profile-menu.open { display: block; }
.profile-menu .head { border-bottom: 1px solid var(--border); padding: .75rem 1rem; }
.profile-menu .items { padding: .25rem; }
.profile-menu .items a, .profile-menu .items button {
  display: flex; width: 100%; align-items: center; gap: .5rem; padding: .5rem .75rem;
  border: none; background: transparent; border-radius: var(--radius); color: var(--muted-foreground);
  font-size: .875rem; cursor: pointer; transition: background .15s, color .15s;
}
.profile-menu .items a:hover { background: var(--accent); color: var(--foreground); }
.profile-menu .items .danger { color: var(--destructive); }
.profile-menu .items .danger:hover { background: color-mix(in oklch, var(--destructive) 10%, transparent); }

/* ── Карточки ─────────────────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
  box-shadow: 0 1px 2px oklch(0 0 0 / .2);
}
.card-head { display: flex; flex-direction: column; gap: .25rem; padding: 1.25rem; }
.card-head.between { flex-direction: row; align-items: center; justify-content: space-between; }
.card-title { font-size: .875rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.card-title svg { color: var(--primary); }
.card-body { padding: 0 1.25rem 1.25rem; }
.card-body.flush { padding: 0; }

/* ── Кнопки ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  height: 2.25rem; padding: 0 1rem; border-radius: var(--radius); border: 1px solid transparent;
  font-size: .875rem; font-weight: 500; cursor: pointer; transition: background .15s, opacity .15s, color .15s;
  background: var(--primary); color: var(--primary-foreground);
}
.btn:hover { opacity: .9; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.btn.outline { background: transparent; border-color: var(--border); color: var(--foreground); }
.btn.outline:hover { background: var(--accent); opacity: 1; }
.btn.ghost { background: transparent; color: var(--foreground); }
.btn.ghost:hover { background: var(--accent); }
.btn.sm { height: 2rem; padding: 0 .75rem; }
.btn.xs { height: 1.75rem; padding: 0 .625rem; font-size: .8125rem; }
.btn svg { height: 1rem; width: 1rem; }

/* ── Бейджи ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; border-radius: 9999px; padding: .125rem .625rem;
  font-size: .75rem; font-weight: 500; background: var(--muted); color: var(--muted-foreground);
}
.badge.success { background: color-mix(in oklch, var(--success) 15%, transparent); color: var(--success); }
.badge.primary { background: color-mix(in oklch, var(--primary) 15%, transparent); color: var(--primary); }
.badge.destructive { background: color-mix(in oklch, var(--destructive) 15%, transparent); color: var(--destructive); }

/* ── Поля ввода ───────────────────────────────────────────────────────────── */
.field, textarea.field {
  width: 100%; border: 1px solid var(--input); background: transparent; color: var(--foreground);
  border-radius: var(--radius); padding: 0 .75rem; height: 2.25rem; font-size: .875rem; outline: none;
}
textarea.field { height: 6rem; padding: .75rem; resize: vertical; font-family: inherit; }
.field:focus { outline: 2px solid var(--ring); outline-offset: -1px; }
.field::placeholder { color: var(--muted-foreground); }

/* ── Таблицы ──────────────────────────────────────────────────────────────── */
table.t { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.t thead th { text-align: left; font-size: .75rem; font-weight: 500; color: var(--muted-foreground); padding-bottom: .5rem; }
table.t.padded thead th { padding: 1rem; }
table.t tbody td { padding: .5rem 0; border-bottom: 1px solid color-mix(in oklch, var(--border) 50%, transparent); }
table.t.padded tbody td { padding: 1rem; }
table.t thead tr { border-bottom: 1px solid var(--border); }
table.t .right { text-align: right; }
table.t tbody.mono td { font-family: var(--font-mono); }

/* ── Утилиты ──────────────────────────────────────────────────────────────── */
.muted { color: var(--muted-foreground); }
.success-text { color: var(--success); }
.destructive-text { color: var(--destructive); }
.primary-text { color: var(--primary); }
.text-xs { font-size: .75rem; }
.text-sm { font-size: .875rem; }
.stat { font-size: 1.5rem; font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.stack-sm { display: flex; flex-direction: column; gap: .25rem; }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-2 { margin-top: .5rem; }
.mb-4 { margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; }
.cols-3 { grid-template-columns: 1fr; }
.cols-2 { grid-template-columns: 1fr; }
@media (min-width: 768px) { .cols-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .cols-2 { grid-template-columns: repeat(2, 1fr); } }
.hidden { display: none; }

pre.box {
  overflow: auto; white-space: pre-wrap; border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 40%, transparent);
  border-radius: var(--radius); padding: .75rem; font-size: .75rem; color: var(--muted-foreground);
}
pre.box.code { white-space: pre; padding-right: 3rem; color: var(--foreground); }
pre.box.tall { max-height: 24rem; }
.token-box {
  border: 1px solid var(--border); background: var(--muted); border-radius: var(--radius);
  padding: .75rem; font-size: .75rem;
}
.token-box code { word-break: break-all; color: var(--success); }
.step-num {
  display: flex; height: 1.5rem; width: 1.5rem; flex-shrink: 0; align-items: center; justify-content: center;
  border-radius: 9999px; background: color-mix(in oklch, var(--primary) 15%, transparent);
  color: var(--primary); font-size: .75rem; font-weight: 600;
}
.copy-btn {
  position: absolute; right: .5rem; top: .5rem; border: 1px solid var(--border); background: var(--card);
  border-radius: var(--radius); padding: .375rem; color: var(--muted-foreground); cursor: pointer;
}
.copy-btn:hover { color: var(--foreground); }
.rel { position: relative; }
details summary { cursor: pointer; user-select: none; color: var(--muted-foreground); font-size: .75rem; }
details summary:hover { color: var(--foreground); }

/* ── График вызовов (bar chart без зависимостей) ──────────────────────────── */
.chart { display: flex; height: 8rem; align-items: flex-end; gap: .5rem; }
.bar-col { display: flex; flex: 1; flex-direction: column; align-items: center; gap: .25rem; }
.bar-area { display: flex; height: 100%; width: 100%; align-items: flex-end; justify-content: center; }
.bar-track {
  position: relative; width: 1.5rem; border-radius: .25rem .25rem 0 0;
  background: color-mix(in oklch, var(--primary) 25%, transparent);
}
.bar-fill { position: absolute; bottom: 0; width: 100%; border-radius: .25rem .25rem 0 0; background: var(--primary); }
.bar-label { font-size: 10px; color: var(--muted-foreground); }

/* ── Страница входа ───────────────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; }
.auth-inner { max-width: 72rem; margin: 0 auto; display: flex; flex-direction: column; padding: 0 1.5rem; }
.auth-header { display: flex; align-items: center; justify-content: space-between; padding: 1.5rem 0; }
.auth-grid { display: grid; gap: 3rem; padding: 4rem 0; align-items: center; }
@media (min-width: 768px) { .auth-grid { grid-template-columns: 1fr 1fr; } }
.hero h1 { font-size: 2.25rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
@media (min-width: 768px) { .hero h1 { font-size: 3rem; } }
.hero p { max-width: 28rem; color: var(--muted-foreground); }
.hero ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .75rem; font-size: .875rem; }
.hero li { display: flex; align-items: center; gap: .75rem; }
.auth-card { width: 100%; max-width: 24rem; justify-self: end; }
@media (max-width: 768px) { .auth-card { justify-self: stretch; } }
.tabs { display: flex; gap: .25rem; border-radius: var(--radius); background: var(--muted); padding: .25rem; font-size: .75rem; }
.tab { flex: 1; border: none; background: transparent; border-radius: .375rem; padding: .375rem .5rem; color: var(--muted-foreground); cursor: pointer; }
.tab.active { background: var(--card); color: var(--foreground); }
