:root {
  --bg-page: #0d1318;
  --bg-deep: #0f141a;
  --bg-panel: #13191f;
  --bg-panel-alt: #171f27;
  --bg-panel-soft: rgba(255, 255, 255, 0.04);
  --bg-hero-overlay: rgba(7, 13, 18, 0.36);
  --bg-elevated: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.14);
  --line-soft: rgba(255, 255, 255, 0.08);
  --line-subtle: rgba(255, 255, 255, 0.05);
  --text-primary: #f6f2ea;
  --text-secondary: rgba(246, 242, 234, 0.8);
  --text-muted: rgba(246, 242, 234, 0.56);
  --text-dim: rgba(246, 242, 234, 0.42);
  --ink-dark: #0d241f;
  --ink-mid: #183b33;
  --accent-forest: #1c4f45;
  --accent-forest-strong: #113a33;
  --accent-mint: #d8ece3;
  --accent-mint-strong: #b9ded0;
  --accent-gold: #c9955c;
  --accent-gold-soft: rgba(201, 149, 92, 0.18);
  --danger: #ff8e8a;
  --danger-soft: rgba(255, 142, 138, 0.12);
  --success: #61d8b5;
  --shadow-heavy: 0 28px 80px rgba(0, 0, 0, 0.34);
  --shadow-medium: 0 18px 44px rgba(0, 0, 0, 0.24);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.16);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --font-ui: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-chat: 'Syne', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

body[data-theme='light'] {
  --bg-page: #f7f3ec;
  --bg-deep: #f3eee6;
  --bg-panel: #fbf8f2;
  --bg-panel-alt: #f4efe6;
  --bg-panel-soft: rgba(17, 36, 32, 0.04);
  --bg-hero-overlay: rgba(247, 243, 236, 0.12);
  --bg-elevated: rgba(17, 36, 32, 0.06);
  --line-strong: rgba(17, 36, 32, 0.16);
  --line-soft: rgba(17, 36, 32, 0.1);
  --line-subtle: rgba(17, 36, 32, 0.06);
  --text-primary: #102820;
  --text-secondary: rgba(16, 40, 32, 0.82);
  --text-muted: rgba(16, 40, 32, 0.62);
  --text-dim: rgba(16, 40, 32, 0.46);
  --ink-dark: #0f2c25;
  --ink-mid: #25493f;
  --accent-forest: #17493e;
  --accent-forest-strong: #0d3129;
  --accent-mint: #dceee5;
  --accent-mint-strong: #cce2d7;
  --accent-gold: #9f7650;
  --accent-gold-soft: rgba(159, 118, 80, 0.14);
  --danger: #cf4a40;
  --danger-soft: rgba(207, 74, 64, 0.1);
  --success: #1e8b71;
  --shadow-heavy: 0 24px 64px rgba(68, 50, 28, 0.08);
  --shadow-medium: 0 18px 38px rgba(68, 50, 28, 0.08);
  --shadow-soft: 0 8px 22px rgba(68, 50, 28, 0.06);
}

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

html,
body {
  min-height: 100%;
}

body {
  min-height: 100dvh;
  font-family: var(--font-ui);
  color: var(--text-primary);
  background:
    radial-gradient(circle at 12% 14%, rgba(48, 131, 123, 0.24), transparent 26%),
    radial-gradient(circle at 88% 8%, rgba(201, 149, 92, 0.18), transparent 18%),
    linear-gradient(180deg, #121a21 0%, #0c1218 100%);
  overflow: hidden;
}

body[data-theme='light'] {
  background:
    radial-gradient(circle at 10% 18%, rgba(23, 73, 62, 0.08), transparent 24%),
    radial-gradient(circle at 84% 12%, rgba(159, 118, 80, 0.08), transparent 16%),
    linear-gradient(180deg, #f8f4ed 0%, #f3eee6 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.22;
  mask-image: radial-gradient(circle at center, black 35%, transparent 82%);
}

body[data-theme='light']::before {
  background:
    linear-gradient(rgba(17, 36, 32, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 36, 32, 0.03) 1px, transparent 1px);
  opacity: 0.55;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
a {
  color: inherit;
  text-decoration: none;
  appearance: none;
  -webkit-appearance: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(97, 216, 181, 0.18);
}

.hidden,
[hidden] {
  display: none !important;
}

.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;
}

.auth-shell {
  position: relative;
  min-height: 100dvh;
  padding: 22px 14px;
  display: grid;
  place-items: center;
  overflow: auto;
}

.auth-layout-theme-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
  backdrop-filter: blur(14px);
}

.auth-layout {
  position: relative;
  width: min(1720px, 100%);
  min-height: calc(100dvh - 44px);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: rgba(8, 12, 16, 0.45);
  box-shadow: var(--shadow-heavy);
}

.auth-layout--profile {
  grid-template-columns: minmax(0, 1fr) minmax(420px, 560px);
  background: rgba(248, 245, 239, 0.92);
  border-color: rgba(14, 27, 23, 0.12);
}

.auth-hero,
.auth-panel {
  position: relative;
  min-height: 100%;
}

.auth-hero {
  overflow: hidden;
}

.auth-hero--photo {
  background:
    linear-gradient(180deg, rgba(8, 14, 19, 0.08), rgba(7, 11, 16, 0.34)),
    url('assets/dorchester-avenue.jpg') center center / cover no-repeat;
}

.auth-hero--photo::before,
.auth-hero--photo::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.auth-hero--photo::before {
  background:
    linear-gradient(180deg, rgba(5, 10, 14, 0.04) 0%, rgba(5, 10, 14, 0.12) 48%, rgba(5, 10, 14, 0.5) 100%);
}

.auth-hero--photo::after {
  background:
    linear-gradient(90deg, rgba(7, 10, 15, 0.46) 0%, rgba(7, 10, 15, 0.08) 24%, rgba(7, 10, 15, 0.1) 72%, rgba(7, 10, 15, 0.42) 100%),
    radial-gradient(circle at 73% 61%, rgba(255, 204, 154, 0.82), transparent 2.5%),
    radial-gradient(circle at 73% 61%, rgba(255, 162, 84, 0.44), transparent 8%);
  opacity: 0.92;
}

.auth-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 8, 12, 0.04), rgba(4, 8, 12, 0.16));
}

