/* ==========================================================================
   AEROPAD & 2FA VAULT — APPLE + WEB3 LUXURY DESIGN SYSTEM
   ========================================================================== */

:root {
  /* Dark Theme Tokens (Default) */
  --bg-canvas: #07090E;
  --bg-surface: rgba(16, 22, 34, 0.72);
  --bg-surface-hover: rgba(24, 32, 48, 0.85);
  --bg-elevated: rgba(22, 30, 46, 0.92);
  --bg-glass: rgba(255, 255, 255, 0.035);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 255, 255, 0.16);
  --border-glow: rgba(0, 242, 254, 0.4);

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-highlight: #FFFFFF;

  --accent-cyan: #00F2FE;
  --accent-indigo: #6366F1;
  --accent-emerald: #10B981;
  --accent-amber: #F59E0B;
  --accent-rose: #F43F5E;
  --accent-violet: #8B5CF6;

  --grad-aurora: linear-gradient(135deg, #00F2FE 0%, #4FACFE 50%, #6366F1 100%);
  --grad-apple: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.02) 100%);
  
  --font-sans: 'Inter var', 'Inter Variable', 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, Monaco, Consolas, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-card: 0 16px 36px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-float: 0 24px 48px -12px rgba(0, 0, 0, 0.75);
  --blur-glass: blur(28px) saturate(180%);
}

@supports (font-variation-settings: normal) {
  :root {
    --font-sans: 'Inter var', 'Inter Variable', 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', sans-serif;
  }
}

/* Light Theme Variables */
html.light {
  --bg-canvas: #F4F6FB;
  --bg-surface: rgba(255, 255, 255, 0.82);
  --bg-surface-hover: rgba(255, 255, 255, 0.95);
  --bg-elevated: #FFFFFF;
  --bg-glass: rgba(0, 0, 0, 0.02);

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-active: rgba(0, 0, 0, 0.16);
  --border-glow: rgba(0, 242, 254, 0.6);

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-highlight: #020617;

  --shadow-card: 0 16px 36px -10px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.06);
  --shadow-float: 0 24px 48px -12px rgba(15, 23, 42, 0.12);
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  font-family: var(--font-sans);
  font-feature-settings: 'cv02' 1, 'cv03' 1, 'cv04' 1, 'cv11' 1, 'ss01' 1, 'ss02' 1;
  font-variation-settings: 'opsz' 16;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Ambient Background Lights */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  transition: opacity 0.5s ease;
}

.glow-top-left {
  top: -15%;
  left: 10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.25) 0%, rgba(99, 102, 241, 0.15) 60%, transparent 80%);
}

.glow-bottom-right {
  bottom: -15%;
  right: 5%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, rgba(16, 185, 129, 0.15) 60%, transparent 80%);
}

.mesh-grid {
  position: fixed;
  inset: 0;
  background-image: 
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.03) 1px, transparent 0);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

html.light .mesh-grid {
  background-image: radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.03) 1px, transparent 0);
}

/* Typography & Utility */
.font-mono { font-family: var(--font-mono) !important; }
.font-semibold { font-weight: 600; }
.text-cyan { color: var(--accent-cyan) !important; }
.text-secondary { color: var(--text-secondary); font-size: 0.9rem; }
.text-gradient {
  background: var(--grad-aurora);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hidden { display: none !important; }

/* Glass Panel System */
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  position: relative;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

button svg {
  width: 18px;
  height: 18px;
  max-width: 18px;
  max-height: 18px;
  flex-shrink: 0;
  pointer-events: none;
}

.glass-panel-nested {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

html.light .glass-panel-nested {
  background: rgba(0, 0, 0, 0.03);
}

/* Layout */
.app-layout {
  position: relative;
  z-index: 1;
  max-width: 1380px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
}

/* Top Navigation Bar */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-radius: var(--radius-xl);
  height: 64px;
  position: relative;
  z-index: 10000;
  overflow: visible !important;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-symbol {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--grad-apple);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 242, 254, 0.2);
  transition: all 0.3s ease;
}

.brand-symbol:hover {
  border-color: var(--border-glow);
  box-shadow: 0 0 22px rgba(0, 242, 254, 0.45);
  transform: scale(1.04);
}

.brand-icon {
  width: 28px;
  height: 28px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
}

