/* ========================================
   CUT THE BULLSHIT — Design System v2
   Premium dark UI with animated gradient
   ======================================== */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colors — lifted background for better contrast */
  --bg-primary: #0e0e16;
  --bg-secondary: #14141e;
  --bg-card: rgba(24, 24, 36, 0.75);
  --bg-card-solid: #1a1a28;
  --bg-input: rgba(30, 30, 44, 0.85);
  --bg-input-focus: rgba(36, 36, 50, 0.9);
  --text-primary: #f0f0f5;
  --text-secondary: #9d9db0;
  --text-muted: #6b6b82;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.2);
  --accent-glow-strong: rgba(99, 102, 241, 0.35);
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 255, 255, 0.16);
  --border-card: rgba(255, 255, 255, 0.1);

  /* Score colors */
  --score-low: #22c55e;
  --score-mid: #eab308;
  --score-high: #ef4444;

  /* Share button colors */
  --linkedin: #0a66c2;
  --whatsapp: #25d366;
  --instagram: #e4405f;

  /* Spacing */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Typography */
  --font-display: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-display);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* ========================================
   ANIMATED GRADIENT BACKGROUND
   ======================================== */
.gradient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  will-change: transform;
}

.gradient-orb-1 {
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.55) 0%, rgba(99, 102, 241, 0.15) 40%, transparent 70%);
  top: -200px;
  left: -100px;
  animation: orbit1 20s ease-in-out infinite;
}

.gradient-orb-2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.5) 0%, rgba(139, 92, 246, 0.15) 40%, transparent 70%);
  bottom: -150px;
  right: -100px;
  animation: orbit2 25s ease-in-out infinite;
}

.gradient-orb-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.45) 0%, rgba(236, 72, 153, 0.12) 40%, transparent 70%);
  top: 40%;
  left: 50%;
  animation: orbit3 18s ease-in-out infinite;
}

@keyframes orbit1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(80px, 60px) scale(1.1); }
  50% { transform: translate(30px, 120px) scale(0.95); }
  75% { transform: translate(-50px, 40px) scale(1.05); }
}

@keyframes orbit2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-60px, -80px) scale(1.05); }
  50% { transform: translate(-100px, -30px) scale(1.1); }
  75% { transform: translate(-20px, -60px) scale(0.9); }
}

@keyframes orbit3 {
  0%, 100% { transform: translate(-50%, 0) scale(1); }
  33% { transform: translate(-60%, 40px) scale(1.15); }
  66% { transform: translate(-40%, -30px) scale(0.9); }
}

/* ========================================
   HEADER
   ======================================== */
.header {
  padding: 3rem 1.5rem 1.5rem;
  text-align: center;
  position: relative;
  z-index: 1;
}

.header-content {
  max-width: 600px;
  margin: 0 auto;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: white;
  margin-bottom: 1rem;
  box-shadow: 0 4px 20px var(--accent-glow-strong);
}

.logo {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--text-primary);
}

.tagline {
  margin-top: 0.5rem;
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.header-stats {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ========================================
   LANGUAGE SELECTOR
   ======================================== */
.lang-selector {
  display: inline-block;
  position: relative;
  margin-top: 0.5rem;
  z-index: 50;
}

.lang-selector-login {
  position: absolute;
  top: 1rem;
  right: 1rem;
  margin: 0;
}

.lang-selector-login .lang-dropdown {
  left: auto;
  right: 0;
  transform: none;
}

.lang-selector-login .lang-dropdown.open {
  animation: langDropInRight 0.15s ease-out;
}

@keyframes langDropInRight {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lang-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 6px;
  color: var(--accent-hover);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.lang-selector-btn:hover {
  color: white;
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.14);
}

.lang-selector-btn svg {
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform 0.2s;
}

.lang-dropdown.open + .lang-selector-btn svg,
.lang-selector-btn:focus + .lang-dropdown.open ~ svg {
  transform: rotate(180deg);
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 170px;
  background: var(--bg-card-solid);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.06) inset;
  padding: 4px;
  z-index: 51;
}

.lang-dropdown.open {
  display: block;
  animation: langDropIn 0.15s ease-out;
}

@keyframes langDropIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--accent-hover);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  text-align: left;
  white-space: nowrap;
}

