:root {
  --bg: #eceff3;
  --surface: #ffffff;
  --text: #1d2939;
  --muted: #667085;
  --border: #d0d5dd;
  --primary: #344054;
  --silver: #c0c6d0;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #f8fafc, var(--bg) 38%);
}
.app-shell { min-height: 100vh; }
.topbar {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: linear-gradient(180deg, #3b4553 0%, #2b3441 100%);
  color: white;
  border-bottom: 1px solid #1f2a44;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #d0d5dd;
  box-shadow: 0 0 0 8px rgba(208, 213, 221, .18);
}
.brand-title { margin: 0; font-size: 15px; font-weight: 600; }
.brand-subtitle { margin: 0; font-size: 12px; color: #a6b0c3; }
.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav a {
  color: #c5d0e6;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: white; }
.container { max-width: 1040px; margin: 0 auto; padding: 22px 16px 32px; }
.page-head h1 { margin: 0 0 8px; }
.muted { color: var(--muted); margin: 0 0 12px; }
.error { color: #b42318; font-size: 14px; margin: 8px 0; }
.grid { display: grid; gap: 14px; }
.metrics-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(16, 24, 40, .05);
}
.metric-label { margin: 0; color: var(--muted); font-size: 13px; }
.metric-value { margin: 6px 0 0; font-size: 26px; font-weight: 700; }
.chatbox { min-height: 280px; max-height: 56vh; overflow: auto; margin-bottom: 14px; }
.msg { margin-bottom: 10px; line-height: 1.45; padding: 10px 12px; border-radius: 10px; background: #f8faff; }
.msg.user { border-left: 3px solid #4caf50; }
.msg.ai { border-left: 3px solid var(--primary); }
.msg.ai:has(.msg-role) { background: #f8f9fc; }
.msg-role { display: inline-block; margin-right: 8px; color: var(--muted); text-transform: uppercase; font-size: 11px; }
.ai-hint {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #1f2a44;
  font-size: 13px;
}
.form { display: grid; gap: 8px; margin-bottom: 14px; }
label { font-size: 13px; color: var(--muted); }
textarea, input {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  background: white;
}
textarea { min-height: 116px; resize: vertical; }
button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #4b5563 0%, #344054 100%);
  color: white;
  cursor: pointer;
  font-weight: 600;
}
button:hover { filter: brightness(1.05); }
.ghost-btn { background: transparent; border: 1px solid #415171; color: #d9e1f2; }
.list { display: grid; gap: 10px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.list-title { margin: 0 0 4px; font-weight: 600; }
.history-details summary { list-style: none; cursor: pointer; }
.history-details summary::-webkit-details-marker { display: none; }
.history-summary { padding: 2px 0; }
.history-chat { margin-top: 10px; display: grid; gap: 8px; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #c7d7ff;
  padding: 4px 10px;
  font-size: 12px;
  color: #2643d4;
  background: #eef2ff;
}
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.product-card p { margin: 8px 0; }
.product-image { width: 100%; height: 180px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin-top: 10px;
  padding-bottom: 4px;
}
.carousel-item {
  scroll-snap-align: start;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: #fafbfc;
}
.gen-progress { margin-top: 8px; }
.gen-progress-bar {
  width: 100%;
  height: 10px;
  background: #e4e7ec;
  border-radius: 999px;
  overflow: hidden;
}
.gen-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #64748b 0%, #334155 100%);
  transition: width .35s ease;
}
.gen-progress-text { margin-top: 6px; margin-bottom: 0; font-size: 13px; }
.profile-card { display: grid; gap: 8px; }
.profile-line { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px dashed var(--border); padding: 8px 0; }
.profile-line:last-child { border-bottom: 0; }
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at top, #f8fafc, #e6eaef 45%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(26, 36, 67, .12);
  padding: 24px;
}
.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.lang-tile {
  text-align: left;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #bfc7d1;
  background: linear-gradient(180deg, #f8fafc 0%, #e5e7eb 100%);
  color: #1f2937;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lang-tile small {
  color: #475467;
  font-weight: 700;
}
.lang-tile:hover {
  border-color: #98a2b3;
  background: linear-gradient(180deg, #ffffff 0%, #dbe0e7 100%);
}
.auth-card h1 { margin-top: 0; }
@media (max-width: 700px) {
  .container { padding-top: 16px; }
  .topbar { padding: 12px; }
  .nav { width: 100%; }
}