.cyrillic-ae-mark {
  font-family: var(--font-sans);
  font-weight: 800;
  letter-spacing: -0.04em;
  background: var(--grad-aurora);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-right: 1px;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
}

/* Segmented Tabs */
.glass-segment {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px;
  gap: 4px;
}

html.light .glass-segment {
  background: rgba(0, 0, 0, 0.05);
}

.nav-pill, .totp-subpill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.nav-pill svg, .totp-subpill svg {
  width: 16px;
  height: 16px;
}

.nav-pill:hover, .totp-subpill:hover {
  color: var(--text-primary);
}

.nav-pill.active, .totp-subpill.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--border-subtle);
  font-weight: 600;
}

.badge-pulse {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald);
  font-weight: 700;
  letter-spacing: 0.05em;
  animation: pulse-dot 2s infinite ease-in-out;
}

/* Nav Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.security-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-emerald);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-button:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
  transform: translateY(-1px);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

html.dark .sun-icon { display: block; }
html.dark .moon-icon { display: none; }
html.light .sun-icon { display: none; }
html.light .moon-icon { display: block; }

.glass-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lock-button svg {
  width: 14px;
  height: 14px;
  color: var(--accent-cyan);
}

/* Language Dropdown */
.lang-dropdown-wrap {
  position: relative;
  z-index: 1001;
}

.lang-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(0, 242, 254, 0.3);
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

html.light .lang-pill {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.15);
}

.lang-pill:hover, .lang-dropdown-wrap.open .lang-pill {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.35);
}

.lang-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-cyan);
}

.chevron-mini {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.lang-dropdown-wrap.open .chevron-mini {
  transform: rotate(180deg);
  color: var(--accent-cyan);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 99999;
  border-radius: var(--radius-lg);
  background: #0B0F17 !important;
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid rgba(0, 242, 254, 0.35) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 24px rgba(0, 242, 254, 0.2) !important;
  animation: menuDrop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

html.light .lang-menu {
  background: #FFFFFF !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18) !important;
}

@keyframes menuDrop {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.lang-menu.show {
  display: flex !important;
}

.lang-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  user-select: none;
}

.lang-opt .flag {
  font-size: 1.2rem;
  line-height: 1;
}

.lang-opt:hover {
  background: rgba(0, 242, 254, 0.12);
  color: var(--accent-cyan);
  transform: translateX(3px);
}

.lang-opt.active {
  background: rgba(0, 242, 254, 0.18);
  color: var(--accent-cyan);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(0, 242, 254, 0.3);
}

/* Tab Panels Switching */
.tab-pane {
  display: none;
  animation: fadeIn 0.35s ease;
}

.tab-pane.active {
  display: block;
}

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

/* ==========================================================================
   TAB 1: SMART NOTEPAD LAYOUT
   ========================================================================== */
.notepad-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 20px;
  height: calc(100vh - 124px);
  min-height: 580px;
}

/* Sidebar */
.notepad-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-header {
  padding: 16px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.glass-input-group {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

html.light .glass-input-group {
  background: rgba(0, 0, 0, 0.04);
}

.glass-input-group svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.glass-input-group input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  width: 100%;
}

.btn-primary-gradient {
  background: var(--grad-aurora);
  color: #07090E;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 242, 254, 0.3);
  transition: all 0.25s ease;
}

.btn-primary-gradient:hover {
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.45);
  transform: translateY(-1px);
}

/* Premium Apple + Web3 'Thêm Mã Mới' Action Button */
.btn-add-vault {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 20px 6px 8px;
  border-radius: var(--radius-full);
  background: var(--grad-aurora);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #07090E;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 4px 20px -2px rgba(0, 242, 254, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.8);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  user-select: none;
}

.btn-add-vault:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 30px rgba(0, 242, 254, 0.6), 0 0 18px rgba(99, 102, 241, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.7);
}

.btn-add-vault:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 2px 10px rgba(0, 242, 254, 0.3);
}