.lang-option:hover {
  background: rgba(99, 102, 241, 0.12);
  color: white;
}

/* ========================================
   DRAG-DROP LANGUAGE OVERRIDES
   ======================================== */
html.lang-pt-BR .textarea-wrapper.drag-over::after {
  content: "Solte o arquivo .docx, .pptx ou .txt aqui";
}

html.lang-es .textarea-wrapper.drag-over::after {
  content: "Suelta el archivo .docx, .pptx o .txt aqu\00ED";
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  position: relative;
  z-index: 1;
}

/* ========================================
   INPUT SECTION
   ======================================== */
.input-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.textarea-wrapper {
  position: relative;
}

.input-textarea {
  width: 100%;
  min-height: 160px;
  padding: 1.1rem 1.1rem 2.2rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 0.95rem;
  line-height: 1.7;
  resize: vertical;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.3s;
  outline: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.input-textarea::placeholder {
  color: var(--text-muted);
}

.input-textarea:focus {
  border-color: rgba(99, 102, 241, 0.3);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 4px 30px rgba(99, 102, 241, 0.08);
}

.char-count {
  position: absolute;
  bottom: 0.7rem;
  right: 0.9rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

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

.char-count.at-limit {
  color: var(--score-high);
}

/* ========================================
   FILE UPLOAD
   ======================================== */
.upload-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.25rem;
  margin-top: 0.4rem;
  margin-bottom: 0.35rem;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  background: rgba(99, 102, 241, 0.06);
  border: 1px dashed rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.upload-btn:hover {
  color: var(--accent-hover);
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.08);
}

.upload-btn:active {
  transform: scale(0.97);
}

.upload-btn svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.upload-btn.loading {
  pointer-events: none;
  opacity: 0.5;
}

.upload-filename {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.upload-filename:empty {
  display: none;
}

/* Drag-and-drop overlay */
.textarea-wrapper.drag-over .input-textarea {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 4px 30px rgba(99, 102, 241, 0.08);
}

.textarea-wrapper.drag-over::after {
  content: "Drop .docx, .pptx, or .txt file here";
  position: absolute;
  inset: 0;
  bottom: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 10, 0.8);
  border-radius: var(--radius);
  color: var(--accent-hover);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  pointer-events: none;
  z-index: 5;
  border: 2px dashed var(--accent);
}

/* Truncation warning */
.truncation-warning {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  color: var(--score-mid);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
}

.truncation-warning.visible {
  display: flex;
}

.truncation-warning svg {
  flex-shrink: 0;
  stroke: var(--score-mid);
}

/* ========================================
   CORPORATE DIAL (Mode Toggle)
   ======================================== */
.dial-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dial-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-mono);
}

.mode-toggle {
  display: flex;
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.mode-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

.mode-btn:hover {
  color: var(--text-primary);
}

.mode-btn.active {
  color: var(--text-primary);
}

.mode-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.25s ease;
  z-index: 0;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* Unhinged mode — red styling */
.mode-btn-unhinged {
  color: #ef4444 !important;
  font-weight: 700 !important;
  font-size: 0.7rem !important;
  letter-spacing: 0.02em;
}

.mode-btn-unhinged:hover {
  color: #f87171 !important;
}

.mode-btn-unhinged.active {
  color: #fca5a5 !important;
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

/* Red slider when unhinged is active */
.mode-btn-unhinged.active ~ .mode-slider {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.2);
}

/* ========================================
   CTA BUTTON — "Cut the Bullshit"
   ======================================== */
.analyze-btn {
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.3s, filter 0.2s;
  position: relative;
  overflow: hidden;
  letter-spacing: -0.01em;
}

.analyze-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%
  );
  opacity: 0;
  transition: opacity 0.3s;
}

.analyze-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 24px var(--accent-glow-strong), 0 0 60px rgba(99, 102, 241, 0.15);
}

