:root {
  --bg-base: #0d1117;
  --bg-surface: #161b22;
  --bg-elevated: #1c2128;
  --bg-hover: #21262d;
  --border: #30363d;
  --border-bright: #484f58;
  --accent: #00b4d8;
  --accent-dark: #0096b7;
  --accent-glow: rgba(0, 180, 216, 0.15);
  --accent-2: #7c3aed;
  --danger: #f85149;
  --success: #3fb950;
  --warning: #d29922;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --sidebar-w: 280px;
  --navbar-h: 56px;
  --radius: 10px;
  --radius-sm: 6px;
  --transition: all 0.2s ease;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
}

/* ─── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 3px;
}

/* ─── Navbar ─────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  min-height: var(--navbar-h);
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  flex-wrap: wrap;
  gap: 6px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-icon {
  font-size: 24px;
}

.nav-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.nav-ai {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: var(--navbar-h);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

/* Mobile info bar — hidden on desktop */
.nav-info-bar {
  display: none;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 0 6px;
  border-top: 1px solid var(--border);
  flex-wrap: nowrap;
}

.nav-desktop-only {
  display: flex !important;
}

@media (max-width: 768px) {
  .nav-info-bar {
    display: flex;
  }

  .nav-desktop-only {
    display: none !important;
  }
}

.storage-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: default;
  white-space: nowrap;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
  display: none;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-hover);
}

/* ─── Layout ─────────────────────────────────────────── */
.layout {
  display: flex;
  margin-top: var(--navbar-h);
  min-height: calc(100vh - var(--navbar-h));
}

/* ─── Sidebar ────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: var(--navbar-h);
  bottom: 0;
  left: 0;
  transition: transform 0.3s ease;
  z-index: 900;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.sidebar-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.btn-new {
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, var(--accent), #0077a8);
  border: none;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-new:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.workspace-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.empty-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  gap: 8px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 36px;
  opacity: 0.5;
}

.empty-list p {
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
}

.workspace-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  margin-bottom: 4px;
  position: relative;
}

.workspace-item:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.workspace-item.active {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.ws-item-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.ws-item-info {
  flex: 1;
  min-width: 0;
}

.ws-item-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-item-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.ws-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}

.ws-status-dot.ready {
  background: var(--success);
}

.ws-status-dot.error {
  background: var(--danger);
}

.ws-status-dot.processing {
  background: var(--warning);
  animation: pulse 1s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* ─── Main content ───────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  min-height: calc(100vh - var(--navbar-h));
}

.view {
  max-width: 900px;
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

/* ─── Upload Hero ────────────────────────────────────── */
.upload-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 0;
  position: relative;
}

.hero-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 300px;
  background: radial-gradient(ellipse at center, rgba(0, 180, 216, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 17px;
  max-width: 560px;
  line-height: 1.6;
  margin-bottom: 36px;
}

/* ─── Upload Zone ────────────────────────────────────── */
.upload-zone {
  width: 100%;
  max-width: 620px;
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 40px 24px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-surface);
  margin-bottom: 48px;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.upload-text {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.upload-link {
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
}

.upload-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.upload-progress {
  margin-top: 20px;
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 3px;
  transition: width 0.3s;
  width: 0%;
}

#progressText {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ─── Feature Grid ───────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
}

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: var(--transition);
}

.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.feat-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─── Workspace View ─────────────────────────────────── */
.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.ws-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-back {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-back:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ws-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ws-icon {
  font-size: 24px;
}

.ws-title {
  font-size: 18px;
  font-weight: 700;
}

.ws-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.btn-danger-sm {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger-sm:hover {
  background: rgba(248, 81, 73, 0.2);
}

/* ─── Tabs ───────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ─── Panel Actions ──────────────────────────────────── */
.panel-action {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.lang-select-wrap,
.style-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.select-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.select-input:focus {
  outline: none;
  border-color: var(--accent);
}

.style-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.style-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.style-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.style-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ─── Buttons ────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0077a8);
  border: none;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-bright);
}