.btn-icon-capsule {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(7, 9, 14, 0.92);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.btn-icon-capsule svg {
  width: 15px;
  height: 15px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-add-vault:hover .btn-icon-capsule svg {
  transform: rotate(90deg) scale(1.15);
  color: #FFFFFF;
}

.btn-add-vault:hover .btn-icon-capsule {
  background: #07090E;
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.7);
}

.btn-text-label {
  font-weight: 700;
  color: #07090E;
}

/* Sub-pixel subtle animated light reflection */
.btn-shimmer {
  position: absolute;
  top: -50%;
  left: -60%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.45) 50%,
    transparent 100%
  );
  transform: rotate(25deg);
  pointer-events: none;
  animation: shimmer-swipe 4s infinite ease-in-out;
}

@keyframes shimmer-swipe {
  0% { left: -60%; opacity: 0; }
  15% { opacity: 1; }
  35% { left: 140%; opacity: 0; }
  100% { left: 140%; opacity: 0; }
}

.btn-icon-round {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon-round svg {
  width: 18px;
  height: 18px;
}

.notes-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-item {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.note-item:hover {
  background: var(--bg-glass);
  border-color: var(--border-subtle);
}

.note-item.active {
  background: var(--bg-surface-hover);
  border-color: var(--border-active);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.note-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item-snippet {
  font-size: 0.775rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
}

.vault-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.progress-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--grad-aurora);
}

.stat-sub {
  font-size: 0.6875rem;
  color: var(--accent-cyan);
}

/* Main Editor */
.notepad-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.editor-header {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  gap: 16px;
}

.editor-title-input {
  font-size: 1.25rem;
  font-weight: 700;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  flex: 1;
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.save-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--accent-emerald);
  opacity: 0.85;
}

.save-indicator svg {
  width: 14px;
  height: 14px;
}

.editor-mode-toggle button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.editor-mode-toggle button.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
}

.btn-glass {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-glass:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-active);
}

.btn-glass svg {
  width: 14px;
  height: 14px;
}

.btn-danger-ghost {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.btn-danger-ghost:hover {
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.1);
}

.btn-danger-ghost svg {
  width: 18px;
  height: 18px;
}

.dropdown-export {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 180px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}

.dropdown-menu.show {
  display: flex;
}

.dropdown-menu button {
  background: transparent;
  border: none;
  text-align: left;
  padding: 8px 12px;
  font-size: 0.8125rem;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.dropdown-menu button:hover {
  background: var(--bg-glass);
}

/* Toolbar */
.editor-toolbar {
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
}

html.light .editor-toolbar {
  background: rgba(0, 0, 0, 0.02);
}

.editor-toolbar button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.editor-toolbar button:hover {
  background: var(--bg-glass);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.toolbar-divider {
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
  margin: 0 4px;
}

.btn-tool-copy {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-tool-copy svg {
  width: 14px;
  height: 14px;
}

/* Workspace */
.editor-workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.raw-editor {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  padding: 24px;
  font-size: 1rem;
  line-height: 1.7;
  resize: none;
  font-family: var(--font-sans);
}

.markdown-preview {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  border-left: 1px solid var(--border-subtle);
  line-height: 1.7;
  font-size: 1rem;
}

.markdown-preview h1, .markdown-preview h2, .markdown-preview h3 {
  margin-top: 16px;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--text-highlight);
}

.markdown-preview p {
  margin-bottom: 12px;
}

.markdown-preview code {
  font-family: var(--font-mono);
  background: rgba(0, 242, 254, 0.1);
  color: var(--accent-cyan);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.875rem;
}

.markdown-preview pre {
  background: rgba(0, 0, 0, 0.35);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  margin-bottom: 14px;
}

.markdown-preview ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.markdown-preview li {
  margin-bottom: 4px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.check-item.checked {
  text-decoration: line-through;
  opacity: 0.7;
}

/* Footer */
.editor-footer {
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.775rem;
  color: var(--text-muted);
}

.editor-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-dot {
  opacity: 0.4;
}

.editor-tags {
  display: flex;
  gap: 6px;
}

.tag-badge {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  color: var(--accent-cyan);
}

/* Empty States */
.empty-state-notes {
  padding: 36px 16px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
}

.empty-state-totp {
  grid-column: 1 / -1;
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-state-totp .empty-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}

.empty-state-totp .empty-icon svg {
  width: 28px;
  height: 28px;
}

.empty-state-totp h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-state-totp p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 420px;
  line-height: 1.5;
}

/* ==========================================================================
   TAB 2: 2FA STUDIO & AUTHENTICATOR
   ========================================================================== */
.totp-subnav-container {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.totp-subpane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.totp-subpane.active {
  display: block;
}

/* Vault Header */
.totp-vault-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.vault-title-wrap h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.vault-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.global-timer-badge {
  padding: 6px 14px;
  gap: 10px;
}

.timer-ring {
  transform: rotate(-90deg);
}

.timer-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 3.5;
}

.timer-progress {
  fill: none;
  stroke: var(--accent-cyan);
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dasharray 0.8s linear, stroke 0.3s ease;
}

.timer-progress.expiring {
  stroke: var(--accent-amber);
}

.timer-num {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* TOTP Grid Cards */
.totp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.totp-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.totp-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-active);
  box-shadow: var(--shadow-float);
}

.totp-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.totp-issuer-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.totp-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-cyan);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.totp-issuer-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.totp-account-label {
  font-size: 0.775rem;
  color: var(--text-muted);
}