.auth-hero--minimal {
  background:
    radial-gradient(circle at 20% 24%, rgba(17, 58, 51, 0.08), transparent 18%),
    linear-gradient(180deg, #f7f3ec 0%, #f2ede5 100%);
  color: #112420;
}

.auth-hero-inner {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 28px 38px 34px;
}

.auth-hero-inner--minimal {
  justify-content: space-between;
  padding: 32px 38px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-lockup--stacked {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.brand-lockup--light {
  color: #f7f3ec;
}

.brand-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-icon svg {
  width: 100%;
  height: 100%;
}

.brand-wordmark {
  font-family: var(--font-display);
  font-size: clamp(28px, 2.6vw, 44px);
  font-weight: 600;
  letter-spacing: -0.025em;
}

.brand-wordmark--dark {
  color: #0f2f28;
}

.brand-tagline {
  color: rgba(15, 47, 40, 0.58);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.auth-hero-copy {
  max-width: 620px;
  display: grid;
  gap: 18px;
  margin-top: clamp(240px, 35vh, 380px);
  color: #f6f2ea;
}

.auth-hero-copy--minimal {
  max-width: 540px;
  margin-top: 0;
  color: inherit;
}

.story-badge,
.section-kicker,
.account-label,
.thread-heading-label,
.meta-label,
.filter-group label,
.event-date,
.provider-pill,
.status-indicator,
.thread-item-meta,
.story-badge--minimal {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.story-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(216, 236, 227, 0.24);
  background: rgba(216, 236, 227, 0.08);
  color: rgba(246, 242, 234, 0.86);
}

.story-badge--minimal {
  color: rgba(15, 47, 40, 0.72);
  background: transparent;
  border: none;
  padding: 0;
}

.auth-hero-title,
.auth-title,
.thread-heading h2,
.section-heading h2,
.logo-display,
.modal-card h3 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

.auth-hero-title {
  font-size: clamp(70px, 8vw, 94px);
  line-height: 0.9;
  max-width: 8ch;
  color: #f6f2ea;
  text-shadow: 0 18px 36px rgba(4, 8, 12, 0.34);
}

.auth-hero-title--minimal {
  max-width: 10ch;
  font-size: clamp(56px, 6vw, 82px);
  line-height: 0.92;
  color: #112420;
  text-shadow: none;
}

.auth-hero-text {
  max-width: 34ch;
  color: rgba(246, 242, 234, 0.88);
  font-size: 18px;
  line-height: 1.7;
  text-shadow: 0 10px 24px rgba(4, 8, 12, 0.26);
}

.auth-hero-text--minimal {
  color: rgba(15, 47, 40, 0.74);
  text-shadow: none;
}

.auth-hero-footnote {
  display: grid;
  gap: 6px;
  margin-top: auto;
  color: rgba(246, 242, 234, 0.72);
  font-size: 14px;
}

.auth-hero-credit {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(246, 242, 234, 0.58);
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-panel--dark {
  background: linear-gradient(180deg, rgba(12, 17, 23, 0.96), rgba(11, 14, 19, 0.98));
}

.auth-panel--light {
  background: rgba(250, 247, 242, 0.94);
  color: #112420;
  border-left: 1px solid rgba(15, 47, 40, 0.1);
}

.auth-panel-inner {
  position: relative;
  width: min(560px, 100%);
  padding: 40px 48px;
}

.auth-panel-inner--light {
  width: min(520px, 100%);
}

.auth-title {
  font-size: clamp(46px, 4vw, 62px);
  line-height: 0.94;
  margin-bottom: 10px;
}

.auth-title--dark {
  color: #0f2f28;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 17px;
  margin-bottom: 28px;
}

.auth-subtitle--dark {
  color: rgba(15, 47, 40, 0.7);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 28px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.auth-panel--light .auth-tabs {
  padding: 0;
  background: transparent;
  border-bottom: 1px solid rgba(15, 47, 40, 0.14);
  border-radius: 0;
  gap: 0;
}

.auth-tab {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.auth-panel--light .auth-tab {
  border-radius: 0;
  min-height: 52px;
  color: rgba(15, 47, 40, 0.58);
}

.auth-tab.active {
  background: rgba(28, 79, 69, 0.92);
  color: #f6f2ea;
}

.auth-panel--light .auth-tab.active {
  background: transparent;
  color: #112420;
  border-bottom: 2px solid #112420;
}

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-form label,
.modal-field {
  display: grid;
  gap: 10px;
}

.auth-form label span,
.modal-copy,
.modal-field span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.auth-form--light label span,
.auth-panel--light .modal-field span {
  color: rgba(15, 47, 40, 0.62);
}

.auth-form input,
.sidebar-filters select,
#flag-detail,
#chat-input,
.modal-field input {
  width: 100%;
  border: 1px solid transparent;
  border-bottom-color: rgba(255, 255, 255, 0.2);
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  padding: 0 0 14px;
  transition: border-color 160ms ease, color 160ms ease;
}

.auth-form--light input,
.auth-panel--light .modal-field input {
  color: #112420;
  border-bottom-color: rgba(15, 47, 40, 0.18);
}

.auth-form input::placeholder,
#chat-input::placeholder,
#flag-detail::placeholder,
.modal-field input::placeholder {
  color: var(--text-dim);
}

.auth-form input:focus,
.sidebar-filters select:focus,
#flag-detail:focus,
#chat-input:focus,
.modal-field input:focus {
  border-bottom-color: var(--accent-mint-strong);
  box-shadow: none;
}

.auth-submit {
  margin-top: 10px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 26px 0;
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

.google-mark {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.google-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: transparent;
}

.auth-note {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
}

.auth-error,
.error-banner,
.error-state,
.modal-error {
  border: 1px solid rgba(255, 142, 138, 0.3);
  background: rgba(255, 142, 138, 0.09);
  color: #ffd6d3;
}

.auth-error,
.modal-error,
.error-banner,
.error-state {
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 14px;
}

.auth-error {
  margin-top: 16px;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-icon,
.btn-send,
.suggestion-chip,
.flag-button {
  border: 1px solid transparent;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.btn-primary,
.btn-secondary,
.btn-icon,
.btn-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 12px;
  font-weight: 700;
}

.btn-primary {
  min-height: 58px;
  padding: 0 22px;
  background: var(--accent-mint);
  color: #0d201b;
  box-shadow: 0 12px 28px rgba(185, 222, 208, 0.16);
}

.btn-primary--dark {
  background: rgba(28, 79, 69, 0.95);
  color: #f7f3ec;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-icon:hover,
.btn-send:hover,
.suggestion-chip:hover,
.flag-button:hover,
.auth-tab:hover {
  transform: translateY(-1px);
}

.btn-secondary {
  min-height: 58px;
  padding: 0 18px;
  background: transparent;
  color: var(--text-primary);
  border-color: var(--line-strong);
}

.auth-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(420px, 100%);
  min-height: 58px;
  margin: 0 auto;
  padding: 0 28px;
  border-radius: 999px;
}

.btn-secondary--light {
  color: #112420;
  border-color: rgba(15, 47, 40, 0.18);
}

.btn-secondary--ghost {
  min-height: 42px;
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.btn-secondary.small,
.btn-primary.small {
  min-height: 40px;
  padding: 0 16px;
  font-size: 13px;
}

.btn-secondary.danger {
  color: var(--danger);
  border-color: rgba(255, 142, 138, 0.24);
}

.btn-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.auth-panel .btn-theme-toggle {
  position: fixed;
}

.btn-panel-toggle .panel-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.btn-panel-toggle .panel-toggle-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform 240ms ease;
}

body[data-events-collapsed='true'] .btn-panel-toggle {
  background: rgba(97, 216, 181, 0.08);
  border-color: rgba(97, 216, 181, 0.18);
  color: #dff5ed;
}

body[data-events-collapsed='true'] .btn-panel-toggle .panel-toggle-icon svg {
  transform: scaleX(-1);
}

.theme-toggle-icon {
  font-size: 20px;
  line-height: 1;
}

.btn-send {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  background: linear-gradient(135deg, #2ea484 0%, #dceee5 100%);
  color: #14342d;
  box-shadow: 0 10px 22px rgba(46, 164, 132, 0.14);
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-send:disabled,
.auth-tab:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#rename-thread-button,
#delete-thread-button,
.thread-action[data-action='rename'] {
  display: none !important;
}

.app-container {
  height: 100dvh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 10px var(--events-panel-width, 340px);
  gap: 0;
  overflow: hidden;
  transition: grid-template-columns 260ms ease;
}

.sidebar,
.chat-container,
.events-resizer,
.events-panel {
  min-height: 0;
  height: 100%;
}

body[data-events-collapsed='true'] .app-container {
  grid-template-columns: 300px minmax(0, 1fr) 0 0;
}

body[data-events-resizing='true'] .app-container {
  transition: none;
}

.events-resizer {
  position: relative;
  cursor: col-resize;
  border-left: 1px solid rgba(255, 255, 255, 0.03);
  border-right: 1px solid rgba(255, 255, 255, 0.03);
  background: rgba(255, 255, 255, 0.01);
  transition: background 160ms ease, border-color 160ms ease;
}

.events-resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 48px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.events-resizer:hover,
body[data-events-resizing='true'] .events-resizer {
  background: rgba(97, 216, 181, 0.08);
  border-left-color: rgba(97, 216, 181, 0.24);
  border-right-color: rgba(97, 216, 181, 0.24);
}

body[data-events-collapsed='true'] .events-resizer {
  opacity: 0;
  pointer-events: none;
}

.sidebar {
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(18, 23, 28, 0.98), rgba(13, 16, 20, 0.98));
}

.sidebar-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 18px;
  gap: 18px;
}

.sidebar-top {
  display: grid;
  gap: 18px;
}

.sidebar-brand {
  padding: 0 10px;
}

.sidebar-brand .brand-wordmark {
  color: var(--text-primary);
  font-size: clamp(26px, 2.3vw, 38px);
}

.sidebar-brand .brand-tagline {
  color: var(--text-muted);
}

.new-thread-button {
  width: 100%;
}

.workspace-nav {
  display: grid;
  gap: 10px;
}

.workspace-nav-item {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px 0 28px;
  border-left: 5px solid transparent;
  border-radius: 0;
  color: rgba(246, 242, 234, 0.68);
  background: transparent;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.workspace-nav-item:hover {
  background: rgba(255, 255, 255, 0.025);
  color: rgba(246, 242, 234, 0.84);
}

.workspace-nav-item--active {
  border-left-color: #f4f0e8;
  background: rgba(255, 255, 255, 0.045);
  color: #f7f3ec;
  box-shadow: none;
}

.workspace-nav-item:focus-visible {
  box-shadow: 0 0 0 3px rgba(97, 216, 181, 0.12);
}

.workspace-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: currentColor;
  opacity: 1;
}

.workspace-nav-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.sidebar-section {
  min-height: 0;
}

.sidebar-section--threads {
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0 0;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading--sidebar {
  padding: 0 10px;
}

.section-heading h2 {
  font-size: 24px;
  line-height: 0.95;
}

.section-kicker,
.account-label,
.thread-heading-label,
.filter-group label,
.meta-label {
  color: var(--text-dim);
  margin-bottom: 8px;
}

.thread-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 10px 10px;
}

.thread-empty {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  line-height: 1.7;
}

.thread-empty strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.thread-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
}

.thread-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.thread-item.active {
  border-color: rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.thread-item-body {
  min-width: 0;
}

.thread-item-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0;
  display: -webkit-box;
  line-clamp: 1;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thread-item-preview {
  display: none;
}

.thread-item-meta {
  display: none;
}

.thread-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  opacity: 0;
  visibility: hidden;
  transform: translateX(4px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.thread-item:hover .thread-actions,
.thread-item:focus-within .thread-actions {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

.thread-action {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.thread-action:hover,
.thread-action:focus-visible {
  background: rgba(255, 103, 103, 0.12);
  border-color: rgba(255, 103, 103, 0.34);
  color: #ffb8b8;
  transform: translateY(-1px);
}

.thread-action svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-account-footer {
  padding: 18px 10px 0;
  border-top: 1px solid var(--line-subtle);
  display: grid;
  gap: 14px;
}

.account-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.account-avatar {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 22px;
}

.account-name {
  font-size: 20px;
  font-weight: 700;
}

.account-email {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.account-providers,
.account-actions,
.header-right,
.message-meta,
.modal-actions,
.suggestions,
.message-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.provider-pill,
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}

.meta-pill a {
  color: inherit;
}

.chat-container {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(circle at 16% 22%, rgba(48, 131, 123, 0.12), transparent 18%),
    linear-gradient(180deg, rgba(15, 20, 25, 0.98), rgba(11, 15, 19, 0.98));
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.thread-heading {
  display: none;
}

.thread-heading h2 {
  font-size: clamp(54px, 5vw, 88px);
  line-height: 0.9;
  max-width: 11ch;
}

.header-right {
  align-items: center;
  justify-content: flex-end;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent-gold);
  box-shadow: 0 0 14px rgba(201, 149, 92, 0.7);
}

.status-indicator.connected .status-dot {
  background: var(--success);
  box-shadow: 0 0 14px rgba(97, 216, 181, 0.72);
}

.status-indicator.error .status-dot {
  background: var(--danger);
  box-shadow: 0 0 14px rgba(255, 142, 138, 0.72);
}

.chat-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
  padding: 14px 24px 0;
}

.chat-stage::before {
  content: '';
  position: absolute;
  inset: 12px 18px 16px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.02);
  pointer-events: none;
}

.chat-messages {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 18px 16px 104px;
  scroll-padding-bottom: 104px;
  overscroll-behavior: contain;
}

.conversation-empty {
  width: min(740px, 100%);
  align-self: center;
  margin: auto 0;
  display: grid;
  gap: 28px;
  justify-items: center;
  text-align: center;
  padding: 24px 0;
}

.conversation-empty-title {
  font-family: var(--font-display);
  font-size: clamp(42px, 4.6vw, 66px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.conversation-empty-grid {
  width: min(640px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.empty-state-card {
  display: grid;
  gap: 14px;
  min-height: 164px;
  padding: 22px 26px;
  text-align: left;
  border-radius: 0;
  border: 1px solid rgba(201, 149, 92, 0.36);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
  box-shadow: none;
}

.empty-state-card:hover {
  border-color: rgba(201, 149, 92, 0.6);
  background: rgba(255, 255, 255, 0.04);
}

.empty-state-card--wide {
  grid-column: 1 / -1;
  min-height: 140px;
}

.empty-state-card-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-secondary);
}

.empty-state-card-copy {
  font-size: 18px;
  line-height: 1.55;
  color: var(--text-primary);
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: min(930px, 100%);
  animation: rise-in 180ms ease;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 16px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(28, 79, 69, 0.2);
  font-size: 22px;
}

.message-avatar--assistant {
  background: #47665f;
  color: #f4f7f2;
  border-color: rgba(244, 247, 242, 0.12);
}

.message-avatar--assistant svg {
  width: 24px;
  height: 24px;
  display: block;
}

.message.user .message-avatar {
  background: rgba(255, 255, 255, 0.06);
}

.message-content {
  min-width: 0;
  max-width: min(760px, calc(100% - 60px));
  padding: 22px 24px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(27, 35, 44, 0.94), rgba(20, 27, 35, 0.92));
  box-shadow: var(--shadow-soft);
}

.message.user .message-content {
  background: linear-gradient(180deg, rgba(21, 70, 62, 0.9), rgba(16, 53, 47, 0.92));
  border-color: rgba(97, 216, 181, 0.22);
}

.message-text,
.message-text p,
#chat-input,
#chat-input::placeholder,
.typing-indicator {
  font-family: var(--font-chat);
}

.message-text {
  font-size: 18px;
  line-height: 1.8;
  color: #f7f3ec;
}

.message-text p + p {
  margin-top: 12px;
}

.message-meta {
  margin-top: 18px;
  align-items: center;
}

.message-tools {
  margin-top: 16px;
}

.meta-label {
  margin-bottom: 0;
}

.flag-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(201, 149, 92, 0.08);
  border-color: rgba(201, 149, 92, 0.22);
  color: #f0c9a7;
  font-weight: 700;
}

.flag-button span[aria-hidden='true'] {
  line-height: 1;
}

#flag-modal .btn-primary,
#flag-modal .btn-primary.small,
#flag-submit {
  background: var(--accent-forest);
  border-color: var(--accent-forest-strong);
  color: #f7f3ec;
  box-shadow: 0 14px 34px rgba(23, 73, 62, 0.18);
}

#flag-modal .btn-primary:hover,
#flag-modal .btn-primary.small:hover,
#flag-submit:hover,
#flag-modal .btn-primary:focus-visible,
#flag-modal .btn-primary.small:focus-visible,
#flag-submit:focus-visible {
  background: var(--accent-forest-strong);
  border-color: var(--accent-forest-strong);
}

.typing-indicator {
  display: inline-flex;
  gap: 8px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(246, 242, 234, 0.5);
  animation: typing-bounce 0.9s infinite ease-in-out;
}

body[data-theme='light'] .typing-indicator span {
  background: rgba(16, 40, 32, 0.55);
}

.message-content.message-content--loading {
  padding: 8px 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.loading-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.loading-status__icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: rgba(246, 242, 234, 0.7);
  animation: loading-spin 1.2s linear infinite;
}

.loading-status__icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.loading-status__ellipsis {
  display: inline-block;
  min-width: 0.8em;
}

.loading-status__label {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-dim);
  transition: opacity 220ms ease, transform 220ms ease;
}

.loading-status__label.is-transitioning {
  opacity: 0;
  transform: translateY(3px);
}

body[data-theme='light'] .loading-status__icon {
  color: rgba(16, 40, 32, 0.55);
}

@keyframes loading-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.12s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.24s;
}

.chat-input-container {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  border-top: 1px solid var(--line-soft);
  padding: 20px 28px 24px;
  background: linear-gradient(180deg, rgba(14, 19, 24, 0.98), rgba(12, 16, 20, 1));
}

.chat-form {
  display: grid;
  gap: 16px;
  width: min(980px, 100%);
  margin: 0 auto;
}

.input-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px 14px 24px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(19, 26, 33, 0.96);
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.2),
    inset 0 -2px 0 rgba(255, 255, 255, 0.03);
}

#chat-input {
  border: none;
  padding: 0;
  background: transparent;
  color: #f7f3ec;
  font-size: 18px;
}

#chat-input::placeholder {
  color: rgba(246, 242, 234, 0.42);
}

#chat-input:focus {
  box-shadow: none;
}

.suggestions {
  padding-left: 8px;
}

.suggestion-chip {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.events-panel {
  border-left: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(18, 23, 28, 0.98), rgba(13, 16, 20, 0.98));
  overflow: hidden;
  min-width: 0;
  transition: opacity 240ms ease, transform 260ms ease, border-color 260ms ease;
}

.events-panel-inner {
  height: 100%;
  padding: 30px 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.12);
  transition: opacity 220ms ease;
}