.analyze-btn:hover:not(:disabled)::before {
  opacity: 1;
}

.analyze-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.analyze-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.analyze-btn .btn-loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.analyze-btn.loading .btn-text {
  display: none;
}

.analyze-btn.loading .btn-loading {
  display: flex;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.shortcut-hint {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  opacity: 0.6;
}

/* ========================================
   RESULT SECTION
   ======================================== */
.result-section {
  margin-top: 2rem;
  display: none;
}

.result-section.visible {
  display: block;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   RESULT CARD — Glassmorphism
   ======================================== */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 2rem;
  position: relative;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3), 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.result-card.faded {
  opacity: 0.5;
  transition: opacity 0.3s;
}

/* --- Score Section --- */
.score-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.score-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.score-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.score-value {
  font-family: var(--font-mono);
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.score-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--score-low);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.5s;
  box-shadow: 0 0 12px currentColor;
}

.score-label {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.2rem 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* --- Analysis Grid --- */
.analysis-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.analysis-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.analysis-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.analysis-text {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text-primary);
  font-weight: 400;
}

/* --- Card Watermark --- */
.card-watermark {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  opacity: 0.6;
}

/* ========================================
   SHARE SECTION
   ======================================== */
.share-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 1.25rem;
  margin-bottom: 0.25rem;
}

.share-section {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.share-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s,
    box-shadow 0.3s;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.share-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.share-btn:active {
  transform: translateY(0);
}

.share-btn svg {
  flex-shrink: 0;
}

.share-linkedin:hover {
  color: var(--linkedin);
  border-color: rgba(10, 102, 194, 0.4);
  box-shadow: 0 4px 16px rgba(10, 102, 194, 0.1);
}

.share-whatsapp:hover {
  color: var(--whatsapp);
  border-color: rgba(37, 211, 102, 0.4);
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.1);
}

.share-instagram:hover {
  color: var(--instagram);
  border-color: rgba(228, 64, 95, 0.4);
  box-shadow: 0 4px 16px rgba(228, 64, 95, 0.1);
}

/* ========================================
   OUTAGE BANNER
   ======================================== */
.outage-banner {
  display: none;
  width: 100%;
  background: rgba(234, 179, 8, 0.08);
  border-bottom: 1px solid rgba(234, 179, 8, 0.2);
  z-index: 90;
}

.outage-banner.visible {
  display: block;
  animation: outage-slide-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes outage-slide-in {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.outage-banner-content {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
}

.outage-banner-content .outage-icon {
  flex-shrink: 0;
  color: #eab308;
}

.outage-banner-content p {
  color: #fde68a;
  font-size: 0.82rem;
  font-family: var(--font-display);
  line-height: 1.5;
  margin: 0;
}

.outage-banner-content strong {
  color: #fef08a;
  font-weight: 600;
}

/* ========================================
   ERROR TOAST
   ======================================== */
.error-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(45, 18, 21, 0.95);
  border: 1px solid rgba(92, 35, 41, 0.6);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
  z-index: 100;
  max-width: calc(100% - 2rem);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.error-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.error-message {
  color: #fca5a5;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ========================================
   TOAST NOTIFICATION
   ======================================== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(18, 18, 26, 0.95);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
  z-index: 100;
  max-width: calc(100% - 2rem);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-message {
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.footer > p {
  opacity: 0.6;
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.75rem;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--accent-hover);
}

/* ========================================
   SKELETON LOADING
   ======================================== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-input) 25%,
    var(--bg-input-focus) 50%,
    var(--bg-input) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 1rem;
  width: 80%;
  margin-bottom: 0.5rem;
}

.skeleton-text.short {
  width: 50%;
}

/* ========================================
   RESULT ACTION BUTTONS ROW
   ======================================== */
.result-actions-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.generate-reply-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1;
  padding: 0.75rem 1.25rem;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-sm);
  color: var(--accent-hover);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s, box-shadow 0.3s;
}

.generate-reply-btn:hover {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.35);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
}

.generate-reply-btn:active {
  transform: translateY(0) scale(0.98);
}

