:root {
  --bg-deep: #06121f;
  --bg-panel: #0b1c2e;
  --line: rgba(120, 190, 230, 0.18);
  --text: #e8f3fa;
  --muted: #8aa6ba;
  --accent: #19b7d4;
  --accent-2: #0d8fb0;
  --danger: #e35d6a;
  --ok: #3ecf8e;
  --radius: 18px;
  --font: "Manrope", system-ui, sans-serif;
  --display: "Space Grotesk", "Manrope", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(25, 183, 212, 0.2), transparent 55%),
    radial-gradient(900px 600px at 100% 0%, rgba(13, 90, 140, 0.3), transparent 50%),
    linear-gradient(160deg, #04101a 0%, #0a1a2c 45%, #071420 100%);
  background-attachment: fixed;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ===== Site nav ===== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(4, 16, 26, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: clamp(0.78rem, 1.6vw, 0.95rem);
  max-width: min(62vw, 520px);
  line-height: 1.25;
}
.nav-brand span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nav-brand img { width: 40px; height: 40px; object-fit: contain; }
.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.94rem;
  padding: 8px 12px;
  border-radius: 999px;
  transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--text); background: rgba(25,183,212,.1); }
.nav-toggle {
  display: none;
  width: 42px; height: 42px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
.nav-toggle span {
  display: block;
  width: 18px; height: 2px;
  background: var(--text);
  transition: transform .2s;
}
.nav-toggle.open span:first-child { transform: translateY(4px) rotate(45deg); }
.nav-toggle.open span:last-child { transform: translateY(-4px) rotate(-45deg); }

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: calc(100vh - 72px);
  display: grid;
  place-items: center;
  padding: 48px 20px 72px;
  overflow: hidden;
}
.hero-glow {
  position: absolute;
  inset: -20% -10% auto;
  height: 70%;
  background:
    radial-gradient(circle at 30% 40%, rgba(25,183,212,.28), transparent 45%),
    radial-gradient(circle at 75% 20%, rgba(30,110,170,.35), transparent 40%);
  animation: drift 12s ease-in-out infinite alternate;
  pointer-events: none;
}
.hero-inner {
  position: relative;
  width: min(760px, 100%);
  text-align: center;
  animation: rise .7s ease both;
}
.hero-logo {
  width: 88px; height: 88px;
  object-fit: contain;
  margin-bottom: 14px;
  filter: drop-shadow(0 12px 28px rgba(25,183,212,.3));
  animation: floaty 5s ease-in-out infinite;
}
.hero-brand {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.35rem, 3.2vw, 2rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.hero-sub {
  margin: 14px auto 0;
  max-width: 540px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}
.hero-actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.btn-primary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 14px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s, filter .2s, background .2s, border-color .2s;
}
.btn-primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #04202a;
  border: 0;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-primary:hover, .btn-ghost:hover { transform: translateY(-1px); filter: brightness(1.06); }

/* ===== Sections ===== */
.section {
  padding: 72px clamp(16px, 4vw, 40px);
  border-top: 1px solid var(--line);
}
.section-inner { width: min(980px, 100%); margin: 0 auto; }
.section h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.02em;
}
.section-lead { margin: 10px 0 28px; color: var(--muted); max-width: 560px; }

.product-list {
  display: grid;
  gap: 14px;
}
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}
.catalog-card-public {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(10, 26, 42, 0.55);
  animation: rise .45s ease both;
}
.catalog-media {
  aspect-ratio: 16 / 10;
  background: rgba(6, 18, 31, 0.9);
  overflow: hidden;
}
.catalog-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.catalog-media-fallback {
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.catalog-body { padding: 16px; }
.catalog-body h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.12rem;
}
.catalog-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.94rem;
  min-height: 2.8em;
}
.catalog-price {
  margin: 14px 0 0;
  font-weight: 700;
  color: var(--accent);
  font-size: 1.05rem;
}
.product-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  animation: rise .45s ease both;
}
.product-item:last-child { border-bottom: 0; }
.product-item h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 1.15rem;
}
.product-desc { margin: 0; color: var(--muted); line-height: 1.55; }
.product-detail { margin: 8px 0 0; font-size: 0.92rem; color: #b7d3e4; }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
  margin-bottom: 24px;
}
.contact-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.contact-item p { margin: 0; line-height: 1.5; }
.contact-item a { color: var(--text); text-decoration: none; border-bottom: 1px solid rgba(25,183,212,.35); }
.contact-item a:hover { color: var(--accent); }

.site-footer {
  padding: 28px 20px 100px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
}

/* ===== Chat FAB + Modal ===== */
.chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #04202a;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
  animation: rise .6s ease both;
  transition: transform .15s, filter .2s;
}
.chat-fab:hover { transform: translateY(-2px) scale(1.02); filter: brightness(1.05); }
.chat-fab-label { font-size: 0.92rem; }

