:root {
  /* Material Design 3-inspired tokens — teal/forest seed (not purple-on-white) */
  --md-sys-color-primary: #0f6a5a;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #a8f0dd;
  --md-sys-color-on-primary-container: #00201a;
  --md-sys-color-secondary: #4a635d;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #cce8e0;
  --md-sys-color-on-secondary-container: #05201b;
  --md-sys-color-tertiary: #426278;
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-surface: #f5fbf8;
  --md-sys-color-surface-dim: #d5dbd8;
  --md-sys-color-surface-container: #e9efec;
  --md-sys-color-surface-container-high: #e3e9e6;
  --md-sys-color-on-surface: #171d1b;
  --md-sys-color-on-surface-variant: #3f4946;
  --md-sys-color-outline: #6f7976;
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-on-error: #ffffff;
  --md-elevation-1: 0 1px 2px rgba(23, 29, 27, 0.12), 0 1px 3px 1px rgba(23, 29, 27, 0.08);
  --md-radius: 12px;
  --md-radius-lg: 28px;
  --font-brand: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Figtree", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--md-sys-color-on-surface);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(168, 240, 221, 0.55), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(204, 232, 224, 0.7), transparent 55%),
    linear-gradient(180deg, #eef7f3 0%, var(--md-sys-color-surface) 40%, #e7f1ed 100%);
}

a {
  color: var(--md-sys-color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.top-app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: color-mix(in srgb, var(--md-sys-color-surface) 82%, white);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 25%, transparent);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-family: var(--font-brand);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  align-items: center;
}

.nav-links a {
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 500;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  text-decoration: none;
}

.page {
  width: min(1100px, calc(100% - 2rem));
  margin: 1.5rem auto 2.5rem;
}

.page-narrow {
  width: min(480px, calc(100% - 2rem));
}

.page-narrow:has(.account-section) {
  width: min(540px, calc(100% - 2rem));
}

.account-section {
  margin-bottom: 1rem;
}

.account-section h2 {
  font-family: var(--font-brand);
  font-size: 1.2rem;
  font-weight: 650;
  margin: 0 0 0.35rem;
}

.account-meta,
.account-hint {
  margin: 0 0 1rem;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.92rem;
  line-height: 1.45;
}

.account-section .md-btn {
  margin-top: 0.15rem;
}

.hero {
  display: grid;
  gap: 1rem;
  padding: clamp(2rem, 6vw, 4.5rem) 0 2rem;
  animation: rise 560ms ease-out;
}

.hero h1 {
  font-family: var(--font-brand);
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  line-height: 1.05;
  margin: 0;
  letter-spacing: -0.03em;
}

.hero .lede {
  font-size: 1.1rem;
  max-width: 36rem;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.md-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.md-btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.md-btn-filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: var(--md-elevation-1);
}

.md-btn-tonal {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.md-btn-outlined {
  background: transparent;
  color: var(--md-sys-color-primary);
  outline: 1px solid var(--md-sys-color-outline);
}

.md-field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.md-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
}

.md-field input,
.md-field textarea,
.md-field select {
  font: inherit;
  padding: 0.85rem 1rem;
  border-radius: var(--md-radius);
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 55%, transparent);
  background: color-mix(in srgb, white 80%, var(--md-sys-color-surface));
  color: var(--md-sys-color-on-surface);
}

.md-field input:focus,
.md-field textarea:focus,
.md-field select:focus {
  outline: 2px solid var(--md-sys-color-primary);
  border-color: transparent;
}

.surface {
  background: color-mix(in srgb, white 70%, var(--md-sys-color-surface-container));
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 18%, transparent);
  border-radius: var(--md-radius-lg);
  padding: 1.25rem;
  box-shadow: var(--md-elevation-1);
  animation: rise 480ms ease-out;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--md-radius);
  margin-bottom: 1rem;
}

.alert-error {
  background: #ffdad6;
  color: #410002;
}

.validation-summary-valid {
  display: none !important;
}

.alert-ok {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 25%, transparent);
  vertical-align: top;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html:has(.page-chat),
html:has(.page-chat) body {
  height: 100%;
  overflow: hidden;
}

