/* Medical Interpreter Stories — dusk theme (matches Stoplight / LAIS Command Center).
   Canonical tokens: see laislogs COLOR-FLOW-NOTES.md / public/css/lais-dusk.css */
:root {
  --bg: #0b0614;
  --fg: #f4f7fb;
  --muted: #c4b5e0;
  --surface: rgba(18, 12, 40, 0.88);
  --surface-glass: rgba(18, 12, 40, 0.72);
  --surface-raised: rgba(36, 22, 62, 0.92);
  --text: #f4f7fb;
  --text-secondary: #e9d5ff;
  --text-muted: #c4b5e0;
  --accent: #e879f9;
  --accent-hover: #f0abfc;
  --accent-strong: #c026d3;
  --accent-light: rgba(232, 121, 249, 0.14);
  --accent-soft: rgba(232, 121, 249, 0.22);
  --border: rgba(232, 121, 249, 0.22);
  --border-subtle: rgba(232, 121, 249, 0.14);
  --border-focus: #e879f9;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.22);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.28);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35), 0 0 36px rgba(192, 38, 211, 0.08);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.42), 0 0 48px rgba(192, 38, 211, 0.10);
  --glow-lilac: 0 0 28px rgba(232, 121, 249, 0.28);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --success: #4ade80;
  --success-bg: rgba(34, 197, 94, 0.16);
  --danger: #f87171;
  --danger-bg: rgba(239, 68, 68, 0.16);
  --warning: #fbbf24;
  --warning-bg: rgba(245, 158, 11, 0.16);
  --shell-height: 4.25rem;
  --content-max: 44rem;
  --content-wide: 56rem;
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-body: 'Source Sans 3', 'Nunito', system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(232, 121, 249, 0.28), transparent 55%),
    radial-gradient(800px 500px at 80% 100%, rgba(109, 40, 217, 0.35), transparent 50%),
    linear-gradient(180deg, #1a0533 0%, #12081f 40%, #0b0614 100%);
  background-attachment: fixed;
  background-color: #0b0614;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* App shell */
.app-shell {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--shell-height);
  background: rgba(18, 12, 40, 0.82);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs), 0 0 40px rgba(192, 38, 211, 0.08);
}