.totp-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

html.light .totp-code-box {
  background: rgba(0, 0, 0, 0.03);
}

.totp-code-text {
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent-cyan);
  user-select: all;
}

.btn-copy-code {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy-code:hover {
  color: var(--accent-cyan);
  border-color: var(--border-glow);
  transform: scale(1.05);
}

.btn-copy-code svg {
  width: 18px;
  height: 18px;
}

/* TOTP Card Optional Password Row */
.totp-card-password-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 0.8125rem;
  transition: all 0.2s ease;
}

html.light .totp-card-password-row {
  background: rgba(0, 0, 0, 0.03);
}

.totp-card-password-row:hover {
  border-color: rgba(0, 242, 254, 0.3);
  background: rgba(0, 242, 254, 0.04);
}

.pass-label-col {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  overflow: hidden;
}

.pass-icon {
  width: 14px;
  height: 14px;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.pass-masked-val {
  font-size: 0.8125rem;
  letter-spacing: 0.12em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pass-actions-col {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-icon-xs {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-icon-xs:hover {
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.1);
}

.btn-icon-xs svg {
  width: 14px;
  height: 14px;
}

/* Required field indicator - centered on text line */
.req-star {
  color: var(--accent-rose, #F43F5E);
  font-weight: 700;
  font-size: 0.875em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(0.1em);
  margin-left: 2px;
  user-select: none;
}

/* Form Password Input & Action Controls */
.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrap input {
  padding-right: 40px !important;
}

.btn-toggle-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}

.btn-toggle-eye:hover {
  color: var(--accent-cyan);
}

.btn-toggle-eye svg {
  width: 16px;
  height: 16px;
}

.label-with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 6px;
}

.btn-text-action {
  background: transparent;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.btn-text-action:hover {
  color: #FFFFFF;
  text-shadow: 0 0 10px var(--accent-cyan);
}

.glass-input-inline {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  color: var(--text-primary);
  font-size: 0.8125rem;
  width: 160px;
  outline: none;
  transition: border-color 0.2s ease;
}

.glass-input-inline:focus {
  border-color: var(--accent-cyan);
}

.dec-pass-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.totp-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.totp-card-progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.totp-card-progress-bar {
  height: 100%;
  background: var(--grad-aurora);
  width: 100%;
  transition: width 0.8s linear;
}

/* Generator Section */
.gen-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
}

.gen-form-panel, .gen-preview-panel {
  padding: 28px;
}

.panel-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.input-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-field-group.full-width {
  grid-column: span 2;
}

.input-field-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.label-with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-text-action {
  background: transparent;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-text-action svg {
  width: 13px;
  height: 13px;
}

.glass-input, .glass-select, .glass-textarea {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

html.light .glass-input, html.light .glass-select, html.light .glass-textarea {
  background: rgba(0, 0, 0, 0.03);
}

.glass-input:focus, .glass-select:focus, .glass-textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 242, 254, 0.15);
}

.secret-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.secret-input-wrap input {
  width: 100%;
  padding-right: 42px;
}

.btn-inner-copy {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
}

.btn-inner-copy:hover {
  color: var(--accent-cyan);
}

.btn-inner-copy svg {
  width: 16px;
  height: 16px;
}

.two-col-inputs {
  display: flex;
  gap: 10px;
}

.two-col-inputs select {
  flex: 1;
}

.form-buttons {
  margin-top: 24px;
}

/* QR Apple Card */
.qr-card-apple {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  position: relative;
}

html.light .qr-card-apple {
  background: #FFFFFF;
}

.qr-canvas-container {
  width: 200px;
  height: 200px;
  background: #FFFFFF;
  padding: 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: #0F172A;
  font-size: 0.8125rem;
}

.qr-canvas-container canvas, .qr-canvas-container img {
  width: 100% !important;
  height: 100% !important;
}

.qr-issuer-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.qr-account-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.qr-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.775rem;
}

/* Decoder Section — Perfectly Synchronized 50/50 Symmetrical Grid */
.decoder-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

.decoder-input-card, .decoder-result-card {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

.decoder-card-header {
  min-height: 86px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.decoder-card-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 4px 0;
  color: var(--text-primary);
}

.decoder-card-header p {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* Top Synchronized Block (Drop Zone vs Decoded Details) */
.decoder-block-top {
  height: 175px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 12px 0;
}

.drop-zone {
  height: 100%;
  border: 2px dashed var(--border-active);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-glass);
  transition: all 0.25s ease;
  box-sizing: border-box;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.06);
  transform: scale(1.01);
}

.file-hidden {
  display: none;
}

.drop-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
}

