@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --border: #D9E1EC;
  --text-1: #0F172A;
  --text-2: #475569;
  --text-3: #7C8AA0;
  --accent: #E98A15;
  --accent-2: #C96F00;
  --green: #15803D;
  --red: #DC2626;
  --blue: #2563EB;
  --purple: #7C3AED;
  --teal: #0F766E;
  --orange: #C2410C;
  --pink: #DB2777;
  --gray: #64748B;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 12px 28px rgba(15, 23, 42, .10);
  --shadow-lg: 0 28px 70px rgba(15, 23, 42, .16);
  --sans: -apple-system, 'SF Pro Text', 'San Francisco', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', 'JetBrains Mono', monospace;
}

:root[data-theme="dark"] {
  --bg: #08111F;
  --surface: #111A2D;
  --surface-2: #0C1423;
  --border: #213046;
  --text-1: #F4F7FB;
  --text-2: #A4B0C2;
  --text-3: #708097;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, .28);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, .38);
}

* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background:
    radial-gradient(circle at top left, rgba(233, 138, 21, .10), transparent 28%),
    radial-gradient(circle at top right, rgba(37, 99, 235, .08), transparent 30%),
    var(--bg);
  color: var(--text-1);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body.category-menu-open { overflow: hidden; }

button, input, select, textarea { font-family: var(--sans); color: inherit; }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.app-shell { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.site-topbar,
.compact-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 14px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid rgba(217, 225, 236, .72);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px) saturate(1.05);
}

:root[data-theme="dark"] .site-topbar,
:root[data-theme="dark"] .compact-topbar {
  background: rgba(17, 26, 45, .88);
  border-bottom-color: rgba(33, 48, 70, .84);
}

.site-brand-block,
.site-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-brand-block {
  min-width: 0;
  flex: 1 1 auto;
}

.site-topbar-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.site-topbar-actions > * { flex-shrink: 0; }

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  min-width: 0;
  max-width: 100%;
}

.site-brand strong,
.site-brand span { display: block; }

