/* Deep Search — light UI (Figma) */

:root {
  --ink: #111827;
  --ink-strong: #0c0c0e;
  --muted: #6b7280;
  --muted-2: #6c7178;
  --hint: #666;
  --surface: #f3f4f6;
  --white: #ffffff;
  --dashed: #d1d1d6;
  --accent: #ffcd4f;
  --danger: #ef4444;
  --ok: #5ec918;
  --ig: #c13584;
  --page-top: #ffffff;
  --page-bottom: #fcf9f5;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 24px;
  --pill: 100px;
  --font: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-sys: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --frame-pad: 24px;
  --shadow-btn: 0px 14px 24px -12px rgba(17, 24, 39, 0.55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.4;
  min-height: 100vh;
  background: var(--page-bottom);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--page-top) 0%, var(--page-bottom) 100%);
  overflow: hidden;
}

/* Top nav */

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
  padding: 18px var(--frame-pad) 8px;
  padding-top: calc(18px + env(safe-area-inset-top));
  background: var(--white);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font);
}

.brand-dot {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: var(--pill);
  background: var(--accent);
  flex-shrink: 0;
}
.brand-dot::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: var(--pill);
  background: #000;
}

.brand-name {
  font-size: 24px;
  font-weight: 500;
  color: var(--ink-strong);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav-link {
  font-family: var(--font-sys);
  font-size: 12px;
  font-weight: 400;
  color: var(--hint);
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 15px;
  background: var(--surface);
  border: none;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.15s;
}
.back-btn:hover { background: #e9eaee; }
.back-btn svg { width: 22px; height: 22px; }

.top-nav-history {
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.06);
}

.history-header-titles {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.history-header-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-strong);
  line-height: 1.2;
}

.history-header-date {
  margin-top: 2px;
  font-family: var(--font-sys);
  font-size: 12px;
  color: var(--hint);
}

.history-header-spacer {
  width: 40px;
  flex-shrink: 0;
}

.top-nav-results {
  gap: 8px;
}

.top-nav-results .history-header-titles {
  text-align: left;
}

.sort-wrap-header {
  flex-shrink: 0;
  max-width: 42%;
}

.sort-btn-header {
  padding: 8px 12px;
  font-size: 12px;
  max-width: 100%;
}
.sort-btn-header span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-main-history {
  padding-top: 16px;
}

/* Main */

.app-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  padding: 24px var(--frame-pad) 140px;
  animation: pageIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-title {
  font-size: 40px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.hero-sub {
  margin-top: 16px;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted-2);
}

/* Search controls */

.controls {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border-radius: 20px;
}

.seg-tab {
  flex: 1 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 48px;
  padding: 0 12px;
  border: none;
  border-radius: 16px;
  background: transparent;
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.seg-tab svg { width: 16px; height: 16px; flex-shrink: 0; }
.seg-tab.active {
  background: var(--white);
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.08);
}

/* Search input */

.search-input {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
}
.search-input svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--muted); }
.search-input input {
  flex: 1 0 0;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-strong);
}
.search-input input::placeholder { color: var(--muted); }

/* Pills */

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--pill);
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 400;
  color: var(--ink);
  white-space: nowrap;
  transition: 0.15s;
}
.pill:hover { background: #e9eaee; }
.pill.active {
  background: var(--ink-strong);
  color: var(--white);
}

/* Extra inputs revealed by pills */

.adv-field { display: flex; flex-direction: column; }
.adv-field input {
  height: 48px;
  padding: 12px 16px;
  background: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  outline: none;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink-strong);
}
.adv-field input::placeholder { color: var(--muted); }

/* Photo upload card */

.upload-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--white);
  border: 1px dashed var(--dashed);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.upload-card:hover { border-color: var(--ink-strong); background: #fafafa; }
.upload-card.drag { border-color: var(--ink-strong); background: #f7f7f7; }

.icon-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.08);
  color: var(--ink);
}
.icon-tile svg { width: 20px; height: 20px; }

.upload-text { text-align: center; display: flex; flex-direction: column; gap: 4px; width: 100%; }
.upload-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.upload-hint { font-size: 12px; font-weight: 400; color: var(--muted); }

.upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 16px;
  background: var(--ink-strong);
  color: var(--white);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.15s, opacity 0.2s;
}
.upload-btn svg { width: 18px; height: 18px; }
.upload-btn:hover { transform: translateY(-1px); }