body[data-events-collapsed='true'] .events-panel {
  opacity: 0;
  transform: translateX(18px);
  border-left-color: transparent;
  pointer-events: none;
}

body[data-events-collapsed='true'] .events-panel-inner {
  opacity: 0;
}

.section-heading--events {
  align-items: center;
  justify-content: flex-start;
}

.sidebar-filters {
  display: grid;
  grid-template-columns: auto auto;
  gap: 10px;
}

.filter-group {
  display: grid;
  gap: 0;
}

.sidebar-filters select {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(151, 198, 187, 0.35);
  background: rgba(29, 37, 35, 0.42);
  color: var(--text-primary);
  font-size: 13px;
}

.events-panel .filter-group label {
  display: none;
}

.events-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.event-card {
  padding: 22px 24px 20px;
  border-radius: 8px;
  border: 1px solid rgba(240, 240, 240, 0.48);
  background: rgba(21, 26, 25, 0.32);
  box-shadow: none;
  cursor: pointer;
}

.event-card.event-card--collapsible:not(.is-expanded) {
  max-height: 390px;
  overflow: hidden;
}

.event-card:hover {
  border-color: rgba(201, 149, 92, 0.42);
  transform: translateY(-1px);
}

.event-date {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 4px;
  margin-bottom: 18px;
  color: #d5e7df;
  background: rgba(115, 143, 134, 0.48);
  border: none;
}