.app-shell-inner {
  max-width: calc(var(--content-wide) + 3rem);
  height: 100%;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

.brand {
  grid-column: 1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}

.brand-icon {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(232, 121, 249, 0.22), rgba(109, 40, 217, 0.35));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  box-shadow: var(--shadow-sm), 0 0 18px rgba(232, 121, 249, 0.2);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.brand-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.brand-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.site-nav {
  grid-column: 2;
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.site-nav-links {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: nowrap;
  padding: 0.22rem;
  background: rgba(8, 4, 18, 0.55);
  border-radius: 999px;
  border: 1px solid var(--border);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.nav-link:hover {
  color: var(--text-secondary);
  background: rgba(232, 121, 249, 0.1);
}

.nav-link-active {
  color: var(--accent-hover);
  background: var(--accent-light);
  box-shadow: inset 0 0 0 1px rgba(232, 121, 249, 0.28), 0 0 16px rgba(232, 121, 249, 0.15);
}

/* Page intro */
.page-intro {
  padding: 2.25rem 1.25rem 0;
}

.page-intro-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.page-intro-inner.wide {
  max-width: var(--content-wide);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.eyebrow svg {
  width: 0.95rem;
  height: 0.95rem;
}

.page-intro h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.85rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.page-lead {
  max-width: 38rem;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.page-auth .page-intro {
  padding-top: 3rem;
  text-align: center;
}

.page-auth .page-intro-inner {
  max-width: 28rem;
}

.page-auth .page-lead {
  margin: 0 auto;
}

/* Layout */
main {
  flex: 1;
  width: 100%;
  max-width: calc(var(--content-max) + 3rem);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

main.wide {
  max-width: calc(var(--content-wide) + 3rem);
}

.card {
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.instructions {
  padding: 2rem 2.25rem 1.75rem;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(to bottom, rgba(36, 22, 62, 0.55), transparent);
}

.instructions h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.instructions p {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 1.25rem;
  line-height: 1.7;
}

.guidelines {
  list-style: none;
  display: grid;
  gap: 0.65rem;
}

.guidelines li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.guidelines li::before {
  content: '';
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.85;
  box-shadow: 0 0 10px rgba(232, 121, 249, 0.55);
}

.form-section {
  padding: 2rem 2.25rem 2.25rem;
}

.form-group {
  margin-bottom: 1.35rem;
}

label {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

label span {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.875rem;
}

input[type="password"],
textarea {
  width: 100%;
  padding: 0.9rem 1.1rem;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: rgba(8, 4, 18, 0.65);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea {
  min-height: 260px;
  resize: vertical;
}

textarea::placeholder,
input::placeholder {
  color: #8b7aa8;
}

textarea:hover,
input[type="password"]:hover {
  border-color: rgba(232, 121, 249, 0.4);
}

textarea:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--border-focus);
  background: rgba(18, 12, 40, 0.9);
  box-shadow: 0 0 0 3px rgba(232, 121, 249, 0.18), var(--glow-lilac);
}

.char-count {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.char-count.near-limit {
  color: var(--warning);
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.privacy-note svg {
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.85;
}

.btn-primary,
.btn-secondary,
.filter-tabs button {
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn-primary {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a0533;
  background: linear-gradient(180deg, #f0abfc 0%, var(--accent) 55%, #c026d3 100%);
  border: 1px solid rgba(192, 38, 211, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.82rem 1.75rem;
  box-shadow: 0 2px 12px rgba(192, 38, 211, 0.35), 0 0 24px rgba(232, 121, 249, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #f5d0fe 0%, var(--accent-hover) 55%, var(--accent) 100%);
  box-shadow: 0 4px 20px rgba(192, 38, 211, 0.45), 0 0 32px rgba(232, 121, 249, 0.28);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-hover);
  background: var(--accent-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.2rem;
  text-decoration: none;
}

.btn-secondary:hover {
  background: rgba(232, 121, 249, 0.22);
  border-color: rgba(232, 121, 249, 0.4);
}

.btn-success {
  color: var(--success);
  background: var(--success-bg);
}

.btn-success:hover {
  background: rgba(34, 197, 94, 0.28);
}

.btn-danger {
  color: var(--danger);
  background: var(--danger-bg);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.28);
}

.success-panel {
  display: none;
  padding: 3.25rem 2.25rem;
  text-align: center;
}

.success-panel.visible {
  display: block;
}

.success-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.35rem;
  background: var(--accent-light);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  box-shadow: var(--shadow-sm), 0 0 24px rgba(232, 121, 249, 0.25);
}

.success-panel h2 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.success-panel p {
  color: var(--text-muted);
  max-width: 28rem;
  margin: 0 auto 1.75rem;
  line-height: 1.7;
}

.form-panel.hidden {
  display: none;
}

.error-message {
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 0.75rem;
}

.story-list {
  padding: 1.5rem 2.25rem 2.25rem;
  display: grid;
  gap: 1.25rem;
}

.story-card {
  padding: 1.5rem 1.6rem;
  background: rgba(18, 12, 40, 0.72);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.story-card:hover {
  box-shadow: var(--shadow-sm), 0 0 24px rgba(232, 121, 249, 0.12);
  border-color: rgba(232, 121, 249, 0.35);
}

.story-card .story-content {
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 0.85rem;
}

.story-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.empty-state {
  padding: 3rem 2.25rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.empty-state .btn-secondary {
  margin-top: 1.25rem;
}

.status-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.status-badge.pending {
  color: var(--warning);
  background: var(--warning-bg);
  border: 1px solid rgba(251, 191, 36, 0.28);
}

.status-badge.approved {
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid rgba(74, 222, 128, 0.28);
}

.status-badge.rejected {
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.admin-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.35rem 2.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(36, 22, 62, 0.45);
}

.admin-toolbar h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-tabs button {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(8, 4, 18, 0.55);
  color: var(--text-muted);
}

.filter-tabs button.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-hover);
  box-shadow: 0 0 16px rgba(232, 121, 249, 0.18);
}

.login-section {
  padding: 2.5rem 2.25rem;
  max-width: 28rem;
  margin: 0 auto;
}

.login-section h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.login-section > p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.site-footer,
footer {
  margin-top: auto;
  text-align: center;
  padding: 2.25rem 1.25rem 2.5rem;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  background: rgba(11, 6, 20, 0.55);
}

.site-footer p,
footer p {
  margin: 0.18rem 0;
}

.site-footer p.legal,
footer p.legal {
  font-size: 0.8rem;
}

.site-footer p.legal:first-of-type,
footer p.legal:first-of-type {
  margin-top: 0.55rem;
}

.hub-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 auto 0.85rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: rgba(18, 12, 40, 0.55);
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.hub-back:hover {
  color: var(--accent-hover);
  border-color: var(--border);
  background: var(--accent-light);
  box-shadow: 0 0 18px rgba(232, 121, 249, 0.18);
}

.hero { display: none; }

@media (max-width: 768px) {
  .app-shell {
    height: auto;
    min-height: var(--shell-height);
  }

  .app-shell-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.7rem 1rem;
    row-gap: 0.65rem;
    height: auto;
    min-height: var(--shell-height);
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
    grid-column: auto;
  }

  .brand-text {
    font-size: 1rem;
  }

  .site-nav {
    width: 100%;
    flex: 1 1 100%;
    justify-content: center;
    grid-column: auto;
  }

  .site-nav-links {
    width: 100%;
    max-width: 18rem;
    justify-content: stretch;
  }

  .nav-link {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.5rem 0.65rem;
    font-size: 0.84rem;
  }

  .page-intro {
    padding-top: 1.75rem;
  }

  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: stretch;
  }

  .toolbar-actions .btn-secondary {
    flex: 1 1 auto;
  }
}

@media (max-width: 640px) {
  .instructions,
  .form-section,
  .story-list,
  .login-section,
  .admin-toolbar,
  .empty-state,
  .success-panel {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .form-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-primary {
    width: 100%;
  }

  .privacy-note {
    justify-content: center;
  }

  .filter-tabs {
    width: 100%;
  }

  .filter-tabs button {
    flex: 1 1 auto;
    text-align: center;
  }
}

@media (max-width: 400px) {
  .brand-text {
    font-size: 0.92rem;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 0.48rem 0.4rem;
  }
}