/* Uploaded photo card */

.uploaded-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--white);
  border: 1px dashed var(--dashed);
  border-radius: var(--radius-lg);
}

.uploaded-photo {
  width: 100%;
  height: 220px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  background: var(--surface);
}

.photo-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.photo-name {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo-name .ok { color: var(--ok); }

.replace-btn {
  padding: 6px 12px;
  background: var(--surface);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: background 0.15s;
}
.replace-btn:hover { background: #e9eaee; }

/* Bottom bar (sticky) */

.bottom-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px var(--frame-pad) 40px;
  background: linear-gradient(180deg, rgba(252, 249, 245, 0) 0%, var(--page-bottom) 45%);
  pointer-events: none;
}
.bottom-bar > * { pointer-events: auto; }

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 56px;
  border: none;
  border-radius: 24px;
  background: var(--ink-strong);
  color: var(--white);
  cursor: pointer;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  box-shadow: var(--shadow-btn);
  transition: transform 0.15s, opacity 0.2s;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary.is-hidden { display: none; }

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  min-height: 40px;
}
.footer-links a {
  font-family: var(--font-sys);
  font-size: 12px;
  font-weight: 400;
  color: var(--hint);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Results */

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.results-summary { font-size: 16px; font-weight: 400; color: var(--muted-2); }

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: 999px;
  background: #111;
  color: #fff;
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  white-space: nowrap;
}
.sort-btn .chev { font-size: 13px; font-weight: 500; }

/* results filter select overlays the sort button */
.sort-wrap { position: relative; }
.sort-wrap select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-family: var(--font);
}

.results-head-compact {
  justify-content: flex-end;
}

/* Knowledge Graph card */

.kg-card {
  margin: 0 0 14px;
  padding: 16px;
  border-radius: 18px;
  background: var(--white);
  border: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.kg-eyebrow {
  margin-bottom: 10px;
  font-family: var(--font-sys);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.kg-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.kg-photo {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 14px;
  background: var(--surface) center/cover no-repeat;
}

.kg-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hint);
  font-size: 22px;
}

.kg-main {
  flex: 1;
  min-width: 0;
}

.kg-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-strong);
  line-height: 1.2;
}

.kg-type {
  margin-top: 4px;
  font-family: var(--font-sys);
  font-size: 13px;
  color: var(--muted);
}

.kg-site {
  display: inline-flex;
  margin-top: 10px;
  padding: 7px 12px;
  border-radius: var(--pill);
  background: var(--ink-strong);
  font-family: var(--font-sys);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
}
.kg-site:hover { opacity: 0.9; }

.kg-desc {
  margin: 12px 0 0;
  font-family: var(--font-sys);
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted-2);
}

.kg-desc-src {
  color: var(--hint);
  font-size: 12px;
}

.kg-attrs {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(17, 24, 39, 0.06);
}

.kg-attr {
  display: grid;
  grid-template-columns: minmax(90px, 36%) 1fr;
  gap: 10px;
  font-family: var(--font-sys);
  font-size: 13px;
  line-height: 1.35;
}

.kg-attr-k {
  color: var(--hint);
}

.kg-attr-v {
  color: var(--ink);
  word-break: break-word;
}

.kg-links {
  margin-top: 12px;
}

.kg-more {
  font-family: var(--font-sys);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-strong);
  text-decoration: none;
}
.kg-more:hover { text-decoration: underline; }

.results-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.results-list {
  margin-top: 4px;
}

/* Name results — product source hits (not browser SERP) */

.source-hits {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.source-hit {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  border-radius: 16px;
  background: var(--white);
  border: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
  text-decoration: none;
  color: inherit;
  animation: cardIn 0.25s ease backwards;
  transition: background 0.15s, transform 0.15s;
}
.source-hit:hover { background: #fafafa; }
.source-hit:active { transform: scale(0.995); }

.source-hit-main {
  flex: 1;
  min-width: 0;
}

.source-hit-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 6px;
}

.source-hit-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 3px 8px 3px 6px;
  border-radius: var(--pill);
  background: var(--surface);
  font-family: var(--font-sys);
  font-size: 11px;
  font-weight: 600;
}

.source-hit-ico {
  font-size: 12px;
  line-height: 1;
}

