/* ═══════════════════════════════════════════════════════════════
   SYNX — Sign Language Translator
   Main Stylesheet
═══════════════════════════════════════════════════════════════ */

/* ── Google Font Import ────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input  { font-family: inherit; }
img    { max-width: 100%; display: block; }
a      { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Brand colours */
  --p:    #059669;
  --pl:   #10B981;
  --pd:   #047857;
  --pbg:  #ECFDF5;
  --acc:  #F59E0B;
  --abg:  #FFFBEB;
  /* Neutrals */
  --dark: #0F172A;
  --gray: #475569;
  --gl:   #94A3B8;
  --bdr:  #E2E8F0;
  --bg:   #F8FAFC;
  --wh:   #FFFFFF;
  /* Radii */
  --r:    12px;
  --rl:   16px;
  /* Transitions */
  --tr: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  /* Shadows */
  --sh-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --sh:    0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --sh-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --sh-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --sh-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* ── Keyframe Animations ───────────────────────────────────── */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.4); }
  50%       { box-shadow: 0 0 0 12px rgba(5, 150, 105, 0); }
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes field-in {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
  40%           { transform: scale(1); opacity: 1; }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes sidebar-slide {
  from { transform: translateX(-280px); }
  to   { transform: translateX(0); }
}
@keyframes backdrop-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes live-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
@keyframes page-enter {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Animation Utility Classes ─────────────────────────────── */
.anim-fade-in   { animation: fade-in  0.5s cubic-bezier(0.4,0,0.2,1) forwards; }
.anim-slide-up  { animation: slide-up 0.6s cubic-bezier(0.4,0,0.2,1) forwards; }
.anim-scale-in  { animation: scale-in 0.4s cubic-bezier(0.4,0,0.2,1) forwards; }
.anim-card-in   { animation: card-in  0.45s cubic-bezier(0.4,0,0.2,1) forwards; }
.anim-page-in   { animation: page-enter 0.35s cubic-bezier(0.4,0,0.2,1) forwards; }
.synx-pulse     { animation: pulse-glow 2s infinite; }

/* ── Custom Scrollbar ──────────────────────────────────────── */
.synx-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.synx-scrollbar::-webkit-scrollbar-track { background: transparent; }
.synx-scrollbar::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
.synx-scrollbar::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ── Dot Loading ───────────────────────────────────────────── */
.synx-dot-loading { display: flex; gap: 6px; align-items: center; justify-content: center; }
.synx-dot-loading span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--p);
  animation: dot-bounce 1.4s infinite ease-in-out both;
  display: inline-block;
}
.synx-dot-loading span:nth-child(1) { animation-delay: -0.32s; }
.synx-dot-loading span:nth-child(2) { animation-delay: -0.16s; }
.synx-dot-loading span:nth-child(3) { animation-delay: 0s; }

/* ═══════════════════════════════════════════════════════════════
   NAVBAR
═══════════════════════════════════════════════════════════════ */
#navbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}
.nav-inner {
  width: 95%; max-width: 1800px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 12px;
}
@media (min-width: 640px) { .nav-inner { padding: 0 24px; } }

