:root {
  color-scheme: dark;
  --bg: #0d0f0e;
  --panel: #191f1b;
  --panel-2: #202821;
  --line: #303b33;
  --text: #f3f7f0;
  --muted: #aab6a9;
  --quiet: #728070;
  --green: #76d672;
  --amber: #e8b957;
  --cyan: #69d7d4;
  --coral: #f08a6c;
  --violet: #a992ff;
  --lime: #b2f05d;
  --danger: #ff7474;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(118, 214, 114, 0.1), transparent 30%),
    radial-gradient(circle at 90% 8%, rgba(105, 215, 212, 0.08), transparent 28%),
    var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
p, h1, h2, h3 { margin: 0; overflow-wrap: anywhere; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 14px clamp(16px, 4vw, 56px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 15, 14, 0.88);
  backdrop-filter: blur(18px);
}

.brand, .top-actions, .hero-actions, .status-row, .session {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand { font-size: 18px; font-weight: 800; white-space: nowrap; }
.brand-mark {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(118, 214, 114, 0.6);
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--green) 0 4px, transparent 5px),
    linear-gradient(135deg, rgba(118, 214, 114, 0.25), rgba(105, 215, 212, 0.12));
}

.main-nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  color: var(--muted);
  font-size: 14px;
}
.main-nav a { padding: 8px 0; transition: color 0.18s ease; }
.main-nav a:hover, .main-nav a.active { color: var(--text); }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}
.icon-button:hover { border-color: rgba(118, 214, 114, 0.6); background: rgba(118, 214, 114, 0.1); }
.mobile-menu-button { display: none; }

.view { display: none; }
.view.active { display: block; }

.hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 68vh;
  padding: clamp(88px, 11vh, 128px) clamp(18px, 5vw, 72px) 42px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(13, 15, 14, 0.98) 0%, rgba(13, 15, 14, 0.78) 52%, rgba(13, 15, 14, 0.48) 100%),
    url("../assets/hero-ai-food.png") center / cover no-repeat;
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(180deg, transparent, var(--bg));
}
.hero-copy { position: relative; z-index: 1; width: min(780px, 100%); }

.eyebrow {
  margin-bottom: 12px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 { max-width: 920px; font-size: clamp(40px, 7.5vw, 84px); line-height: 0.98; letter-spacing: 0; }
h2 { font-size: clamp(28px, 4vw, 48px); line-height: 1.04; letter-spacing: 0; }
h3 { font-size: 20px; line-height: 1.18; }
.lead { max-width: 720px; margin-top: 22px; color: #d7e0d5; font-size: clamp(17px, 2vw, 21px); line-height: 1.56; }

.hero-actions { flex-wrap: wrap; margin-top: 28px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  line-height: 1;
}
.button.primary { background: var(--green); color: #071007; }
.button.primary:hover { background: #93ef8d; }
.button.secondary { border-color: var(--line); background: rgba(255, 255, 255, 0.06); color: var(--text); }
.button.secondary:hover { border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.1); }
.button.full { width: 100%; }
.button.compact { min-height: 40px; padding: 10px 12px; font-size: 14px; }
.button.danger { background: rgba(255, 116, 116, 0.13); border-color: rgba(255, 116, 116, 0.35); color: #ffd5d5; }

.status-row { flex-wrap: wrap; margin-top: 24px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  color: #dbe5d9;
  font-size: 13px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.warning { background: var(--amber); box-shadow: 0 0 0 4px rgba(232, 185, 87, 0.13); }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 4px rgba(118, 214, 114, 0.13); }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 116, 116, 0.13); }
.status-dot.muted { background: var(--quiet); }

.section { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: clamp(52px, 8vw, 92px) 0; }
.section.compact { padding-top: 28px; }
.section-heading { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); gap: 34px; align-items: end; margin-bottom: 26px; }
.feature-grid, .details-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.feature-card, .detail-card, .pipeline-step, .auth-card, .gate, .request-panel, .chat-card, .release-card, .admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
}
.feature-card { min-height: 230px; padding: 22px; }
.feature-card svg, .pipeline-step svg, .notice svg, .gate svg { width: 28px; height: 28px; margin-bottom: 20px; }
.feature-card h3 { margin-bottom: 12px; }
.feature-card p, .detail-card p, .pipeline-step p, .page-title p, .account-copy p, .download-layout p, .gate p, .preset, .admin-title p { color: var(--muted); line-height: 1.62; }

.accent-green svg { color: var(--green); }
.accent-amber svg { color: var(--amber); }
.accent-cyan svg { color: var(--cyan); }
.accent-coral svg { color: var(--coral); }
.accent-violet svg { color: var(--violet); }
.accent-lime svg { color: var(--lime); }

.page-title { padding-bottom: 28px; }
.page-title h1, .account-copy h1, .download-layout h1, .chat-title h1, .admin-title h1 { font-size: clamp(36px, 6vw, 68px); }
.page-title p, .account-copy p, .download-layout p, .admin-title p { max-width: 760px; margin-top: 18px; font-size: 18px; }

.detail-card { min-height: 250px; padding: 24px; }
.detail-card span { display: block; margin-bottom: 42px; color: var(--green); font-weight: 900; }
.detail-card h2, .pipeline-step h2, .request-panel h2 { margin-bottom: 12px; font-size: 24px; }
.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.pipeline-step { min-height: 250px; padding: 20px; }

