/* ==========================================================================
   Interface stylesheet
   ---------------------------------------------------------------------------
   1.  Design tokens (dark by default, light overrides in one block)
   2.  Reset and base
   3.  Layout: shell, sidebar, top bar, content
   4.  Components: buttons, panels, forms, badges, drawer, tabs, empty states
   5.  Page blocks: dashboard, hunts, hunt detail, login
   6.  Utilities
   7.  Responsive
   ========================================================================== */


/* ==========================================================================
   1. Design tokens
   ========================================================================== */

/* Dark is the product default. Light is a deliberate second theme, not an
   inversion: it re-tunes surfaces, borders and the ink versions of the accents
   while the accent itself, the spacing, radii and motion stay identical. */

:root {
  color-scheme: dark;

  /* Surfaces */
  --bg:             #0E141B;
  --surface:        #151D26;
  --surface-2:      #1C2733;
  --surface-hover:  #232F3D;
  --border:         #2A3846;
  --border-strong:  #394A59;

  /* Text */
  --text:           #F3F6F8;
  --text-2:         #93A4B3;
  --text-3:         #6E7E8D;

  /* Accents. The accent itself is identical in both themes. */
  --accent:         #35D0BA;
  --accent-hover:   #4ADCC8;
  --accent-ink:     #04211D;
  --interesting:    #F3A742;
  --success:        #45C486;
  --danger:         #EF6461;

  /* Ink versions: the accent colours where they have to read as text or as an
     icon. On dark they are the accents themselves; on light they darken. */
  --accent-text:      var(--accent);
  --success-text:     var(--success);
  --danger-text:      #F5A7A5;
  --interesting-text: var(--interesting);

  /* Derived tints, written out so no colour functions are needed at runtime */
  --accent-soft:      rgba(53, 208, 186, 0.12);
  --accent-line:      rgba(53, 208, 186, 0.34);
  --interesting-soft: rgba(243, 167, 66, 0.12);
  --interesting-line: rgba(243, 167, 66, 0.30);
  --success-soft:     rgba(69, 196, 134, 0.12);
  --success-line:     rgba(69, 196, 134, 0.30);
  --danger-soft:      rgba(239, 100, 97, 0.12);
  --danger-line:      rgba(239, 100, 97, 0.32);
  --neutral-soft:     rgba(147, 164, 179, 0.10);

  /* Navigation fills */
  --nav-hover:      var(--surface);
  --nav-active:     var(--surface-2);

  /* Floating layers. On dark, elevation gets lighter; on light, whiter. */
  --elevated:       var(--surface-2);

  /* How far the filtered-out cards in the sign-in visual recede */
  --scan-dim:       0.5;

  /* Overlays, translucency and decorative fills */
  --overlay:          rgba(4, 8, 12, 0.62);
  --scrim-soft:       rgba(14, 20, 27, 0.72);
  --bg-blur:          rgba(14, 20, 27, 0.80);
  --bg-blur-strong:   rgba(14, 20, 27, 0.88);
  --hatch:            rgba(255, 255, 255, 0.026);
  --dot:              rgba(255, 255, 255, 0.055);
  --sweep:            rgba(53, 208, 186, 0.11);
  --accent-ring:      rgba(53, 208, 186, 0.26);
  --line-muted:       rgba(147, 164, 179, 0.40);

  /* Reference-image placeholder tints */
  --tint-teal:        rgba(53, 208, 186, 0.07);
  --tint-teal-line:   rgba(53, 208, 186, 0.20);
  --tint-amber:       rgba(243, 167, 66, 0.07);
  --tint-amber-line:  rgba(243, 167, 66, 0.20);
  --tint-green:       rgba(69, 196, 134, 0.07);
  --tint-green-line:  rgba(69, 196, 134, 0.20);

  /* Radii */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* Spacing scale */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s7: 32px;
  --s8: 40px;
  --s9: 56px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 12px 28px -16px rgba(0, 0, 0, 0.80);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.90);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 120ms;
  --base: 200ms;

  /* Layout */
  --sidebar-w: 252px;
  --sidebar-rail: 72px;
  --topbar-h: 60px;
  --content-max: 1180px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
}

/* Light theme. Only the colour layer is redeclared; everything structural is
   inherited from :root above. */
[data-theme="light"] {
  color-scheme: light;

  --bg:             #F6F8FA;
  --surface:        #FFFFFF;
  --surface-2:      #EEF2F5;
  --surface-hover:  #E3EAEF;
  --border:         #DCE3E9;
  --border-strong:  #BFCBD4;

  --text:           #0D1620;
  --text-2:         #4C5C6B;
  --text-3:         #62727F;

  --accent-hover:   #27BEA9;

  --accent-text:      #0B7A6D;
  --success-text:     #16794C;
  --danger-text:      #C33A37;
  --interesting-text: #9A6206;

  --accent-soft:      rgba(11, 122, 109, 0.10);
  --accent-line:      rgba(11, 122, 109, 0.30);
  --interesting-soft: rgba(154, 98, 6, 0.10);
  --interesting-line: rgba(154, 98, 6, 0.28);
  --success-soft:     rgba(22, 121, 76, 0.10);
  --success-line:     rgba(22, 121, 76, 0.28);
  --danger-soft:      rgba(195, 58, 55, 0.08);
  --danger-line:      rgba(195, 58, 55, 0.28);
  --neutral-soft:     rgba(76, 92, 107, 0.10);

  --nav-hover:      #EAEFF3;
  --nav-active:     #FFFFFF;

  --elevated:       #FFFFFF;
  --scan-dim:       0.66;

  --overlay:          rgba(13, 22, 32, 0.42);
  --scrim-soft:       rgba(255, 255, 255, 0.82);
  --bg-blur:          rgba(246, 248, 250, 0.82);
  --bg-blur-strong:   rgba(246, 248, 250, 0.92);
  --hatch:            rgba(13, 22, 32, 0.035);
  --dot:              rgba(13, 22, 32, 0.075);
  --sweep:            rgba(11, 122, 109, 0.10);
  --accent-ring:      rgba(11, 122, 109, 0.22);
  --line-muted:       rgba(76, 92, 107, 0.26);

  --tint-teal:        rgba(53, 208, 186, 0.14);
  --tint-teal-line:   rgba(11, 122, 109, 0.22);
  --tint-amber:       rgba(243, 167, 66, 0.18);
  --tint-amber-line:  rgba(154, 98, 6, 0.22);
  --tint-green:       rgba(69, 196, 134, 0.16);
  --tint-green-line:  rgba(22, 121, 76, 0.22);

  --shadow-sm: 0 1px 2px rgba(13, 22, 32, 0.05);
  --shadow-md: 0 12px 28px -18px rgba(13, 22, 32, 0.28);
  --shadow-lg: 0 30px 70px -34px rgba(13, 22, 32, 0.30);
}