.event-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.05;
  margin-bottom: 14px;
}

.event-time,
.event-description,
.empty-state,
.loading-state,
.error-state,
.status-text {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.65;
}

.event-time {
  margin-bottom: 6px;
}

.event-description {
  color: rgba(246, 242, 234, 0.86);
}

.event-description-text {
  color: inherit;
  line-height: 1.65;
  white-space: pre-line;
}

.event-description-text.is-clamped {
  display: -webkit-box;
  line-clamp: var(--event-description-clamp-lines, 8);
  -webkit-line-clamp: var(--event-description-clamp-lines, 8);
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-description-toggle {
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-mint-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.event-description-toggle:hover,
.event-description-toggle:focus-visible {
  color: #f5d3b2;
}

.loading-state,
.empty-state,
.error-state {
  text-align: center;
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 12px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--success);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 8, 12, 0.64);
  backdrop-filter: blur(14px);
}

.modal-card {
  width: min(520px, 100%);
  padding: 28px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(18, 23, 28, 0.98), rgba(13, 16, 20, 0.98));
  box-shadow: var(--shadow-heavy);
}

.modal-card h3 {
  font-size: 38px;
  line-height: 0.95;
  margin-bottom: 10px;
}

.modal-copy {
  display: block;
  margin-bottom: 18px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
}