.account-layout, .download-layout { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(340px, 460px); gap: 48px; align-items: start; }
.notice { display: flex; align-items: center; gap: 12px; margin-top: 28px; color: #dbe5d9; }
.notice svg { margin: 0; color: var(--green); }
.auth-card { padding: 18px; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 5px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0, 0, 0, 0.22); }
.tabs button { min-height: 38px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.tabs button.active { background: var(--panel-2); color: var(--text); }
.auth-form { display: none; }
.auth-form.active { display: grid; gap: 14px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 760; }
input, select { width: 100%; min-height: 44px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: #0f1210; color: var(--text); outline: none; }
input:focus, select:focus { border-color: rgba(118, 214, 114, 0.72); box-shadow: 0 0 0 3px rgba(118, 214, 114, 0.13); }
.text-button { min-height: 34px; padding: 0; border: 0; background: transparent; color: var(--green); text-align: left; }
.form-status { min-height: 22px; margin-top: 14px; color: var(--muted); line-height: 1.4; }
.form-status.error { color: var(--danger); }
.form-status.ok { color: var(--green); }

.chat-layout, .admin-layout { padding-top: 44px; }
.chat-title, .admin-title { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.session span { max-width: 240px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gate { display: grid; justify-items: start; gap: 12px; padding: 28px; }
.gate svg { margin: 0; color: var(--amber); }
.gate h2 { font-size: 28px; }
.chat-shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; min-height: 620px; }
.request-panel { align-self: start; padding: 18px; }
.preset { margin-bottom: 16px; padding: 12px; border: 1px solid rgba(118, 214, 114, 0.22); border-radius: 8px; background: rgba(118, 214, 114, 0.07); font-size: 13px; }
.request-panel label { margin-bottom: 14px; }
.chat-card { display: grid; grid-template-rows: 1fr auto; min-height: 620px; overflow: hidden; }
.messages { display: flex; flex-direction: column; gap: 12px; padding: 18px; overflow: auto; }
.message { width: fit-content; max-width: min(720px, 86%); padding: 12px 14px; border-radius: 8px; line-height: 1.5; }
.message.assistant { align-self: flex-start; background: #242b26; color: #e7eee5; }
.message.user { align-self: flex-end; background: #d5ffd2; color: #071007; }
.message.error { align-self: flex-start; background: rgba(255, 116, 116, 0.12); color: #ffd0d0; }
.chat-form { display: grid; grid-template-columns: 1fr 46px; gap: 10px; padding: 14px; border-top: 1px solid var(--line); background: rgba(0, 0, 0, 0.18); }
.send-button { width: 46px; height: 46px; background: var(--green); color: #071007; }

.admin-panel { padding: 18px; }
.admin-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.admin-table { width: 100%; min-width: 820px; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.admin-table th { color: var(--muted); font-size: 13px; font-weight: 800; }
.admin-table td { color: #e9efe6; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mini-button { min-height: 34px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.05); color: var(--text); }
.mini-button.danger { border-color: rgba(255, 116, 116, 0.36); color: #ffd4d4; }
.badge { display: inline-flex; padding: 5px 8px; border-radius: 8px; background: rgba(255,255,255,0.07); color: var(--muted); font-size: 12px; }
.badge.blocked { background: rgba(255, 116, 116, 0.12); color: #ffd4d4; }
.badge.active { background: rgba(118, 214, 114, 0.12); color: #caffc7; }

.release-card { display: grid; gap: 12px; padding: 22px; }
.release-card div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.release-card div:last-child { border-bottom: 0; }
.release-card span { color: var(--muted); }
.release-card strong { text-align: right; }
.footer { display: flex; justify-content: space-between; gap: 18px; padding: 28px clamp(16px, 4vw, 56px); border-top: 1px solid var(--line); color: var(--quiet); font-size: 14px; }
svg { width: 20px; height: 20px; flex: 0 0 auto; }
[hidden] { display: none !important; }

@media (max-width: 1020px) {
  .main-nav { position: fixed; inset: 72px 14px auto; display: none; flex-direction: column; align-items: stretch; gap: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(13, 15, 14, 0.96); }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 13px 12px; }
  .mobile-menu-button { display: inline-grid; }
  .section-heading, .account-layout, .download-layout { grid-template-columns: 1fr; }
  .feature-grid, .details-grid, .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-shell { grid-template-columns: 1fr; }
  .request-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .request-panel h2, .request-panel .preset { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .topbar { min-height: 66px; padding: 12px 14px; }
  .hero { min-height: 76vh; padding: 82px 18px 34px; }
  .lead, .page-title p, .account-copy p, .download-layout p, .admin-title p { font-size: 16px; }
  .feature-grid, .details-grid, .pipeline, .request-panel { grid-template-columns: 1fr; }
  .feature-card, .detail-card, .pipeline-step { min-height: auto; }
  .chat-title, .admin-title, .footer { flex-direction: column; align-items: flex-start; }
  .session { width: 100%; justify-content: space-between; }
  .message { max-width: 96%; }
  .tabs { grid-template-columns: 1fr; }
}