/* ==========================================================================
   2. Reset and base
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a {
  color: inherit;
  text-decoration: none;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { background: none; border: 0; padding: 0; }

svg { display: block; flex: none; }

:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

[x-cloak] { display: none !important; }

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

/* Scrollbars, tuned to the surface palette rather than the OS default. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--r-pill);
}


/* ==========================================================================
   3. Layout
   ========================================================================== */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns var(--base) var(--ease);
}

.frame {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--s6) var(--s7) var(--s9);
  flex: 1;
}

/* --- Sidebar ------------------------------------------------------------ */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  padding: var(--s5) var(--s3) var(--s4);
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  padding: 0 var(--s2);
  min-height: 34px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border-radius: var(--r-sm);
}

.brand__mark { color: var(--accent-text); }

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand__name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand__tag {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  flex: 1;
}

.nav__label {
  padding: 0 var(--s3);
  margin-bottom: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.nav__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--fast), color var(--fast);
}

.nav__item:hover {
  background: var(--nav-hover);
  color: var(--text);
}

.nav__item.is-active {
  background: var(--nav-active);
  color: var(--text);
  font-weight: 600;
}

.nav__item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}

.nav__icon { color: var(--text-3); transition: color var(--fast); }
.nav__item:hover .nav__icon { color: var(--text-2); }
.nav__item.is-active .nav__icon { color: var(--accent-text); }

.nav__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}



.sidebar__foot {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding-top: var(--s4);
  border-top: 1px solid var(--border);
}

.sidebar__version {
  padding: 0 var(--s3);
  font-size: 11px;
  color: var(--text-3);
}

.sidebar__close { display: none; }

/* --- Top bar ------------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  height: var(--topbar-h);
  padding: 0 var(--s7);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

@supports (backdrop-filter: blur(2px)) {
  .topbar {
    background: var(--bg-blur);
    backdrop-filter: blur(14px) saturate(1.3);
  }
}

.topbar__left,
.topbar__right {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-width: 0;
}

.topbar__title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__brand { display: none; color: var(--accent-text); }

/* --- State pill --------------------------------------------------------- */

.state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
}

.state__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  flex: none;
}

.state__label { font-weight: 600; color: var(--text); }
.state__detail { color: var(--text-3); }

.state--hunting .state__dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: pulse 2.6s ease-in-out infinite;
}

.state--paused .state__dot { background: var(--interesting); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* --- User menu ---------------------------------------------------------- */

.user-menu { position: relative; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 8px 0 5px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast);
}

.user-chip:hover {
  background: var(--surface);
  border-color: var(--border);
}

.user-chip__name {
  font-size: 13px;
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip__caret { color: var(--text-3); }

.avatar {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  min-width: 232px;
  padding: 6px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
}

.menu__head {
  padding: 8px 10px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.menu__name { font-size: 13px; font-weight: 600; }
.menu__meta {
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-xs);
  font-size: 13.5px;
  color: var(--text-2);
  transition: background var(--fast), color var(--fast);
}

.menu__item:hover { background: var(--surface-hover); color: var(--text); }
.menu__item--danger:hover { color: var(--danger-text); }

/* --- Mobile bar --------------------------------------------------------- */

.mobilebar { display: none; }
.scrim { display: none; }


/* ==========================================================================
   4. Components
   ========================================================================== */

/* --- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast),
              color var(--fast), transform var(--fast);
}

.btn__content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  line-height: 1;
}

.btn:active { transform: translateY(0.5px); }
.btn[disabled] { opacity: 0.55; pointer-events: none; }

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.btn--primary:hover { background: var(--accent-hover); }

.btn--ghost {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.btn--ghost:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn--quiet {
  height: 32px;
  padding: 0 10px;
  color: var(--text-2);
}

.btn--quiet:hover { background: var(--surface-2); color: var(--text); }

.btn--block { width: 100%; height: 42px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--fast), color var(--fast);
}

.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  margin-left: -4px;
  border-radius: var(--r-xs);
  font-size: 13px;
  color: var(--text-3);
  transition: color var(--fast);
}

.backlink:hover { color: var(--text-2); }

/* --- Panels and cards --------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.panel--card { padding: var(--s6); }
.panel--roomy { padding: var(--s8) var(--s6); }
.panel--list { padding: var(--s2); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.card-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-3);
}

.card-note {
  margin-top: var(--s4);
  padding-top: var(--s4);
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-3);
}

.prose {
  margin-top: var(--s3);
  font-size: 14px;
  line-height: 1.68;
  color: var(--text-2);
  white-space: pre-line;
}

.prose--muted { color: var(--text-3); }

/* --- Reference-image placeholder ---------------------------------------- */

.thumb {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

/* A faint hatch so the slot reads as "no image yet" rather than as a failure. */
.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    135deg,
    var(--hatch) 0 1px,
    transparent 1px 8px
  );
}

.thumb__monogram {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-3);
  z-index: 1;
}

.thumb__badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--scrim-soft);
  color: var(--text-3);
}

.thumb--sm  { width: 42px;  height: 42px;  border-radius: var(--r-sm); }
.thumb--md  { width: 56px;  height: 56px; }
.thumb--lg  { width: 76px;  height: 76px; }
.thumb--hero { width: 112px; height: 112px; border-radius: var(--r-lg); }
.thumb--wide { width: 100%; aspect-ratio: 16 / 10; border-radius: 0; border-width: 0 0 1px; }