.flag-options {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.flag-options label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

#flag-detail {
  min-height: 120px;
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  resize: vertical;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 240px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(18, 23, 28, 0.96);
  box-shadow: var(--shadow-medium);
}

.toast.success {
  border-color: rgba(97, 216, 181, 0.28);
}

.toast.warning {
  border-color: rgba(201, 149, 92, 0.28);
}

body[data-theme='light'] .sidebar {
  background: linear-gradient(180deg, rgba(251, 248, 242, 0.98), rgba(245, 239, 230, 0.98));
}

body[data-theme='light'] #auth-view .auth-layout {
  background: rgba(249, 245, 238, 0.94);
  border-color: rgba(17, 36, 32, 0.12);
}

body[data-theme='light'] #auth-view .auth-panel--dark {
  background: rgba(250, 247, 242, 0.96);
  color: #112420;
  border-left: 1px solid rgba(15, 47, 40, 0.1);
}

body[data-theme='light'] #auth-view .auth-title {
  color: #112420;
}

body[data-theme='light'] #auth-view .auth-subtitle {
  color: rgba(15, 47, 40, 0.72);
}

body[data-theme='light'] #auth-view .auth-tabs {
  padding: 0;
  background: transparent;
  border-bottom: 1px solid rgba(15, 47, 40, 0.14);
  border-radius: 0;
  gap: 0;
}