.source-hit-host {
  min-width: 0;
  font-family: var(--font-sys);
  font-size: 11px;
  color: var(--hint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-hit-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--ink-strong);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.source-hit-text {
  margin-top: 5px;
  font-family: var(--font-sys);
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.source-hit-chev {
  align-self: center;
  flex-shrink: 0;
  font-size: 22px;
  font-weight: 300;
  color: var(--hint);
  line-height: 1;
}

.result-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 220px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  animation: cardIn 0.3s ease backwards;
  transition: transform 0.18s, box-shadow 0.18s;
}
.result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.12);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-photo {
  height: 156px;
  border-radius: 24px 24px 4px 4px;
  background: #d9d9d9;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.card-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
}
.card-name {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-platform {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  overflow: hidden;
}
.card-platform .ico { font-size: 13px; line-height: 1; flex-shrink: 0; }
.card-platform .plabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 4px 10px;
  background: var(--white);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.badge-18 {
  position: absolute;
  right: 12px;
  top: 12px;
  padding: 4px 10px;
  background: var(--danger);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
}

/* States */

.state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
  font-size: 14px;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 48px 16px;
  text-align: center;
  color: var(--muted-2);
  font-size: 14px;
}
.loading .sub { font-size: 12px; color: var(--muted); }

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--surface);
  border-top-color: var(--ink-strong);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.err {
  text-align: center;
  padding: 16px;
  border-radius: 16px;
  font-size: 14px;
  color: #b42318;
  background: #fef3f2;
  border: 1px solid #fecdca;
}

.inline-slot { margin-top: 4px; }

/* Load more */

.load-more {
  grid-column: 1 / -1;
  height: 48px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: var(--white);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  transition: 0.15s;
}
.load-more:hover { background: var(--surface); }

.provider-badge {
  display: inline-block;
  align-self: flex-start;
  margin-top: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
}

/* Legal pages */

.legal {
  padding-top: 24px;
  padding-bottom: 140px;
}
.legal h1 {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 6px;
}
.legal .updated {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.legal .lead {
  font-size: 15px;
  line-height: 1.6;
  color: #374151;
  margin: 12px 0 20px;
}
.legal h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin: 26px 0 8px;
}
.legal h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin: 18px 0 6px;
}
.legal p {
  font-size: 14px;
  line-height: 1.65;
  color: #374151;
  margin-bottom: 14px;
}
.legal ul {
  margin: 0 0 14px;
  padding-left: 20px;
}
.legal li {
  font-size: 14px;
  line-height: 1.6;
  color: #374151;
  margin-bottom: 6px;
}
.legal .note {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  font-size: 13px;
  line-height: 1.6;
  color: #4b5563;
  margin: 6px 0 18px;
}
.legal a.email {
  color: var(--ig);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* MARK: - Auth / login screen */

.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px var(--frame-pad);
  background: linear-gradient(180deg, var(--page-top) 0%, var(--page-bottom) 100%);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  animation: pageIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.auth-brand {
  font-family: var(--font-sys);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}
.auth-title {
  font-family: var(--font);
  font-size: 28px;
  font-weight: 700;
  color: var(--ink-strong);
  margin: 0 0 8px;
}
.auth-sub {
  font-family: var(--font-sys);
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 24px;
}
.auth-input {
  width: 100%;
  height: 54px;
  padding: 0 18px;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  background: #fff;
  font-family: var(--font-sys);
  font-size: 16px;
  color: var(--ink-strong);
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 12px;
}
.auth-input:focus { border-color: var(--ink-strong); }
.auth-input::placeholder { color: var(--muted); }
.auth-input--code {
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 8px;
}
.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 54px;
  border: none;
  border-radius: var(--radius);
  background: var(--ink-strong);
  color: var(--white);
  cursor: pointer;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.15s, opacity 0.15s;
}
.auth-btn:hover:not(:disabled) { transform: translateY(-2px); }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-row {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
}
.auth-link {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-sys);
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-link:disabled { opacity: 0.5; cursor: not-allowed; text-decoration: none; }
.auth-msg {
  min-height: 20px;
  margin-top: 14px;
  font-family: var(--font-sys);
  font-size: 13px;
  line-height: 1.4;
}
.auth-msg.is-error { color: #dc2626; }
.auth-msg.is-ok { color: #16a34a; }
.auth-funnel {
  margin-top: 24px;
  font-family: var(--font-sys);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Nav icon */

.nav-icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--surface);
  border-radius: var(--pill);
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
}
.nav-icon-btn svg {
  width: 20px;
  height: 20px;
}
.nav-icon-btn:hover { background: #e8eaee; }

/* Usage meters */

.subscription-banner {
  margin: 10px 0 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  font-family: var(--font-sys);
  font-size: 13px;
  line-height: 1.4;
  color: #9a3412;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.subscription-banner-text {
  flex: 1;
}

.subscription-renew-btn {
  align-self: flex-start;
  padding: 9px 14px;
  border: none;
  border-radius: var(--pill);
  background: var(--ink-strong);
  color: #fff;
  font-family: var(--font-sys);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.subscription-renew-btn:hover { opacity: 0.9; }
.subscription-renew-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.usage-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 4px 0 18px;
}

.usage-meter {
  padding: 12px 12px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(17, 24, 39, 0.06);
}

.usage-meter-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.usage-meter-label {
  font-family: var(--font-sys);
  font-size: 12px;
  color: var(--muted);
}

.usage-meter-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-strong);
}