.thumb--sm .thumb__monogram  { font-size: 13px; }
.thumb--md .thumb__monogram  { font-size: 17px; }
.thumb--lg .thumb__monogram  { font-size: 22px; }
.thumb--hero .thumb__monogram { font-size: 30px; }
.thumb--wide .thumb__monogram { font-size: 26px; }

.thumb--sm .thumb__badge { display: none; }

.thumb--teal   { background: var(--tint-teal); border-color: var(--tint-teal-line); }
.thumb--teal .thumb__monogram { color: var(--accent-text); }
.thumb--amber  { background: var(--tint-amber); border-color: var(--tint-amber-line); }
.thumb--amber .thumb__monogram { color: var(--interesting-text); }
.thumb--green  { background: var(--tint-green); border-color: var(--tint-green-line); }
.thumb--green .thumb__monogram { color: var(--success-text); }
.thumb--slate  { background: var(--surface-2); }
.thumb--slate .thumb__monogram { color: var(--text-2); }

/* --- Badges and chips --------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--active,
.badge--ok      { background: var(--success-soft); color: var(--success-text); }
.badge--paused,
.badge--neutral { background: var(--neutral-soft); color: var(--text-2); }
.badge--warn    { background: var(--interesting-soft); color: var(--interesting-text); }
.badge--bad     { background: var(--danger-soft); color: var(--danger-text); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--s3);
}

.chips--wrap { margin-top: var(--s4); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
}

.chip__meta {
  color: var(--text-3);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chip--accent {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-text);
}

.chip--danger {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger-text);
}

.chip--quiet { background: transparent; color: var(--text-3); }

.chip--empty {
  background: transparent;
  border-style: dashed;
  color: var(--text-3);
}

/* --- Forms -------------------------------------------------------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

.field__optional {
  font-weight: 500;
  color: var(--text-3);
}

.field__hint {
  font-size: 12px;
  color: var(--text-3);
}

.field__control { position: relative; }

.field__icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  transition: color var(--fast);
}

.field__control:focus-within .field__icon { color: var(--accent-text); }

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
}

.input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--fast), box-shadow var(--fast);
}

.input::placeholder { color: var(--text-3); }
.input:hover { border-color: var(--border-strong); }

.input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input[aria-invalid="true"] {
  border-color: var(--danger-line);
}

.input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.input--with-icon { padding-left: 40px; }

.input--area {
  height: auto;
  min-height: 104px;
  padding: 11px 13px;
  line-height: 1.6;
  resize: vertical;
}

.switch {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  cursor: pointer;
  transition: border-color var(--fast);
}

.switch:hover { border-color: var(--border-strong); }

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__track {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  margin-top: 1px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  transition: background var(--fast), border-color var(--fast);
}

.switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-3);
  transition: transform var(--base) var(--ease), background var(--fast);
}

.switch input:checked + .switch__track {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.switch input:checked + .switch__track .switch__thumb {
  transform: translateX(16px);
  background: var(--accent);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

.switch__text { display: flex; flex-direction: column; gap: 2px; }
.switch__title { font-size: 13.5px; font-weight: 600; }
.switch__meta { font-size: 12.5px; color: var(--text-3); }

/* --- Alerts ------------------------------------------------------------- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.5;
}

.alert__icon { margin-top: 1px; }

.alert--danger {
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  color: var(--danger-text);
}

/* --- Drawer ------------------------------------------------------------- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: flex-end;
}

.drawer__scrim {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.drawer__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  height: 100%;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.drawer__head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s5) var(--s6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.drawer__eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.drawer__title {
  margin-top: 4px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.drawer__body {
  gap: var(--s5);
  padding: var(--s6);
}

.drawer__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--s2);
  padding-top: var(--s1);
}

.drawer-anim { transition: transform 260ms var(--ease), opacity 200ms ease; }
.drawer-anim--out { transition-duration: 160ms; }
.drawer-from { transform: translateX(28px); opacity: 0; }
.drawer-to { transform: none; opacity: 1; }

/* --- Tabs --------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 2px;
  margin: var(--s7) 0 var(--s6);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 13px;
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--fast);
}

.tab:hover { color: var(--text-2); }
.tab.is-active { color: var(--text); font-weight: 600; }

.tab.is-active::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}

.tab__badge {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 5px;
  padding: 1px 5px;
}

/* --- Empty and coming-soon states --------------------------------------- */

.empty {
  max-width: 520px;
  margin: 0 auto;
  padding: var(--s5) 0;
  text-align: center;
}

.empty__icon,
.soon__icon {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-3);
}

.empty__title { font-size: 16px; font-weight: 600; }

.empty__body {
  max-width: 44ch;
  margin: 8px auto 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-2);
}

.empty__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s2);
  margin-top: var(--s5);
}

.empty--sm { padding: var(--s3) 0; }
.empty--sm .empty__icon { width: 44px; height: 44px; }

.soon { text-align: center; }
.soon__icon { width: 62px; height: 62px; }

.soon__tag {
  display: inline-block;
  margin-bottom: var(--s3);
  padding: 3px 9px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.soon__title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.soon__body {
  max-width: 52ch;
  margin: 10px auto 0;
  color: var(--text-2);
  line-height: 1.7;
}

.soon__actions {
  display: flex;
  justify-content: center;
  gap: var(--s2);
  margin-top: var(--s6);
}

/* --- Facts, meters, slots ----------------------------------------------- */

.facts {
  display: flex;
  flex-direction: column;
  margin-top: var(--s3);
}

.fact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.fact:last-child { border-bottom: 0; padding-bottom: 0; }

.fact__icon { color: var(--text-3); }
.fact__label { flex: 1; font-size: 13px; color: var(--text-3); }

.fact__value {
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fact__value.is-empty { color: var(--text-3); font-weight: 400; }

.meters {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  margin-top: var(--s4);
}

.meter__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
}

.meter__label { font-size: 13px; color: var(--text-2); }

.meter__value {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.meter__track {
  height: 6px;
  margin-top: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
}

.meter__fill {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--accent);
}

.meters .meter:nth-child(2) .meter__fill { background: var(--interesting); }

.slots { display: flex; gap: var(--s6); }

.slots--stacked {
  flex-direction: column;
  gap: 0;
  margin-top: var(--s3);
}

.slots--stacked .slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.slots--stacked .slot:last-child { border-bottom: 0; padding-bottom: 0; }

.slot dt {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
}

.slot dd {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.slots--stacked .slot dt { font-size: 13px; letter-spacing: 0; text-transform: none; font-weight: 400; }
.slots--stacked .slot dd { margin-top: 0; font-size: 13px; }

.slot.is-empty dd { color: var(--text-3); font-weight: 500; }


/* ==========================================================================
   5. Page blocks
   ========================================================================== */

/* --- Headings ----------------------------------------------------------- */

.greeting { padding: var(--s2) 0 var(--s6); }

.greeting__title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.greeting__sub {
  margin-top: 6px;
  font-size: 14.5px;
  color: var(--text-2);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s2) 0 var(--s6);
}

.page-head__title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.022em;
}