.generate-reply-btn svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.generate-summary-btn {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.2);
  color: rgba(34, 197, 94, 0.9);
}

.generate-summary-btn:hover {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.35);
  color: white;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.15);
}

/* ========================================
   REPLY MODAL
   ======================================== */
.reply-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.reply-modal-backdrop.visible {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.reply-modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 0;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.06) inset;
  animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Scrollbar styling for the modal */
.reply-modal::-webkit-scrollbar {
  width: 6px;
}

.reply-modal::-webkit-scrollbar-track {
  background: transparent;
}

.reply-modal::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* --- Modal Header --- */
.reply-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card-solid);
  z-index: 2;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.reply-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.reply-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.reply-close-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

/* --- Config & Output Views --- */
.reply-config-view,
.reply-output-view {
  padding: 1.25rem 1.5rem 1.5rem;
}

/* --- Form Groups --- */
.reply-form-group {
  margin-bottom: 1.25rem;
}

.reply-form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

/* --- Tone Buttons --- */
.reply-tone-group {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.reply-tone-btn {
  flex: 1;
  padding: 0.45rem 0.5rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.reply-tone-btn:hover {
  color: var(--text-primary);
}

.reply-tone-btn.active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-hover);
}

/* --- Intent Buttons --- */
.reply-intent-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reply-intent-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: left;
}

.reply-intent-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.reply-intent-btn.active {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.25);
  color: var(--accent-hover);
}

.intent-icon {
  font-size: 0.85rem;
  width: 1.2rem;
  text-align: center;
  flex-shrink: 0;
}

/* --- Optional Fields Grid --- */
.reply-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.reply-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.reply-field-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
}

.reply-input {
  padding: 0.5rem 0.65rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.reply-input::placeholder {
  color: var(--text-muted);
}

.reply-input:focus {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* --- Constraints Grid --- */
.reply-constraints-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 1rem;
}

.reply-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: color 0.15s;
}

.reply-checkbox-label:hover {
  color: var(--text-primary);
}

.reply-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* --- Generate Reply CTA --- */
.reply-generate-btn {
  width: 100%;
  padding: 0.8rem 1.25rem;
  background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.3s, filter 0.2s;
  position: relative;
  overflow: hidden;
}

.reply-generate-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 24px var(--accent-glow-strong);
}

.reply-generate-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.reply-generate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.reply-generate-btn .reply-generate-loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.reply-generate-btn.loading .reply-generate-text {
  display: none;
}

.reply-generate-btn.loading .reply-generate-loading {
  display: flex;
}

/* --- Output View --- */
.reply-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
  margin-bottom: 1rem;
}

.reply-back-btn:hover {
  color: var(--text-primary);
}

.reply-text-box {
  width: 100%;
  padding: 1rem 1.1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
  user-select: all;
  -webkit-user-select: all;
}

.reply-text-box::-webkit-scrollbar {
  width: 5px;
}

.reply-text-box::-webkit-scrollbar-track {
  background: transparent;
}

.reply-text-box::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

/* --- Action Buttons Row --- */
.reply-actions-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.reply-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.7rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.reply-action-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.reply-action-btn.reply-action-primary {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.2);
  color: var(--accent-hover);
}

.reply-action-btn.reply-action-primary:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.35);
  color: white;
}

/* --- Reply Output Loading State --- */
.reply-text-box.loading {
  position: relative;
  color: transparent;
  user-select: none;
  -webkit-user-select: none;
  min-height: 120px;
}

.reply-text-box.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0.03) 30%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.03) 70%
  );
  background-size: 200% 100%;
  animation: reply-shimmer 1.5s ease-in-out infinite;
}

@keyframes reply-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.reply-loading-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
}

.reply-loading-indicator .spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.reply-text-box.loading .reply-loading-indicator {
  display: flex;
}

.reply-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.reply-action-btn.active-modifier {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--accent-hover);
}

/* --- Context Chips --- */
.reply-context-section {
  margin-top: 1rem;
}