/* Logo */
.nav-logo-btn { display: flex; align-items: center; gap: 10px; background: none; border: none; cursor: pointer; }
.nav-logo-icon {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, #10B981, #047857);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(5,150,105,0.25);
  transition: box-shadow 0.2s;
  flex-shrink: 0;
}
.nav-logo-icon:hover { box-shadow: 0 4px 20px rgba(5,150,105,0.45); }
.nav-logo-icon svg { color: #fff; }
.nav-title { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.03em; color: #0F172A; }
.nav-title .accent { color: #059669; }

/* Desktop nav tabs */
.nav-tabs {
  display: none; align-items: center; gap: 4px;
  background: rgba(241, 245, 249, 0.7);
  border-radius: 12px; padding: 4px;
}
@media (min-width: 1024px) { .nav-tabs { display: flex; } }
.nav-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 9px;
  font-size: 0.875rem; font-weight: 500;
  color: #64748B; transition: var(--tr); cursor: pointer; background: none; border: none;
}
.nav-tab:hover { color: #334155; background: rgba(255,255,255,0.6); }
.nav-tab.active { background: white; color: #059669; box-shadow: var(--sh-sm); }

/* Nav right */
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-user-info { display: none; align-items: center; gap: 8px; }
@media (min-width: 640px) { .nav-user-info { display: flex; } }
.nav-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #34D399, #059669);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.875rem; font-weight: 600; flex-shrink: 0;
}
.nav-username { font-size: 0.875rem; font-weight: 500; color: #334155; }
.btn-logout {
  padding: 8px 16px; border-radius: 12px;
  color: #64748B; transition: var(--tr); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #F1F5F9; border: 1px solid #E2E8F0;
}
.btn-logout:hover { color: #EF4444; background: #FEF2F2; border-color: #FEE2E2; transform: translateY(-1px); }
.btn-logout:active { transform: translateY(0); }
.btn-logout .btn-text { font-size: 0.875rem; font-weight: 600; }
@media (max-width: 640px) { .btn-logout .btn-text { display: none; } }

.btn-hamburger {
  display: flex; padding: 10px 14px; border-radius: 12px;
  color: #64748B; transition: var(--tr); cursor: pointer;
  align-items: center; justify-content: center; gap: 8px;
  background: #F1F5F9; border: 1px solid #E2E8F0;
}
.btn-hamburger:hover { color: #059669; background: #ECFDF5; border-color: #10B981; }
.btn-hamburger .btn-text { font-size: 0.875rem; font-weight: 600; }
@media (max-width: 480px) { .btn-hamburger .btn-text { display: none; } }
@media (min-width: 1280px) { .btn-hamburger { display: none; } }

/* ═══════════════════════════════════════════════════════════════
   MOBILE SIDEBAR
═══════════════════════════════════════════════════════════════ */
#sidebar-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
  animation: backdrop-fade 0.2s ease-out forwards;
}
#sidebar-panel {
  position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 50;
  background: white; box-shadow: var(--sh-xl);
  display: flex; flex-direction: column;
  animation: sidebar-slide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #F1F5F9;
}
.sidebar-header-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-nav { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.sidebar-nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 12px; border-radius: 10px;
  font-size: 0.875rem; font-weight: 500; color: #64748B;
  transition: var(--tr); background: none; border: none; cursor: pointer; text-align: left;
}
.sidebar-nav-item:hover { color: #334155; background: #F8FAFC; }
.sidebar-nav-item.active { color: #059669; background: #ECFDF5; }
.sidebar-footer {
  padding: 16px; border-top: 1px solid #F1F5F9;
}
.sidebar-user { display: flex; align-items: center; gap: 12px; padding: 8px; }
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #34D399, #059669);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.875rem; font-weight: 600; flex-shrink: 0;
}
.sidebar-user-name { font-size: 0.875rem; font-weight: 500; color: #334155; }
.sidebar-user-email { font-size: 0.75rem; color: #94A3B8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════════ */
#main-footer {
  background: white;
  border-top: 1px solid rgba(226, 232, 240, 0.6);
  margin-top: auto;
}
.footer-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 16px 24px;
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
}
@media (min-width: 640px) {
  .footer-inner { flex-direction: row; justify-content: space-between; }
}
.footer-inner p { font-size: 0.75rem; color: #94A3B8; }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS (shared)
═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 11px;
  font-size: 0.875rem; font-weight: 600;
  transition: var(--tr); user-select: none; cursor: pointer; border: none;
}
.btn-primary {
  background: linear-gradient(135deg, #059669, #10B981);
  color: white;
  box-shadow: 0 4px 14px rgba(5,150,105,0.25);
}
.btn-primary:hover { background: linear-gradient(135deg,#047857,#059669); box-shadow: 0 4px 18px rgba(5,150,105,0.4); transform: scale(1.01); }
.btn-primary:active { transform: scale(0.98); }
.btn-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: white;
  box-shadow: 0 4px 14px rgba(239,68,68,0.25);
}
.btn-danger:hover { background: linear-gradient(135deg,#DC2626,#B91C1C); transform: scale(1.01); }
.btn-danger:active { transform: scale(0.98); }
.btn-outline {
  border: 1px solid var(--bdr); background: white; color: #475569; font-weight: 500;
}
.btn-outline:hover { background: #F8FAFC; }
.btn-icon {
  padding: 7px; border-radius: 9px;
  color: #94A3B8; transition: var(--tr);
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover { color: #059669; background: #ECFDF5; }
.btn-icon.danger:hover { color: #EF4444; background: #FEF2F2; }

/* ═══════════════════════════════════════════════════════════════
   INPUTS (shared)
═══════════════════════════════════════════════════════════════ */
.input-group { position: relative; }
.input-group .input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: #94A3B8; pointer-events: none; display: flex;
}
.input {
  width: 100%; padding: 10px 16px 10px 40px;
  border-radius: 11px; border: 1px solid var(--bdr);
  background: rgba(248,250,252,0.5);
  font-size: 0.875rem; color: #0F172A;
  outline: none; transition: var(--tr);
}
.input::placeholder { color: #94A3B8; }
.input:focus { border-color: #059669; box-shadow: 0 0 0 3px rgba(5,150,105,0.1); background: white; }

/* ═══════════════════════════════════════════════════════════════
   CARD (shared)
═══════════════════════════════════════════════════════════════ */
.card {
  background: white; border-radius: var(--rl);
  border: 1px solid rgba(226,232,240,0.6);
  box-shadow: var(--sh-sm);
}

/* ═══════════════════════════════════════════════════════════════
   PAGE CONTENT WRAPPER
═══════════════════════════════════════════════════════════════ */
.page-content {
  width: 95%; max-width: 1800px; margin: 0 auto;
  padding: 32px 0;
  animation: page-enter 0.35s cubic-bezier(0.4,0,0.2,1);
}
@media (min-width: 640px) { .page-content { padding: 24px; } }

.page-heading { font-size: 1.5rem; font-weight: 700; color: #0F172A; }
.page-subheading { font-size: 0.875rem; color: #64748B; margin-top: 4px; }
.page-header { margin-bottom: 24px; }
.page-header-row {
  display: flex; flex-direction: column; gap: 16px;
}
@media (min-width: 640px) {
  .page-header-row { flex-direction: row; align-items: center; justify-content: space-between; }
}
.page-header-icon-row {
  display: flex; align-items: center; gap: 12px;
}
.page-header-icon {
  padding: 8px; border-radius: 11px; background: #ECFDF5;
  display: flex; align-items: center; justify-content: center;
}
.page-header-icon svg { color: #059669; }

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════════ */
#login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #F8FAFC 0%, rgba(16,185,129,0.05) 50%, #F1F5F9 100%);
  padding: 32px 16px; position: relative; overflow: hidden;
}
.login-blob {
  position: absolute; border-radius: 50%;
  pointer-events: none; filter: blur(60px);
}
.login-blob-1 {
  top: -10%; right: -5%; width: 500px; height: 500px;
  background: rgba(16,185,129,0.08);
  animation: scale-in 1s ease-out 0.3s both;
}
.login-blob-2 {
  bottom: -15%; left: -10%; width: 600px; height: 600px;
  background: rgba(245,158,11,0.07);
  animation: scale-in 1.2s ease-out 0.4s both;
}
.login-blob-3 {
  top: 40%; left: 60%; width: 300px; height: 300px;
  background: rgba(16,185,129,0.05);
}
.login-card-wrap {
  width: 100%; max-width: 440px; position: relative; z-index: 10;
  animation: card-in 0.5s cubic-bezier(0.4,0,0.2,1) forwards;
}
.login-card {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.08), 0 0 0 1px rgba(226,232,240,0.6);
  overflow: hidden;
}
.login-header {
  padding: 32px 32px 24px; text-align: center;
}
.login-logo-icon {
  width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 20px;
  background: linear-gradient(135deg, #10B981, #047857);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(5,150,105,0.3);
  transition: transform 0.3s, box-shadow 0.3s; cursor: default;
}
.login-logo-icon:hover { transform: scale(1.05) rotate(-3deg); box-shadow: 0 8px 30px rgba(5,150,105,0.45); }
.login-logo-icon svg { color: white; }
.login-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; color: #0F172A; margin-bottom: 4px; }
.login-title .accent { color: #059669; }
.login-subtitle { font-size: 0.875rem; color: #64748B; }
.login-form-body { padding: 0 32px 32px; display: flex; flex-direction: column; gap: 16px; }
.login-label { display: block; font-size: 0.875rem; font-weight: 500; color: #475569; margin-bottom: 6px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 40px; }
.pw-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: #94A3B8; cursor: pointer; transition: color 0.2s; display: flex;
}
.pw-toggle:hover { color: #475569; }
.hearing-row { display: flex; gap: 12px; }
.hearing-btn {
  flex: 1; padding: 10px 8px; border-radius: 11px;
  border: 2px solid var(--bdr); font-size: 0.8rem; font-weight: 500; color: #64748B;
  background: rgba(248,250,252,0.5); transition: var(--tr); text-align: center; cursor: pointer;
}
.hearing-btn:hover { border-color: #94A3B8; background: white; }
.hearing-btn.active { border-color: #059669; background: #ECFDF5; color: #059669; box-shadow: var(--sh-sm); }
.hearing-row-wrap { overflow: hidden; }
.hearing-row-wrap.hidden-field { display: none; }
.login-submit-btn {
  width: 100%; padding: 12px; border-radius: 11px;
  background: linear-gradient(135deg, #059669, #10B981);
  color: white; font-size: 0.875rem; font-weight: 600;
  box-shadow: 0 4px 14px rgba(5,150,105,0.3);
  transition: var(--tr); display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border: none; font-family: inherit; margin-top: 8px;
}
.login-submit-btn:hover { background: linear-gradient(135deg,#047857,#059669); box-shadow: 0 4px 20px rgba(5,150,105,0.45); transform: scale(1.01); }
.login-submit-btn:active { transform: scale(0.98); }
.login-footer-bar {
  padding: 20px 32px; background: rgba(248,250,252,0.8);
  border-top: 1px solid #F1F5F9; text-align: center;
}
.login-footer-bar p { font-size: 0.875rem; color: #64748B; }
.login-switch-btn { color: #059669; font-weight: 600; cursor: pointer; transition: color 0.2s; background: none; border: none; font-family: inherit; font-size: inherit; }
.login-switch-btn:hover { color: #047857; }
.login-tagline {
  text-align: center; font-size: 0.75rem; color: #94A3B8; margin-top: 20px;
  animation: fade-in 0.5s ease-out 0.6s both;
}
.name-field-wrap { overflow: hidden; transition: max-height 0.3s ease, opacity 0.3s ease; max-height: 0; opacity: 0; }
.name-field-wrap.show { max-height: 100px; opacity: 1; }

/* ═══════════════════════════════════════════════════════════════
   TRANSLATE PAGE
═══════════════════════════════════════════════════════════════ */
.translate-page { display: flex; flex-direction: column; gap: 24px; }

/* Webcam */
.webcam-wrap {
  position: relative; border-radius: var(--rl); overflow: hidden;
  background: #0F172A; aspect-ratio: 16/9;
  width: 100%; max-width: 768px; margin: 0 auto;
}
.webcam-wrap video, .webcam-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.webcam-off-state {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #64748B; padding: 24px;
}
.webcam-off-state svg { margin-bottom: 16px; opacity: 0.3; }
.webcam-off-state .off-text { font-size: 0.875rem; font-weight: 500; opacity: 0.6; }
.webcam-off-state .off-hint { font-size: 0.75rem; opacity: 0.4; margin-top: 4px; text-align: center; }
.webcam-overlay {
  position: absolute; inset: 0; pointer-events: none;
  border-radius: var(--rl); border: 3px solid transparent; transition: var(--tr);
}
.webcam-wrap.active .webcam-overlay {
  border-color: var(--p);
  box-shadow: inset 0 0 30px rgba(5,150,105,0.1);
}
.corner-bracket {
  position: absolute; width: 32px; height: 32px;
  border-style: solid; border-color: #10B981; opacity: 0.85;
}
.corner-tl { top: 16px; left: 16px; border-width: 3px 0 0 3px; border-radius: 8px 0 0 0; }
.corner-tr { top: 16px; right: 16px; border-width: 3px 3px 0 0; border-radius: 0 8px 0 0; }
.corner-bl { bottom: 16px; left: 16px; border-width: 0 0 3px 3px; border-radius: 0 0 0 8px; }
.corner-br { bottom: 16px; right: 16px; border-width: 0 3px 3px 0; border-radius: 0 0 8px 0; }
.live-badge {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 6px 14px;
  border-radius: 999px; background: rgba(239,68,68,0.9);
  backdrop-filter: blur(8px); color: white;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em;
  animation: scale-in 0.3s ease-out;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: white; animation: live-blink 1.2s infinite; }
.camera-controls { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }

/* TTS toggle button states */
.tts-toggle-btn {
  display: inline-flex; align-items: center; gap: 8px;
  transition: var(--tr);
}
.tts-toggle-btn.tts-on {
  border-color: #10B981 !important;
  color: #059669 !important;
  background: #ECFDF5 !important;
}
.tts-toggle-btn.tts-on:hover {
  background: #D1FAE5 !important;
  box-shadow: 0 0 0 3px rgba(5,150,105,0.15);
}
.tts-toggle-btn.tts-off {
  border-color: #FCA5A5 !important;
  color: #DC2626 !important;
  background: #FEF2F2 !important;
}
.tts-toggle-btn.tts-off:hover {
  background: #FEE2E2 !important;
}

/* Translation Output */
.output-card {
  background: white; border-radius: var(--rl);
  border: 1px solid rgba(226,232,240,0.6); box-shadow: var(--sh-sm); overflow: hidden;
  width: 100%; max-width: 768px; margin: 0 auto;
}
.output-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid #F1F5F9;
  background: rgba(248,250,252,0.5);
}
.output-label { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; font-weight: 500; color: #475569; }
.output-label svg { color: #059669; }
.output-action-btns { display: flex; gap: 4px; }
.output-body { padding: 16px 20px; min-height: 80px; display: flex; align-items: center; }
.output-text { font-size: 1.1rem; font-weight: 600; color: #0F172A; animation: fade-in 0.3s ease-out; }
.output-placeholder { font-size: 0.875rem; color: #94A3B8; }
.output-loading { display: flex; align-items: center; gap: 12px; color: #059669; }
.output-loading .loading-text { font-size: 0.875rem; font-weight: 500; }

/* Mini History */
.mini-history-section { width: 100%; max-width: 768px; margin: 0 auto; }
.mini-history-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.mini-history-label { font-size: 0.7rem; font-weight: 600; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.08em; }
.mini-history-count { font-size: 0.75rem; color: #94A3B8; }
.mini-history-scroll {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px;
}
.mini-history-scroll::-webkit-scrollbar { height: 3px; }
.mini-history-scroll::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 2px; }
.mini-tag {
  flex-shrink: 0; padding: 6px 12px;
  background: #ECFDF5; border: 1px solid rgba(16,185,129,0.3);
  border-radius: 8px; font-size: 0.75rem; font-weight: 500; color: #059669;
  animation: fade-in 0.3s ease-out;
}

/* ═══════════════════════════════════════════════════════════════
   HISTORY PAGE
═══════════════════════════════════════════════════════════════ */
.filters-bar {
  display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px;
}
@media (min-width: 640px) { .filters-bar { flex-direction: row; align-items: center; } }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 12px; border-radius: 9px; border: 1px solid var(--bdr);
  font-size: 0.75rem; font-weight: 500; color: #64748B;
  background: white; transition: var(--tr); cursor: pointer;
}
.chip:hover { border-color: #94A3B8; }
.chip.active { border-color: #059669; background: #ECFDF5; color: #059669; }

/* Table */
.table-wrap {
  background: white; border-radius: var(--rl);
  border: 1px solid rgba(226,232,240,0.6); box-shadow: var(--sh-sm); overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead tr { background: rgba(248,250,252,0.6); border-bottom: 1px solid #F1F5F9; }
.data-table th {
  padding: 12px 20px; text-align: left;
  font-size: 0.7rem; font-weight: 700; color: #94A3B8;
  text-transform: uppercase; letter-spacing: 0.07em;
  cursor: pointer; user-select: none; white-space: nowrap;
}
.data-table th:hover { color: #475569; }
.th-inner { display: flex; align-items: center; gap: 6px; }
.sort-arrow { color: #059669; font-weight: 700; }
.data-table tbody tr { border-bottom: 1px solid #F1F5F9; transition: background 0.15s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(248,250,252,0.5); }
.data-table td { padding: 14px 20px; font-size: 0.875rem; vertical-align: middle; }
.desktop-table-wrap { display: none; overflow-x: auto; }
@media (min-width: 768px) { .desktop-table-wrap { display: block; } }
.mobile-cards-list { display: block; }
@media (min-width: 768px) { .mobile-cards-list { display: none; } }
.mobile-row { padding: 16px; border-bottom: 1px solid #F1F5F9; animation: fade-in 0.3s ease-out; }
.mobile-row:last-child { border-bottom: none; }

/* Confidence badges */
.conf-badge { display: inline-flex; padding: 2px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; }
.conf-high { background: #ECFDF5; color: #059669; }
.conf-mid  { background: #FFFBEB; color: #D97706; }
.conf-low  { background: #FEF2F2; color: #DC2626; }

/* Type badge */
.type-asl  { background: #ECFDF5; color: #059669; }
.type-text { background: #FFFBEB; color: #D97706; }

/* Pagination */
.pagination-wrap {
  display: flex; align-items: center; justify-content: space-between; margin-top: 16px; flex-wrap: wrap; gap: 8px;
}
.pagination-info { font-size: 0.75rem; color: #94A3B8; }
.pagination-pages { display: flex; align-items: center; gap: 4px; }
.pg-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 500; color: #64748B;
  border: 1px solid var(--bdr); background: white; transition: var(--tr); cursor: pointer;
}
.pg-btn:hover:not(:disabled) { background: #F1F5F9; }
.pg-btn.active { background: #059669; color: white; border-color: #059669; box-shadow: var(--sh-sm); }
.pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Detail panel */
.detail-panel {
  margin-top: 16px; background: white; border-radius: var(--rl);
  border: 1px solid rgba(16,185,129,0.3); box-shadow: var(--sh-sm);
  padding: 20px; animation: fade-in 0.3s ease-out;
}
.detail-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.detail-panel-title { font-size: 0.875rem; font-weight: 600; color: #0F172A; }
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .detail-grid { grid-template-columns: 1fr 1fr; } }
.detail-label { font-size: 0.75rem; color: #94A3B8; margin-bottom: 4px; }
.detail-value { font-size: 0.875rem; font-weight: 500; color: #334155; }

/* Empty state */
.empty-state { padding: 64px 24px; text-align: center; }
.empty-state svg { margin: 0 auto 12px; color: #CBD5E1; }
.empty-state-title { font-size: 0.875rem; color: #94A3B8; }
.empty-state-hint { font-size: 0.75rem; color: #CBD5E1; margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════
   DICTIONARY PAGE
═══════════════════════════════════════════════════════════════ */
.dict-filters-card {
  background: white; border-radius: var(--rl);
  border: 1px solid rgba(226,232,240,0.6); box-shadow: var(--sh-sm);
  padding: 16px; margin-bottom: 24px;
}
.dict-top-bar { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 640px) { .dict-top-bar { flex-direction: row; align-items: center; } }
.sort-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px; border-radius: 11px;
  border: 1px solid var(--bdr); background: rgba(248,250,252,0.5);
  font-size: 0.875rem; font-weight: 500; color: #475569;
  transition: var(--tr); cursor: pointer; white-space: nowrap;
}
.sort-btn:hover { background: white; }
.view-toggle { display: flex; border: 1px solid var(--bdr); border-radius: 11px; overflow: hidden; }
.view-btn { padding: 8px 16px; font-size: 0.875rem; font-weight: 500; transition: var(--tr); cursor: pointer; border: none; font-family: inherit; }
.view-btn.active { background: #059669; color: white; }
.view-btn:not(.active) { background: white; color: #64748B; }
.view-btn:not(.active):hover { background: #F8FAFC; }
.cat-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.cat-chip {
  padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--bdr); font-size: 0.75rem; font-weight: 500;
  color: #64748B; background: white; transition: var(--tr); cursor: pointer; text-transform: capitalize;
}
.cat-chip:hover { border-color: #94A3B8; }
.cat-chip.active { border-color: #059669; background: #ECFDF5; color: #059669; }
.dict-count { font-size: 0.75rem; color: #94A3B8; margin-bottom: 16px; }

/* Grid view */
.dict-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.dict-card {
  background: white; border-radius: var(--rl);
  border: 1px solid rgba(226,232,240,0.6); box-shadow: var(--sh-sm);
  overflow: hidden; transition: var(--tr); cursor: default;
}
.dict-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.dict-img-wrap {
  position: relative; aspect-ratio: 1/1; overflow: hidden; background: #F1F5F9;
}
.dict-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.dict-card:hover .dict-img-wrap img { transform: scale(1.06); }
.dict-overlay-badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.dict-overlay-diff { position: absolute; top: 10px; right: 10px; }
.dict-speak-btn {
  position: absolute; bottom: 10px; right: 10px;
  padding: 6px; border-radius: 50%; background: rgba(255,255,255,0.92);
  color: #64748B; box-shadow: var(--sh-sm);
  opacity: 0; transition: var(--tr); cursor: pointer; border: none; display: flex;
}
.dict-card:hover .dict-speak-btn { opacity: 1; }
.dict-speak-btn:hover { color: #059669; }
.dict-card-body { padding: 14px; }
.dict-card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dict-word { font-size: 1rem; font-weight: 700; color: #0F172A; }
.dict-expand-btn { font-size: 0.75rem; color: #059669; font-weight: 500; cursor: pointer; background: none; border: none; font-family: inherit; }
.dict-expand-btn:hover { color: #047857; text-decoration: underline; }
.dict-desc { font-size: 0.75rem; color: #64748B; line-height: 1.5; animation: fade-in 0.2s ease-out; }
.dict-collapse-btn { font-size: 0.75rem; color: #059669; font-weight: 500; cursor: pointer; margin-top: 6px; display: block; background: none; border: none; font-family: inherit; }

/* List view */
.dict-list { display: flex; flex-direction: column; gap: 8px; }
.dict-list-item {
  background: white; border-radius: 12px;
  border: 1px solid rgba(226,232,240,0.6); box-shadow: var(--sh-sm);
  padding: 12px 16px; display: flex; align-items: center; gap: 16px;
  transition: var(--tr); cursor: default; overflow: hidden;
}
.dict-list-item:hover { box-shadow: var(--sh-md); }
.dict-list-thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; background: #F1F5F9; flex-shrink: 0; }
.dict-list-meta { flex: 1; min-width: 0; }
.dict-list-name-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.dict-list-name { font-size: 0.875rem; font-weight: 700; color: #0F172A; }
.dict-list-desc { font-size: 0.75rem; color: #64748B; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Difficulty + category inline badges */
.badge-xs { display: inline-flex; padding: 2px 7px; border-radius: 5px; font-size: 0.65rem; font-weight: 700; }
.d-beginner { background: #DCFCE7; color: #16A34A; }
.d-intermediate { background: #FEF3C7; color: #B45309; }
.d-advanced { background: #FEE2E2; color: #B91C1C; }
.c-greetings  { background: #ECFDF5; color: #059669; border: 1px solid rgba(16,185,129,0.3); }
.c-manners    { background: #FFFBEB; color: #D97706; border: 1px solid rgba(245,158,11,0.3); }
.c-actions    { background: #F0F9FF; color: #0284C7; border: 1px solid rgba(2,132,199,0.3); }
.c-basics     { background: #F5F3FF; color: #7C3AED; border: 1px solid rgba(124,58,237,0.3); }
.c-emotions   { background: #FFF1F2; color: #BE185D; border: 1px solid rgba(190,24,93,0.3); }
.c-adjectives { background: #F0FDFA; color: #0D9488; border: 1px solid rgba(13,148,136,0.3); }
.c-people     { background: #FFF7ED; color: #C2410C; border: 1px solid rgba(194,65,12,0.3); }
.c-education  { background: #ECFEFF; color: #0E7490; border: 1px solid rgba(14,116,144,0.3); }

/* ═══════════════════════════════════════════════════════════════
   ADMIN PAGE
═══════════════════════════════════════════════════════════════ */
.admin-layout { display: flex; flex-direction: column; gap: 24px; }
@media (min-width: 1024px) { .admin-layout { flex-direction: row; align-items: flex-start; } }
.admin-sidebar-nav {
  background: white; border-radius: var(--rl);
  border: 1px solid rgba(226,232,240,0.6); box-shadow: var(--sh-sm);
  padding: 8px; display: flex; flex-direction: column; gap: 4px;
  animation: fade-in 0.4s ease-out;
}
@media (min-width: 1024px) { .admin-sidebar-nav { width: 240px; flex-shrink: 0; position: sticky; top: 88px; } }
.admin-nav-btn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 11px;
  font-size: 0.875rem; font-weight: 500; color: #64748B;
  background: none; border: none; cursor: pointer; text-align: left;
  transition: var(--tr); font-family: inherit;
}
.admin-nav-btn:hover { color: #334155; background: #F8FAFC; }
.admin-nav-btn.active { background: #ECFDF5; color: #059669; }
.admin-nav-arrow { margin-left: auto; transition: transform 0.2s; opacity: 0; }
.admin-nav-btn.active .admin-nav-arrow { opacity: 1; transform: rotate(90deg); color: #059669; }
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 24px; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .stats-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1280px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card {
  background: white; border-radius: var(--rl);
  border: 1px solid rgba(226,232,240,0.6); box-shadow: var(--sh-sm);
  padding: 20px; transition: var(--tr); animation: card-in 0.4s ease-out backwards;
}
.stat-card:hover { box-shadow: var(--sh-md); }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.stat-icon { padding: 10px; border-radius: 11px; display: flex; box-shadow: var(--sh-md); }
.stat-icon svg { color: white; }
.stat-icon.emerald { background: linear-gradient(135deg, #10B981, #059669); box-shadow: 0 4px 12px rgba(5,150,105,0.3); }
.stat-icon.amber   { background: linear-gradient(135deg, #F59E0B, #D97706); box-shadow: 0 4px 12px rgba(245,158,11,0.3); }
.stat-icon.teal    { background: linear-gradient(135deg, #14B8A6, #0D9488); box-shadow: 0 4px 12px rgba(20,184,166,0.3); }
.stat-icon.slate   { background: linear-gradient(135deg, #64748B, #475569); box-shadow: 0 4px 12px rgba(100,116,139,0.2); }
.stat-change { display: flex; align-items: center; gap: 3px; font-size: 0.75rem; font-weight: 600; }
.stat-change.up   { color: #059669; }
.stat-change.down { color: #EF4444; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: #0F172A; }
.stat-label { font-size: 0.75rem; color: #94A3B8; margin-top: 2px; }

/* Two col */
.two-col-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 1280px) { .two-col-grid { grid-template-columns: 1fr 1fr; } }

/* Recent activity */
.activity-card {
  background: white; border-radius: var(--rl);
  border: 1px solid rgba(226,232,240,0.6); box-shadow: var(--sh-sm);
  overflow: hidden; animation: card-in 0.4s ease-out backwards;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #F1F5F9;
}
.card-header-title { font-size: 0.875rem; font-weight: 600; color: #0F172A; }
.card-header-link { font-size: 0.75rem; color: #059669; font-weight: 500; cursor: pointer; background: none; border: none; font-family: inherit; }
.card-header-link:hover { color: #047857; text-decoration: underline; }
.activity-list { overflow-y: auto; max-height: 360px; }
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 20px; transition: background 0.15s;
  border-bottom: 1px solid rgba(241,245,249,0.8);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: rgba(248,250,252,0.5); }
.activity-icon { flex-shrink: 0; margin-top: 2px; display: flex; }
.activity-text { font-size: 0.875rem; color: #475569; line-height: 1.4; }
.activity-text strong { color: #0F172A; font-weight: 600; }
.activity-time { font-size: 0.7rem; color: #94A3B8; margin-top: 4px; display: flex; align-items: center; gap: 4px; }

/* Top users */
.top-users-list { overflow: hidden; }
.top-user-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; transition: background 0.15s;
  border-bottom: 1px solid rgba(241,245,249,0.8);
}
.top-user-item:last-child { border-bottom: none; }
.top-user-item:hover { background: rgba(248,250,252,0.5); }
.rank-badge {
  width: 24px; height: 24px; border-radius: 50%;
  background: #F1F5F9; display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; color: #64748B; flex-shrink: 0;
}
.user-avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #34D399, #059669);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.75rem; font-weight: 600; flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; }
.user-name { font-size: 0.875rem; font-weight: 500; color: #334155; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-sessions { font-size: 0.7rem; color: #94A3B8; }
.user-accuracy { text-align: right; flex-shrink: 0; }
.accuracy-val { font-size: 0.875rem; font-weight: 700; color: #059669; }
.accuracy-label { font-size: 0.6rem; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.05em; }

/* Quick actions */
.quick-actions-card {
  background: white; border-radius: var(--rl);
  border: 1px solid rgba(226,232,240,0.6); box-shadow: var(--sh-sm);
  padding: 20px; animation: card-in 0.4s ease-out backwards;
}
.quick-actions-title { font-size: 0.875rem; font-weight: 600; color: #0F172A; margin-bottom: 16px; }
.quick-actions-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .quick-actions-grid { grid-template-columns: repeat(3, 1fr); } }
.quick-action-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 11px;
  border: 1px solid var(--bdr); background: white;
  transition: var(--tr); cursor: pointer; font-family: inherit; text-align: left;
}
.quick-action-btn:hover { border-color: rgba(16,185,129,0.4); background: rgba(236,253,245,0.5); }
.quick-action-icon {
  padding: 8px; border-radius: 9px; background: #F1F5F9;
  display: flex; align-items: center; justify-content: center;
  transition: var(--tr);
}
.quick-action-icon svg { color: #64748B; transition: var(--tr); }
.quick-action-btn:hover .quick-action-icon { background: #DCFCE7; }
.quick-action-btn:hover .quick-action-icon svg { color: #059669; }
.quick-action-name { font-size: 0.875rem; font-weight: 500; color: #334155; }
.quick-action-desc { font-size: 0.7rem; color: #94A3B8; }

/* ═══════════════════════════════════════════════════════════════
   LIVE DETECTION INDICATOR (translate page)
═══════════════════════════════════════════════════════════════ */
@keyframes bar-fill {
  from { width: 0; }
}
.output-detecting {
  display: flex; flex-direction: column; gap: 8px;
  width: 100%; animation: fade-in 0.25s ease-out;
}
.detecting-label {
  display: flex; align-items: center; justify-content: space-between;
}
.detecting-word {
  font-size: 1.1rem; font-weight: 700; color: #059669;
  text-transform: capitalize; letter-spacing: -0.01em;
}
.detecting-conf {
  font-size: 0.8rem; font-weight: 600; color: #94A3B8;
  background: #F1F5F9; padding: 2px 8px; border-radius: 6px;
}
.detecting-bar-wrap {
  width: 100%; height: 6px; background: #E2E8F0; border-radius: 999px; overflow: hidden;
}
.detecting-bar {
  height: 100%; background: linear-gradient(90deg, #10B981, #059669);
  border-radius: 999px; transition: width 0.4s ease-out;
  animation: bar-fill 0.4s ease-out;
}
.detecting-hint {
  font-size: 0.75rem; color: #94A3B8; font-style: italic;
}