.btn-download {
  background: linear-gradient(135deg, var(--success), #2ea043);
  border: none;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.btn-download:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

/* ─── Result Box ─────────────────────────────────────── */
.result-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.btn-copy {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-copy:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.result-content {
  padding: 20px;
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
  max-height: 60vh;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
}

.markdown-content {
  font-family: 'Inter', sans-serif;
  white-space: normal;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
  font-weight: 700;
  margin: 16px 0 8px;
  color: var(--accent);
}

.markdown-content ul,
.markdown-content ol {
  padding-left: 20px;
  margin: 8px 0;
}

.markdown-content li {
  margin: 4px 0;
}

.markdown-content strong {
  color: var(--text-primary);
  font-weight: 700;
}

.markdown-content p {
  margin: 8px 0;
}

/* ─── Loading Overlay ────────────────────────────────── */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
}

.loading-overlay p {
  font-size: 15px;
}

.loading-overlay small {
  font-size: 12px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Notice ─────────────────────────────────────────── */
.notice-box {
  background: rgba(210, 153, 34, 0.1);
  border: 1px solid rgba(210, 153, 34, 0.3);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 14px;
  color: var(--warning);
}

/* ─── Export ─────────────────────────────────────────── */
.export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.export-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
}

.export-card:hover {
  border-color: var(--border-bright);
}

.export-icon {
  font-size: 40px;
}

.export-card h3 {
  font-size: 18px;
  font-weight: 700;
}

.export-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─── Toast ──────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  z-index: 9999;
  max-width: 320px;
  animation: slideUp 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--danger);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Responsive: Mobile ─────────────────────────────── */
@media (max-width: 768px) {
  .btn-icon {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 85vw;
    top: calc(var(--navbar-h) + 38px);
    /* account for 2-row mobile navbar */
    z-index: 920;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.6);
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  /* Account for 2-row navbar on mobile */
  .layout {
    margin-top: calc(var(--navbar-h) + 38px);
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .export-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 28px;
  }

  .hero-desc {
    font-size: 15px;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab {
    font-size: 12px;
    padding: 8px 12px;
    white-space: nowrap;
  }

  .panel-action {
    flex-direction: column;
    align-items: stretch;
  }

  .style-grid {
    justify-content: flex-start;
  }
}

@media (min-width: 769px) {
  .btn-icon {
    display: none;
  }

  .sidebar {
    transform: translateX(0) !important;
  }
}

/* ─── Overlay (mobile sidebar bg) ───────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: calc(var(--navbar-h) + 38px);
  /* below 2-row navbar on mobile */
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 910;
}

.sidebar-overlay.visible {
  display: block;
}

/* ─── PPTX Theme Picker ──────────────────────────────── */
.pptx-theme-picker {
  margin: 12px 0 16px;
  text-align: left;
}

.pptx-theme-picker label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pptx-theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.pptx-theme-btn {
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 6px 8px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.pptx-theme-btn:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.pptx-theme-btn.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

/* Mini slide preview thumbnails */
.theme-preview {
  display: flex;
  flex-direction: column;
  width: 60px;
  height: 40px;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.theme-gov {
  background: #F5F7FA;
}

.theme-dark {
  background: #0D1117;
}

.theme-minimal {
  background: #FFFFFF;
  border: 1px solid #e0e0e0;
}

.theme-corporate {
  background: #F0F4F8;
}

.tp-bar {
  display: block;
  height: 12px;
  width: 100%;
}

.theme-gov .tp-bar {
  background: #0D3B6E;
}

.theme-dark .tp-bar {
  background: #0088A8;
}

.theme-minimal .tp-bar {
  background: #1A1A1A;
}

.theme-corporate .tp-bar {
  background: #003A70;
}

.tp-title,
.tp-lines {
  display: block;
  font-size: 5px;
  padding: 2px 4px;
  overflow: hidden;
  white-space: nowrap;
}

.theme-gov .tp-title,
.theme-gov .tp-lines {
  color: #1A1A2E;
}

.theme-dark .tp-title,
.theme-dark .tp-lines {
  color: #E6EDF3;
}

.theme-minimal .tp-title,
.theme-minimal .tp-lines {
  color: #1A1A1A;
}

.theme-corporate .tp-title,
.theme-corporate .tp-lines {
  color: #1A2E44;
}

.theme-name {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.pptx-theme-btn.active .theme-name {
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 480px) {
  .pptx-theme-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ─── Mobile Navbar Fix ──────────────────────────────── */
@media (max-width: 640px) {
  .nav-right {
    gap: 6px;
    overflow: hidden;
    max-width: calc(100vw - 160px);
  }

  /* Hide request badge on tiny screens */
  #requestBadge {
    display: none;
  }

  /* Compact storage badge */
  #storageBadge .storage-icon {
    display: none;
  }

  #storageText {
    font-size: 11px;
  }

  .btn-logout {
    padding: 5px 8px;
    font-size: 11px;
  }
}

@media (max-width: 400px) {
  #storageBadge {
    display: none;
  }
}


/* ─── Delete Confirmation Modal ──────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: 16px;
  padding: 32px 28px 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 28px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-modal-cancel {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  min-height: 48px;
}

.btn-modal-cancel:hover {
  background: var(--bg-hover);
  border-color: var(--border-bright);
}

.btn-modal-confirm {
  flex: 1;
  background: var(--danger);
  border: none;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-height: 48px;
}

.btn-modal-confirm:hover {
  background: #e03e37;
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .modal-box {
    padding: 24px 20px 20px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }
}

/* ─── Login Screen ───────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  z-index: 9999;
  padding: 20px;
  /* Animated background */
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(0, 180, 216, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(124, 58, 237, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 60% 80%, rgba(0, 180, 216, 0.05) 0%, transparent 60%);
}

.login-screen.hidden {
  display: none !important;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 44px 40px 36px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 24px 64px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(0, 180, 216, 0.06);
  animation: cardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-logo {
  font-size: 52px;
  display: block;
  text-align: center;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

.login-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-align: center;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 32px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.login-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.login-field input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
  width: 100%;
  outline: none;
}

.login-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

.login-field input::placeholder {
  color: var(--text-muted);
}

/* Password field with toggle button */
.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pw-wrap input {
  padding-right: 46px;
}

.pw-toggle {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  font-size: 16px;
  opacity: 0.6;
  transition: opacity 0.2s;
  line-height: 1;
}

.pw-toggle:hover {
  opacity: 1;
}

.login-error {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
}

.btn-login {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
  margin-top: 4px;
  width: 100%;
  min-height: 48px;
  position: relative;
  overflow: hidden;
}

.btn-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background 0.2s;
}

.btn-login:hover::before {
  background: rgba(255, 255, 255, 0.08);
}

.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 180, 216, 0.35);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@media (max-width: 480px) {
  .login-card {
    padding: 32px 24px 28px;
    border-radius: 16px;
  }
}

/* ─── Nav User + Logout ──────────────────────────────── */
.nav-user {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-logout:hover {
  background: rgba(248, 81, 73, 0.1);
  border-color: rgba(248, 81, 73, 0.4);
  color: var(--danger);
}

@media (max-width: 768px) {

  /* logout text hidden; shown as icon-only via CSS content trick below */
  .btn-logout {
    font-size: 0;
    padding: 5px 9px;
    letter-spacing: 0;
  }

  /* Show only the emoji icon part (⏏️) - use ::before */
  .btn-logout::before {
    content: '⏏️';
    font-size: 16px;
  }
}