.page-head__meta {
  margin-top: 5px;
  font-size: 13.5px;
  color: var(--text-3);
}

.page-head__actions { display: flex; gap: var(--s2); flex: none; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s4);
}

.section-head__title { font-size: 15px; font-weight: 600; }

.block--lead .section-head { margin-bottom: var(--s5); }

.block--lead .section-head__title {
  font-size: 17px;
  letter-spacing: -0.015em;
}

.section-head__meta {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-3);
}

.block { margin-top: var(--s7); }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: var(--s6);
  margin-top: var(--s7);
}

.split--detail {
  grid-template-columns: minmax(0, 1fr) 320px;
  margin-top: 0;
}

.split > .block { margin-top: 0; }

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}

/* --- Stat bar ----------------------------------------------------------- */
/* Operational counts. One quiet strip rather than four competing cards. */

.statbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.statbar__cell {
  padding: 13px 18px 15px;
  background: var(--surface);
}

.statbar__label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.statbar__value {
  margin-top: 5px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.statbar__cell--accent .statbar__value { color: var(--accent-text); }
.statbar__cell--warn .statbar__value { color: var(--danger-text); }

.statbar__hint {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--text-3);
}

/* --- Hunt cards --------------------------------------------------------- */

.hunt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: var(--s5);
}

.hunt-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--fast), box-shadow var(--base), transform var(--base);
}

.hunt-card__main:focus-visible { outline-offset: -3px; }

.hunt-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.hunt-card:focus-within { border-color: var(--accent-line); }

.hunt-card.is-paused .thumb__monogram { color: var(--text-3); }

.hunt-card__main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "media body"
    "filters filters";
  column-gap: var(--s4);
  row-gap: 12px;
  padding: 18px;
  align-items: flex-start;
}

.hunt-card__main > .thumb { grid-area: media; }
.hunt-card__body { grid-area: body; min-width: 0; }

.hunt-card__filters {
  grid-area: filters;
  margin-top: 0;
  flex-wrap: nowrap;
  min-width: 0;
}

.hunt-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s3);
}

.hunt-card__title {
  flex: 1;
  min-width: 0;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hunt-card__target {
  margin-top: 3px;
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hunt-card__foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-top: auto;
  min-height: 56px;
  padding: 9px 16px;
  border-top: 1px solid var(--border);
}

.hunt-card__foot .slots {
  gap: 22px;
  min-width: 0;
}

.hunt-card__foot .toggle__form {
  margin: 0;
}

.hunt-card__foot .btn--quiet {
  min-height: 32px;
  padding-inline: 8px;
}

.toggle--detail {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s3);
}

/* --- Hunt rows (dashboard) ---------------------------------------------- */

.hunt-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 10px 12px;
  border-radius: var(--r-md);
  transition: background var(--fast);
}

.hunt-row:hover { background: var(--surface-2); }

.hunt-row__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hunt-row__title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hunt-row__meta {
  font-size: 12.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hunt-row__side {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex: none;
}

.hunt-row__count { font-size: 12.5px; color: var(--text-2); }
.hunt-row__count.is-empty { color: var(--text-3); }
.hunt-row__caret { color: var(--text-3); flex: none; }

/* --- Source rows -------------------------------------------------------- */

.source-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 10px 12px;
  border-radius: var(--r-md);
  transition: background var(--fast);
}

.source-row:hover { background: var(--surface-2); }

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

.source-row__head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
}

.source-row__name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chips--tight { margin-top: 6px; }

.source-row__slots { flex: none; }

.source-row__link {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: var(--r-xs);
  color: var(--text-3);
  transition: background var(--fast), color var(--fast);
}

.source-row__link:hover { background: var(--surface-hover); color: var(--accent-text); }


/* --- Hunt detail hero --------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "media body side"
    "media meta meta";
  align-items: start;
  column-gap: var(--s5);
  row-gap: 14px;
  margin-top: var(--s4);
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
}

.hero__media { grid-area: media; }
.hero__body { grid-area: body; min-width: 0; }

.hero__eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.hero__title {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.hero__target {
  margin-top: 6px;
  font-size: 14.5px;
  color: var(--text-2);
}

.hero__side {
  grid-area: side;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s4);
}

.hero__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.hero__actions form {
  display: inline-flex;
  margin: 0;
}

.hero__actions > .btn,
.hero__actions > form > .btn {
  width: auto;
  min-width: 0;
  height: 36px;
  padding-inline: 14px;
}

.tabpanel { display: block; }

/* --- Findings ----------------------------------------------------------- */

.finding-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(262px, 1fr));
  gap: var(--s5);
}

.finding {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color var(--fast), box-shadow var(--base);
}

.finding:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }

.finding__media {
  width: 100%;
  height: 190px;
  overflow: hidden;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.finding__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.finding__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 42px;
  font-weight: 700;
  color: var(--text-3);
}


.finding__body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }

.finding__hunt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.finding__title {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.finding__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-3);
}

.finding__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-top: var(--s4);
  padding-top: var(--s3);
  border-top: 1px solid var(--border);
}

.score {
  font-size: 12px;
  font-weight: 600;
  color: var(--success-text);
  font-variant-numeric: tabular-nums;
}

.finding__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-2);
  transition: color var(--fast);
}

