/* Reset & Variables */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== Theme Tokens ===== */
:root,
:root[data-theme="dark"] {
  --bg-primary: #0f1117;
  --bg-secondary: #14171f;
  --bg-tertiary: #1a1d27;
  --surface: #14171f;
  --surface-hover: #1f232e;

  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);

  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --danger: #f43f5e;
  --danger-hover: #fb7185;
  --warning: #f59e0b;

  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(99, 102, 241, 0.4);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 16px var(--accent-glow);
}

:root[data-theme="light"] {
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f4f4f5;
  --surface: #ffffff;
  --surface-hover: #f4f4f5;

  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.18);

  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(99, 102, 241, 0.4);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.10);
  --shadow-glow: 0 0 16px var(--accent-glow);
}

body {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom);
  transition: background 0.2s ease, color 0.2s ease;
}

.container {
  padding: 16px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}

.logo span {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo img {
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.header-actions {
  display: flex;
  gap: 6px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

/* Forms */
.add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.add-form h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.25s ease;
}

.form-group textarea {
  min-height: 82px;
  resize: vertical;
  line-height: 1.45;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-hint {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

/* Buttons */
.btn {
  flex: 1;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-hover);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 14px var(--success-glow);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--success-glow);
}

/* Accounts List */
.accounts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-item {
  background: linear-gradient(145deg, var(--surface) 0%, rgba(30, 41, 59, 0.8) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.account-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.account-item:hover {
  border-color: var(--border-hover);
  transform: translateX(2px);
  box-shadow: var(--shadow-md);
}

.account-item:hover::before {
  opacity: 1;
}

.account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.account-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.account-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.account-email {
  font-size: 10px;
  color: var(--text-muted);
}

.account-actions {
  display: flex;
  gap: 4px;
}

.edit-btn,
.reveal-btn,
.delete-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
}

.account-item:hover .edit-btn,
.account-item:hover .reveal-btn,
.account-item:hover .delete-btn {
  opacity: 1;
}

.edit-btn:hover {
  background: var(--accent);
  color: white;
  transform: scale(1.1);
}

.reveal-btn:hover {
  background: var(--warning);
  color: white;
  transform: scale(1.1);
}

.delete-btn:hover {
  background: var(--danger);
  color: white;
  transform: scale(1.1);
}

/* Secret Modal Styles */
.secret-content {
  text-align: center;
}

.secret-icon {
  width: 50px;
  height: 50px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.secret-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  padding: 14px;
  border-radius: var(--radius-sm);
  margin: 14px 0;
}

.secret-display code {
  flex: 1;
  font-family: 'SF Mono', 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent);
  word-break: break-all;
  text-align: left;
}

.btn-copy {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-copy:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.secret-warning {
  font-size: 12px;
  color: var(--warning);
  margin-bottom: 14px;
}

/* OTP Display */
.otp-container {
  display: flex;
  align-items: center;
  gap: 14px;
}

.otp-code {
  font-size: 20px;
  font-weight: 700;
  font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
  letter-spacing: 3px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px 12px;
  background: linear-gradient(145deg, var(--bg-tertiary) 0%, rgba(31, 41, 55, 0.6) 100%);
  border-radius: var(--radius-sm);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1;
  text-align: center;
  border: 1px solid transparent;
  text-shadow: 0 0 20px var(--accent-glow);
}

.otp-code:hover {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  transform: scale(1.02);
  text-shadow: none;
}

.otp-code.copied {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  animation: copyPulse 0.4s ease;
}

@keyframes copyPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

/* Timer Ring */
.timer-ring {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.timer-ring svg {
  transform: rotate(-90deg);
}

.timer-ring circle {
  fill: none;
  stroke-width: 3;
}

.timer-ring .bg {
  stroke: var(--bg-tertiary);
}

.timer-ring .progress {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
  filter: drop-shadow(0 0 4px var(--accent-glow));
}

.timer-ring .time {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.4;
  color: var(--accent);
}

.empty-state p {
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--text-muted);
}

/* Utility */
.hidden {
  display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--surface-hover);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* File Upload */
.file-upload {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--surface);
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-upload:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
}

.file-name {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  margin: 18px 0;
  gap: 14px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-hover), transparent);
}

.divider span {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Scan Preview */
.scan-preview {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 14px;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}

.preview-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preview-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.preview-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0;
}