.drop-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 242, 254, 0.1);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px auto;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 0 14px rgba(0, 242, 254, 0.15);
}

.drop-zone:hover .drop-icon-circle {
  transform: translateY(-2px) scale(1.05);
  background: rgba(0, 242, 254, 0.2);
  box-shadow: 0 0 22px rgba(0, 242, 254, 0.35);
}

.drop-icon-circle svg {
  width: 24px;
  height: 24px;
  color: var(--accent-cyan);
  display: block;
}

.drop-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 4px 0;
  text-align: center;
  color: var(--text-primary);
}

.drop-content p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
}

.drop-content span {
  color: var(--accent-cyan);
  text-decoration: underline;
}

.decoded-details {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  box-sizing: border-box;
}

.detail-row {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  box-sizing: border-box;
}

html.light .detail-row {
  background: rgba(0, 0, 0, 0.03);
}

.detail-label {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
}

.secret-clip-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon-sm {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
}

.btn-icon-sm:hover {
  color: var(--accent-cyan);
}

.btn-icon-sm svg {
  width: 15px;
  height: 15px;
}

/* Synchronized Divider */
.divider-text {
  text-align: center;
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0;
}

.divider-text::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1px;
  background: var(--border-subtle);
}

.divider-text span {
  position: relative;
  background: var(--bg-surface);
  padding: 0 12px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Middle Synchronized Block (Textarea vs Live Code Box) */
.decoder-block-middle {
  height: 135px;
  display: flex;
  flex-direction: column;
  margin: 8px 0;
  box-sizing: border-box;
}

.decoder-textarea {
  height: 100%;
  width: 100%;
  padding: 12px 14px;
  resize: none;
  font-size: 0.8125rem;
  line-height: 1.45;
  box-sizing: border-box;
}

.decoder-live-box {
  height: 100%;
  width: 100%;
  padding: 12px 16px;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

.test-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.725rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 10px var(--accent-emerald); }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.live-code-display {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 0.2em;
  margin: 2px 0;
  text-shadow: 0 0 20px rgba(0, 242, 254, 0.35);
}

.test-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.test-progress-fill {
  height: 100%;
  background: var(--grad-aurora);
  width: 100%;
}

/* Bottom Synchronized Action Buttons */
.decoder-block-bottom {
  margin-top: 14px;
}

.btn-decoder-action {
  height: 46px;
  font-size: 0.9375rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

.badge-accent {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-bottom: 8px;
}

.badge-success {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-bottom: 8px;
}

.full-width {
  width: 100%;
}

/* ==========================================================================
   TOAST & MODALS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-active);
  box-shadow: var(--shadow-float);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  width: 100%;
  max-width: 440px;
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ==========================================================================
   RESPONSIVE DESIGN SYSTEM (MOBILE & TABLET OPTIMIZED)
   ========================================================================== */

/* Tablet Optimization (768px to 1024px) */
@media (max-width: 1024px) {
  .app-layout {
    padding: 16px;
    gap: 16px;
  }

  .top-nav {
    padding: 10px 16px;
  }

  .notepad-layout {
    grid-template-columns: 260px 1fr;
    gap: 16px;
    height: calc(100vh - 120px);
  }

  .gen-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .gen-preview-panel {
    display: flex;
    justify-content: center;
  }

  .decoder-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .decoder-input-card, .decoder-result-card {
    min-height: auto;
  }

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

/* Mobile & Small Tablet Optimization (< 768px) */
@media (max-width: 768px) {
  /* Prevent Safari auto-zoom on input focus */
  input, select, textarea {
    font-size: 16px !important;
  }

  .app-layout {
    padding: 10px 12px 28px;
    gap: 12px;
  }

  /* Responsive Top Navbar with CSS Grid */
  .top-nav {
    display: grid !important;
    grid-template-columns: auto 1fr !important;
    grid-template-areas:
      "brand actions"
      "segments segments" !important;
    gap: 12px !important;
    height: auto !important;
    padding: 12px 14px !important;
    align-items: center !important;
  }

  .nav-brand {
    grid-area: brand;
    gap: 10px;
  }

  .brand-symbol {
    width: 36px;
    height: 36px;
  }

  .brand-title {
    font-size: 1.1rem;
  }

  .brand-badge {
    font-size: 0.6rem;
  }

  .nav-actions {
    grid-area: actions;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
  }

  .security-chip {
    display: none; /* Hide non-essential badge on tight mobile screens */
  }

  .lock-button span {
    display: none; /* Icon-only on mobile for compact layout */
  }

  .lock-button {
    padding: 8px;
    border-radius: 50%;
  }

  /* Full-width segmented main tab pills */
  .nav-segments {
    grid-area: segments;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 3px;
  }

  .nav-pill {
    justify-content: center;
    padding: 8px 12px;
    font-size: 0.8125rem;
  }

  /* Language Dropdown Mobile */
  .lang-menu {
    right: 0;
    min-width: 190px;
  }

  /* Smart Notepad Mobile Layout */
  .notepad-layout {
    grid-template-columns: 1fr;
    height: auto;
    gap: 14px;
  }

  .notepad-sidebar {
    height: 240px;
    border-radius: var(--radius-lg);
  }

  .sidebar-header {
    padding: 10px 12px;
  }

  .notes-list-scroll {
    padding: 8px 12px;
  }

  .sidebar-footer {
    padding: 10px 14px;
  }

  .notepad-editor {
    border-radius: var(--radius-lg);
    min-height: 480px;
  }

  .editor-header {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .editor-title-input {
    font-size: 1.15rem;
  }

  .editor-actions {
    justify-content: space-between;
    width: 100%;
  }

  .editor-toolbar {
    padding: 8px 12px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
  }

  .editor-toolbar button {
    flex-shrink: 0;
    padding: 6px 10px;
  }

  .raw-editor, .markdown-preview {
    padding: 16px 14px;
    font-size: 0.9375rem;
  }

  .editor-footer {
    padding: 10px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* 2FA Studio Mobile Layout */
  .totp-subnav-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .totp-subnav {
    display: flex;
    flex-wrap: nowrap;
    width: max-content;
  }

  .totp-subpill {
    padding: 8px 14px;
    font-size: 0.8125rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .totp-vault-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .vault-controls {
    width: 100%;
    justify-content: space-between;
  }

  .btn-add-vault {
    flex: 1;
    justify-content: center;
  }

  .totp-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .totp-code-display, .live-code-display {
    font-size: 1.85rem !important;
    letter-spacing: 0.15em !important;
  }

  /* Generator & Decoder Mobile */
  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .input-field-group.full-width {
    grid-column: span 1;
  }

  .two-col-inputs {
    flex-direction: column;
  }

  .decoder-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .decoder-input-card, .decoder-result-card {
    padding: 20px 16px;
  }

  .decoder-card-header {
    min-height: auto;
    margin-bottom: 12px;
  }

  .decoder-block-top {
    height: auto;
    min-height: 150px;
  }

  .decoded-details {
    gap: 8px;
  }

  .detail-row {
    padding: 10px 12px;
    font-size: 0.8125rem;
  }

  .decoder-block-middle {
    height: auto;
    min-height: 120px;
  }

  .decoder-textarea {
    height: 110px;
  }

  .decoder-live-box {
    height: auto;
    padding: 14px;
  }

  .modal-box {
    margin: 16px;
    padding: 20px;
  }
}