.app-shell:has(.page-chat) {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.page-chat {
  width: min(1180px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 0.65rem 0 0.75rem;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.chat-page-head {
  flex-shrink: 0;
  margin-bottom: 0.65rem;
}

.chat-page-head h1 {
  font-family: var(--font-brand);
  font-size: 1.35rem;
  font-weight: 650;
  margin: 0;
}

.chat-lede {
  margin: 0.2rem 0 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.92rem;
}

.chat-page.has-thread .chat-lede {
  display: none;
}

.chat-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

@media (max-width: 800px) {
  .chat-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .chat-sidebar {
    max-height: 26vh;
  }
}

.chat-sidebar,
.chat-main {
  background: color-mix(in srgb, white 72%, var(--md-sys-color-surface-container));
  border-radius: var(--md-radius-lg);
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 18%, transparent);
  padding: 1rem;
  min-height: 0;
}

.chat-sidebar {
  overflow: auto;
}

.chat-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-blank {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-on-surface-variant);
  text-align: center;
}

.chat-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-main.is-empty .chat-stage {
  justify-content: center;
}

.chat-empty-hint {
  margin: 0;
  text-align: center;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 1.05rem;
}

.chat-main.has-messages .chat-empty-hint {
  display: none;
}

.chat-main.has-messages .chat-messages {
  flex: 1;
}

.chat-main.has-messages .chat-ask-form {
  flex-shrink: 0;
}

.chat-nav-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.chat-nav-item a {
  flex: 1;
  min-width: 0;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  padding: 0.35rem 0.45rem;
  border-radius: 10px;
}

.chat-nav-item.is-active a {
  font-weight: 700;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.chat-nav-hide button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: 8px;
}

.chat-nav-hide button:hover {
  background: #ffdad6;
  color: #410002;
}

.chat-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  flex-shrink: 0;
}

.switch-row.compact {
  padding: 0.65rem 0.85rem;
}

.switch-row.compact small {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 0.15rem;
}

.history-toggle {
  margin: 0;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  overflow: auto;
  margin-bottom: 0.85rem;
}

.chat-main.is-empty .chat-messages {
  overflow: visible;
  margin-bottom: 1rem;
}

.bubble {
  max-width: min(720px, 92%);
  padding: 0.85rem 1rem;
  border-radius: 18px;
  animation: rise 280ms ease-out;
}

.bubble-plain {
  white-space: pre-wrap;
}

.bubble-user {
  align-self: flex-end;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-bottom-right-radius: 6px;
}

.bubble-assistant {
  align-self: flex-start;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border-bottom-left-radius: 6px;
}

.bubble-md {
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.bubble-md > :first-child {
  margin-top: 0;
}

.bubble-md > :last-child {
  margin-bottom: 0;
}

.bubble-md p {
  margin: 0.55em 0;
}

.bubble-md ul,
.bubble-md ol {
  margin: 0.45em 0;
  padding-left: 1.35em;
}

.bubble-md li {
  margin: 0.2em 0;
}

.bubble-md li > p {
  margin: 0.2em 0;
}

.bubble-md strong {
  font-weight: 700;
}

.bubble-md a {
  color: var(--md-sys-color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.bubble-md a:hover {
  text-decoration-thickness: 2px;
}

.bubble-md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
}

.bubble-md pre {
  margin: 0.65em 0;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  overflow-x: auto;
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
}

.bubble-md pre code {
  padding: 0;
  background: none;
  font-size: 0.86em;
}

.bubble-md blockquote {
  margin: 0.55em 0;
  padding: 0.15em 0 0.15em 0.85em;
  border-left: 3px solid color-mix(in srgb, var(--md-sys-color-primary) 45%, transparent);
  color: var(--md-sys-color-on-surface-variant);
}

.bubble-md h1,
.bubble-md h2,
.bubble-md h3,
.bubble-md h4 {
  margin: 0.75em 0 0.35em;
  font-family: var(--font-brand);
  font-weight: 650;
  line-height: 1.25;
}

.bubble-md h1 { font-size: 1.2rem; }
.bubble-md h2 { font-size: 1.1rem; }
.bubble-md h3,
.bubble-md h4 { font-size: 1.02rem; }

.bubble-md table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.65em 0;
  font-size: 0.92em;
}

.bubble-md th,
.bubble-md td {
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 55%, transparent);
  padding: 0.35em 0.5em;
  text-align: left;
}

