:root {
  --bg-color: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-rgb: 255, 255, 255;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-dashed: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sub: #94a3b8;
  --primary: #0f172a;
  --primary-fg: #ffffff;
  --primary-hover: #1e293b;
  --secondary: #f1f5f9;
  --secondary-fg: #0f172a;
  --secondary-hover: #e2e8f0;
  --accent: #0f172a;
  --accent-fg: #ffffff;
  --input-bg: #ffffff;
  --ring-color: rgba(15, 23, 42, 0.12);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] {
  --bg-color: #09090b;
  --bg-card: #121215;
  --bg-card-rgb: 18, 18, 21;
  --bg-card-hover: #1a1a1f;
  --border-color: #27272a;
  --border-dashed: #3f3f46;
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-sub: #71717a;
  --primary: #f4f4f5;
  --primary-fg: #09090b;
  --primary-hover: #ffffff;
  --secondary: #1e1e24;
  --secondary-fg: #f4f4f5;
  --secondary-hover: #27272e;
  --accent: #27272a;
  --accent-fg: #f4f4f5;
  --input-bg: #16161a;
  --ring-color: rgba(244, 244, 245, 0.2);
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.15);
  --warning: #fbbf24;
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.15);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 24px -3px rgba(0, 0, 0, 0.6);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
  word-break: break-word;
}

/* ==========================================
   Header & Navigation
   ========================================== */
header {
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(var(--bg-card-rgb), 0.92);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

.header-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.header-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text-main);
  letter-spacing: -0.025em;
  flex-shrink: 0;
}

.brand-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background-color: var(--primary);
  color: var(--primary-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.brand-muted {
  font-weight: 400;
  color: var(--text-muted);
}

/* Header Action Buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.user-nav-wrap {
  display: flex;
  align-items: center;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem 0.3rem 0.35rem;
  background-color: var(--secondary);
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  max-width: 150px;
}

.user-avatar-tiny {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--primary);
  color: var(--primary-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.theme-btn:hover {
  background-color: var(--secondary);
  color: var(--text-main);
  border-color: var(--border-dashed);
}

/* Segmented Navigation Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background-color: var(--secondary);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.nav-btn:hover {
  color: var(--text-main);
}

.nav-btn.active {
  background-color: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ==========================================
   Main Content Layout
   ========================================== */
main {
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem 1.25rem;
  flex: 1;
}

/* Hero Section */
.hero-section {
  position: relative;
  margin-bottom: 1.75rem;
  padding: 0.5rem 0;
  overflow: hidden;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-sm);
}

.hero-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--success);
  display: inline-block;
  box-shadow: 0 0 0 2px var(--success-bg);
}

.hero-title {
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--text-main);
  margin-bottom: 0.45rem;
}

.hero-desc {
  font-size: clamp(0.85rem, 3.5vw, 0.98rem);
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 680px;
  margin-bottom: 1rem;
}

.hero-steps {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.step-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.step-num {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-weight: 700;
  color: var(--text-main);
  background: var(--secondary);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.step-arrow {
  color: var(--text-sub);
}

/* Decorative Orbit Graphic (Desktop Only) */
.hero-deco {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0.4;
}

.orbit-circle-1 {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed var(--border-dashed);
  animation: rotateSlow 35s linear infinite;
}

.orbit-circle-2 {
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
}

.orbit-circle-3 {
  position: absolute;
  inset: 48px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
}

.orbit-icon {
  color: var(--text-sub);
  width: 26px;
  height: 26px;
}

@keyframes rotateSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==========================================
   Grid & Card Architecture
   ========================================== */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 370px;
  gap: 1.25rem;
  align-items: stretch;
}

.ui-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  min-width: 0;
}

.ui-card:hover {
  border-color: var(--border-dashed);
  box-shadow: var(--shadow-md);
}

.card-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.card-title {
  font-size: 0.925rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
  min-width: 0;
}

.card-step-badge {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Inputs & Textareas */
.secret-textarea-wrapper {
  position: relative;
  margin-bottom: 0.75rem;
  width: 100%;
}

.secret-textarea {
  width: 100%;
  min-height: 130px;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--input-bg);
  color: var(--text-main);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: block;
}