.finding__link:hover { color: var(--accent-text); }

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-3);
  flex: none;
}

/* --- Checklist ---------------------------------------------------------- */

.checklist { padding: var(--s2); }

.checklist__item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 12px;
  border-radius: var(--r-md);
  transition: background var(--fast);
}

.checklist__item:hover { background: var(--surface-2); }

.checklist__tick {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: transparent;
}

.checklist__item.is-done .checklist__tick {
  background: var(--success-soft);
  border-color: var(--success-line);
  color: var(--success-text);
}

.checklist__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.checklist__title { font-size: 13.5px; font-weight: 600; }
.checklist__item.is-done .checklist__title { color: var(--text-2); }
.checklist__meta { font-size: 12px; color: var(--text-3); }

.checklist__action {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  color: var(--text-3);
  flex: none;
  transition: background var(--fast), color var(--fast);
}

.checklist__action:hover { background: var(--surface-hover); color: var(--text); }

/* --- Theme toggle ------------------------------------------------------- */

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--text-3);
  cursor: pointer;
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}

.theme-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
}

.theme-toggle__icon { display: none; }
.theme-toggle__icon--sun { display: block; }

[data-theme="light"] .theme-toggle__icon--sun { display: none; }
[data-theme="light"] .theme-toggle__icon--moon { display: block; }

/* On the sign-in screen the switch sits out of the way of the form. */
.theme-toggle--floating {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 5;
  background: var(--bg-blur);
  border-color: var(--border);
}

.theme-toggle--floating:hover {
  background: var(--surface);
  border-color: var(--border-strong);
}


/* --- Setup disclosure --------------------------------------------------- */

.setup {
  margin-top: var(--s6);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.setup__summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  list-style: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-3);
  border-radius: var(--r-md);
  transition: color var(--fast);
}

.setup__summary::-webkit-details-marker { display: none; }
.setup__summary:hover { color: var(--text-2); }

.setup__label { font-weight: 600; }
.setup__meta { flex: 1; }
.setup__caret { transition: transform var(--base) var(--ease); }
.setup[open] .setup__caret { transform: rotate(180deg); }
.setup[open] .setup__summary { border-radius: var(--r-md) var(--r-md) 0 0; }

.setup__body {
  padding: var(--s2);
  border-top: 1px solid var(--border);
}

.setup__body .checklist { padding: 0; }


/* --- Login / landing ----------------------------------------------------- */

.auth {
  position: relative;
  display: grid;
  grid-template-columns: 43fr 57fr;
  min-height: 100vh;
}

/* Product side ------------------------------------------------------------ */

.auth__intro {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--s8);
  padding: 48px clamp(40px, 5vw, 88px) clamp(52px, 10vh, 128px);
  overflow: hidden;
  isolation: isolate;
}

.auth__brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.auth__mark { color: var(--accent-text); }
.auth__name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.auth__tag { font-size: 12px; color: var(--text-3); }

.auth__pitch { max-width: 540px; }

.auth__headline {
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.035em;
  max-width: 18ch;
}

.auth__copy {
  max-width: 48ch;
  margin-top: var(--s5);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-2);
}

.auth__caps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4) var(--s6);
  margin-top: var(--s7);
}

.auth__caps li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.auth__cap-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--accent-text);
}

/* Decorative scan field --------------------------------------------------- */

.auth__field {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.scan__grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(115% 85% at 72% 24%, #000 0%, transparent 70%);
  mask-image: radial-gradient(115% 85% at 72% 24%, #000 0%, transparent 70%);
}

.scan__rings,
.scan__sweep,
.scan__stack {
  position: absolute;
  top: 26%;
  left: 72%;
}

.scan__rings {
  width: 340px;
  height: 340px;
  margin: -170px 0 0 -170px;
  border: 1px solid var(--border);
  border-radius: 50%;
}

.scan__rings::before,
.scan__rings::after {
  content: "";
  position: absolute;
  border: 1px solid var(--border);
  border-radius: 50%;
}

.scan__rings::before { inset: -85px; opacity: 0.65; }
.scan__rings::after { inset: -170px; opacity: 0.4; }

/* A single slow sweep. Low enough in opacity to read as depth, not as neon. */
.scan__sweep {
  width: 560px;
  height: 560px;
  margin: -280px 0 0 -280px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    var(--sweep),
    transparent 26%,
    transparent 100%
  );
  -webkit-mask-image: radial-gradient(circle, #000 38%, transparent 70%);
  mask-image: radial-gradient(circle, #000 38%, transparent 70%);
  animation: sweep 20s linear infinite;
}

@keyframes sweep {
  to { transform: rotate(360deg); }
}

.scan__stack {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  width: 252px;
  transform: translate(-50%, -50%);
}

.scan__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  opacity: var(--scan-dim);
}

.scan__item:nth-child(1) { margin-left: -30px; }
.scan__item:nth-child(3) { margin-left: 36px; }

.scan__tile {
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
}

.scan__lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.scan__lines i {
  display: block;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--border);
}

.scan__lines i:first-child { width: 78%; }
.scan__lines i:last-child { width: 50%; opacity: 0.6; }

.scan__item.is-match {
  opacity: 1;
  border-color: var(--accent-line);
}

.scan__item.is-match .scan__tile {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.scan__item.is-match .scan__lines i { background: var(--line-muted); }

.scan__item.is-match::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow: 0 0 0 0 var(--accent-ring);
  animation: resolve 4s ease-out infinite;
  pointer-events: none;
}

@keyframes resolve {
  0%       { box-shadow: 0 0 0 0 var(--accent-ring); }
  55%, 100% { box-shadow: 0 0 0 10px transparent; }
}

.scan__mark {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
}

/* Authentication side ----------------------------------------------------- */

.auth__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.auth__form { width: 100%; max-width: 352px; }

.auth__panel-brand {
  display: none;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s6);
}

.auth__title { font-size: 22px; font-weight: 600; letter-spacing: -0.022em; }

.auth__sub {
  margin: 6px 0 var(--s6);
  font-size: 13.5px;
  color: var(--text-2);
}

.auth .alert { margin-bottom: var(--s5); }
.auth .form { gap: var(--s5); }
.auth .btn--block { margin-top: var(--s1); }