.preview-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.preview-field input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.preview-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.preview-secret {
  font-size: 11px;
  font-family: 'SF Mono', monospace;
  color: var(--text-muted);
  word-break: break-all;
}

/* Scan Screen Section */
.scan-screen-section {
  text-align: center;
  margin-bottom: 10px;
}

.btn-scan-screen {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 50%, #06b6d4 100%);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-scan-screen:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.5);
}

.btn-scan-screen:active {
  transform: translateY(-1px);
}

.scan-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* Loading State */
.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin-top: -9px;
  margin-left: -9px;
  border: 2px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 15, 26, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  background: linear-gradient(145deg, var(--surface) 0%, var(--bg-secondary) 100%);
  border-radius: var(--radius);
  padding: 24px;
  width: 90%;
  max-width: 340px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, 0.1);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-content h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-close-modal:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* Sync Actions */
.sync-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.btn-sync {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-sync svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
  transition: transform 0.3s ease;
}

.btn-sync:hover {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-sync:hover svg {
  color: white;
  transform: scale(1.1);
}

.btn-sync:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-guide {
  width: 100%;
  margin: -2px 0 16px;
}

.guide-content {
  max-width: 720px;
  max-height: 88vh;
  overflow: auto;
}

.guide-steps {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.guide-steps p {
  margin: 0 0 12px;
}

.guide-steps ol {
  margin: 0 0 18px;
  padding-left: 22px;
}

.guide-steps li {
  margin: 6px 0;
}

.guide-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.guide-code {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
}

.guide-code code {
  font-family: 'SF Mono', Consolas, monospace;
}

/* Sync Status */
.sync-status {
  padding: 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.sync-status.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.sync-status.error {
  background: rgba(244, 63, 94, 0.1);
  color: var(--danger);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.sync-status.loading {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.sync-status:empty {
  display: none;
}

/* Scan Status */
.scan-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 14px;
}

.scan-status .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-icon {
  font-size: 16px;
  font-weight: 700;
}

.toast.success {
  border-color: var(--success);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, var(--surface) 100%);
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error {
  border-color: var(--danger);
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.15) 0%, var(--surface) 100%);
}

.toast.error .toast-icon {
  color: var(--danger);
}

.toast.info {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, var(--surface) 100%);
}

.toast.info .toast-icon {
  color: var(--accent);
}

/* Confirm Modal */
.confirm-content {
  text-align: center;
}

.confirm-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(244, 63, 94, 0.1);
  color: var(--danger);
}

.confirm-content h3 {
  justify-content: center;
  margin-bottom: 8px;
}

.confirm-message {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #db2777 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.4);
}

/* Service Filter Chips */
.service-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 2px 8px 2px;
  margin-bottom: 8px;
  scrollbar-width: thin;
}

.service-filter::-webkit-scrollbar {
  height: 4px;
}

.service-filter::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.filter-chip {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.filter-chip:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.filter-chip.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.filter-chip .chip-count {
  opacity: 0.7;
  margin-left: 4px;
  font-size: 12px;
}

.filter-chip.active .chip-count {
  opacity: 0.9;
}

/* Search Bar */
.search-container {
  margin-bottom: 16px;
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: all 0.25s ease;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

#searchInput {
  border: none;
  background: transparent;
  padding: 12px 10px;
  width: 100%;
  color: var(--text-primary);
  font-size: 13px;
}

#searchInput:focus {
  outline: none;
  box-shadow: none;
}

.clear-search {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clear-search:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* Pagination */
.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.btn-page {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-page:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--bg-primary);
}

.page-info {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Account Actions */
.account-actions {
  display: flex;
  gap: 4px;
}

.reveal-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
}

.account-item:hover .reveal-btn {
  opacity: 1;
}

.reveal-btn:hover {
  background: var(--accent);
  color: white;
}

/* Secret Modal */
.secret-content {
  text-align: center;
}

.secret-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
}

.secret-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 16px 0;
}

.secret-display code {
  font-family: 'SF Mono', 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent);
  word-break: break-all;
  flex: 1;
  text-align: left;
}

