/* Qlan demo landing — Geist, dark theme, bento layout per Figma 3006:322 + Petville. */

:root {
  --bg: #0a0a0a;
  --surface: #171717;
  --surface-2: #1f1f1f;
  --border: #262626;
  --border-strong: #2f2f2f;
  --text: #fafafa;
  --text-muted: #a3a3a3;
  --text-dim: #737373;
  --text-inverse: #171717;
  --accent: #00928b;
  --accent-2: #002a28;
  --mask: #002a28;
  --btn-bg: #f5f5f5;
  --radius-card: 16px;
  --radius-btn: 8px;
  --max-w: 1216px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Geist", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }

.page {
  width: 100%;
  max-width: calc(var(--max-w) + 224px);
  margin: 0 auto;
  padding: 16px 112px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  height: 116px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 40px 0;
}
.logo { display: inline-flex; align-items: center; }
.logo svg, .logo img { display: block; height: 36px; width: auto; }
.btn-group { display: inline-flex; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-btn);
  background: var(--btn-bg);
  color: var(--text-inverse);
  font-weight: 500;
  font-size: 14px;
  line-height: 20px;
  border: 0;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}
.btn:hover { background: #e5e5e5; }
.btn:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--surface); }
.btn-danger {
  background: #b54a4a;
  color: #fff;
}
.btn-danger:hover { background: #a33e3e; }

/* Hero */
.hero {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 48px;
}
.hero-text { display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }
.title {
  font-weight: 600;
  font-size: 48px;
  line-height: 48px;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
}
.title .accent { color: var(--accent); }
.subtitle {
  font-size: 16px;
  line-height: 24px;
  color: var(--text-muted);
  margin: 0;
  max-width: 720px;
}

/* Bento layout: 3 columns. Left: big card. Middle: 2 stacked small. Right: big card. Bottom row: Petville wide. */
.bento {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 400px 200px;
  gap: 16px;
}
.bento .card-big-left { grid-column: 1; grid-row: 1; }
.bento .card-stack { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; gap: 16px; }
.bento .card-stack > .card-sm { flex: 1; }
.bento .card-big-right { grid-column: 3; grid-row: 1; }
.bento .card-wide { grid-column: 1 / span 3; grid-row: 2; }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
  text-decoration: none;
  color: inherit;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 12px 32px rgba(0, 146, 139, 0.08);
}
.card-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  z-index: 2;
}
.card-icon, .card-arrow {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.card-icon svg, .card-arrow svg, .card-icon img {
  width: 26px;
  height: 26px;
  display: block;
}
.card-arrow svg { opacity: 0.6; transition: opacity 200ms ease, transform 200ms ease; }
.card:hover .card-arrow svg { opacity: 1; transform: translate(2px, -2px); }

.card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  z-index: 2;
}
.card-title {
  font-weight: 600;
  font-size: 22px;
  line-height: 26.4px;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}
.card-desc {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
  margin: 0;
}

/* big-card decorative arcs */
.card-decor {
  position: absolute;
  bottom: -90px;
  left: 50%;
  transform: translateX(-50%);
  width: 110%;
  max-width: 480px;
  pointer-events: none;
  opacity: 0.85;
}
.card-decor::before {
  content: "";
  position: absolute;
  inset: -10% -20% auto -20%;
  height: 60%;
  background: linear-gradient(to bottom, rgba(23,23,23,0.95) 0%, rgba(23,23,23,0.55) 40%, rgba(23,23,23,0) 100%);
  z-index: 1;
}
.card-decor img { width: 100%; height: auto; display: block; }
.card-sm .card-decor { display: none; }

/* Wide card (Petville) — horizontal layout with image right */
.card-wide {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0;
}
.card-wide .card-wide-text {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.card-wide .card-wide-image {
  position: relative;
  background: var(--mask);
  overflow: hidden;
  border-radius: 0 16px 16px 0;
}
.card-wide .card-wide-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 100% at 100% 100%, rgba(0,146,139,0.15) 0%, transparent 60%),
    linear-gradient(90deg, rgba(23,23,23,0.6) 0%, transparent 50%);
}
.card-wide .card-wide-image img {
  position: absolute;
  bottom: -20%;
  right: -10%;
  width: 90%;
  height: auto;
  opacity: 0.8;
}

/* Footer */
.footer {
  width: 100%;
  max-width: var(--max-w);
  margin: 48px auto 0;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 24px;
  padding: 40px 0;
}
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-btn);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}
.footer-link:hover { background: var(--surface); color: var(--text); }
.footer-link svg { width: 14px; height: 14px; }

/* Breadcrumb (used on demo pages) */
.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 12px;
}
.breadcrumb a { color: inherit; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb svg { width: 14px; height: 14px; }

/* Demo page common shell */
.demo-wrap {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-top: 8px;
  padding-bottom: 8px;
  min-width: 0;
}
.demo-head {
  min-width: 0;
}
.demo-head h1 {
  font-weight: 600;
  font-size: 44px;
  line-height: 48px;
  letter-spacing: -0.02em;
  margin: 4px 0 12px 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}
.demo-head .lead {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 24px;
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}
.demo-head .lead .pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 13px;
  color: var(--text);
}

/* Dropzone */
.dropzone {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 32px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: rgba(23,23,23,0.45);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
  position: relative;
  overflow: hidden;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: rgba(0,146,139,0.06);
}
.dropzone .dz-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  color: var(--text);
  display: block;
}
.dropzone .dz-title {
  font-size: 15px;
  color: var(--text);
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}
.dropzone .dz-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}
.dropzone input[type="file"] { display: none; }