.auth__foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: var(--s6);
  padding-top: var(--s5);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
}


/* ==========================================================================
   6. Utilities
   ========================================================================== */

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

.skip-link {
  position: absolute;
  left: var(--s4);
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--r-sm);
  font-weight: 600;
  transition: top var(--fast);
}

.skip-link:focus { top: var(--s4); }


/* ==========================================================================
   7. Responsive
   ========================================================================== */

/* Collapsed sidebar rail. Desktop only: below the breakpoint the sidebar is a
   drawer and the collapsed state must not apply. */
@media (min-width: 861px) {
  .is-sidebar-collapsed .shell { grid-template-columns: var(--sidebar-rail) minmax(0, 1fr); }
  .is-sidebar-collapsed .sidebar { padding-left: var(--s3); padding-right: var(--s3); }
  .is-sidebar-collapsed .brand { justify-content: center; width: 100%; }
  .is-sidebar-collapsed .brand__text,
  .is-sidebar-collapsed .nav__label,
  .is-sidebar-collapsed .nav__text,
  .is-sidebar-collapsed .sidebar__version { display: none; }

  .is-sidebar-collapsed .nav__item { justify-content: center; padding: 0; }

  /* Tooltip for the icon-only rail. */
  .is-sidebar-collapsed .nav__item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    z-index: 70;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    background: var(--elevated);
    box-shadow: var(--shadow-md);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--fast), transform var(--fast);
  }

  .is-sidebar-collapsed .nav__item:hover::after,
  .is-sidebar-collapsed .nav__item:focus-visible::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

@media (max-width: 1060px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split--detail { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 90;
    width: 288px;
    height: 100%;
    background: var(--surface);
    transform: translateX(-100%);
    transition: transform 240ms var(--ease);
  }

  .is-nav-open .sidebar {
    transform: none;
    box-shadow: var(--shadow-lg);
  }

  .is-nav-open { overflow: hidden; }

  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 85;
    background: var(--overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--base);
  }

  .is-nav-open .scrim { opacity: 1; pointer-events: auto; }

  .sidebar__close { display: inline-grid; }
  .topbar__collapse { display: none; }
  .topbar__brand { display: inline-flex; }

  .topbar { padding: 0 var(--s4); gap: var(--s2); }
  .state__detail { display: none; }
  .user-chip__name { display: none; }
  .user-chip { padding: 0 4px; }

  .content { padding: var(--s5) var(--s4) 96px; }

  .mobilebar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    border-top: 1px solid var(--border);
    background: var(--bg);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  @supports (backdrop-filter: blur(2px)) {
    .mobilebar {
      background: var(--bg-blur-strong);
      backdrop-filter: blur(14px) saturate(1.3);
    }
  }

  .mobilebar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 9px 4px 10px;
    color: var(--text-3);
    font-size: 10.5px;
    font-weight: 500;
    cursor: pointer;
    transition: color var(--fast);
  }

  .mobilebar__item.is-active { color: var(--accent-text); }
  .mobilebar__item:active { color: var(--text-2); }

  .page-head,
  .section-head {
    flex-direction: column;
    align-items: stretch;
    gap: var(--s4);
  }

  .page-head__actions .btn,
  .section-head__actions .btn { width: 100%; }

  .greeting__title,
  .page-head__title { font-size: 22px; }

  .hero {
    flex-direction: column;
    gap: var(--s4);
    padding: var(--s5);
  }

  .hero__side { width: 100%; }
  .toggle--detail { flex-direction: row; align-items: center; justify-content: space-between; }
  .hero__title { font-size: 22px; }

  .hunt-grid,
  .finding-grid { grid-template-columns: minmax(0, 1fr); }

  .source-row {
    flex-wrap: wrap;
    align-items: flex-start;
    row-gap: var(--s3);
  }

  .source-row__slots {
    flex: 1 0 100%;
    padding-left: 54px;
  }

  .statbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .panel--roomy { padding: var(--s6) var(--s5); }

  /* The composer becomes a bottom sheet. */
  .drawer { align-items: flex-end; }

  .drawer__panel {
    width: 100%;
    height: auto;
    max-height: 88vh;
    border-left: 0;
    border-top: 1px solid var(--border);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .drawer-from { transform: translateY(28px); }

  .field-row { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 420px) {
  .statbar { grid-template-columns: minmax(0, 1fr); }
  .slots { gap: var(--s5); }
}

/* Login / landing collapses to a single column. */
@media (max-width: 1024px) {
  .auth { grid-template-columns: minmax(0, 1fr); }

  .auth__panel-brand { display: flex; }

  .auth__intro {
    gap: var(--s6);
    padding: 40px 32px 48px;
  }

  .auth__brand { display: none; }

  .auth__headline { font-size: 30px; max-width: 22ch; }
  .auth__copy { margin-top: var(--s4); font-size: 14px; }
  .auth__caps { margin-top: var(--s6); }

  .scan__rings,
  .scan__stack { display: none; }

  .scan__sweep {
    top: 8%;
    left: 88%;
    width: 420px;
    height: 420px;
    margin: -210px 0 0 -210px;
  }

  .scan__grid {
    -webkit-mask-image: radial-gradient(110% 72% at 84% 10%, #000 0%, transparent 68%);
    mask-image: radial-gradient(110% 72% at 84% 10%, #000 0%, transparent 68%);
  }

  .auth__panel {
    align-items: flex-start;
    padding: 56px 32px 44px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 560px) {
  .auth__intro { padding: 32px 20px 36px; }
  .auth__panel { padding: 32px 20px 48px; }
  .auth__headline { font-size: 27px; }
  .auth__caps { gap: var(--s3) var(--s5); }
  .auth__caps li { gap: 8px; font-size: 12.5px; }
  .auth__cap-icon { width: 27px; height: 27px; border-radius: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Real Hunt reference images use the existing thumbnail slots. */
.thumb__image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: var(--surface-1);
}

/* Hunt detail action row and destructive confirmation. */
.hero__meta-row {
  grid-area: meta;
  min-width: 0;
}

.hero__facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  color: var(--text-2);
  font-size: 12.5px;
}

.hero__fact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.hero__fact + .hero__fact::before {
  content: "";
  width: 1px;
  height: 14px;
  margin: 0 11px;
  background: var(--border-strong);
}

.hero__fact svg { color: var(--text-3); }

.hero__fact--accent,
.hero__fact--accent svg { color: var(--accent-text); }

.hero__fact--quiet { color: var(--text-3); }

.hero__countdown [data-countdown-value] {
  display: inline-block;
  min-width: 5ch;
  font-variant-numeric: tabular-nums;
}

.btn--delete {
  color: var(--text-2);
}

.btn--delete:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text-1);
}

.edit-reference {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: 0 0 var(--s3);
  padding: var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.edit-reference .thumb--hero {
  width: 72px;
  height: 72px;
  flex: none;
}

.edit-reference strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--text-1);
}

.edit-reference .field__hint { margin: 0; }

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: var(--s5);
}