.usage-track {
  height: 4px;
  border-radius: var(--pill);
  background: #eceff3;
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  border-radius: var(--pill);
  background: var(--accent);
  transition: width 0.25s ease;
}

.usage-meter-sub {
  margin-top: 6px;
  font-family: var(--font-sys);
  font-size: 11px;
  color: var(--hint);
}

.usage-meter.is-low .usage-fill { background: #f59e0b; }
.usage-meter.is-low .usage-meter-value { color: #b45309; }
.usage-meter.is-empty .usage-fill { background: var(--danger); }
.usage-meter.is-empty .usage-meter-value { color: var(--danger); }

/* History feed */

.history-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 28px;
}

.history-plaque {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 16px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
  transition: background 0.15s, transform 0.15s;
}
.history-plaque:hover:not(:disabled) {
  background: #f7f8fa;
}
.history-plaque:active:not(:disabled) {
  transform: scale(0.995);
}
.history-plaque:disabled {
  opacity: 0.55;
  cursor: default;
}

.history-plaque-main {
  flex: 1;
  min-width: 0;
}

.history-plaque .history-kind-row {
  margin-bottom: 4px;
}

.history-plaque-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-strong);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-plaque .history-meta {
  margin-top: 4px;
}

.history-plaque-chev {
  flex-shrink: 0;
  font-size: 22px;
  font-weight: 300;
  color: var(--hint);
  line-height: 1;
}

.history-entry {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.06);
}
.history-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.history-entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.history-kind-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-family: var(--font-sys);
  font-size: 12px;
  color: var(--hint);
}

.history-kind {
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--muted);
}

.history-dot { opacity: 0.5; }
.history-time { color: var(--hint); }

.history-query {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink-strong);
  line-height: 1.15;
  word-break: break-word;
}

.history-meta {
  margin-top: 6px;
  font-family: var(--font-sys);
  font-size: 12px;
  color: var(--hint);
}

.history-open-btn {
  flex-shrink: 0;
  margin-top: 2px;
  padding: 9px 14px;
  border: none;
  border-radius: var(--pill);
  background: var(--ink-strong);
  color: #fff;
  font-family: var(--font-sys);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.history-open-btn:hover { opacity: 0.9; }

.history-thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.history-thumbs::-webkit-scrollbar { display: none; }

.history-thumb-card {
  position: relative;
  flex: 0 0 112px;
  width: 112px;
  text-decoration: none;
  color: inherit;
}

.history-thumb-photo {
  width: 112px;
  height: 112px;
  border-radius: 14px;
  background: var(--surface) center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  overflow: hidden;
}

.history-thumb-score {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.92);
  font-family: var(--font-sys);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-strong);
}

.history-thumb-name {
  display: block;
  margin-top: 6px;
  font-family: var(--font-sys);
  font-size: 11px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.history-preview-grid .result-card { min-height: 0; }
.history-preview-grid .card-photo { height: 110px; }
.history-preview-grid .card-name { font-size: 13px; }

.history-no-results {
  font-family: var(--font-sys);
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0;
}

.history-empty,
.history-status {
  margin-top: 28px;
  font-family: var(--font-sys);
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  line-height: 1.45;
}