.chat-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 16px;
}
.chat-modal[hidden] { display: none !important; }
.chat-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 14, 0.55);
  backdrop-filter: blur(2px);
  animation: fade .2s ease both;
}
.chat-modal-panel {
  position: relative;
  width: min(400px, 100%);
  height: min(620px, calc(100vh - 32px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: rgba(8, 22, 36, 0.97);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  animation: pop .28s ease both;
  margin-right: 4px;
  margin-bottom: 4px;
}
.chat-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 18, 31, 0.9);
}
.chat-modal-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
}
.chat-modal-sub { margin: 2px 0 0; color: var(--muted); font-size: 0.8rem; }
.chat-close {
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.chat-main {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  scroll-behavior: smooth;
}
.msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.5;
  font-size: 0.92rem;
  border: 1px solid var(--line);
  animation: pop .25s ease both;
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(145deg, #16587a, #0f3f58);
  border-bottom-right-radius: 5px;
}
.msg.ai {
  align-self: flex-start;
  background: rgba(14, 34, 52, 0.92);
  border-bottom-left-radius: 5px;
}
.msg .meta {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 600;
}
.msg-body { white-space: pre-wrap; word-break: break-word; }
.msg-body strong { font-weight: 700; color: #f2fbff; }
.msg-body .md-h {
  display: block;
  font-weight: 700;
  color: #f2fbff;
  margin: 0.3em 0 0.1em;
  font-family: var(--display);
}
.msg-body .md-h1 { font-size: 1.08em; }
.msg-body .md-h2 { font-size: 1.04em; }
.msg-body .md-h3, .msg-body .md-h4 { font-size: 1.01em; }
.msg-body .md-li {
  display: block;
  padding-left: 0.85em;
  position: relative;
}
.msg-body .md-li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
}
.msg.typing { opacity: 0.75; font-style: italic; color: var(--muted); }

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(6, 18, 31, 0.92);
}
.chat-form textarea {
  width: 100%;
  resize: none;
  max-height: 120px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 8px 4px;
  line-height: 1.4;
}
.chat-form button {
  width: 42px; height: 42px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #04202a;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.chat-form button:disabled { opacity: 0.55; cursor: not-allowed; }

body.chat-open .chat-fab { opacity: 0; pointer-events: none; }

/* ===== Admin ===== */
.admin-page { min-height: 100%; }
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: rgba(10, 26, 42, 0.92);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 24px;
  display: grid;
  gap: 12px;
  animation: rise .45s ease both;
}
.login-logo { width: 64px; height: 64px; object-fit: contain; margin: 0 auto; }
.login-card h1 {
  margin: 0;
  text-align: center;
  font-family: var(--display);
  font-size: 1.45rem;
}
.login-desc { margin: 0 0 6px; text-align: center; color: var(--muted); font-size: 0.92rem; }
.login-card label, .config-form label {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 600;
}
.login-card input, .config-form input, .config-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(6, 18, 31, 0.85);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  outline: none;
}
.login-card input:focus, .config-form input:focus, .config-form textarea:focus {
  border-color: rgba(25, 183, 212, 0.55);
  box-shadow: 0 0 0 3px rgba(25, 183, 212, 0.12);
}
.login-card button, .form-actions button, .logout-btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.login-card button, .form-actions button {
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #04202a;
}
.form-error { color: var(--danger); margin: 0; font-size: 0.88rem; }
.form-status { margin: 12px 0; font-size: 0.9rem; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--danger); }

.dash-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}
.dash-side {
  background: rgba(6, 18, 31, 0.88);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.side-brand { display: flex; gap: 10px; align-items: center; }
.side-brand img { width: 42px; height: 42px; object-fit: contain; }
.side-brand strong { display: block; font-family: var(--display); font-size: 1rem; }
.side-brand span { color: var(--muted); font-size: 0.78rem; }
.dash-side nav { display: grid; gap: 10px; flex: 1; }
.dash-side nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0;
  border-radius: 0;
  font-weight: 500;
  font-size: 0.95rem;
  background: none;
}
.dash-side nav a.active,
.dash-side nav a:hover {
  color: var(--text);
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.logout-btn {
  background: transparent !important;
  color: var(--muted);
  border: 0 !important;
  padding: 0 !important;
  font-weight: 500 !important;
  text-align: left;
  width: fit-content;
}
.logout-btn:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.dash-content { padding: 28px 28px 40px; }
.dash-header h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}
.dash-header p { margin: 8px 0 22px; color: var(--muted); }
.dash-header code {
  font-size: 0.85em;
  color: var(--accent);
}
.config-form {
  display: grid;
  gap: 16px;
  max-width: 820px;
  background: rgba(10, 26, 42, 0.72);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-actions { display: flex; justify-content: flex-end; max-width: 820px; }
.sticky-save {
  position: sticky;
  bottom: 12px;
  margin-top: 16px;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes drift {
  from { transform: translate3d(0,0,0) scale(1); }
  to { transform: translate3d(2%, 3%, 0) scale(1.04); }
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    padding: 12px;
    background: rgba(6, 18, 31, 0.96);
    border-bottom: 1px solid var(--line);
  }
  .nav-links.open { display: flex; }
  .contact-grid { grid-template-columns: 1fr; }
  .dash-wrap { grid-template-columns: 1fr; }
  .dash-side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .grid-2 { grid-template-columns: 1fr; }
  .dash-content { padding: 18px 14px 28px; }
  .chat-fab-label { display: none; }
  .chat-modal { padding: 10px; }
  .chat-modal-panel {
    width: 100%;
    height: min(78vh, 640px);
  }
}