.site-brand strong {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.site-brand span:last-child {
  font-size: 12px;
  color: var(--text-3);
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-brand-mark {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #F9B24B);
  color: #1F1300;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  box-shadow: var(--shadow-md);
}

.site-brand-logo {
  width: min(240px, 46vw);
  height: auto;
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}

.site-link {
  height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 800;
}

:root[data-theme="dark"] .site-link { background: rgba(255,255,255,.04); }
.site-link:hover { color: var(--text-1); border-color: rgba(233, 138, 21, .35); box-shadow: var(--shadow-sm); }

.btn {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease, color .15s ease, opacity .15s ease;
}

.btn:hover, .btn-ghost:hover, .site-link:hover, .drawer-close:hover { transform: translateY(-1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #F9B24B);
  color: #1D1200;
  box-shadow: 0 10px 22px rgba(233, 138, 21, .18);
}

.btn-primary:hover { opacity: .95; }

.btn-ghost {
  background: rgba(255,255,255,.72);
  border-color: var(--border);
  color: var(--text-2);
}

:root[data-theme="dark"] .btn-ghost { background: rgba(255,255,255,.04); }
.btn-ghost:hover { color: var(--text-1); border-color: rgba(233, 138, 21, .28); }

.btn-block,
.btn-fill { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm { min-height: 34px; padding: 0 12px; border-radius: 12px; font-size: 12px; }

.pill {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.pill-amber { background: rgba(233,138,21,.14); color: var(--accent-2); }
.pill-green { background: rgba(21,128,61,.12); color: var(--green); }
.pill-red { background: rgba(220,38,38,.12); color: var(--red); }
.pill-blue { background: rgba(37,99,235,.12); color: var(--blue); }
.pill-purple { background: rgba(124,58,237,.12); color: var(--purple); }
.pill-teal { background: rgba(15,118,110,.12); color: var(--teal); }
.pill-orange { background: rgba(194,65,12,.12); color: var(--orange); }
.pill-pink { background: rgba(219,39,119,.12); color: var(--pink); }
.pill-gray { background: rgba(100,116,139,.14); color: var(--gray); }

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.auth-form input,
.ingest-form input,
.ingest-form select,
.field input,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.95);
  color: var(--text-1);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

:root[data-theme="dark"] .auth-form input,
:root[data-theme="dark"] .ingest-form input,
:root[data-theme="dark"] .ingest-form select,
:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field select {
  background: rgba(255,255,255,.03);
  color: var(--text-1);
}

:root[data-theme="dark"] .ingest-form select,
:root[data-theme="dark"] .field select {
  color-scheme: dark;
}

:root[data-theme="dark"] .ingest-form select option,
:root[data-theme="dark"] .field select option {
  background: #1a1a1a;
  color: #e0e0e0;
}

.auth-form input:focus,
.ingest-form input:focus,
.ingest-form select:focus,
.field input:focus,
.field select:focus {
  outline: none;
  border-color: rgba(233, 138, 21, .55);
  box-shadow: 0 0 0 4px rgba(233, 138, 21, .12);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title,
.topbar-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-sub,
.topbar-sub,
.ingest-hint,
.auth-tag,
.hero-search input::placeholder {
  color: var(--text-3);
}

.panel,
.hint-card,
.content-shell,
.table-panel {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.94));
  box-shadow: var(--shadow-sm);
}

:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .hint-card,
:root[data-theme="dark"] .content-shell,
:root[data-theme="dark"] .table-panel {
  background: linear-gradient(180deg, rgba(17,26,45,.96), rgba(12,20,35,.95));
}

.banner,
.auth-error {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.banner-error,
.auth-error { background: rgba(220, 38, 38, .10); color: var(--red); }
.banner-success { background: rgba(21,128,61,.10); color: var(--green); }
.banner-info { background: rgba(37,99,235,.10); color: var(--blue); }
.banner-warning { background: rgba(245, 158, 11, .12); color: #B45309; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  .site-topbar,
  .compact-topbar {
    padding: 12px 18px;
  }

  .site-brand-block { gap: 10px; }

  .site-brand-logo { width: min(190px, 42vw); }

  .site-brand span:last-child { max-width: 34vw; }
}

@media (max-width: 760px) {
  .site-topbar,
  .compact-topbar {
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
  }

  .site-brand-block,
  .site-topbar-actions {
    justify-content: flex-start;
  }

  .site-brand { min-width: 0; }
  .site-brand strong {
    font-size: 13px;
    line-height: 1.1;
  }

  .site-brand span:last-child { display: none; }
  .site-brand-logo { width: min(160px, 54vw); }

  .site-topbar-actions > a.site-link {
    display: none;
  }

  .site-topbar-actions { gap: 6px; }
  .site-topbar-actions .btn-icon { width: 36px; height: 36px; }
  .site-topbar-actions .btn { min-height: 36px; }
}

/* Report Button */
#reportButton {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #e98a15 0%, #d97706 100%);
  color: white;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(233, 138, 21, 0.3);
  transition: all 0.3s ease;
  border: none;
}

#reportButton:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(233, 138, 21, 0.4);
}

#reportButton.has-items {
  background: linear-gradient(135deg, #e98a15 0%, #d97706 100%);
}

.report-icon {
  font-size: 16px;
}

.report-label {
  display: inline-block;
}

.report-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.25);
  color: white;
  border-radius: 12px;
  width: 24px;
  height: 24px;
  font-size: 12px;
  font-weight: 700;
}

.add-to-report-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(233, 138, 21, 0.1);
  color: #e98a15;
  border: 1px solid rgba(233, 138, 21, 0.3);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

:root[data-theme="dark"] .add-to-report-btn {
  background: rgba(233, 138, 21, 0.15);
  border-color: rgba(233, 138, 21, 0.4);
}

.add-to-report-btn:hover:not(:disabled) {
  background: rgba(233, 138, 21, 0.2);
  border-color: rgba(233, 138, 21, 0.5);
}

.add-to-report-btn:disabled,
.add-to-report-btn.in-report {
  opacity: 0.6;
  cursor: not-allowed;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
}

@media (max-width: 640px) {
  #reportButton {
    padding: 10px 12px;
    gap: 6px;
    font-size: 12px;
    bottom: 16px;
    right: 16px;
  }

  .report-label {
    display: none;
  }

  .report-badge {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }
}