body[data-theme='light'] #auth-view .auth-tab {
  min-height: 52px;
  border-radius: 0;
  color: rgba(15, 47, 40, 0.58);
}

body[data-theme='light'] #auth-view .auth-tab.active {
  background: transparent;
  color: #112420;
  border-bottom: 2px solid #112420;
}

body[data-theme='light'] #auth-view .auth-form label span,
body[data-theme='light'] #auth-view .modal-field span {
  color: rgba(15, 47, 40, 0.62);
}

body[data-theme='light'] #auth-view .auth-form input,
body[data-theme='light'] #auth-view .modal-field input {
  color: #112420;
  border-bottom-color: rgba(15, 47, 40, 0.18);
}

body[data-theme='light'] #auth-view .auth-divider {
  color: rgba(15, 47, 40, 0.5);
}

body[data-theme='light'] #auth-view .auth-divider::before,
body[data-theme='light'] #auth-view .auth-divider::after {
  background: rgba(15, 47, 40, 0.12);
}

body[data-theme='light'] #auth-view .auth-google {
  color: #112420;
  border-color: rgba(15, 47, 40, 0.14);
  background: rgba(255, 255, 255, 0.9);
}

body[data-theme='light'] #auth-view .auth-note {
  color: rgba(15, 47, 40, 0.68);
}

body[data-theme='light'] #auth-view .auth-error {
  color: #7a1b14;
  background: rgba(207, 74, 64, 0.08);
  border-color: rgba(207, 74, 64, 0.18);
}

body[data-theme='light'] #auth-view .auth-hero-overlay {
  background: linear-gradient(180deg, rgba(4, 8, 12, 0.04), rgba(4, 8, 12, 0.16));
}

body[data-theme='light'] .chat-container {
  background: linear-gradient(180deg, rgba(251, 249, 244, 0.98), rgba(247, 243, 236, 0.98));
}

body[data-theme='light'] .events-panel {
  background: linear-gradient(180deg, rgba(251, 248, 242, 0.98), rgba(244, 238, 228, 0.98));
}

