:root {
  --bg: #f7f7f8;
  --paper: #ffffff;
  --ink: #0b0c10;
  --muted: rgba(11, 12, 16, 0.68);
  --line: rgba(11, 12, 16, 0.12);
  --shadow: 0 24px 70px rgba(10, 14, 28, 0.12);

  --accent-a: #0057ff;
  --accent-b: #ff2d55;
  --accent-c: #00d2ff;

  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --container: 1180px;
  --assistant-width: min(420px, 96vw);

  --font: "Golos Text", ui-sans-serif, system-ui, -apple-system, Segoe UI, Arial, sans-serif;
}

/* Hard guarantee for any element using the HTML `hidden` attribute.
   Some component styles can accidentally override UA defaults. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 18% -10%, rgba(0, 87, 255, 0.20), transparent 65%),
    radial-gradient(900px 560px at 85% 0%, rgba(255, 45, 85, 0.18), transparent 60%),
    radial-gradient(1000px 820px at 60% 70%, rgba(0, 210, 255, 0.12), transparent 62%),
    var(--bg);
  line-height: 1.45;
  overflow-x: hidden;
  transition: padding-right 200ms ease;
}
body.is-locked { overflow: hidden; }
body.assistant-open {
  padding-right: var(--assistant-width);
  overflow: hidden;
  position: fixed;
  width: 100%;
}

a { color: inherit; text-decoration: none; }

.container {
  width: min(var(--container), calc(100% - 24px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.62);
  border-bottom: 1px solid rgba(11, 12, 16, 0.08);
  backdrop-filter: blur(12px);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand__logo {
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.12);
}
.brand__name { font-weight: 700; letter-spacing: -0.02em; }
.brand__tag { font-size: 12px; color: var(--muted); margin-top: 2px; }

.topbar__meta { display: flex; gap: 10px; align-items: center; }
.topbar__meta .btn { white-space: nowrap; }
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.tg-link {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(11, 12, 16, 0.12);
  background: rgba(255,255,255,0.86);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.tg-link svg { width: 18px; height: 18px; fill: #1c7ed6; }
.tg-link:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0,0,0,0.12); }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(11, 12, 16, 0.10);
  color: rgba(11, 12, 16, 0.78);
  font-size: 13px;
}
.pill--quiet { color: rgba(11, 12, 16, 0.62); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
  will-change: transform;
}
.btn--sm { padding: 6px 10px; font-size: 12px; }
.btn:active { transform: translateY(1px); }

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  box-shadow: 0 14px 34px rgba(0, 87, 255, 0.22), 0 12px 34px rgba(255, 45, 85, 0.16);
  position: relative;
  overflow: hidden;
}
.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(0, 87, 255, 0.24), 0 16px 40px rgba(255, 45, 85, 0.18);
}
.btn--primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,0.18), rgba(255,255,255,0));
  transform: translateX(-60%);
  transition: transform 280ms ease;
}
.btn--primary:hover::after { transform: translateX(0%); }

.btn--ghost {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(11, 12, 16, 0.12);
  color: rgba(11, 12, 16, 0.86);
}
.btn--ghost:hover { background: rgba(255, 255, 255, 0.94); }

.btn--lg { padding: 12px 18px; font-size: 14px; }

.main { padding: 16px 0 24px; }

.app {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
  position: relative;
}
.app::before {
  content: "";
  position: absolute;
  inset: -20px -20px auto -20px;
  height: 160px;
  background:
    radial-gradient(420px 200px at 15% 40%, rgba(0, 87, 255, 0.18), transparent 70%),
    radial-gradient(420px 240px at 85% 60%, rgba(255, 45, 85, 0.16), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.panel, .panel__head, .panel__head--right, .results { position: relative; z-index: 1; }

.panel {
  border-radius: 20px;
  border: 1px solid rgba(11, 12, 16, 0.10);
  background: rgba(255,255,255,0.90);
  box-shadow: 0 18px 60px rgba(0,0,0,0.06);
  overflow: hidden;
}

.panel--left { padding: 14px; }
.panel--right { padding: 0; background:
  radial-gradient(800px 300px at 10% 0%, rgba(0, 87, 255, 0.08), transparent 62%),
  radial-gradient(820px 420px at 100% 100%, rgba(255, 45, 85, 0.08), transparent 62%),
  rgba(255,255,255,0.92);
}

.panel__head {
  padding: 14px 14px 0;
}
.panel__head--right {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.03em;
  line-height: 1.12;
  font-weight: 700;
}
.lead {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.h2 {
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 18px;
}
.h3 {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 15px;
}
.kicker {
  color: rgba(11, 12, 16, 0.55);
  font-size: 12px;
  font-weight: 500;
}

.block { margin-top: 16px; }
.block__title { font-weight: 700; letter-spacing: -0.02em; font-size: 13px; margin-bottom: 10px; }

.drop {
  border-radius: 22px;
  border: 1px dashed rgba(11, 12, 16, 0.22);
  background:
    radial-gradient(840px 300px at 20% 0%, rgba(0, 87, 255, 0.08), transparent 62%),
    radial-gradient(720px 420px at 95% 70%, rgba(255, 45, 85, 0.08), transparent 62%),
    rgba(255, 255, 255, 0.84);
  padding: 14px;
  position: relative;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.drop.is-drag {
  border-color: rgba(0, 87, 255, 0.55);
  box-shadow: 0 18px 60px rgba(0, 87, 255, 0.12);
  transform: translateY(-1px);
}
.drop__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
input, textarea, select { max-width: 100%; }
.drop__kicker { font-weight: 600; letter-spacing: -0.02em; }
.drop__name { margin-top: 6px; color: rgba(11, 12, 16, 0.72); font-size: 12px; font-weight: 400; }
.drop__hint { margin-top: 6px; color: rgba(11, 12, 16, 0.56); font-size: 12px; font-weight: 400; }

.modes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.mode {
  border: 1px solid rgba(11, 12, 16, 0.10);
  background: rgba(255,255,255,0.78);
  border-radius: 18px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}
.mode:hover { transform: translateY(-1px); background: rgba(255,255,255,0.92); }
.mode.is-active {
  border-color: rgba(0, 87, 255, 0.35);
  background:
    radial-gradient(400px 140px at 20% 0%, rgba(0, 87, 255, 0.16), transparent 65%),
    radial-gradient(400px 180px at 100% 80%, rgba(255, 45, 85, 0.12), transparent 65%),
    rgba(255,255,255,0.96);
  box-shadow: 0 16px 40px rgba(0, 87, 255, 0.12);
}
.mode__title { font-weight: 700; letter-spacing: -0.02em; font-size: 13px; }
.mode__desc { margin-top: 6px; font-size: 12px; color: var(--muted); }
.mode--custom .mode__title::after {
  content: "•";
  margin-left: 6px;
  color: rgba(255, 45, 85, 0.8);
}

.seg {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(11, 12, 16, 0.04);
  border: 1px solid rgba(11, 12, 16, 0.10);
}
.seg__btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 9px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  color: rgba(11, 12, 16, 0.76);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.seg__btn.is-active {
  background: rgba(255,255,255,0.92);
  border-color: rgba(11, 12, 16, 0.10);
  color: rgba(11, 12, 16, 0.90);
  box-shadow: 0 12px 34px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.field { margin-top: 12px; }
.label { display: block; font-size: 12px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 8px; }

textarea, select, input[type="file"] {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(11, 12, 16, 0.12);
  background: rgba(255,255,255,0.92);
  padding: 12px 12px;
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}
textarea:focus, select:focus {
  border-color: rgba(0, 87, 255, 0.35);
  box-shadow: 0 0 0 4px rgba(0, 87, 255, 0.10);
}

.hint { margin-top: 6px; font-size: 12px; color: rgba(11, 12, 16, 0.56); font-weight: 400; }

.run {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.price { font-size: 12px; color: rgba(11, 12, 16, 0.64); font-weight: 400; }
.tier-note { margin-top: 8px; font-size: 12px; color: rgba(11, 12, 16, 0.62); font-weight: 400; }

.warn {
  margin-top: 10px;
  border-radius: 16px;
  border: 1px dashed rgba(255, 45, 85, 0.35);
  background: rgba(255, 45, 85, 0.06);
  padding: 10px 12px;
  font-size: 12px;
  color: rgba(11, 12, 16, 0.76);
}

.results { padding: 0 18px 18px; }

.empty { padding: 14px 0 0; }
.empty__card {
  border-radius: 22px;
  border: 1px dashed rgba(11, 12, 16, 0.18);
  background: rgba(11, 12, 16, 0.03);
  padding: 16px;
}
.empty__title { font-weight: 700; letter-spacing: -0.02em; }
.empty__text { margin-top: 6px; color: var(--muted); font-size: 13px; }
.empty__example {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(11, 12, 16, 0.72);
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(11, 12, 16, 0.10);
}
.empty__mono {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

.grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.card {
  border-radius: 22px;
  border: 1px solid rgba(11, 12, 16, 0.10);
  background:
    radial-gradient(460px 160px at 10% 0%, rgba(0, 87, 255, 0.08), transparent 65%),
    radial-gradient(460px 200px at 100% 100%, rgba(255, 45, 85, 0.08), transparent 65%),
    rgba(255, 255, 255, 0.95);
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0,0,0,0.06);
}

.thumb {
  aspect-ratio: 4 / 5;
  background:
    radial-gradient(500px 220px at 25% 15%, rgba(0, 87, 255, 0.16), transparent 60%),
    radial-gradient(420px 240px at 75% 75%, rgba(255, 45, 85, 0.12), transparent 60%),
    linear-gradient(135deg, rgba(255,255,255,0.76), rgba(255,255,255,0.30));
  position: relative;
  border-bottom: 1px solid rgba(11, 12, 16, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.10), rgba(255,255,255,0.46), rgba(255,255,255,0.10));
  transform: translateX(-100%);
  animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.card__body { padding: 12px; }
.card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card__title { font-weight: 700; letter-spacing: -0.02em; font-size: 13px; }

.link {
  font-size: 12px;
  font-weight: 600;
  color: rgba(0, 87, 255, 0.92);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 87, 255, 0.18);
  background: rgba(0, 87, 255, 0.06);
}
.link:hover { background: rgba(0, 87, 255, 0.10); }

.prompt {
  margin-top: 10px;
  color: rgba(11, 12, 16, 0.62);
  font-size: 12px;
  max-height: 54px;
  overflow: hidden;
}

.history {
  margin-top: 18px;
  padding-top: 14px;
  padding-left: 18px;
  padding-right: 18px;
  padding-bottom: 18px;
  border-top: 1px solid rgba(11, 12, 16, 0.08);
  overflow: hidden;
}

.editor {
  margin-top: 12px;
  padding: 0 0 18px;
}
.history__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.history__empty {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(11, 12, 16, 0.6);
}
.history__grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.history-card {
  border-radius: 16px;
  border: 1px solid rgba(11, 12, 16, 0.10);
  background: rgba(255, 255, 255, 0.92);
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0,0,0,0.05);
}
.history-card .thumb { aspect-ratio: 4 / 5; }
.history-card__body { padding: 8px 10px; }
.history-card__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.history-card__meta {
  margin-top: 4px;
  font-size: 11px;
  color: rgba(11, 12, 16, 0.56);
}

.settings { display: flex; flex-direction: column; gap: 12px; }
.settings__row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}
.settings__row--defaults {
  grid-template-columns: repeat(4, 1fr);
}
.settings__row--site {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.settings__row--models {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mode-manager {
  display: grid;
  gap: 12px;
}
.mode-manager__section {
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(11, 12, 16, 0.08);
  background: rgba(255,255,255,0.78);
}
.mode-manager__create {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}
.mode-manager__create input,
.mode-manager__create select {
  width: 100%;
}
.mode-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(11, 12, 16, 0.04);
  border: 1px solid rgba(11, 12, 16, 0.08);
  margin-top: 8px;
}
.mode-item__title { font-weight: 600; font-size: 12px; }
.mode-item__desc { font-size: 11px; color: rgba(11, 12, 16, 0.6); }
.mode-item__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mode-item__actions .btn { width: auto; }

.mode-library {
  display: grid;
  gap: 8px;
}
.mode-library__actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

#modelEditor .settings__col {
  border-radius: 16px;
  border: 1px solid rgba(11, 12, 16, 0.08);
  background: rgba(255, 255, 255, 0.78);
  padding: 10px;
}
#modelEditor input {
  margin-top: 6px;
}
.model-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.model-chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(11, 12, 16, 0.12);
  background: rgba(255,255,255,0.92);
  font-size: 11px;
  cursor: pointer;
}
.model-chip:hover { background: rgba(255,255,255,1); }
.settings__col--actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.settings__status {
  font-size: 12px;
  color: rgba(11, 12, 16, 0.62);
}
.invite {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.app--settings .panel--left { min-height: 720px; }
.settings-editor { padding: 0 18px 18px; }
.settings-editor textarea { width: 100%; }
#modelEditor .settings__col {
  border-radius: 16px;
  border: 1px solid rgba(11, 12, 16, 0.08);
  background: rgba(255, 255, 255, 0.78);
  padding: 10px;
}
#modelEditor input {
  margin-top: 6px;
}
.prompt-list {
  padding: 0 18px 18px;
  display: grid;
  gap: 8px;
}
.prompt-item {
  border-radius: 16px;
  border: 1px solid rgba(11, 12, 16, 0.10);
  background: rgba(255,255,255,0.86);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}
.prompt-item.is-active {
  border-color: rgba(0, 87, 255, 0.35);
  box-shadow: 0 16px 40px rgba(0, 87, 255, 0.12);
  background:
    radial-gradient(320px 120px at 20% 0%, rgba(0, 87, 255, 0.16), transparent 65%),
    rgba(255,255,255,0.96);
}
.settings-editor { padding: 0 18px 18px; }
.settings-users {
  padding: 0 18px 18px;
  border-top: 1px solid rgba(11, 12, 16, 0.08);
  margin-top: 10px;
}
.users {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}
.user-card {
  border-radius: 12px;
  border: 1px solid rgba(11, 12, 16, 0.10);
  background: rgba(255,255,255,0.86);
  padding: 8px 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.user-card__meta { color: rgba(11, 12, 16, 0.58); font-size: 11px; }

.analysis { margin-top: 12px; }
.analysis__box {
  border-radius: 22px;
  border: 1px solid rgba(11, 12, 16, 0.10);
  background: rgba(255,255,255,0.92);
  padding: 14px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.06);
}
.analysis__title { font-weight: 700; letter-spacing: -0.02em; }
.analysis__text {
  margin: 10px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  white-space: pre-wrap;
  color: rgba(11, 12, 16, 0.78);
  font-weight: 400;
}

.jobmeta { font-size: 12px; color: rgba(11, 12, 16, 0.60); }

.mobile-actions {
  display: none;
  position: static;
  margin-top: 16px;
  margin-bottom: 16px;
}
.mobile-actions__inner {
  display: flex;
  gap: 10px;
}
.mobile-actions__inner .btn {
  width: auto;
  flex: 1;
}

.history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.35);
  backdrop-filter: blur(8px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.history-overlay[hidden] { display: none !important; }
.history-panel {
  width: min(1100px, calc(100% - 32px));
  background: var(--paper);
  border-radius: 24px;
  border: 1px solid rgba(11, 12, 16, 0.08);
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  padding: 18px;
  max-height: calc(100vh - 80px);
  overflow: hidden;
}
.history-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 2;
  padding-bottom: 6px;
}
.history-panel__body {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}
.history-col {
  display: grid;
  gap: 10px;
  min-height: 0;
}
.history-col__title {
  font-weight: 600;
  font-size: 13px;
}
.history-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  overflow-y: hidden;
  max-height: calc(100vh - 200px);
}
.history-item {
  min-width: 240px;
  max-width: 280px;
  background: rgba(11, 12, 16, 0.04);
  border: 1px solid rgba(11, 12, 16, 0.08);
  border-radius: 16px;
  padding: 10px;
  display: grid;
  gap: 8px;
}
.history-item__img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  object-fit: cover;
  background: #f0f0f0;
}
.history-item__text {
  font-size: 12px;
  color: rgba(11, 12, 16, 0.7);
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
}
.history-item__actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
}
.history-item__actions .btn {
  flex: 1 1 auto;
  justify-content: center;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .history-panel__body { grid-template-columns: 1fr; }
}

.gallery-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
}
.gallery-overlay[hidden] { display: none !important; }
.gallery-image {
  max-width: 92vw;
  max-height: 86vh;
  border-radius: 16px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.45);
}
.gallery-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 999px;
  width: 38px;
  height: 38px;
  font-size: 18px;
  cursor: pointer;
}
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 999px;
  width: 44px;
  height: 44px;
  font-size: 20px;
  cursor: pointer;
}
.gallery-prev { left: 20px; }
.gallery-next { right: 20px; }

.assistant-dock {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  display: grid;
  gap: 10px;
  justify-items: end;
}
.assistant-button {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(11, 12, 16, 0.12);
  background: linear-gradient(135deg, #4cc3ff, #2b6bff);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 18px 40px rgba(43, 107, 255, 0.28);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.assistant-button svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}
.assistant-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: var(--assistant-width);
  background: var(--paper);
  border-radius: 18px 0 0 18px;
  border: 1px solid rgba(11, 12, 16, 0.08);
  box-shadow: -24px 0 60px rgba(0,0,0,0.12);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  padding: 16px;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.assistant-panel[hidden] { display: none !important; }
.assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 4px;
}
.assistant-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
  align-items: center;
}
.assistant-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(11, 12, 16, 0.12);
  background: rgba(255,255,255,0.8);
  padding: 0 10px;
  font-size: 11px;
  cursor: pointer;
  flex: 0 0 auto;
  max-width: 140px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  gap: 6px;
}
.assistant-tab__text {
  overflow: hidden;
  text-overflow: ellipsis;
}
.assistant-tab__actions {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  flex: 0 0 auto;
}
.assistant-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: rgba(11, 12, 16, 0.6);
  border: 1px solid rgba(11, 12, 16, 0.12);
  background: rgba(255,255,255,0.85);
  opacity: 0;
  transition: opacity 120ms ease;
}
.assistant-tab:hover .assistant-icon { opacity: 1; }
.assistant-tab.is-active .assistant-icon { opacity: 1; }
.assistant-tab.is-active {
  border-color: rgba(43, 107, 255, 0.4);
  background: rgba(43, 107, 255, 0.12);
}
.assistant-tab--add {
  width: 26px;
  height: 26px;
  padding: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.assistant-body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-content: flex-start;
  min-height: 0;
  padding-right: 2px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.assistant-msg {
  padding: 6px 10px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.35;
  max-width: 72%;
  width: fit-content;
  white-space: pre-wrap;
  word-break: break-word;
}
.assistant-msg--user {
  background: #2b6bff;
  color: #fff;
  align-self: flex-end;
}
.assistant-msg--ai {
  background: rgba(11, 12, 16, 0.06);
  color: rgba(11, 12, 16, 0.9);
  align-self: flex-start;
}
.assistant-code {
  margin: 6px 0 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(11, 12, 16, 0.08);
  font-size: 12px;
  overflow-x: auto;
}
.assistant-inline {
  padding: 1px 4px;
  border-radius: 6px;
  background: rgba(11, 12, 16, 0.1);
  font-size: 12px;
}
.assistant-input {
  display: flex;
  gap: 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.assistant-input input {
  flex: 1;
  border-radius: 12px;
}

@media (max-width: 860px) {
  .assistant-panel {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    padding: 16px;
  }
  .assistant-input { position: sticky; bottom: 0; background: var(--paper); padding-top: 6px; }
  .assistant-input input { font-size: 16px; }
  body.assistant-open { padding-right: 0; }
  .assistant-icon { opacity: 1; }
}

.dock {
  position: static;
  margin-top: 16px;
  margin-bottom: 10px;
  z-index: 60;
}
.dock__inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 20px;
  background:
    radial-gradient(420px 120px at 20% 0%, rgba(0, 87, 255, 0.12), transparent 65%),
    radial-gradient(420px 160px at 100% 100%, rgba(255, 45, 85, 0.10), transparent 65%),
    rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(11, 12, 16, 0.10);
  backdrop-filter: blur(12px);
  box-shadow: 0 26px 80px rgba(0,0,0,0.12);
}
.dock__inner { flex-wrap: wrap; }

.dock__title { font-weight: 700; letter-spacing: -0.02em; font-size: 12px; }
.dock__hint { font-size: 12px; color: rgba(11, 12, 16, 0.60); margin-left: 10px; }

.dock__left { display: flex; align-items: center; gap: 10px; }
.dock__right { display: flex; align-items: center; gap: 14px; }
.dock__group { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; flex-shrink: 0; }
.dock__group--tier { margin-left: auto; }

.toggle {
  display: inline-flex;
  padding: 6px;
  border-radius: 999px;
  background: rgba(11, 12, 16, 0.04);
  border: 1px solid rgba(11, 12, 16, 0.10);
  gap: 6px;
}
.toggle__btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 9px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  color: rgba(11, 12, 16, 0.72);
}
.toggle__btn.is-active {
  background: rgba(255,255,255,0.92);
  border-color: rgba(11, 12, 16, 0.10);
  color: rgba(11, 12, 16, 0.92);
  box-shadow: 0 12px 34px rgba(0,0,0,0.08);
}

.count {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(11, 12, 16, 0.04);
  border: 1px solid rgba(11, 12, 16, 0.10);
}
.count__btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  color: rgba(11, 12, 16, 0.72);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.count__btn.is-active {
  background: rgba(255,255,255,0.92);
  border-color: rgba(11, 12, 16, 0.10);
  color: rgba(11, 12, 16, 0.92);
  box-shadow: 0 12px 34px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.count__btn:disabled,
.count__btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@media (max-width: 1060px) {
  .history__grid { grid-template-columns: repeat(2, 1fr); }
  .panel__head--right { align-items: flex-start; flex-direction: column; }
  .run { flex-direction: column; align-items: stretch; }
  .btn { width: 100%; }
  .settings__row { grid-template-columns: 1fr; }
  .settings__col--actions { justify-content: flex-start; }
  .settings__row--defaults { grid-template-columns: 1fr 1fr; }
  .settings__row--site { grid-template-columns: 1fr; }
  .settings__row--models { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .container { width: min(var(--container), calc(100% - 20px)); }
  .topbar__meta .pill { display: none; }
  .topbar__inner { flex-direction: row; align-items: center; }
  .topbar__actions { display: none; }
  .dock__inner { flex-direction: row; align-items: center; }
  .settings__row--defaults { grid-template-columns: 1fr; }
  .mobile-actions { display: block; }
}

@media (max-width: 420px) {
  .dock__inner { flex-wrap: wrap; }
}

@media (min-width: 980px) {
  .container { width: min(var(--container), calc(100% - 48px)); }
  .main { padding: 22px 0 96px; }
  .app { grid-template-columns: 1.02fr 0.98fr; gap: 16px; }
  .app::before { inset: -40px -40px auto -40px; height: 260px; }
  .panel { border-radius: 26px; }
  .panel--left { padding: 18px; }
  .panel__head { padding: 18px 18px 0; }
  .panel__head--right { align-items: flex-end; flex-wrap: nowrap; gap: 12px; padding-bottom: 12px; }
  .modes { grid-template-columns: repeat(5, 1fr); }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .dock { position: static; margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .mode { transition: none; }
  .skel::after { animation: none; }
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.25);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.auth-card {
  width: min(420px, calc(100% - 32px));
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(11, 12, 16, 0.08);
  display: grid;
  gap: 14px;
}
.auth-card .field { margin-top: 0; }
.auth-card .label { margin-bottom: 6px; }
.auth-card input { width: 100%; }
.auth-card .btn { width: 100%; margin-top: 6px; }

.admin-body .main { padding-top: 24px; }
.admin-panel {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(11, 12, 16, 0.08);
  box-shadow: var(--shadow);
}
.admin-panel #adminLogin .btn { margin-top: 8px; }
.admin-panel .settings__row {
  align-items: end;
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(11, 12, 16, 0.06);
  background: rgba(255, 255, 255, 0.78);
  gap: 14px;
}
.admin-panel .settings__row .label { font-weight: 600; }
.admin-panel .settings__row .settings__col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.admin-panel textarea { width: 100%; resize: vertical; }
.admin-panel .settings__col--actions {
  align-items: flex-end;
  justify-content: flex-end;
  flex-direction: column;
  gap: 8px;
}
.admin-panel .settings__col--actions .btn { width: 120px; justify-content: center; }
.admin-panel .settings__row--site { grid-template-columns: 1.4fr 1.4fr 1fr auto; }
.admin-panel .settings__row + .admin-users { margin-top: 16px; }
.admin-users { display: grid; gap: 16px; }
.admin-divider {
  height: 1px;
  background: rgba(11, 12, 16, 0.08);
  margin: 18px 0;
}
.admin-section { display: grid; gap: 12px; }

.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}
.tab {
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  border: 1px solid rgba(11, 12, 16, 0.12);
  background: rgba(255,255,255,0.85);
  cursor: pointer;
}
.tab.is-active {
  border-color: rgba(0, 87, 255, 0.35);
  box-shadow: 0 10px 26px rgba(0, 87, 255, 0.15);
  background: rgba(0, 87, 255, 0.08);
}
.admin-tab { display: block; }
.user-card--admin {
  padding: 16px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  border: 1px solid rgba(11, 12, 16, 0.08);
  margin-bottom: 12px;
}
.user-card__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.user-card__actions { display: flex; gap: 8px; }
.user-card__title .pill { margin-left: 8px; font-size: 10px; }
.device-list { margin-top: 10px; display: grid; gap: 10px; }
.device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(11, 12, 16, 0.04);
  border: 1px solid rgba(11, 12, 16, 0.06);
}
.device-row__title { font-weight: 600; font-size: 13px; }
.device-row__meta { font-size: 12px; color: var(--muted); }
.device-row__actions { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; }
.device-row__actions .btn { white-space: nowrap; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(11, 12, 16, 0.7);
}
.switch input { width: 16px; height: 16px; }

.user-card--admin .settings__row {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(11, 12, 16, 0.03);
  border: 1px solid rgba(11, 12, 16, 0.06);
}
.user-card--admin .settings__col--actions { align-items: center; }