.bubble-md hr {
  border: none;
  border-top: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 50%, transparent);
  margin: 0.85em 0;
}

.citations {
  font-size: 0.8rem;
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 0.35rem;
}

.chat-send-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}

.chat-ask-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.4rem 0.4rem 0.4rem 0.95rem;
  border-radius: 24px;
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 45%, transparent);
  background: color-mix(in srgb, white 88%, var(--md-sys-color-surface));
  box-shadow: var(--md-elevation-1);
}

.chat-composer:focus-within {
  outline: 2px solid var(--md-sys-color-primary);
  border-color: transparent;
}

.chat-composer textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  overflow-y: auto;
  border: none;
  background: transparent;
  font: inherit;
  color: var(--md-sys-color-on-surface);
  line-height: 1.45;
  padding: 0.5rem 0.25rem;
  min-height: 1.45em;
  max-height: 10rem;
}

.chat-composer textarea:focus {
  outline: none;
}

.chat-send-button {
  flex-shrink: 0;
  padding: 0.55rem 1.05rem;
  white-space: nowrap;
}

.thinking-status {
  font-size: 0.9rem;
  color: var(--md-sys-color-on-surface-variant);
  animation: pulse-soft 1.4s ease-in-out infinite;
}

.thinking-status[hidden] {
  display: none !important;
}

.bubble-thinking {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--md-sys-color-on-surface-variant);
  min-width: 7.5rem;
}

.bubble-thinking[hidden] {
  display: none !important;
}

.thinking-label {
  font-weight: 600;
}

.thinking-dots {
  display: inline-flex;
  gap: 0.28rem;
  align-items: center;
}

.thinking-dots span {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  opacity: 0.35;
  animation: thinking-bounce 1.1s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

.chat-ask-form.is-thinking textarea,
.chat-ask-form.is-thinking button[type="submit"] {
  opacity: 0.7;
  cursor: wait;
}

@keyframes thinking-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@keyframes pulse-soft {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

.knob-panel {
  display: grid;
  gap: 1.15rem;
  padding: 0.25rem 0 0.5rem;
}

.knob {
  padding: 0.85rem 1rem;
  border-radius: 18px;
  background: color-mix(in srgb, var(--md-sys-color-surface-container) 70%, white);
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 16%, transparent);
  transition: box-shadow 180ms ease, transform 180ms ease;
}

.knob:focus-within {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary) 22%, transparent);
}

.knob-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.knob-head label {
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.knob-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--md-sys-color-primary);
  font-size: 0.95rem;
}

.knob-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--md-sys-color-on-surface-variant);
}

.knob-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 0.45rem;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--md-sys-color-primary) 0%,
    var(--md-sys-color-primary) var(--knob-pct, 0%),
    color-mix(in srgb, var(--md-sys-color-outline) 28%, transparent) var(--knob-pct, 0%),
    color-mix(in srgb, var(--md-sys-color-outline) 28%, transparent) 100%
  );
  outline: none;
  cursor: pointer;
}

.knob-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  border: 3px solid var(--md-sys-color-on-primary);
  box-shadow: var(--md-elevation-1);
  transition: transform 140ms ease;
}

.knob-slider:active::-webkit-slider-thumb {
  transform: scale(1.08);
}

.knob-slider::-moz-range-thumb {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  border: 3px solid var(--md-sys-color-on-primary);
  box-shadow: var(--md-elevation-1);
}

.knob-toggles {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  background: color-mix(in srgb, var(--md-sys-color-surface-container) 55%, white);
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 14%, transparent);
  cursor: pointer;
}

.switch-row > span:first-child {
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

.switch {
  position: relative;
  width: 3.1rem;
  height: 1.85rem;
  flex: 0 0 auto;
}

.switch-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}

.switch-ui {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--md-sys-color-outline) 45%, transparent);
  transition: background 160ms ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: white;
  box-shadow: var(--md-elevation-1);
  transition: transform 160ms ease;
}

.switch-input:checked + .switch-ui {
  background: var(--md-sys-color-primary);
}

.switch-input:checked + .switch-ui::after {
  transform: translateX(1.2rem);
}