body[data-theme='light'] .events-resizer {
  border-left-color: rgba(17, 36, 32, 0.06);
  border-right-color: rgba(17, 36, 32, 0.06);
  background: rgba(17, 36, 32, 0.02);
}

body[data-theme='light'] .events-resizer::after {
  background: rgba(17, 36, 32, 0.18);
}

body[data-theme='light'] .events-resizer:hover,
body[data-theme='light'][data-events-resizing='true'] .events-resizer {
  background: rgba(23, 73, 62, 0.08);
  border-left-color: rgba(23, 73, 62, 0.2);
  border-right-color: rgba(23, 73, 62, 0.2);
}

body[data-theme='light'] .event-description-toggle {
  color: #1f5d4f;
}

body[data-theme='light'] .event-description-toggle:hover,
body[data-theme='light'] .event-description-toggle:focus-visible {
  color: #17493e;
}

body[data-theme='light'] .chat-header,
body[data-theme='light'] .chat-input-container,
body[data-theme='light'] .sidebar,
body[data-theme='light'] .events-panel {
  border-color: var(--line-soft);
}

body[data-theme='light'] .chat-input-container {
  background: linear-gradient(180deg, rgba(248, 244, 237, 0.98), rgba(244, 239, 231, 1));
}

body[data-theme='light'] .chat-stage::before {
  inset: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

body[data-theme='light'] .btn-icon,
body[data-theme='light'] .status-indicator,
body[data-theme='light'] .btn-secondary--ghost,
body[data-theme='light'] .provider-pill,
body[data-theme='light'] .meta-pill {
  background: rgba(17, 36, 32, 0.04);
  border-color: rgba(17, 36, 32, 0.1);
  color: var(--text-secondary);
}

body[data-theme='light'] .workspace-nav-item {
  color: rgba(16, 40, 32, 0.48);
}

body[data-theme='light'] .workspace-nav-item:hover {
  background: rgba(17, 36, 32, 0.035);
  color: rgba(16, 40, 32, 0.78);
}

body[data-theme='light'] .workspace-nav-item--active {
  border-left-color: var(--accent-forest);
  background: rgba(16, 40, 32, 0.045);
  color: var(--accent-forest);
  box-shadow: none;
}

body[data-theme='light'] .thread-item:hover {
  background: rgba(17, 36, 32, 0.04);
}

body[data-theme='light'] .thread-item.active {
  background: rgba(17, 36, 32, 0.08);
  border-color: rgba(17, 36, 32, 0.08);
}

body[data-theme='light'] .thread-action {
  background: rgba(17, 36, 32, 0.04);
  border-color: rgba(17, 36, 32, 0.1);
  color: rgba(17, 36, 32, 0.48);
}

body[data-theme='light'] .thread-action:hover,
body[data-theme='light'] .thread-action:focus-visible {
  background: rgba(150, 34, 34, 0.08);
  border-color: rgba(150, 34, 34, 0.24);
  color: #962222;
}

body[data-theme='light'] .account-avatar,
body[data-theme='light'] .message-avatar {
  background: rgba(17, 36, 32, 0.06);
  border-color: rgba(17, 36, 32, 0.1);
}

body[data-theme='light'] .message-avatar--assistant {
  background: #5f7a73;
  color: #fff;
  border-color: rgba(17, 36, 32, 0.14);
}

body[data-theme='light'] .message.user .message-avatar {
  background: rgba(23, 73, 62, 0.1);
}

body[data-theme='light'] .message-content {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(17, 36, 32, 0.1);
  box-shadow: 0 10px 28px rgba(84, 67, 48, 0.05);
}

body[data-theme='light'] .message.user .message-content {
  background: rgba(223, 234, 228, 0.96);
  border-color: rgba(23, 73, 62, 0.18);
}

body[data-theme='light'] .flag-button {
  background: rgba(166, 40, 40, 0.08);
  border-color: rgba(166, 40, 40, 0.26);
  color: #a62828;
}

body[data-theme='light'] .flag-button:hover,
body[data-theme='light'] .flag-button:focus-visible {
  background: rgba(166, 40, 40, 0.12);
  border-color: rgba(166, 40, 40, 0.34);
  color: #8f1f1f;
}

body[data-theme='light'] .message-text {
  color: #132b24;
}

body[data-theme='light'] .input-wrapper {
  background: rgba(255, 255, 255, 0.96);
}

body[data-theme='light'] .chat-form {
  width: min(980px, 100%);
  margin: 0 auto;
}

body[data-theme='light'] #chat-input {
  color: #102820;
}

body[data-theme='light'] #chat-input::placeholder {
  color: rgba(16, 40, 32, 0.42);
}

body[data-theme='light'] .suggestion-chip {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(17, 36, 32, 0.1);
  color: var(--text-secondary);
}