.reply-context-section:empty {
  display: none;
}

.reply-context-category {
  margin-bottom: 0.6rem;
}

.reply-context-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.reply-context-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.reply-chip {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ========================================
   TAB BAR
   ======================================== */
.tab-bar {
  display: flex;
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
  margin-bottom: 1.25rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.tab-btn {
  flex: 1;
  padding: 0.6rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--text-primary);
}

.tab-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* ========================================
   TONE TOGGLE (rewrite tab)
   ======================================== */
.tone-toggle .mode-btn {
  flex: 1 1 0;
  font-size: 0.72rem;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
  white-space: nowrap;
}

/* ========================================
   SUMMARY MODAL CONTENT
   ======================================== */
.summary-content {
  padding: 1.25rem 1.5rem 1.5rem;
}

.summary-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.summary-output {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.summary-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.summary-overview-text {
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
}

.summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.summary-list li {
  position: relative;
  padding-left: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.summary-list li::before {
  content: "\2013";
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.summary-list-actions li::before {
  content: "\25B8";
  color: var(--accent);
}

/* ========================================
   REWRITE RESULT
   ======================================== */
.rewrite-output-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.changes-section {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.changes-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.change-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.change-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0.12rem 0.5rem;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 0.15rem;
}

.change-badge-removed {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.change-badge-simplified {
  background: rgba(234, 179, 8, 0.12);
  color: #fde68a;
}

.change-badge-shortened {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-hover);
}

.change-badge-restructured {
  background: rgba(168, 85, 247, 0.12);
  color: #c4b5fd;
}

.rewrite-word-stats {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (min-width: 768px) {
  .header {
    padding: 4rem 2rem 2rem;
  }

  .logo {
    font-size: 3rem;
  }

  .logo-badge {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
    border-radius: var(--radius);
  }

  .tagline {
    font-size: 1.1rem;
  }

  .main {
    padding: 2rem 2rem 4rem;
  }

  .input-textarea {
    min-height: 180px;
    font-size: 1rem;
  }

  .result-card {
    padding: 2.25rem;
  }

  .score-value {
    font-size: 2.75rem;
  }

  .share-section {
    gap: 0.75rem;
  }

  .share-btn {
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
  }

  .gradient-orb-1 {
    width: 800px;
    height: 800px;
  }

  .gradient-orb-2 {
    width: 700px;
    height: 700px;
  }

  .gradient-orb-3 {
    width: 500px;
    height: 500px;
  }
}

@media (max-width: 480px) {
  .result-actions-row {
    flex-direction: column;
  }

  .share-section {
    flex-direction: column;
  }

  .share-btn {
    justify-content: center;
  }

  .tab-btn {
    font-size: 0.72rem;
    padding: 0.55rem 0.5rem;
  }

  .tone-toggle {
    flex-wrap: wrap;
  }

  .tone-toggle .mode-btn {
    flex: 1 1 auto;
    min-width: calc(33% - 4px);
    font-size: 0.68rem;
  }

  .mode-btn {
    font-size: 0.75rem;
    padding: 0.5rem 0.5rem;
  }

  .mode-btn-unhinged {
    font-size: 0.6rem !important;
    padding: 0.5rem 0.25rem !important;
  }

  .logo {
    font-size: 1.8rem;
  }

  .result-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
  }

  /* Reply modal as bottom sheet on mobile */
  .reply-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .reply-modal {
    max-height: 92vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: modalSlideUpMobile 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes modalSlideUpMobile {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .reply-modal-header {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .reply-fields-grid {
    grid-template-columns: 1fr;
  }

  .reply-constraints-grid {
    grid-template-columns: 1fr;
  }

  .reply-tone-group {
    flex-wrap: wrap;
  }

  .reply-tone-btn {
    flex: 1 1 auto;
    min-width: calc(50% - 4px);
  }

  .reply-actions-row {
    flex-wrap: wrap;
  }
}

/* ========================================
   REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  .gradient-orb {
    animation: none;
  }

  .result-section.visible {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .score-bar-fill {
    transition: none;
  }

  .reply-modal-backdrop.visible {
    animation: none;
  }

  .reply-modal {
    animation: none;
  }
}

/* ========================================
   USER INFO (Header)
   ======================================== */
.user-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.user-email {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.user-logout-btn {
  padding: 0.25rem 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.user-logout-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
  background: rgba(255, 255, 255, 0.07);
}

/* ========================================
   LOGIN PAGE
   ======================================== */
.login-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3), 0 0 1px rgba(255, 255, 255, 0.05) inset;
  position: relative;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.login-title {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.login-subtitle strong {
  color: var(--accent-hover);
  font-weight: 600;
}

.login-form-group {
  margin-bottom: 1rem;
}

.login-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.login-input::placeholder {
  color: var(--text-muted);
}

.login-input:focus {
  border-color: rgba(99, 102, 241, 0.3);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-input.otp-input {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.4em;
  padding: 0.85rem 1rem;
}

.login-btn {
  width: 100%;
  padding: 0.8rem 1.25rem;
  background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}

.login-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 24px var(--accent-glow-strong);
}

.login-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-btn .login-btn-loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.login-btn.loading .login-btn-text {
  display: none;
}

.login-btn.loading .login-btn-loading {
  display: flex;
}

.login-error {
  margin-top: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  color: #fca5a5;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
  display: none;
}

.login-error.visible {
  display: block;
}

.login-footer-actions {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 1rem;
}

.login-text-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
  padding: 0;
}

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

.login-text-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-spam-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  margin-top: -1rem;
}

.login-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 1rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.login-consent-checkbox {
  margin-top: 0.15rem;
  accent-color: var(--accent);
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ========================================
   ADMIN DASHBOARD
   ======================================== */
.admin-main {
  max-width: 960px;
}

.admin-header {
  margin-bottom: 2rem;
}

.admin-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}

.admin-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Stats grid */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.admin-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.admin-stat-value {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.admin-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.4rem;
  font-family: var(--font-mono);
  font-weight: 500;
}

/* Sections */
.admin-section {
  margin-bottom: 2rem;
}

.admin-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.admin-section-title span {
  color: var(--accent-hover);
}

/* Tables */
.admin-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-table th {
  text-align: left;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.admin-table th.sortable:hover {
  color: var(--text-secondary);
}

.admin-table th.sortable::after {
  content: "";
  margin-left: 0.3rem;
}

.admin-table th.sort-asc::after {
  content: " \u2191";
}

.admin-table th.sort-desc::after {
  content: " \u2193";
}

.admin-table td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}

.admin-table tr.clickable-row {
  cursor: pointer;
  transition: background 0.15s;
}

.admin-table tr.clickable-row:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

/* Pagination */
.admin-pagination {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.75rem;
  justify-content: center;
}

.admin-page-btn {
  padding: 0.35rem 0.7rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.admin-page-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.admin-page-btn.active {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
  color: var(--accent-hover);
}

.admin-page-dots {
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 0 0.2rem;
}

/* Detail panel */
.admin-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.admin-close-detail {
  padding: 0.3rem 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.admin-close-detail:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
}

/* Usage log entries */
.admin-log-entry {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.6rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.admin-log-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.admin-log-type {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
}

.admin-log-type.analyze {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-hover);
}

.admin-log-type.reply {
  background: rgba(34, 197, 94, 0.12);
  color: var(--score-low);
}

.admin-log-mode {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.15rem 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 100px;
}

.admin-log-date {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-left: auto;
}

.admin-log-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-log-section {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.admin-log-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-log-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  word-break: break-word;
}

.admin-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2rem 0;
}

/* Admin responsive */
@media (max-width: 640px) {
  .admin-main {
    padding: 1rem 1rem 2rem;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-stat-value {
    font-size: 1.4rem;
  }

  .admin-table {
    font-size: 0.75rem;
  }

  .admin-table th,
  .admin-table td {
    padding: 0.5rem 0.6rem;
  }

  .login-card {
    padding: 1.75rem;
    border-radius: var(--radius-lg);
  }
}