.btn-copy {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-copy:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.secret-warning {
  font-size: 12px;
  color: var(--warning);
  margin-bottom: 16px;
}

/* Settings Tabs */
.settings-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.settings-tab {
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-tab.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.settings-panel {
  display: block;
}

.settings-panel.hidden {
  display: none;
}

.backup-hint {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.unlock-content {
  max-width: 380px;
}

/* Backup Actions */
.backup-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.btn-backup {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-backup:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Edit Button */
.edit-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
}

.account-item:hover .edit-btn {
  opacity: 1;
}

.edit-btn:hover {
  background: var(--success);
  color: white;
}

/* QR Modal */
.qr-content {
  text-align: center;
}

.qr-display {
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 16px auto;
  width: fit-content;
}

.qr-display img {
  display: block;
}

/* Camera Scan */
.btn-scan-camera {
  width: 100%;
  padding: 12px;
  background: var(--surface-hover);
  border: 1px dashed var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 500;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.btn-scan-camera:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}

.camera-container {
  width: 100%;
  height: 280px;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  margin-bottom: 16px;
}

#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scan-area {
  width: 200px;
  height: 200px;
  border: 2px solid var(--accent);
  border-radius: 12px;
  position: relative;
  box-shadow: 0 0 0 400px rgba(0, 0, 0, 0.5);
}

.scan-area::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: scanMove 2s linear infinite;
}

@keyframes scanMove {
  0% {
    top: 10px;
    opacity: 0;
  }

  10% {
    opacity: 1;
  }

  90% {
    opacity: 1;
  }

  100% {
    top: 190px;
    opacity: 0;
  }
}

.camera-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  z-index: 10;
}

.camera-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