body[data-theme='light'] .btn-send {
  background: linear-gradient(135deg, #2ea484 0%, #dceee5 100%);
  color: #14342d;
  box-shadow: 0 10px 22px rgba(46, 164, 132, 0.14);
}

body[data-theme='light'] .events-panel-inner {
  background: transparent;
}

body[data-theme='light'] .sidebar-filters select {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(17, 36, 32, 0.16);
  color: var(--text-primary);
}

body[data-theme='light'] .event-card {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(17, 36, 32, 0.12);
}

body[data-theme='light'] .event-card:hover {
  border-color: rgba(159, 118, 80, 0.34);
}

body[data-theme='light'] .event-date {
  color: #18352d;
  background: rgba(214, 230, 221, 0.9);
}

body[data-theme='light'] .event-description {
  color: rgba(16, 40, 32, 0.8);
}

body[data-theme='light'] .empty-state-card {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(159, 118, 80, 0.52);
}

body[data-theme='light'] .empty-state-card:hover {
  background: rgba(255, 255, 255, 0.92);
}

body[data-theme='light'] .thread-empty,
body[data-theme='light'] .toast {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(17, 36, 32, 0.1);
}

body[data-theme='light'] .modal-backdrop {
  background: rgba(245, 239, 230, 0.56);
}

body[data-theme='light'] .modal-card {
  background: linear-gradient(180deg, rgba(251, 249, 244, 0.98), rgba(246, 241, 233, 0.98));
  border-color: rgba(17, 36, 32, 0.12);
  box-shadow: 0 28px 56px rgba(73, 56, 38, 0.12);
}

body[data-theme='light'] .modal-card h3 {
  color: #112420;
}

body[data-theme='light'] .modal-copy {
  color: rgba(17, 36, 32, 0.72);
}

body[data-theme='light'] .flag-options label {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(17, 36, 32, 0.12);
  color: #132b24;
}

body[data-theme='light'] .flag-options input[type='radio'] {
  accent-color: #17493e;
}

body[data-theme='light'] #flag-detail {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(17, 36, 32, 0.12);
  color: #132b24;
}

body[data-theme='light'] #flag-detail::placeholder {
  color: rgba(17, 36, 32, 0.42);
}

body[data-theme='light'] .modal-error {
  background: rgba(166, 40, 40, 0.08);
  border-color: rgba(166, 40, 40, 0.24);
  color: #a62828;
}

body[data-theme='light'] .spinner {
  border-color: rgba(17, 36, 32, 0.14);
  border-top-color: var(--success);
}

body[data-theme='light'] ::-webkit-scrollbar-thumb {
  background: rgba(17, 36, 32, 0.16);
  border-color: transparent;
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 3px solid transparent;
  background-clip: padding-box;
}

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

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

@keyframes typing-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@media (max-width: 1280px) {
  .app-container {
    grid-template-columns: 280px minmax(0, 1fr) 10px min(var(--events-panel-width, 340px), 380px);
  }

  body[data-events-collapsed='true'] .app-container {
    grid-template-columns: 280px minmax(0, 1fr) 0 0;
  }

  .thread-heading h2 {
    font-size: clamp(44px, 4vw, 72px);
  }
}

@media (max-width: 1120px) {
  body {
    overflow: auto;
  }

  .auth-shell {
    padding: 18px;
  }

  .auth-layout,
  .auth-layout--profile {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .auth-hero {
    min-height: 360px;
  }

  .app-container {
    height: auto;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .sidebar,
  .chat-container,
  .events-resizer,
  .events-panel {
    height: auto;
  }

  .events-resizer {
    display: none;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line-soft);
  }

  .events-panel {
    border-left: none;
    border-top: 1px solid var(--line-soft);
  }

  body[data-events-collapsed='true'] .events-panel {
    max-height: 0;
    opacity: 0;
    transform: translateY(-12px);
    border-top-color: transparent;
  }

  body[data-events-collapsed='true'] .events-panel-inner {
    padding-top: 0;
    padding-bottom: 0;
  }

  .sidebar-shell,
  .events-panel-inner {
    padding: 22px;
  }

  .sidebar-filters {
    grid-template-columns: 1fr 1fr;
  }

  .chat-stage {
    min-height: 50dvh;
  }

  .auth-layout-theme-toggle {
    top: 22px;
    right: 22px;
  }
}

@media (max-width: 720px) {
  .auth-shell {
    padding: 0;
  }

  .auth-layout,
  .auth-layout--profile {
    width: 100%;
    border-radius: 0;
  }

  .auth-hero-inner,
  .auth-panel-inner,
  .auth-panel-inner--light,
  .sidebar-shell,
  .chat-header,
  .chat-stage,
  .chat-input-container,
  .events-panel-inner {
    padding-left: 20px;
    padding-right: 20px;
  }

  .auth-layout-theme-toggle {
    top: 18px;
    right: 18px;
  }

  .auth-hero-title {
    font-size: clamp(48px, 14vw, 72px);
  }

  .auth-title {
    font-size: 42px;
  }

  .thread-heading h2 {
    font-size: clamp(38px, 12vw, 56px);
  }

  .chat-header {
    flex-direction: column;
  }

  .header-right {
    width: 100%;
    justify-content: flex-start;
  }

  .message,
  .message.user {
    width: 100%;
  }

  .conversation-empty-grid {
    grid-template-columns: 1fr;
  }

  .empty-state-card--wide {
    grid-column: auto;
  }

  .message-content {
    max-width: 100%;
  }

  .input-wrapper {
    padding: 12px;
    grid-template-columns: minmax(0, 1fr) 56px;
  }

  .sidebar-filters {
    grid-template-columns: 1fr;
  }

  .btn-send {
    width: 56px;
    height: 56px;
  }
}