.secret-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring-color);
}

.dropzone-overlay {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  border: 2px dashed var(--primary);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 10;
  color: var(--primary);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 1rem;
  text-align: center;
}

.secret-textarea-wrapper.dragover .dropzone-overlay {
  display: flex;
}

.textarea-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Buttons */
.btn-group {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1.15rem;
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.885rem;
  font-weight: 600;
  padding: 0.7rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  outline: none;
  user-select: none;
  white-space: nowrap;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-fg);
  flex: 2;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background-color: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-main);
  flex: 1;
}

.btn-outline:hover {
  background-color: var(--secondary);
  border-color: var(--border-dashed);
}

.btn-sm {
  padding: 0.42rem 0.8rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  flex: initial;
}

.btn-icon-sm {
  padding: 0.42rem 0.55rem;
}

.btn-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
}

.action-row-left {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.action-hint-text {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================
   Result Card & Live TOTP
   ========================================== */
.result-card {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.idle-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem 0.5rem;
}

.idle-icon-wrap {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background-color: var(--secondary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 1.15rem;
}

.idle-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 1.15rem;
}

.dots-placeholder {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 1.35rem;
  max-width: 100%;
}

.dot-box {
  width: clamp(28px, 6.5vw, 36px);
  height: clamp(38px, 9vw, 48px);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-dashed);
  background-color: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, monospace;
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  color: var(--text-sub);
}

.idle-dot {
  animation: pulseDot 1.4s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.idle-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Active Code Display */
.active-container {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: fadeIn 0.25s ease;
  width: 100%;
}

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

.account-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-muted);
  background-color: var(--secondary);
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  margin-bottom: 1.25rem;
  max-width: 95%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-display-wrap {
  cursor: pointer;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  position: relative;
  user-select: all;
  margin-bottom: 1.15rem;
  background-color: var(--secondary);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 320px;
}

.code-display-wrap:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.code-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(2rem, 7.5vw, 2.75rem);
  font-weight: 750;
  letter-spacing: 0.12em;
  color: var(--text-main);
  line-height: 1.1;
  white-space: nowrap;
}

.copy-hint-badge {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  white-space: nowrap;
  background: var(--bg-card);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.code-display-wrap:hover .copy-hint-badge {
  opacity: 1;
}

/* Circular Timer */
.countdown-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 1.35rem;
}

.progress-ring {
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.progress-ring-circle-bg {
  stroke: var(--border-color);
}

.progress-ring-circle {
  stroke: var(--primary);
  transition: stroke-dashoffset 0.5s linear, stroke 0.3s;
}

.progress-ring-circle.warning {
  stroke: var(--danger);
  animation: pulseWarn 1s infinite;
}

@keyframes pulseWarn {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.countdown-text {
  font-family: ui-monospace, monospace;
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-main);
}

.countdown-text.warning {
  color: var(--danger);
}

/* Privacy Banner */
.privacy-banner {
  margin-top: 1.5rem;
  padding: 0.95rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-dashed);
  background-color: var(--bg-card);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.825rem;
  line-height: 1.5;
}

.privacy-banner svg {
  flex-shrink: 0;
  color: var(--text-main);
}

/* ==========================================
   Batch Section
   ========================================== */
.batch-section {
  display: none;
}

.batch-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.batch-item-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: all 0.2s ease;
  position: relative;
  min-width: 0;
}

.batch-item-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.batch-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.batch-item-title {
  font-size: 0.885rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-item-code {
  font-family: ui-monospace, monospace;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-main);
}

.batch-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.35rem;
}

/* ==========================================
   My 2FA Section
   ========================================== */
.my2fa-section {
  display: none;
}

.my2fa-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 380px;
}

.search-input {
  width: 100%;
  padding: 0.55rem 0.85rem 0.55rem 2.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--input-bg);
  color: var(--text-main);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--ring-color);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-sub);
  pointer-events: none;
}

.my2fa-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.saved-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1rem;
}