@media screen and (max-width: 480px) {
  .container {
    padding: 12px;
  }

  /* Header */
  .header {
    padding-bottom: 12px;
    margin-bottom: 12px;
  }

  .logo {
    font-size: 14px;
  }

  .logo img {
    width: 22px;
    height: 22px;
  }

  .btn-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  /* Forms */
  .add-form {
    padding: 16px;
  }

  .form-group input {
    padding: 14px 16px;
    font-size: 16px;
    /* Prevent iOS zoom */
  }

  .form-actions {
    flex-direction: column;
  }

  .btn {
    padding: 16px 20px;
    font-size: 14px;
    min-height: 48px;
  }

  /* Account Items */
  .account-item {
    padding: 14px;
  }

  .account-name {
    font-size: 13px;
  }

  .account-email {
    font-size: 11px;
  }

  .otp-code {
    font-size: 24px;
    padding: 10px 14px;
    letter-spacing: 4px;
  }

  .timer-ring {
    width: 40px;
    height: 40px;
  }

  /* Action Buttons - Always visible on mobile */
  .delete-btn,
  .edit-btn,
  .reveal-btn {
    opacity: 1;
    width: 40px;
    height: 40px;
  }

  /* Search */
  .search-box input {
    font-size: 16px;
    padding: 12px 14px 12px 40px;
  }

  /* Modals */
  .modal-content {
    width: 95%;
    max-width: none;
    padding: 20px;
    margin: 10px;
  }

  .sync-actions {
    flex-direction: column;
  }

  .btn-sync {
    padding: 16px;
  }

  /* Camera */
  .camera-container {
    height: 260px;
  }

  .scan-area {
    width: 180px;
    height: 180px;
  }

  .camera-close {
    width: 44px;
    height: 44px;
  }

  /* File Upload */
  .file-upload {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-upload {
    justify-content: center;
    padding: 14px;
  }

  /* Pagination */
  .pagination-controls {
    padding: 12px 0;
  }

  .btn-page {
    width: 44px;
    height: 44px;
  }

  /* Empty State */
  .empty-state {
    padding: 40px 16px;
  }

  .empty-state svg {
    width: 40px;
    height: 40px;
  }

  /* Toast */
  .toast {
    width: calc(100% - 32px);
    left: 16px;
    transform: translateY(100px);
    bottom: 16px;
  }

  .toast.show {
    transform: translateY(0);
  }
}

/* Small phones */
@media screen and (max-width: 360px) {
  .logo span {
    font-size: 13px;
  }

  .header-actions {
    gap: 4px;
  }

  .btn-icon {
    width: 40px;
    height: 40px;
  }

  .otp-code {
    font-size: 20px;
    letter-spacing: 3px;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {

  .delete-btn,
  .edit-btn,
  .reveal-btn {
    opacity: 0.8;
  }

  .otp-code:active {
    transform: scale(0.98);
  }

  .btn:active {
    transform: scale(0.98);
  }

  .btn-icon:active {
    transform: scale(0.95);
  }
}

/* iOS Safe Area */
@supports (padding: env(safe-area-inset-bottom)) {
  .container {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .toast {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* ============================================ */
/*       MODERN MINIMAL REDESIGN OVERRIDES      */
/* ============================================ */

.btn-icon[data-theme-toggle] svg.theme-icon-light,
.btn-icon[data-theme-toggle] svg.theme-icon-dark {
  display: none;
}
:root[data-theme="dark"] .btn-icon[data-theme-toggle] svg.theme-icon-light { display: block; }
:root[data-theme="light"] .btn-icon[data-theme-toggle] svg.theme-icon-dark { display: block; }
:root:not([data-theme]) .btn-icon[data-theme-toggle] svg.theme-icon-light { display: block; }

:root[data-theme="light"] .btn-icon:hover { color: white; }
:root[data-theme="light"] .otp-code:hover {
  background: rgba(99, 102, 241, 0.1);
}
:root[data-theme="light"] .account-actions button:hover {
  background: rgba(0, 0, 0, 0.05);
}
:root[data-theme="light"] .empty-state svg { opacity: 0.6; }

/* HOTP-specific */
.hotp-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  margin-left: 6px;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 4px;
  vertical-align: middle;
  text-transform: uppercase;
}
.hotp-refresh-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s ease;
}
.hotp-refresh-btn:hover {
  background: var(--accent-glow);
  color: var(--accent);
}
.hotp-refresh-btn:active svg { transform: rotate(180deg); }
.hotp-refresh-btn svg { transition: transform 0.3s ease; }

/* Logo solid color */
.logo span {
  background: none;
  -webkit-text-fill-color: var(--text-primary);
  color: var(--text-primary);
}
.logo img { filter: none; }

/* Compact account list */
.accounts-list { gap: 8px; }

.account-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.account-item:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: none;
  box-shadow: none;
}
.account-item::before { display: none; }

.account-item .account-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}
.account-item .account-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.account-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-email {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-email-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.account-email-row .account-email {
  min-width: 0;
}

.account-note {
  display: -webkit-box;
  max-width: 100%;
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.copy-account-btn {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.copy-account-btn:hover,
.copy-account-btn.copied {
  color: var(--accent);
  background: var(--surface-hover);
}

/* OTP row */
.account-item .otp-container {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 12px;
}

/* OTP code: minimal pill */
.otp-code {
  flex: 0 0 auto;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 2px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  color: var(--accent);
  text-shadow: none;
  font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
}
.otp-code:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
  transform: none;
  box-shadow: none;
  text-shadow: none;
}
.otp-code.copied {
  background: var(--success-glow);
  color: var(--success);
}

.otp-copy-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.otp-copy-btn:hover,
.otp-copy-btn.copied {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-glow);
}

/* Circular countdown */
.timer-ring {
  width: 36px;
  height: 36px;
  display: flex !important;
}
.timer-ring .progress {
  stroke: var(--accent);
}
.timer-ring.warn .progress {
  stroke: var(--warning);
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.35));
}
.timer-ring.warn .time {
  color: var(--warning);
}

/* New: linear progress bar */
.timer-bar {
  position: relative;
  height: 3px;
  width: 100%;
  background: var(--bg-tertiary);
  overflow: hidden;
}
.timer-bar .timer-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 100%);
  width: var(--progress, 100%);
  transition: width 1s linear;
  border-radius: 0 2px 2px 0;
}
.timer-bar.warn .timer-fill {
  background: linear-gradient(90deg, var(--warning) 0%, #fbbf24 100%);
}

/* Action buttons */
.account-actions { gap: 2px; }
.account-actions button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  opacity: 1;
}
.account-actions button:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.account-actions .delete-btn:hover { color: var(--danger); }
.reveal-btn { opacity: 1; }

/* Soft buttons */
.btn {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
.btn-primary {
  background: var(--accent);
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.2);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: none;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-success {
  background: var(--success);
  box-shadow: 0 1px 2px rgba(16, 185, 129, 0.2);
}
.btn-success:hover {
  filter: brightness(1.1);
  transform: none;
}
.btn-danger { background: var(--danger); }

.filter-chip {
  background: transparent;
  border-color: var(--border);
}
.filter-chip:hover {
  background: var(--surface-hover);
}

.modal-content {
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.search-box {
  background: var(--surface);
  border-color: var(--border);
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