.confirm-modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
}

.confirm-modal__panel {
  position: relative;
  width: min(520px, 100%);
  padding: var(--s6);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.confirm-modal__title {
  margin-bottom: var(--s3);
  font-size: 20px;
  font-weight: 600;
}

.confirm-modal__panel form { margin-top: var(--s4); }

.confirm-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s3);
  margin-top: var(--s4);
}

@media (max-width: 1120px) {
  .hero {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "media body"
      "media meta"
      "side side";
  }

  .hero__side {
    width: 100%;
    align-items: flex-start;
  }

  .hero__actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 88px minmax(0, 1fr);
    grid-template-areas:
      "media body"
      "meta meta"
      "side side";
    padding: 18px;
  }

  .hero .thumb--hero {
    width: 88px;
    height: 88px;
  }

  .hero__facts { row-gap: 8px; }
  .hero__fact + .hero__fact::before { margin-inline: 8px; }

  .hero__actions { width: 100%; }

  .hunt-card__foot {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .hunt-card__foot .slots { gap: 16px; }

  .confirm-modal__actions {
    flex-direction: column-reverse;
  }

  .confirm-modal__actions .btn { width: 100%; }
}


/* Final Hunt header layout: status left, actions right, metadata independent. */
.hero__status {
  min-height: 24px;
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.hero__side { align-self: flex-start; }
.hero__side .hero__actions { margin-top: 0; }

/* Keep the final destructive action visibly destructive, even before confirmation. */
.btn--danger:disabled {
  background: rgba(222, 73, 73, 0.07);
  border-color: rgba(222, 73, 73, 0.24);
  color: rgba(255, 143, 143, 0.55);
  opacity: 1;
}


/* Worldwide Hunt search markets ------------------------------------------------ */
.search-suggestion {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: start;
}
.search-suggestion__query { min-width: 0; }
.search-suggestion__meaning {
  margin-top: 4px;
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}
.market-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.market-panel__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 18px;
  cursor: pointer;
  list-style: none;
}
.market-panel__summary::-webkit-details-marker { display: none; }
.market-panel__summary:hover { background: var(--surface-2); }
.market-panel__summary > span:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.market-panel__meta {
  color: var(--text-muted);
  font-size: 12px;
  text-align: right;
}
.market-panel__body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--border);
}

.search-language-note {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 14px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}
.search-language-note strong { color: var(--text); }

.localized-terms { display: grid; gap: 8px; padding-top: 14px; }
.localized-term {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.localized-term__display { font-weight: 650; }
.localized-term__native {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.localized-term__native span { margin-left: 6px; opacity: .78; }
.market-toggle-row,
.source-market-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.market-toggle-row { padding: 14px 0; }
.source-market-list { border-top: 1px solid var(--border); }
.source-market-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.source-market-row:last-child { border-bottom: 0; }
.source-market-row__meta { margin-top: 3px; color: var(--text-muted); font-size: 12px; }

@media (max-width: 720px) {
  .search-suggestion { grid-template-columns: 56px minmax(0, 1fr) 58px; }
  .market-panel__summary { align-items: flex-start; }
  .market-panel__meta { max-width: 45%; }
}

/* Hunt activity ---------------------------------------------------------- */
.activity-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.activity-list {
  display: grid;
  gap: 12px;
}

.activity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 18px 22px;
}

.activity-row__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.activity-row__meta {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.activity-row__error {
  margin: 8px 0 0;
  color: var(--danger-text);
  font-size: 0.86rem;
}

.activity-row__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, auto));
  gap: 22px;
  margin: 0;
}

.activity-row__stats div { text-align: right; }
.activity-row__stats dt {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.activity-row__stats dd { margin: 4px 0 0; font-weight: 700; }

@media (max-width: 760px) {
  .activity-toolbar { flex-direction: column; }
  .activity-row { grid-template-columns: 1fr; }
  .activity-row__stats { justify-content: start; }
  .activity-row__stats div { text-align: left; }
}

.chip__remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0 0 0 2px;
  opacity: .65;
}

.chip__remove:hover { opacity: 1; }

/* Per-Hunt operation feedback ------------------------------------------- */
.hunt-operation {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
}

.hunt-operation > span:last-child {
  display: grid;
  gap: 2px;
}

.hunt-operation small {
  color: var(--text-muted);
  font-size: 11px;
}

.hunt-operation__pulse {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent);
  animation: hunt-operation-pulse 1.6s infinite;
}

@keyframes hunt-operation-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 42%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.action-lock {
  position: relative;
  display: inline-flex;
}

.action-lock.is-locked::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 120;
  width: max-content;
  max-width: min(340px, 80vw);
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--elevated);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  opacity: 0;
  transform: translateY(3px);
  pointer-events: none;
  transition: opacity var(--fast), transform var(--fast);
}

.action-lock.is-locked:hover::after,
.action-lock.is-locked:focus-within::after {
  opacity: 1;
  transform: translateY(0);
}

/* AI Assistant */
.frame:has(.content--assistant) {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.content--assistant {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 20px 24px 24px;
  overflow: hidden;
  background: var(--bg);
}

.assistant-layout {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  width: min(100%, 1500px);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .025) inset,
    0 18px 50px rgba(0, 0, 0, .20);
}