.switch-input:focus-visible + .switch-ui {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.footer {
  padding: 1rem 1.25rem 1.5rem;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.9rem;
  text-align: center;
}

.validation-summary-errors ul {
  margin: 0;
  padding-left: 1.1rem;
}

.text-danger {
  color: var(--md-sys-color-error);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* AJAX form submitting indicator */
form.is-submitting {
  position: relative;
  pointer-events: none;
  cursor: wait;
}

form.is-submitting .dropzone,
form.is-submitting .md-field {
  opacity: 0.65;
}

form.is-submitting button[type="submit"] {
  cursor: wait;
}

.btn-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

.upload-status {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.85rem 0 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.95rem;
  font-weight: 600;
}

.upload-status[hidden] {
  display: none;
}

/* Toast Notifications in Top Right Corner */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: min(420px, calc(100vw - 2.5rem));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  border-radius: var(--md-radius);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16), 0 1px 3px rgba(0, 0, 0, 0.08);
  font-size: 0.95rem;
  line-height: 1.45;
  animation: toast-in 260ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast-success {
  background: #0f6a5a;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-error {
  background: #ba1a1a;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-info {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 25%, transparent);
}

.toast-content {
  flex: 1 1 auto;
  word-break: break-word;
}

.toast-close {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.75;
  cursor: pointer;
  padding: 0;
  margin: 0;
  font-size: 1.25rem;
  line-height: 1;
  border-radius: 4px;
}

.toast-close:hover {
  opacity: 1;
}

.toast.toast-hiding {
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 8.75rem;
  margin-bottom: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--md-radius-lg);
  border: 2px dashed color-mix(in srgb, var(--md-sys-color-outline) 55%, transparent);
  background: color-mix(in srgb, var(--md-sys-color-primary-container) 28%, white);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-copy {
  display: grid;
  gap: 0.25rem;
  text-align: center;
  pointer-events: none;
  color: var(--md-sys-color-on-surface-variant);
}

.dropzone-copy strong {
  color: var(--md-sys-color-on-surface);
  font-size: 1.05rem;
}

.dropzone:hover,
.dropzone.is-dragover,
.dropzone:has(.dropzone-input:focus-visible) {
  border-color: var(--md-sys-color-primary);
  background: color-mix(in srgb, var(--md-sys-color-primary-container) 55%, white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary) 18%, transparent);
}

.dropzone.has-file {
  border-style: solid;
  border-color: var(--md-sys-color-primary);
}

.dropzone-file {
  font-weight: 700;
  color: var(--md-sys-color-primary);
}

.tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.tag-suggestions-label {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}

.tag-chip-form {
  display: inline;
  margin: 0;
}

.tag-chip {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 40%, transparent);
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.tag-chip:hover {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-color: transparent;
}

.doc-tags-cell {
  min-width: 16rem;
  max-width: 22rem;
}

.tag-manager {
  display: grid;
  gap: 0.45rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.tag-empty {
  font-size: 0.85rem;
  color: var(--md-sys-color-on-surface-variant);
}

.tag-chip-current {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  cursor: default;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-color: transparent;
}

.tag-chip-current:hover {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.tag-chip-remove {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.1rem;
  border-radius: 999px;
}

.tag-chip-remove:hover {
  background: color-mix(in srgb, var(--md-sys-color-error) 18%, transparent);
  color: var(--md-sys-color-error);
}

.tag-chip-suggest {
  background: transparent;
}

.tag-add-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.tag-add-form input[type="text"] {
  flex: 1 1 8rem;
  min-width: 8rem;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 55%, transparent);
  background: color-mix(in srgb, white 80%, var(--md-sys-color-surface));
  color: var(--md-sys-color-on-surface);
}

.tag-add-form input[type="text"]:focus {
  outline: 2px solid var(--md-sys-color-primary);
  border-color: transparent;
}

.doc-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.doc-source-badge {
  display: inline-block;
  margin: 0.25rem 0 0;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.user-status {
  display: inline-block;
  margin: 0.1rem 0.15rem 0.1rem 0;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
}

.user-status-ok {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.user-status-off {
  background: #ffdad6;
  color: #410002;
}

.user-status-you {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}