.saved-account-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  position: relative;
  min-width: 0;
}

.saved-account-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-dashed);
}

.acc-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.9rem;
  gap: 0.5rem;
}

.acc-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background-color: var(--secondary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  flex-shrink: 0;
}

.acc-info {
  margin-left: 0.65rem;
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

.acc-name {
  font-size: 0.925rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acc-issuer {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acc-actions-dropdown {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}

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

.icon-btn:hover {
  background-color: var(--secondary);
  color: var(--text-main);
}

.acc-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--secondary);
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.15s;
  border: 1px solid var(--border-color);
}

.acc-code-row:hover {
  border-color: var(--primary);
}

.acc-code-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(1.35rem, 5vw, 1.55rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-main);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1.5rem;
  border: 1px dashed var(--border-dashed);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 0.75rem;
  color: var(--text-sub);
}

/* ==========================================
   Modals & Overlays
   ========================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: min(440px, calc(100vw - 1.5rem));
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  box-sizing: border-box;
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.form-group {
  margin-bottom: 0.95rem;
}

.form-label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-main);
}

.form-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--input-bg);
  color: var(--text-main);
  font-size: 16px; /* Prevents auto-zoom on iOS safari */
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: block;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--ring-color);
}

/* ==========================================
   Toast Notification
   ========================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background-color: var(--primary);
  color: var(--primary-fg);
  padding: 0.7rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   Footer
   ========================================== */
footer {
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-card);
  padding: 1.75rem 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-container {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ==========================================
   Responsive Breakpoints: Mobile Perfection
   ========================================== */

/* Tablet & Mobile (<= 860px) */
@media (max-width: 860px) {
  .main-grid {
    grid-template-columns: 100%;
    gap: 1rem;
  }
  .hero-deco {
    display: none !important;
  }
}

/* Mobile Screens (<= 768px) */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 0.85rem 0.65rem 0.85rem;
    gap: 0.55rem;
  }

  .header-main-row {
    width: 100%;
    min-height: 40px;
  }

  .nav-tabs {
    width: 100%;
    display: flex;
    padding: 3px;
    gap: 2px;
  }

  .nav-btn {
    flex: 1;
    padding: 0.5rem 0.2rem;
    font-size: 0.825rem;
    justify-content: center;
  }

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

  main {
    padding: 1rem 0.85rem 3rem 0.85rem;
    width: 100%;
    max-width: 100%;
  }

  .ui-card {
    padding: 1.15rem 0.95rem;
    border-radius: var(--radius-md);
  }

  .hero-section {
    margin-bottom: 1.25rem;
    padding: 0.25rem 0;
  }

  .hero-steps {
    display: none; /* Hide multi-step badges on small phones to keep focus on input */
  }

  .btn-group {
    gap: 0.5rem;
  }

  .btn-primary {
    flex: 1.6;
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
  }

  .btn-outline {
    flex: 1;
    padding: 0.65rem 0.75rem;
    font-size: 0.85rem;
  }

  .btn-action-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .action-row-left {
    width: 100%;
  }

  .action-row-left .btn {
    width: 100%;
    justify-content: center;
  }

  .action-hint-text {
    text-align: center;
    font-size: 0.75rem;
  }

  /* My 2FA Toolbar on Mobile */
  .my2fa-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .search-input-wrap {
    max-width: 100%;
    width: 100%;
  }

  .my2fa-actions {
    width: 100%;
    display: flex;
    gap: 0.4rem;
  }

  .my2fa-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 0.45rem 0.35rem;
    font-size: 0.78rem;
  }

  .my2fa-actions .btn svg {
    width: 13px;
    height: 13px;
  }

  /* Saved Accounts Grid */
  .saved-account-grid {
    grid-template-columns: 100%;
    gap: 0.75rem;
  }

  .batch-card-grid {
    grid-template-columns: 100%;
    gap: 0.75rem;
  }

  .toast-container {
    bottom: 1.25rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 360px;
  }

  .footer-container {
    text-align: center;
  }

  .hide-on-mobile {
    display: none !important;
  }
}