.assistant-chats {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--surface-raised);
}

.assistant-chats__head {
  flex: 0 0 auto;
  padding: 18px 14px 12px;
}

.assistant-chats__head h2 {
  margin: 0 0 3px;
  font-size: 14px;
}

.assistant-chats__head p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 11px;
}

.assistant-chats__head .btn {
  width: 100%;
}

.assistant-chats__list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 8px 14px;
}

.assistant-conversation {
  display: block;
  width: 100%;
  margin: 2px 0;
  padding: 10px 11px;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.assistant-conversation:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.assistant-conversation.is-active {
  background: var(--surface-active);
  color: var(--text);
  font-weight: 650;
  box-shadow:
    inset 3px 0 0 currentColor,
    inset 0 0 0 1px var(--border);
}

.assistant-chat {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.assistant-chat__messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 34px clamp(28px, 5vw, 72px) 38px;
}

.assistant-welcome {
  width: 100%;
  max-width: 780px;
  margin: clamp(34px, 8vh, 82px) auto 0;
}

.assistant-welcome__mark {
  display: flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: var(--surface-raised);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.assistant-welcome h2 {
  margin: 0 0 14px;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -.035em;
}

.assistant-welcome p {
  max-width: 660px;
  margin: 7px 0;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.65;
}

.assistant-welcome strong {
  display: block;
  margin-top: 18px;
  color: var(--accent);
}

.assistant-message {
  display: flex;
  width: 100%;
  max-width: 820px;
  margin: 0 auto 26px;
}

.assistant-message--user {
  justify-content: flex-end;
}

.assistant-message__body {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.68;
}

.assistant-message--user .assistant-message__body {
  max-width: min(78%, 650px);
  padding: 11px 15px;
  border: 1px solid var(--border);
  border-radius: 16px 16px 5px 16px;
  background: var(--surface-raised);
  white-space: pre-wrap;
}

.assistant-message--assistant .assistant-message__body {
  width: 100%;
  white-space: pre-wrap;
}

.assistant-thinking,
.assistant-loading,
.assistant-empty {
  color: var(--text-muted);
}

.assistant-action {
  max-width: 820px;
  margin: 0 auto 26px;
  padding: 16px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: var(--accent-soft);
}

.assistant-action__label {
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.assistant-action pre {
  max-height: 220px;
  overflow: auto;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  white-space: pre-wrap;
}

.assistant-action__buttons {
  display: flex;
  gap: 8px;
}

.assistant-composer {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  padding: 10px clamp(28px, 5vw, 72px) 14px;
  background:
    linear-gradient(
      to bottom,
      rgba(0,0,0,0),
      var(--surface) 22px
    );
}

.assistant-composer form {
  display: flex;
  max-width: 820px;
  margin: 0 auto;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface-raised);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}

.assistant-composer textarea {
  flex: 1;
  min-height: 42px;
  max-height: 160px;
  resize: none;
  padding: 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1.45;
}

.assistant-send {
  align-self: flex-end;
  min-width: 68px;
  height: 42px;
  border: 0;
  border-radius: 11px;
  background: var(--accent);
  color: #07110f;
  font-weight: 800;
  cursor: pointer;
}

.assistant-send:disabled {
  opacity: .5;
  cursor: wait;
}

.assistant-composer__hint {
  max-width: 820px;
  margin: 7px auto 0;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

.assistant-error {
  max-width: 820px;
  margin: 12px auto;
  color: var(--danger);
}

@media (max-width: 800px) {
  .content--assistant {
    padding: 0;
  }

  .assistant-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .assistant-chats {
    max-height: 140px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .assistant-chats__head {
    padding: 11px 14px 8px;
  }

  .assistant-chats__head p {
    display: none;
  }

  .assistant-chats__list {
    padding-bottom: 7px;
  }

  .assistant-chat__messages {
    padding: 24px 16px 30px;
  }

  .assistant-welcome {
    margin-top: 22px;
  }

  .assistant-composer {
    padding: 8px 14px 10px;
  }
}

.assistant-conversation {
  position: relative;
  padding-right: 34px;
}

.assistant-conversation strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-conversation__rename {
  position: absolute;
  top: 50%;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  border-radius: 5px;
  opacity: 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition:
    opacity 120ms ease,
    background 120ms ease;
}

.assistant-conversation:hover .assistant-conversation__rename,
.assistant-conversation.is-active .assistant-conversation__rename {
  opacity: .7;
}

.assistant-conversation__rename:hover {
  opacity: 1;
  background: var(--surface-hover);
}

.assistant-conversation__rename-input {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
}

.assistant-conversation__rename-input:focus {
  border-color: currentColor;
}


/* Contextual Search Logic Assistant */
.search-logic-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-logic-assistant-modal[hidden] { display: none; }
.search-logic-assistant-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
}
.search-logic-assistant-modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(7, 15, 28, 0.68);
  backdrop-filter: blur(3px);
}
.search-logic-assistant-modal__panel {
  position: relative;
  width: min(900px, 100%);
  height: min(78vh, 760px);
  min-height: 520px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, rgba(15, 23, 42, 0.12));
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(7, 15, 28, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.search-logic-assistant-modal__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line, rgba(15, 23, 42, 0.12));
}
.search-logic-assistant-modal__head h3 { margin: 3px 0 2px; }
.search-logic-assistant-modal__head p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.search-logic-assistant-modal__messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.search-logic-assistant-modal__composer {
  position: static;
  border-top: 1px solid var(--line, rgba(15, 23, 42, 0.12));
  box-shadow: none;
}
.assistant-welcome--compact { margin: auto; max-width: 620px; }
.assistant-action__terms {
  margin: 10px 0 0;
  padding-left: 20px;
}
.assistant-action__terms li { margin: 5px 0; }
body.assistant-modal-open { overflow: hidden; }

@media (max-width: 720px) {
  .search-logic-assistant-modal { padding: 0; place-items: stretch; }
  .search-logic-assistant-modal__panel {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    border-radius: 0;
  }
  .search-logic-assistant-modal__head,
  .search-logic-assistant-modal__messages { padding-left: 16px; padding-right: 16px; }
}