/* File row */
.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.file-row .file-icon {
  width: 20px; height: 20px;
  color: var(--text-muted);
}
.file-row .file-name { color: var(--text); font-size: 14px; flex: 0 0 auto; }
.file-row .file-size { color: var(--text-muted); font-size: 13px; margin-left: 6px; }
.file-row .file-progress {
  flex: 1;
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 12px;
}
.file-row .file-progress > span {
  display: block;
  height: 100%;
  background: var(--text);
  border-radius: 999px;
  width: 0%;
  transition: width 200ms ease;
}
.file-row .file-remove {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}
.file-row .file-remove:hover { color: var(--text); }

/* Action button row */
.actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}
/* Respect the [hidden] attribute on flex/grid containers and buttons.
   Without this, .actions { display:flex } overrides the UA default
   [hidden] { display:none }, causing the "Очистить", "Остановить",
   etc. buttons/rows to appear before they should. */
[hidden] { display: none !important; }
.action-btn {
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--btn-bg);
  color: var(--text-inverse);
  border: 0;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.action-btn:hover { background: #e5e5e5; }
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.action-btn.danger { background: #b54a4a; color: #fff; }
.action-btn.danger:hover { background: #a33e3e; }
.action-btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.action-btn.ghost:hover { background: var(--surface); }

/* Accordion */
.accordion {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.accordion + .accordion { margin-top: 8px; }
.accordion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
}
.accordion-head:hover { background: #1c1c1c; }
.accordion-head .acc-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.accordion-head .acc-chev {
  color: var(--text-muted);
  transition: transform 200ms ease;
}
.accordion.open .acc-chev { transform: rotate(180deg); }
.accordion-body {
  padding: 16px;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  line-height: 22px;
  display: none;
  background: #131313;
}
.accordion.open .accordion-body { display: block; }
.accordion-body pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 13px;
  color: #6ee7b7;
}

/* Chat input (Deep Research / Search) */
.chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 8px 8px 8px 18px;
}
.chat-input-row input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  height: 32px;
}
.chat-input-row input::placeholder { color: var(--text-dim); }
.chat-input-row button {
  background: var(--btn-bg);
  color: var(--text-inverse);
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  height: 32px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chat-input-row button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Result section */
.result-section { margin-top: 32px; }
.result-section h2 {
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 0 0 12px 0;
  color: var(--text);
}

/* Pills / Tag */
.pill-row { display: inline-flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--text);
}
.pill.muted { color: var(--text-muted); }
.pill.active { background: rgba(0,146,139,0.15); border-color: rgba(0,146,139,0.4); color: #5eead4; }

/* Table */
.qlan-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 14px;
}
.qlan-table th, .qlan-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.qlan-table tr:last-child td { border-bottom: 0; }
.qlan-table th { color: var(--text-muted); font-weight: 500; font-size: 13px; background: #131313; }
.qlan-table td { color: var(--text); }
.qlan-table td.right { text-align: right; }

/* History list (deep research, search) */
.history-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}
.history-item .h-tag { color: var(--text-muted); font-size: 12px; }

/* Login card */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
}
.login-frame {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 112px;
  flex: 1;
}
.login-main {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  overflow: hidden;
}
.login-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -60% -20%;
  height: 220px;
  background: radial-gradient(50% 100% at 50% 100%, rgba(0,146,139,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.login-head { display: flex; flex-direction: column; gap: 8px; }
.login-title {
  font-weight: 600;
  font-size: 28px;
  line-height: 32px;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}
.login-sub {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
  margin: 0;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.form-input {
  height: 40px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 120ms ease;
}
.form-input:focus { border-color: var(--accent); background: #0d0d0d; }
.form-error {
  color: #f87171;
  font-size: 13px;
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.25);
  border-radius: var(--radius-btn);
  padding: 8px 12px;
}
.btn-primary {
  height: 40px;
  width: 100%;
  background: var(--btn-bg);
  color: var(--text-inverse);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-btn);
  border: 0;
  cursor: pointer;
}
.btn-primary:hover { background: #e5e5e5; }

/* Responsive */
@media (max-width: 1280px) {
  .page, .login-frame { padding-left: 48px; padding-right: 48px; }
}
@media (max-width: 1024px) {
  .bento {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
  }
  .bento .card-big-left { grid-column: 1; grid-row: 1; }
  .bento .card-stack { grid-column: 2; grid-row: 1; }
  .bento .card-big-right { grid-column: 1 / span 2; grid-row: 2; }
  .bento .card-wide { grid-column: 1 / span 2; grid-row: 3; }
}
@media (max-width: 640px) {
  .page, .login-frame { padding-left: 20px; padding-right: 20px; }
  .header { height: auto; padding: 24px 0; flex-wrap: wrap; gap: 12px; }
  .title { font-size: 36px; line-height: 40px; }
  .demo-head h1 { font-size: 30px; line-height: 34px; }
  .bento {
    grid-template-columns: 1fr;
  }
  .bento .card-big-left, .bento .card-stack, .bento .card-big-right, .bento .card-wide { grid-column: 1; grid-row: auto; }
  .card-wide { grid-template-columns: 1fr; }
  .card-wide .card-wide-image { display: none; }
  .footer { flex-direction: column; gap: 16px; height: auto; padding: 24px 0; align-items: flex-start; }
}
