/* ══════════════════════════════════════════════════════════════════
   Gmail Manager Pro — Premium Glassmorphism UI  (Upgraded)
   ══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* CHANGED: minimal black & white theme — decorative purple/pink
     gradients and glows removed. Green/red are kept ONLY for pass/fail
     status indicators (account health, connected/disconnected) since
     those carry functional meaning, not decoration. */
  --bg:             #060606;
  --surface:        rgba(255,255,255,0.035);
  --border:         rgba(255,255,255,0.10);
  --border-bright:  rgba(255,255,255,0.22);
  --grad:           linear-gradient(135deg,#ffffff 0%,#c9c9c9 100%);
  --accent:         #ffffff;
  /* Functional status hues — the ONLY saturated colors in the UI. They mark
     account health (active / dead / locked / app-password) and the 2FA
     countdown, where color carries meaning. Everything else stays monochrome.
     Before, these were all near-identical grays (orange == yellow == #b0b0b0),
     so Active / Dead / Locked / App-Password were impossible to tell apart. */
  --green:          #34d399;
  --red:            #f87171;
  --orange:         #fb923c;
  --yellow:         #fbbf24;
  --t1:             #ffffff;
  --t2:             #a3a3a3;
  --t3:             #5c5c5c;
  --sb-w:           288px;
  --sb-w-collapsed: 72px;
  --sb-bg:          #060606;
  --font:           'Inter', system-ui, sans-serif;
  --mono:           'JetBrains Mono', monospace;
  --glow-accent:    0 0 16px rgba(255,255,255,.18);
  --glow-green:     0 0 10px rgba(52,211,153,.45);
  --gray:           #5c5c5c;
  --sb-transition:  width 0.28s cubic-bezier(.4,0,.2,1);
}

html, body {
  height: 100%; font-family: var(--font);
  background: var(--bg); color: var(--t1);
  overflow: hidden; font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Background Blobs ───────────────────────────────────────────── */
body::before, body::after {
  content: ''; position: fixed; border-radius: 50%;
  filter: blur(120px); pointer-events: none; z-index: 0;
  animation: drift 18s ease-in-out infinite alternate;
}
body::before {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(255,255,255,.12), transparent 70%);
  top: -200px; left: -100px;
}
body::after {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,.1), transparent 70%);
  bottom: -150px; right: -100px; animation-delay: -9s;
}
@keyframes drift {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(60px,40px) scale(1.1); }
}

/* ── Splash ─────────────────────────────────────────────────────── */
.splash {
  position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; z-index: 999; background: var(--bg);
}
.splash-box {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; padding: 52px 48px;
  max-width: calc(100vw - 24px); box-sizing: border-box;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-bright); border-radius: 28px;
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  box-shadow: 0 40px 80px rgba(0,0,0,.6), var(--glow-accent);
}
.splash-icon {
  width: 88px; height: 88px; border-radius: 24px;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.3);
  display: flex; align-items: center;
  justify-content: center;
  position: relative; overflow: visible;
  box-shadow: 0 0 0 0 rgba(255,255,255,.5);
  animation: splashPulse 2s ease-in-out infinite;
}
/* spinning border ring around splash icon */
.splash-icon::before {
  content: ''; position: absolute; inset: -4px; border-radius: 28px;
  border: 2px solid transparent;
  border-top-color: #ffffff; border-right-color: #d4d4d4;
  animation: spinRing 2s linear infinite;
}
.splash-icon::after {
  content: ''; position: absolute; inset: -8px; border-radius: 32px;
  border: 1px solid transparent;
  border-bottom-color: rgba(255,255,255,.5);
  animation: spinRing 3s linear infinite reverse;
}
@keyframes spinRing {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes splashPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,.5), 0 0 30px rgba(255,255,255,.2); }
  50%     { box-shadow: 0 0 0 12px rgba(255,255,255,0), 0 0 50px rgba(255,255,255,.4); }
}
.splash-title { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.splash-sub   { font-size: 13px; color: var(--t2); }
.splash-bar   {
  width: 100%; max-width: 240px; height: 3px; background: rgba(255,255,255,.06);
  border-radius: 3px; overflow: hidden; margin-top: 4px;
}
.splash-fill { height: 100%; border-radius: 3px; background: var(--grad); }
.splash-fill.anim { animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer {
  0%   { width: 0%; margin-left: 0; }
  50%  { width: 60%; margin-left: 20%; }
  100% { width: 0%; margin-left: 100%; }
}
.splash-err { font-size: 12px; color: var(--red); min-height: 16px; text-align: center; max-width: 280px; }

/* ── Mobile Top Bar ─────────────────────────────────────────────── */
.mobile-bar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; z-index: 400;
  /* FIX: add the top safe-area inset so the bar clears the notch/status bar
     on iPhone (viewport-fit=cover). Content sits in the lower 52px. */
  height: calc(52px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 16px 0;
  background: rgba(8,9,16,.95); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  align-items: center; gap: 12px;
}
.mobile-title { font-size: 15px; font-weight: 800; letter-spacing: -.3px; }
.btn-hamburger {
  width: 36px; height: 36px; border: none; background: transparent;
  cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px; padding: 6px;
}
.btn-hamburger span {
  display: block; width: 18px; height: 2px; background: var(--t2);
  border-radius: 2px; transition: all .2s;
}
body.sb-open .btn-hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.sb-open .btn-hamburger span:nth-child(2) { opacity: 0; }
body.sb-open .btn-hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Sidebar Overlay (mobile) ───────────────────────────────────── */
/* FIX: removed backdrop-filter:blur(2px) — on iOS Safari the blur layer
   ghost-sticks to content behind the overlay even after display:none,
   making the Gmail inbox list invisible. Dark rgba bg is enough. */
.sb-overlay {
  display: none; position: fixed; inset: 0; z-index: 490;
  background: rgba(0,0,0,.55);
  animation: fadeIn .18s ease;
}
.sb-overlay:not(.hidden) { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── App Layout ─────────────────────────────────────────────────── */
.app {
  display: flex; height: 100vh; overflow: hidden;
  position: relative; z-index: 1;
}
.hidden { display: none !important; }

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sb-w); min-width: var(--sb-w);
  background: var(--sb-bg); display: flex; flex-direction: column;
  border-right: 1px solid var(--border); position: relative; z-index: 2;
  overflow: hidden; transition: var(--sb-transition);
  flex-shrink: 0;
}
.sidebar::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: var(--grad); opacity: .6;
}

/* Collapsed sidebar */
.sidebar.collapsed {
  width: var(--sb-w-collapsed);
  min-width: var(--sb-w-collapsed);
}
.sidebar.collapsed .sb-info,
.sidebar.collapsed .sb-hdr-btns,
.sidebar.collapsed .tabs,
.sidebar.collapsed .acc-count,
.sidebar.collapsed .search-wrap,
.sidebar.collapsed .btn-add-sb,
.sidebar.collapsed .divider {
  opacity: 0; pointer-events: none; overflow: hidden;
  transition: opacity .15s;
}
.sidebar.collapsed .acc-label { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .acc-item  { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .acc-avatar { margin: 0; }
.sidebar.collapsed .sb-header { justify-content: center; padding: 18px 0 16px; }

.sb-header {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px; flex-shrink: 0;
}
.sb-logo {
  width: 38px; height: 38px; border-radius: 12px;
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.3);
  display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
  box-shadow: var(--glow-accent);
  overflow: hidden;
  /* FIX: the hover that used to animate these two properties is gone (dead
     affordance), so the transition had nothing left to do. */
}
/* FIX: .sb-logo is a plain <div> with no click handler anywhere (it had no
   cursor:pointer either), so the hover glow/scale was a dead affordance.
   The interactive hover treatment is gone; the static glow stays. */
.sb-info { flex: 1; min-width: 0; }
.sb-title { font-size: 15px; font-weight: 800; letter-spacing: -.3px; white-space: nowrap; }
.sb-sub   { font-size: 10px; color: var(--t3); margin-top: 2px; letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; }

.sb-hdr-btns { display: flex; gap: 4px; flex-shrink: 0; }
.btn-icon {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border);
  background: rgba(255,255,255,.04); color: var(--t3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .18s;
}
.btn-icon:hover { background: rgba(255,255,255,.1); color: var(--t1); border-color: var(--border-bright); }

/* Sidebar collapse button */
.btn-collapse {
  position: absolute; bottom: 14px; right: 12px; z-index: 3;
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--border);
  background: rgba(255,255,255,.04); color: var(--t3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .18s;
}
.btn-collapse:hover { background: rgba(255,255,255,.1); color: var(--t1); border-color: var(--border-bright); }
.sidebar.collapsed .btn-collapse { right: 50%; transform: translateX(50%); }
#collapse-icon { transition: transform .28s cubic-bezier(.4,0,.2,1); }

/* Tabs */
.tabs {
  display: flex; gap: 3px; margin: 0 14px 10px;
  padding: 4px; background: rgba(255,255,255,0.04);
  border: 1px solid var(--border); border-radius: 12px;
  white-space: nowrap;
}
.tab {
  flex: 1; padding: 7px 0; border: none; border-radius: 9px;
  font-size: 11px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--t3); transition: all .2s ease;
  font-family: var(--font);
}
.tab:hover { color: var(--t2); }
.tab.active { background: #ffffff; color: #000000; font-weight: 700; box-shadow: 0 2px 12px rgba(255,255,255,.3); }

/* v24: the old "Sharing tab" picker styles are gone with the feature. */

.acc-count {
  font-size: 10px; font-weight: 600; letter-spacing: .5px;
  text-transform: uppercase; color: var(--t3); padding: 0 18px 8px;
  white-space: nowrap;
}

/* Search */
.search-wrap {
  display: flex; align-items: center; gap: 8px; margin: 0 14px 10px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 12px; padding: 0 12px; height: 40px;
  transition: border-color .2s, box-shadow .2s;
}
.search-wrap:focus-within { border-color: rgba(255,255,255,.5); box-shadow: 0 0 0 3px rgba(255,255,255,.12); }
.search-ic  { font-size: 13px; color: var(--t3); }
/* FIX: a flex item's automatic minimum size is its content size, so this
   input kept its ~20-character intrinsic width — 234px at the ≤767px 16px
   iOS-zoom font size — inside a 231px pill, overflowing it and the sidebar
   (drawer scrollWidth 277 vs clientWidth 259). min-width:0 lets it shrink
   into the pill like every other flex child in this file. */
.search-inp { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--t1); font-size: 12px; font-family: var(--font); }
.search-inp::placeholder { color: var(--t3); }

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

/* ── Account List ───────────────────────────────────────────────── */
.acc-list {
  flex: 1; overflow-y: auto; list-style: none;
  padding: 6px 10px 52px; /* bottom padding for collapse btn */
}

/* Animated entry */
.acc-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 12px; cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--t2);
  transition: background .18s, color .18s, border .18s, box-shadow .18s;
  white-space: nowrap; overflow: hidden;
  border: 1px solid transparent;
  animation: slideInLeft .25s ease both;
  position: relative;
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}
.acc-item:hover {
  background: rgba(255,255,255,.05); color: var(--t1);
}
.acc-item.active {
  background: rgba(255,255,255,.12); color: var(--t1);
  border-color: rgba(255,255,255,.25);
  box-shadow: 0 0 12px rgba(255,255,255,.1);
}

/* Avatar */
.acc-avatar {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: #2a2a2a; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 800; color: #fff;
  position: relative; transition: box-shadow .2s;
  border: 1px solid rgba(255,255,255,.12);
}
.acc-item:hover .acc-avatar { box-shadow: 0 0 12px rgba(255,255,255,.4); }

/* Status badge on avatar */
.acc-avatar-badge {
  position: absolute; bottom: -2px; right: -2px;
  width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--sb-bg);
  background: var(--t3);
}
.acc-avatar-badge.green  { background: var(--green);  box-shadow: 0 0 5px var(--green); }
.acc-avatar-badge.red    { background: var(--red);    box-shadow: 0 0 5px var(--red); }
.acc-avatar-badge.orange { background: var(--orange); box-shadow: 0 0 5px var(--orange); }

/* OAuth connection indicator — bottom-left of avatar */
.acc-oauth-dot {
  position: absolute; bottom: -2px; left: -2px;
  width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--sb-bg);
}
.acc-oauth-dot.connected    { background: var(--green); box-shadow: 0 0 6px var(--green); }
.acc-oauth-dot.disconnected { background: #555; box-shadow: none; }

.acc-label {
  flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .2s, width .2s;
}

.btn-add-sb {
  width: 100%; padding: 15px; padding-right: 46px; border: none; cursor: pointer;
  background: #ffffff; color: #000000;
  font-size: 13px; font-weight: 700; font-family: var(--font); letter-spacing: .2px;
  transition: opacity .2s, box-shadow .2s;
  box-shadow: 0 -1px 0 rgba(255,255,255,.05);
  flex-shrink: 0;
}
.btn-add-sb:hover { opacity: .9; box-shadow: 0 -1px 0 rgba(255,255,255,.05), 0 0 30px rgba(255,255,255,.3); }

/* ── Content Area ───────────────────────────────────────────────── */
.content {
  flex: 1; overflow-y: auto; position: relative; z-index: 1; min-width: 0;
  animation: pageEnter .22s ease;
}
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Welcome / Dashboard ────────────────────────────────────────── */
.welcome {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100%; gap: 16px; padding: 24px;
}
/* Welcome screen icon */
.w-icon-wrap {
  position: relative; width: 100px; height: 100px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.w-icon-img {
  width: 80px; height: 80px; object-fit: contain; position: relative; z-index: 2;
  filter: drop-shadow(0 0 16px rgba(255,255,255,.8)) drop-shadow(0 0 40px rgba(255,255,255,.5));
  animation: welcomeFloat 4s ease-in-out infinite, welcomeGlow 3s ease-in-out infinite alternate;
}
@keyframes welcomeFloat {
  0%,100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-10px) rotate(2deg); }
}
@keyframes welcomeGlow {
  from { filter: drop-shadow(0 0 12px rgba(255,255,255,.6)) drop-shadow(0 0 24px rgba(255,255,255,.3)); }
  to   { filter: drop-shadow(0 0 24px rgba(255,255,255,1)) drop-shadow(0 0 48px rgba(255,255,255,.6)); }
}
.w-icon-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.25);
  animation: ringPulse 2.5s ease-in-out infinite;
}
.w-icon-ring::before {
  content: ''; position: absolute; inset: -10px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15);
  animation: ringPulse 2.5s ease-in-out infinite .6s;
}
@keyframes ringPulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0; transform: scale(1.4); }
}
.w-title {
  font-size: 30px; font-weight: 800; letter-spacing: -.5px;
  background: var(--grad); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
  background-size: 200% auto;
  animation: titleShine 3s linear infinite;
}
@keyframes titleShine {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}
.welcome h2 { font-size: 26px; font-weight: 800; color: var(--t2); letter-spacing: -.3px; }
.welcome p  { font-size: 13px; color: var(--t3); }

/* Dashboard stats */
.dash-stats {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  margin-top: 4px;
}
.dash-stat {
  background: rgba(255,255,255,.04); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px 22px; text-align: center;
  min-width: 80px; transition: all .18s;
  animation: popIn .3s ease both;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
.dash-stat:hover { background: rgba(255,255,255,.07); transform: translateY(-2px); }
.dash-stat.green .dash-stat-num { color: var(--green); }
.dash-stat.red   .dash-stat-num { color: var(--red); }
.dash-stat.orange .dash-stat-num { color: var(--orange); }
.dash-stat-num { font-size: 28px; font-weight: 800; line-height: 1; }
.dash-stat-lbl { font-size: 10px; color: var(--t3); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }

.dash-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

/* ── Glass Card ─────────────────────────────────────────────────── */
.card {
  background: rgba(255,255,255,0.035); border: 1px solid var(--border);
  border-radius: 20px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  padding: 22px 24px;
  transition: border-color .2s, box-shadow .2s;
}

/* ── Detail View ────────────────────────────────────────────────── */
.detail-scroll { padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; }

/* FIX: removed always-on 3px left border that shifted content even without a color tag.
   Color tag is now applied via inline style only when a color is actually set. */
.detail-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px; padding: 20px 24px;
}
.detail-email {
  font-size: 20px; font-weight: 800; letter-spacing: -.4px;
  background: var(--grad); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
  word-break: break-all;
}
.detail-meta    { font-size: 11px; color: var(--t2); margin-top: 5px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.detail-body { display: grid; grid-template-columns: 3fr 2fr; gap: 18px; }
/* FIX: grid items default to min-width:auto, which lets long email
   addresses / codes push the columns wider than the viewport. Let them
   shrink so ellipsis and wrapping work as intended. */
.detail-body > .card, .form-body > .card { min-width: 0; }

/* Info rows */
.info-row {
  display: flex; align-items: center;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: 14px; min-height: 58px; padding: 0 16px; gap: 12px;
  margin-bottom: 8px; overflow: hidden; position: relative;
  transition: border-color .2s, background .2s;
}
.info-row::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); opacity: .6;
}
.info-row:hover { background: rgba(255,255,255,0.05); border-color: var(--border-bright); }
.info-row.compact { min-height: 38px; border-radius: 11px; }
.info-row.compact::before { display: none; }
.info-label {
  font-size: 10px; font-weight: 700; color: var(--t3);
  width: 90px; flex-shrink: 0; text-transform: uppercase; letter-spacing: .5px;
}
.info-row.compact .info-label { font-size: 9px; width: 80px; }
.info-value {
  flex: 1; font-size: 14px; font-weight: 600; color: var(--t1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.info-row.compact .info-value { font-size: 11px; }
.info-value.secret { font-family: var(--mono); letter-spacing: 3px; }
.info-value.empty  { color: var(--t3); font-size: 13px; font-weight: 400; font-style: italic; }
.info-actions { display: flex; gap: 5px; flex-shrink: 0; }

/* ── TOTP Widget ────────────────────────────────────────────────── */
.totp-card {
  background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.2); border-radius: 18px;
  padding: 18px 20px; margin-top: 10px; position: relative; overflow: hidden;
}
.totp-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at top left, rgba(255,255,255,.07), transparent 60%);
  pointer-events: none;
}
.totp-hdr { display: flex; justify-content: space-between; margin-bottom: 14px; }
.totp-hdr .l {
  font-size: 9px; font-weight: 800; color: var(--green);
  text-transform: uppercase; letter-spacing: 1px;
  display: flex; align-items: center; gap: 5px;
}
.totp-hdr .l::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); box-shadow: var(--glow-green);
  animation: pulse-dot 1s ease-in-out infinite;
}
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.totp-hdr .r { font-size: 9px; color: var(--t3); }
.totp-body { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.totp-code {
  font-family: var(--mono); font-size: 32px; font-weight: 700;
  color: var(--green); letter-spacing: 6px; text-shadow: var(--glow-green);
  white-space: nowrap; transition: color .5s;
}
.totp-ring-wrap { position: relative; width: 76px; height: 76px; flex-shrink: 0; }
.totp-ring-wrap svg { transform: rotate(-90deg); }
.totp-ring-bg { fill: none; stroke: rgba(255,255,255,.12); stroke-width: 6; }
.totp-ring-fg {
  fill: none; stroke: var(--green); stroke-width: 6; stroke-linecap: round;
  stroke-dasharray: 188.5; stroke-dashoffset: 0;
  transition: stroke-dashoffset .9s linear, stroke .9s;
  filter: drop-shadow(0 0 4px var(--green));
}
.totp-ring-text {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; flex-direction: column;
}
.totp-ring-num { font-size: 18px; font-weight: 800; color: var(--green); line-height: 1; }
.totp-ring-s   { font-size: 9px; color: var(--t3); font-weight: 600; }
.totp-info { display: flex; flex-direction: column; gap: 8px; }

/* ── Backup Codes ───────────────────────────────────────────────── */
.codes-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.section-label { font-size: 9px; font-weight: 800; color: var(--t3); letter-spacing: 1px; text-transform: uppercase; }
.codes-unused  { font-size: 12px; font-weight: 700; }

.codes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; overflow-y: auto; max-height: 460px; }
.code-tile {
  display: flex; align-items: center; gap: 9px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 12px; height: 50px; padding: 0 12px;
  overflow: hidden; transition: all .18s;
}
.code-tile:not(.used):hover { background: rgba(255,255,255,.07); border-color: var(--border-bright); }
.code-tile.used { background: rgba(255,255,255,.02); opacity: .5; }
.code-badge {
  width: 24px; height: 24px; border-radius: 8px; background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  /* FIX: badge background (--grad) is a white→light-gray gradient, but the
     text color was #fff — white-on-white, so the serial number (01, 02…)
     was invisible. Badge is light, so its label needs a dark color. */
  font-size: 9px; font-weight: 800; color: var(--bg); flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(255,255,255,.35);
}
.code-tile.used .code-badge { background: rgba(255,255,255,.08); box-shadow: none; color: var(--t2); }
.code-val { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--t1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-tile.used .code-val { text-decoration: line-through; color: var(--t3); }
.code-used-date { font-size: 8px; color: var(--t3); flex-shrink: 0; }
.code-tile-btns { display: flex; gap: 4px; flex-shrink: 0; }
.code-empty {
  background: rgba(255,255,255,.02); border: 1px dashed var(--border);
  border-radius: 12px; height: 70px;
  display: flex; align-items: center; justify-content: center;
  color: var(--t3); font-size: 12px; grid-column: 1/-1;
}

/* ── Checker ────────────────────────────────────────────────────── */
.checker-top {
  display: flex; align-items: center; gap: 14px; padding: 14px 22px;
  background: rgba(255,255,255,.02); border-bottom: 1px solid var(--border);
  flex-wrap: wrap; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 5;
}
.checker-title { font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.checker-stats { font-size: 11px; color: var(--t2); flex: 1; }
.checker-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.checker-controls label { font-size: 11px; color: var(--t2); display: flex; align-items: center; gap: 6px; }
.checker-controls select {
  background: rgba(255,255,255,.06); color: var(--t1);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 10px; font-size: 11px; cursor: pointer;
  outline: none; font-family: var(--font); transition: border-color .2s;
}
.checker-controls select:focus { border-color: rgba(255,255,255,.5); }
.checker-progress      { height: 3px; background: rgba(255,255,255,.04); }
.checker-progress-fill { height: 100%; background: var(--grad); transition: width .3s; width: 0; box-shadow: 0 0 8px rgba(255,255,255,.6); }
.checker-legend {
  display: flex; gap: 18px; padding: 8px 22px;
  background: rgba(255,255,255,.02); border-bottom: 1px solid var(--border);
  font-size: 10px; overflow-x: auto; font-weight: 600;
}
.checker-legend span { white-space: nowrap; opacity: .85; }
.checker-table { width: 100%; border-collapse: collapse; font-size: 12px; }
/* v24: the scroll cap lives here (not inline) so it can respond to the fixed
   mobile bar. max-height, not height — the wrap shrinks to fit a short table
   instead of reserving dead space. */
.checker-table-wrap {
  max-height: calc(100vh - 240px);
  max-height: calc(100dvh - 240px);
  overflow: auto;
}
.checker-table thead th {
  text-align: left; padding: 10px 14px;
  font-size: 9px; font-weight: 800; color: var(--t3);
  text-transform: uppercase; letter-spacing: .8px;
  background: rgba(255,255,255,.02); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
.checker-table tbody tr { border-bottom: 1px solid rgba(255,255,255,.04); transition: background .15s; }
.checker-table tbody tr:hover { background: rgba(255,255,255,.04); }
.checker-table tbody tr:nth-child(odd) { background: rgba(255,255,255,.018); }
.checker-table td { padding: 9px 14px; vertical-align: middle; }
.checker-table .td-email { font-weight: 700; color: var(--t1); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checker-table .td-pass  { font-family: var(--mono); font-size: 11px; color: var(--t3); }
.checker-table .td-action { white-space: nowrap; }

/* ── Form ───────────────────────────────────────────────────────── */
.form-scroll { padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; }
.form-body   { display: grid; grid-template-columns: 3fr 2fr; gap: 18px; }
/* ── Table scroller (keeps wide tables inside their card) ───────── */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.form-row {
  display: flex; align-items: center;
  background: rgba(255,255,255,.03); border: 1px solid var(--border);
  border-radius: 14px; height: 50px; padding: 0 14px; gap: 10px; margin-bottom: 8px;
  transition: border-color .2s, box-shadow .2s;
}
.form-row:focus-within { border-color: rgba(255,255,255,.4); box-shadow: 0 0 0 3px rgba(255,255,255,.1); }
.form-label {
  font-size: 10px; font-weight: 700; color: var(--t3);
  width: 90px; flex-shrink: 0; text-transform: uppercase; letter-spacing: .5px;
}
.form-input {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  color: var(--t1); font-size: 13px; font-family: var(--font);
}
.form-input.mono { font-family: var(--mono); }
.form-input::placeholder { color: var(--t3); }

.paste-box {
  width: 100%; background: rgba(255,255,255,.03); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 14px; color: var(--t2);
  font-size: 10px; font-family: var(--mono); resize: vertical; min-height: 48px;
  outline: none; transition: border-color .2s;
}
.paste-box:focus { border-color: rgba(255,255,255,.4); color: var(--t1); }
.paste-box::placeholder { color: var(--t3); }

/* v24 LAYOUT FIX (LAY2): grid items default to `min-width: auto` and an
   <input> carries a ~20-character intrinsic minimum, so both tracks blew past
   the card and the ENTIRE second column escaped it — 40px on desktop, 105px
   on a 390px phone (with a horizontal scrollbar). */
.codes-edit-grid {
  display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 6px; min-width: 0;
}
.code-edit-tile {
  display: flex; align-items: center; gap: 7px; min-width: 0;
  background: rgba(255,255,255,.03); border: 1px solid var(--border);
  border-radius: 10px; height: 36px; padding: 0 10px; transition: border-color .2s;
}
.code-edit-tile:not(.used):focus-within { border-color: rgba(255,255,255,.35); }
.code-edit-tile.used { background: rgba(255,255,255,.015); }
.code-edit-input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--t1); font-family: var(--mono); font-size: 11px; font-weight: 700; }
.code-edit-input:disabled { color: var(--t3); }
.code-edit-input::placeholder { color: var(--t3); font-weight: 400; }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  border: none; border-radius: 10px; cursor: pointer;
  font-weight: 600; font-family: var(--font); transition: all .18s ease;
  white-space: nowrap; display: inline-flex; align-items: center;
  justify-content: center; gap: 5px; letter-spacing: .1px;
  user-select: none; -webkit-user-select: none;
}
.btn-sm  { font-size: 10px; padding: 4px 11px; height: 28px; border-radius: 8px; }
.btn-md  { font-size: 12px; padding: 7px 16px; height: 34px; }
.btn-lg  { font-size: 13px; padding: 0 22px; height: 44px; }
.btn-xl  { font-size: 14px; padding: 0 32px; height: 52px; }

/* FIX: was white text on a near-white gradient background — completely
   invisible. Primary/accent buttons now use solid white with black text,
   a proper high-contrast "inverted" style that fits a B&W theme. */
.btn-accent { background: #ffffff; color: #000000; font-weight: 700; box-shadow: 0 4px 14px rgba(255,255,255,.25); }
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255,255,255,.35); background: #e8e8e8; }
.btn-accent:active { transform: translateY(0); }

.btn-ghost  { background: rgba(255,255,255,.06); color: var(--t2); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,.1); color: var(--t1); border-color: var(--border-bright); }

.btn-danger { background: rgba(255,255,255,.1); color: var(--red); border: 1px solid rgba(255,255,255,.25); }
.btn-danger:hover { background: rgba(255,255,255,.2); border-color: var(--red); box-shadow: 0 0 14px rgba(255,255,255,.25); }

.btn-green  { background: rgba(255,255,255,.15); color: var(--green); border: 1px solid rgba(255,255,255,.3); }
.btn-green:hover { background: rgba(255,255,255,.25); box-shadow: 0 0 14px rgba(255,255,255,.3); }

.btn-red-stop { background: rgba(255,255,255,.2); color: var(--red); border: 1px solid rgba(255,255,255,.4); }
.btn-red-stop:hover { background: rgba(255,255,255,.3); }

.btn-warn   { background: rgba(255,255,255,.1); color: var(--orange); border: 1px solid rgba(255,255,255,.3); }
.btn-warn:hover { background: rgba(255,255,255,.2); }

.btn-yellow { background: rgba(255,255,255,.1); color: var(--yellow); border: 1px solid rgba(255,255,255,.3); }
.btn-yellow:hover { background: rgba(255,255,255,.2); }

.btn-dead   { background: rgba(255,255,255,.12); color: var(--red); border: 1px solid rgba(255,255,255,.3); }
.btn-dead:hover { background: rgba(255,255,255,.22); }

/* Copy feedback animation */
.btn-copied {
  background: rgba(255,255,255,.2) !important;
  color: var(--green) !important;
  border-color: rgba(255,255,255,.4) !important;
  transition: all .15s !important;
}

/* ── Toast ──────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: rgba(16,16,28,.95); color: var(--green);
  border: 1px solid rgba(255,255,255,.3); border-radius: 14px;
  padding: 11px 26px; font-size: 13px; font-weight: 600;
  z-index: 9999; pointer-events: none; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.06);
  white-space: nowrap; animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity:0; transform:translateX(-50%) translateY(8px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }
.toast.red    { color: var(--red);    border-color: rgba(255,255,255,.3); }
.toast.orange { color: var(--orange); border-color: rgba(255,255,255,.3); }
.toast.green  { color: var(--green);  border-color: rgba(255,255,255,.3); }

/* ── Misc ───────────────────────────────────────────────────────── */
.loading-inline { color: var(--t3); font-size: 12px; padding: 36px; text-align: center; }

/* Fix password dialog */
.fix-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center; z-index: 9000;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fadeIn .18s ease;
}
.fix-dialog {
  background: #0D0E16; border: 1px solid var(--border-bright);
  border-radius: 22px; padding: 32px; width: 420px; max-width: 95vw;
  box-shadow: 0 40px 80px rgba(0,0,0,.7);
  animation: popIn .22s ease;
}
.fix-dialog h3 { font-size: 18px; font-weight: 800; margin-bottom: 4px; letter-spacing: -.3px; }
.fix-dialog .sub { font-size: 12px; margin-bottom: 18px; }
.fix-dialog label { font-size: 10px; color: var(--t3); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.fix-input {
  width: 100%; margin-top: 8px; padding: 12px 16px;
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  border-radius: 12px; color: var(--t1); font-size: 13px;
  font-family: var(--mono); outline: none; transition: border-color .2s, box-shadow .2s;
}
.fix-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,255,255,.2); }
.fix-show { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 11px; color: var(--t2); cursor: pointer; }
.fix-show input { accent-color: var(--accent); cursor: pointer; }
.fix-btns { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; }

/* ── Gmail OAuth ────────────────────────────────────────────────── */
.btn-gmail {
  background: rgba(255,255,255,.06);
  color: var(--t1); border: 1px solid var(--border);
  display: inline-flex; align-items: center; gap: 7px;
}
.btn-gmail:hover { background: rgba(255,255,255,.12); border-color: var(--border-bright); box-shadow: 0 0 16px rgba(255,255,255,.12); }
.btn-gmail-connected { background: rgba(255,255,255,.1); color: var(--green); border: 1px solid rgba(255,255,255,.3); display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.btn-gmail-connected:hover { background: rgba(255,255,255,.2); }
.gmail-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); animation: pulse-dot 1.4s ease-in-out infinite; }

/* ── Inbox ──────────────────────────────────────────────────────── */
.inbox-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.mail-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 16px; border-radius: 14px;
  background: rgba(255,255,255,.025); border: 1px solid transparent;
  margin-bottom: 7px; transition: all .18s ease; cursor: default; position: relative;
}
.mail-item:hover { background: rgba(255,255,255,.05); border-color: var(--border); }
.mail-item.unread { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); }
/* background is set inline via stringToColor */
.mail-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: #2a2a2a; display: flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 700; color: #fff;
}
.mail-body { flex: 1; min-width: 0; }
.mail-top  { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.mail-from { font-size: 12px; font-weight: 700; color: var(--t1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-from-email { font-size: 10px; color: var(--t3); font-weight: 400; }
.mail-date { font-size: 10px; color: var(--t3); flex-shrink: 0; }
.mail-subject { font-size: 12px; color: var(--t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 3px; }
.mail-subject.bold { color: var(--t1); font-weight: 700; }
.mail-snippet { font-size: 11px; color: var(--t3); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mail-unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--accent); flex-shrink: 0; margin-top: 4px; }

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile, Tablet (iPad), Desktop
   ════════════════════════════════════════════════════════════════ */

/* ── Shared: tablet + mobile get drawer sidebar ─────────────────── */
@media (max-width: 1023px) {
  /* Performance: kill heavy blobs */
  body::before, body::after { display: none; }

  .card {
    backdrop-filter: none; -webkit-backdrop-filter: none;
    background: rgba(14,15,24,0.97);
  }

  /* Show hamburger top bar */
  .mobile-bar { display: flex; }

  /* App: column layout under the top bar.
     z-index: auto so it doesn't create a stacking context that would
     trap the sidebar below the overlay. */
  .app {
    flex-direction: column;
    padding-top: calc(52px + env(safe-area-inset-top, 0px));
    height: 100vh;   /* fallback for Safari <15.4 (iPad Air 2 / iOS 15.8) */
    height: 100dvh;  /* progressive enhancement on newer browsers */
    overflow: hidden;
    z-index: auto;
  }

  /* Sidebar: off-screen drawer — z-index 300 ensures it's above everything */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    /* FIX: drawer must sit ABOVE the fixed top bar (z-index 400), otherwise
       the bar covered the drawer's own header (logo + export/import/logout).
       Overlay is z-index 490, drawer 500. */
    z-index: 500;
    width: 300px !important; min-width: 300px !important;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    will-change: transform;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    padding-top: env(safe-area-inset-top, 0px);
    overflow-y: auto;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 8px 0 48px rgba(0,0,0,.7);
  }

  /* Undo collapsed styles — drawer must always show full content */
  .sidebar.collapsed {
    width: 300px !important; min-width: 300px !important;
  }
  .sidebar.collapsed .sb-info,
  .sidebar.collapsed .sb-hdr-btns,
  .sidebar.collapsed .tabs,
  .sidebar.collapsed .acc-count,
  .sidebar.collapsed .search-wrap,
  .sidebar.collapsed .btn-add-sb,
  .sidebar.collapsed .divider {
    opacity: 1 !important; pointer-events: auto !important;
    overflow: visible !important;
  }
  .sidebar.collapsed .acc-label {
    opacity: 1 !important; width: auto !important; overflow: visible !important;
  }
  .sidebar.collapsed .acc-item  { justify-content: flex-start !important; padding: 8px 10px !important; }
  .sidebar.collapsed .acc-avatar { margin: 0 !important; }
  .sidebar.collapsed .sb-header { justify-content: flex-start !important; padding: 18px 16px 16px !important; }

  /* Hide desktop collapse btn */
  .btn-collapse { display: none; }

  /* Content: full remaining height, scrollable */
  .content {
    flex: 1; min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 80px;
  }

  /* Detail/form scroll padding */
  .detail-scroll { padding: 16px 16px 28px; gap: 14px; }
  .form-scroll   { padding: 16px 16px 28px; gap: 14px; }
  .detail-header { padding: 14px 16px; }

  /* Stacked grids */
  .detail-body { grid-template-columns: 1fr; }
  .form-body   { grid-template-columns: 1fr; }

  /* Inbox always visible */
  #inbox-section { display: block !important; overflow: visible; }
  #inbox-slot    { min-height: 60px; }

  /* Checker table scroll */
  .checker-table-wrap { overflow: auto; max-height: calc(100dvh - 320px); }
  .checker-table      { min-width: 580px; }
  .checker-top        { padding: 12px 16px; }

  /* Toast */
  .toast { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); max-width: 92vw; white-space: normal; text-align: center; }

  /* Tappable list items — touch-action:manipulation removes 300ms click delay */
  .acc-item { touch-action: manipulation; -webkit-tap-highlight-color: rgba(255,255,255,.18); cursor: pointer; }
  .acc-list  { overflow-y: auto; -webkit-overflow-scrolling: touch; }
}

/* ── Mobile only (phones ≤ 767px) ────────────────────────────────── */
@media (max-width: 767px) {
  .sidebar { width: 285px !important; min-width: 285px !important; }
  .sidebar.collapsed { width: 285px !important; min-width: 285px !important; }

  .detail-email   { font-size: 15px; }
  .detail-actions { gap: 6px; flex-wrap: wrap; }
  /* FIX: height:32px here (and 29px at ≤400px) never rendered — the later
     equal-specificity '.detail-actions .btn { height: 38px }' in the ≤1023px
     block always won, so the phone buttons were a lie in the sheet. */
  .detail-actions .btn { font-size: 11px; padding: 6px 12px; }

  /* Mail list */
  .mail-item   { padding: 11px 12px; gap: 10px; border-radius: 12px; }
  .mail-avatar { width: 34px; height: 34px; border-radius: 9px; font-size: 13px; }
  .mail-from   { font-size: 12px; }
  .mail-from-email { display: none; }
  .mail-subject { font-size: 12px; }
  .mail-snippet { font-size: 11px; -webkit-line-clamp: 2; }
  .mail-date    { font-size: 10px; white-space: nowrap; }

  /* Dashboard */
  .dash-stats   { gap: 8px; }
  .dash-stat    { padding: 12px 14px; min-width: 64px; }
  .dash-stat-num { font-size: 22px; }
  .dash-actions  { gap: 8px; }
  .dash-actions .btn-lg { font-size: 12px; padding: 0 16px; height: 40px; }

  /* Backup codes single column */
  .codes-grid { grid-template-columns: 1fr 1fr; }

  /* Fix dialog */
  .fix-dialog { padding: 22px 16px; }
  .checker-stats { display: none; }
}

/* v26: at tablet/narrow-desktop widths the right detail card is too narrow
   for two 50px code tiles + Copy/Used buttons; the old 2-column grid clipped
   the code and the buttons. One column until there is real room. */
@media (max-width: 1200px) {
  .codes-grid { grid-template-columns: 1fr; }
  .code-tile { min-width: 0; }
}

/* ── Extra small phones (≤ 400px) ───────────────────────────────── */
@media (max-width: 400px) {
  .sidebar { width: 260px !important; min-width: 260px !important; }
  .sidebar.collapsed { width: 260px !important; min-width: 260px !important; }
  .detail-email { font-size: 13px; }
  .detail-actions .btn { font-size: 10px; padding: 5px 9px; }
  .codes-grid { grid-template-columns: 1fr; }
  /* v24: the masked password (8 bullets at 3px letter-spacing ≈ 91px) was
     clipped to ~46px next to the fixed 90px label + Show/Copy buttons. */
  .info-label { width: 68px; }
  .info-value.secret { letter-spacing: 1.5px; font-size: 12px; }
}

/* ── iPad / Tablet (768px – 1023px) ─────────────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  .sidebar { width: 320px !important; min-width: 320px !important; }
  .sidebar.collapsed { width: 320px !important; min-width: 320px !important; }

  /* Two-column detail on tablet */
  .detail-body { grid-template-columns: 3fr 2fr; }
  .form-body   { grid-template-columns: 3fr 2fr; }

  .detail-scroll { padding: 20px 22px 28px; }
  .form-scroll   { padding: 20px 22px 28px; }
  .detail-email  { font-size: 18px; }
  .detail-actions { gap: 8px; }

  /* Mail list roomier on tablet */
  .mail-item   { padding: 13px 16px; }
  .mail-avatar { width: 38px; height: 38px; }
  .mail-from   { font-size: 13px; }
  .mail-subject { font-size: 13px; }
  .mail-from-email { display: inline; }

  /* Dashboard wider stats */
  .dash-stat    { padding: 16px 22px; min-width: 80px; }
  .dash-stat-num { font-size: 28px; }
}

/* ── Desktop (≥ 1024px): hide mobile bar and overlay ────────────── */
@media (min-width: 1024px) {
  .mobile-bar { display: none !important; }
  .sb-overlay { display: none !important; }
}

/* ── Large desktop (≥ 1400px) ───────────────────────────────────── */
@media (min-width: 1400px) {
  :root { --sb-w: 308px; }
  .detail-scroll, .form-scroll { padding: 32px 36px; }
}


/* ── UPDATED v2 additions ────────────────────────────────────────── */

/* v26: native <option> popups follow the OS theme, not the page; without
   color-scheme the white text above rendered white-on-white on Windows/Linux. */
select { color-scheme: dark; }
:root[data-theme="light"] select { color-scheme: light; }
select option { background: #111214; color: #f8fafc; }
:root[data-theme="light"] select option { background: #ffffff; color: #111111; }

/* Inbox limit select */
.inbox-limit-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--t2);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
  transition: border-color .2s;
}
.inbox-limit-select:hover,
.inbox-limit-select:focus { border-color: var(--accent); color: var(--t1); }

/* (v2 duplicate blocks for .mail-avatar / .btn-dead / .btn-danger /
   .fix-input:focus were merged into the base rules above — the cascade
   result is identical, the double definitions are gone.) */

/* ══════════════════════════════════════════════════════════════════
   v20 additions — bulk select, import/export menu, theme, polish
   ══════════════════════════════════════════════════════════════════ */

/* ── Import/Export dropdown menu ─────────────────────────────────── */
.menu-wrap { position: relative; }
.io-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
  min-width: 232px; padding: 6px;
  background: var(--sb-bg); border: 1px solid var(--border-bright);
  border-radius: 12px; box-shadow: 0 18px 40px rgba(0,0,0,.55);
  animation: menuPop .14s ease both;
}
@keyframes menuPop { from { opacity: 0; transform: translateY(-5px) scale(.98); } to { opacity: 1; transform: none; } }
.io-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border: none; border-radius: 8px;
  background: none; color: var(--t1); font-size: 12px; font-family: var(--font);
  cursor: pointer; transition: background .12s; white-space: nowrap;
}
.io-item:hover { background: rgba(255,255,255,.07); }
.io-item-primary { font-weight: 700; color: var(--accent, #fafafa); }
.io-sep { height: 1px; background: var(--border); margin: 5px 8px; }

/* ── Header select-mode toggle active state ──────────────────────── */
.btn-icon.active { color: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px rgba(255,255,255,.25); }

/* ── Bulk select (sidebar) ───────────────────────────────────────── */
.acc-sel { flex-shrink: 0; accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }
.acc-sel:disabled { opacity: .3; cursor: not-allowed; }
.acc-item.sel { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.28); }

.bulk-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; margin: 0 10px 8px;
  background: rgba(255,255,255,.06); border: 1px solid var(--border-bright);
  border-radius: 12px; animation: menuPop .15s ease both;
  flex-shrink: 0;
}
.bulk-count { flex: 1; font-size: 11px; font-weight: 700; color: var(--t1); white-space: nowrap; }

.sb-add-wrap { flex-shrink: 0; }

/* ── Bulk select (checker table) ─────────────────────────────────── */
.chk-sel { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }
.chk-sel:disabled { opacity: .3; cursor: not-allowed; }

/* ── Bulk select (inbox) ─────────────────────────────────────────── */
.mail-left { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
.mail-sel { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; margin-top: 2px; }

/* ── Light theme ─────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:             #f4f4f5;
  --surface:        rgba(0,0,0,0.035);
  --border:         rgba(0,0,0,0.12);
  --border-bright:  rgba(0,0,0,0.25);
  --grad:           linear-gradient(135deg,#18181b 0%,#52525b 100%);
  --accent:         #18181b;
  --t1:             #18181b;
  --t2:             #52525b;
  /* FIX: #a1a1aa measured 2.33:1 on #f4f4f5 — too pale for real TEXT
     (.sb-sub, .acc-count, .search-ic + placeholder, .mail-snippet,
     .mail-date, .code-used-date, .btn-icon all use --t3). #71717a is
     4.40:1 there / 4.83:1 on white. The dark theme's --t3 is untouched. */
  --t3:             #71717a;
  /* FIX: the light theme re-tuned every other token but none of the status
     hues, so the values chosen for the DARK background were then used as
     text on light surfaces — measured 1.75:1 (green), 2.52:1 (red),
     2.06:1 (orange), 1.52:1 (yellow); the 32px TOTP code failed even the
     3:1 large-text floor and the dashboard numbers were near-invisible.
     These are ≥4.5:1 on #f4f4f5 and #ffffff (the suggested #059669/#dc2626/
     #a16207 were 3.43/4.39/4.48, i.e. still short, so they are darkened). */
  --green:          #047857;
  --red:            #c62828;
  --orange:         #c2410c;
  --yellow:         #854d0e;
  --sb-bg:          #fafafa;
  --gray:           #a1a1aa;
  --glow-accent:    0 0 16px rgba(0,0,0,.12);
}
[data-theme="light"] body { color: var(--t1); }
[data-theme="light"] .login-page { background: var(--bg); }
/* FIX: was `color:#fafafa` only — the base .btn-accent keeps
   background:#ffffff, so light mode rendered near-white text on a white
   button (Sign In / Save / Add Account all invisible). Accent buttons in
   light mode are now dark with light text. */
[data-theme="light"] .btn-accent { background: #18181b; color: #fafafa; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
[data-theme="light"] .btn-accent:hover { background: #3f3f46; box-shadow: 0 6px 20px rgba(0,0,0,.22); }
/* FIX: .tab.active is hardcoded #ffffff — invisible on the near-white
   light sidebar. Same dark treatment as .btn-accent. */
[data-theme="light"] .tab.active { background: #18181b; color: #fafafa; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
[data-theme="light"] .btn-add-sb { background: #18181b; color: #fafafa; }
[data-theme="light"] .tag-chip.active { color: #fafafa; }
/* FIX: rgba(255,255,255,x) surfaces all but disappear on the light
   background — swap the main containers/ghost buttons to dark tints. */
[data-theme="light"] .card,
[data-theme="light"] .login-box,
[data-theme="light"] .splash-box { background: rgba(255,255,255,.72); }
[data-theme="light"] .btn-ghost  { background: rgba(0,0,0,.05); color: var(--t2); }
[data-theme="light"] .btn-ghost:hover { background: rgba(0,0,0,.1); color: var(--t1); }
[data-theme="light"] .btn-danger,
[data-theme="light"] .btn-green,
[data-theme="light"] .btn-warn,
[data-theme="light"] .btn-yellow,
[data-theme="light"] .btn-dead   { background: rgba(0,0,0,.05); border-color: rgba(0,0,0,.2); }
[data-theme="light"] .btn-gmail  { background: rgba(0,0,0,.05); }
[data-theme="light"] .btn-gmail-connected { background: rgba(0,0,0,.06); border-color: rgba(0,0,0,.2); }
[data-theme="light"] .btn-icon   { background: rgba(0,0,0,.04); }
[data-theme="light"] .btn-icon:hover { background: rgba(0,0,0,.09); }
[data-theme="light"] .btn-copied { background: rgba(0,0,0,.12) !important; border-color: rgba(0,0,0,.3) !important; }
[data-theme="light"] .mail-unread-dot { background: #18181b; box-shadow: none; }
[data-theme="light"] .toast { background: rgba(255,255,255,.97); border-color: rgba(0,0,0,.2); }
/* Rows/inputs/tiles: white-alpha fills vanish on the light background. */
[data-theme="light"] .info-row,
[data-theme="light"] .form-row,
[data-theme="light"] .code-tile,
[data-theme="light"] .code-edit-tile,
[data-theme="light"] .auth-input,
[data-theme="light"] .detect-box,
[data-theme="light"] .paste-box,
[data-theme="light"] .mail-item,
[data-theme="light"] .tabs,
[data-theme="light"] .dash-stat,
[data-theme="light"] .search-wrap  { background: rgba(0,0,0,.04); }
[data-theme="light"] .mail-item.unread { background: rgba(0,0,0,.07); }
/* FIX: .dash-stat was missed by this sweep — its rgba(255,255,255,.04) fill
   (and .07 hover) simply vanished on the light background. */
[data-theme="light"] .dash-stat:hover { background: rgba(0,0,0,.07); }
/* FIX: .../unread only overrode the BACKGROUND, so the unread outline
   stayed white-alpha (rgba(255,255,255,.14)) and disappeared. */
[data-theme="light"] .mail-item.unread { border-color: rgba(0,0,0,.18); }
[data-theme="light"] .acc-item:hover   { background: rgba(0,0,0,.05); }
[data-theme="light"] .acc-item.active  { background: rgba(0,0,0,.09); border-color: rgba(0,0,0,.25); box-shadow: none; }
[data-theme="light"] .tag-chip { background: rgba(0,0,0,.04); }
[data-theme="light"] .acc-tag  { background: rgba(0,0,0,.06); }
[data-theme="light"] .totp-card { background: rgba(0,0,0,.04); border-color: rgba(0,0,0,.18); }
[data-theme="light"] .checker-top,
[data-theme="light"] .checker-legend { background: rgba(255,255,255,.85); }
[data-theme="light"] .code-badge { color: #fafafa; box-shadow: none; }
[data-theme="light"] .totp-ring-bg { stroke: rgba(0,0,0,.12); }
[data-theme="light"] .splash-bar { background: rgba(0,0,0,.08); }
[data-theme="light"] .mobile-bar { background: rgba(250,250,250,.95); }
[data-theme="light"] .fix-dialog { background: #ffffff; box-shadow: 0 40px 80px rgba(0,0,0,.25); }
[data-theme="light"] .fix-input { background: rgba(0,0,0,.04); }
[data-theme="light"] .io-menu { background: #ffffff; box-shadow: 0 18px 40px rgba(0,0,0,.18); }
[data-theme="light"] .io-item:hover { background: rgba(0,0,0,.06); }
[data-theme="light"] .bulk-bar { background: rgba(0,0,0,.05); border-color: rgba(0,0,0,.25); }
[data-theme="light"] .acc-item.sel { background: rgba(0,0,0,.08); border-color: rgba(0,0,0,.3); }
[data-theme="light"] .acc-avatar { background: #e4e4e7; border-color: rgba(0,0,0,.1); }
[data-theme="light"] .acc-avatar svg path { fill: #3f3f46; }
[data-theme="light"] .acc-avatar svg path[fill-opacity] { fill-opacity: .45; }

/* v24 LIGHT-THEME GAPS: the checker table kept its white-alpha fills, so row
   striping and the header band vanished on the light background and the --t3
   header text was low-contrast. */
[data-theme="light"] .checker-table thead th {
  background: rgba(0,0,0,.05); color: #52525b; border-bottom-color: rgba(0,0,0,.12);
}
[data-theme="light"] .checker-table tbody tr              { border-bottom-color: rgba(0,0,0,.07); }
[data-theme="light"] .checker-table tbody tr:nth-child(odd) { background: rgba(0,0,0,.022); }
[data-theme="light"] .checker-table tbody tr:hover          { background: rgba(0,0,0,.05); }
/* v24: the splash icon tile + white spinner arcs were invisible on the light
   splash card, and the decorative blobs/glows are white-only. */
[data-theme="light"] .splash-icon { background: rgba(0,0,0,.06); border-color: rgba(0,0,0,.15); }
[data-theme="light"] .splash-icon::before { border-top-color: #18181b; border-right-color: #71717a; }
[data-theme="light"] .splash-icon::after  { border-bottom-color: rgba(0,0,0,.35); }
[data-theme="light"] .splash-icon-img { filter: drop-shadow(0 0 14px rgba(0,0,0,.25)); }
/* FIX: the rule above was DEAD CODE. The base rule animates `filter`
   (iconGlow, WHITE keyframes) and a running animation outranks a normal
   declaration, so light mode still measured filter = drop-shadow(rgba(255,
   255,255,.4) …) — a white halo on a white card. Re-declaring the animation
   without iconGlow keeps the float and lets the dark drop-shadow win. */
[data-theme="light"] .splash-icon-img { animation: iconFloat 3s ease-in-out infinite; }
[data-theme="light"] .login-blob-1 { background: radial-gradient(circle, rgba(0,0,0,.055), transparent 70%); }
[data-theme="light"] .login-blob-2 { background: radial-gradient(circle, rgba(0,0,0,.045), transparent 70%); }
[data-theme="light"] .login-logo-img { filter: drop-shadow(0 0 12px rgba(0,0,0,.22)); }
[data-theme="light"] .login-logo-ring {
  background: linear-gradient(135deg,rgba(0,0,0,.45),rgba(0,0,0,.15)) border-box;
}
[data-theme="light"] .w-icon-img { filter: drop-shadow(0 0 14px rgba(0,0,0,.28)); }
/* FIX: same dead-code problem — .w-icon-img animates welcomeGlow (white).
   Keep the float, drop the glow keyframe. */
[data-theme="light"] .w-icon-img { animation: welcomeFloat 4s ease-in-out infinite; }
[data-theme="light"] .w-icon-ring,
[data-theme="light"] .w-icon-ring::before { border-color: rgba(0,0,0,.18); }
[data-theme="light"] body::before,
[data-theme="light"] body::after { display: none; }
[data-theme="light"] .sb-logo { background: rgba(0,0,0,.06); border-color: rgba(0,0,0,.15); }

/* v25 LIGHT-THEME LEFTOVERS: each of these was still a white-alpha value
   that renders as ~nothing on the light background. */
[data-theme="light"] .code-tile.used .code-badge { background: rgba(0,0,0,.08); }
[data-theme="light"] .checker-progress { background: rgba(0,0,0,.06); }
[data-theme="light"] .checker-controls select { background: rgba(0,0,0,.05); }
/* The splash pulse also only knows WHITE box-shadows, which both made the
   light card invisible and defeated the static box-shadow (running animation
   wins). Light mode gets its own dark-shadow pulse. */
@keyframes splashPulseLight {
  0%,100% { box-shadow: 0 0 0 0 rgba(0,0,0,.22), 0 0 30px rgba(0,0,0,.10); }
  50%     { box-shadow: 0 0 0 12px rgba(0,0,0,0), 0 0 50px rgba(0,0,0,.18); }
}
[data-theme="light"] .splash-icon {
  box-shadow: 0 0 0 0 rgba(0,0,0,.22);
  animation: splashPulseLight 2s ease-in-out infinite;
}
/* .fix-dialog and .io-menu already got a toned-down light shadow; these two
   still dropped a hard black shadow (rgba(0,0,0,.5)/.6) on the pale page. */
[data-theme="light"] .login-box,
[data-theme="light"] .splash-box { box-shadow: 0 40px 80px rgba(0,0,0,.25), 0 0 0 1px rgba(0,0,0,.06); }
[data-theme="light"] .sb-logo-img { filter: none; }
[data-theme="light"] .mobile-logo-img { filter: none; }

/* ── Global polish ───────────────────────────────────────────────── */
html { scrollbar-gutter: stable; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }
input[type="checkbox"] { accent-color: var(--accent); }
:focus-visible { outline: 2px solid rgba(255,255,255,.45); outline-offset: 2px; }
[data-theme="light"] :focus-visible { outline-color: rgba(0,0,0,.45); }
.card:hover { border-color: var(--border-bright); }

/* FIX: app.js renders '<div class="mail-expand-btn">▼ Show full message</div>'
   at EVERY width, but this file only styled it inside @media(max-width:767px),
   so on desktop it was a clickable but unstyled bare div (measured 16px tall,
   body-text look). Base rule first; the ≤767px rule further down stays as the
   roomier phone refinement (it comes later, so its display/padding win). */
.mail-expand-btn {
  display: inline-block; padding: 6px 2px; font-size: 11px; font-weight: 600;
  color: var(--t2); cursor: pointer; border-radius: 6px; transition: color .15s;
}
.mail-expand-btn:hover { color: var(--t1); }

@media (max-width: 767px) {
  .io-menu { min-width: 200px; right: -4px; }
  .bulk-bar { margin: 0 8px 6px; padding: 6px 8px; gap: 4px; }
  .bulk-bar .btn { font-size: 10px; padding: 4px 8px; }
  .bulk-count { font-size: 10px; }
}

/* ══════════════════════════════════════════════════════════════════
   v24 MOBILE FIXES
   Found by auditing the rendered DOM at 320 / 360 / 390 / 414 px plus
   phone landscape (844×390) and tablet (768×1024), both themes.
   ══════════════════════════════════════════════════════════════════ */

/* ── Touch devices in drawer mode (≤1023px: phones, landscape phones,
      tablets) ────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  /* Header: the drawer is only 260–320px wide, yet it held the logo, the
     app title, the LOGGED-IN EMAIL and four icon buttons on one line —
     leaving the email ~45px ("me@ex…"). In drawer mode that header is the
     only place that shows which login you are using. */
  .sb-header { flex-wrap: wrap; row-gap: 6px; }
  .sb-hdr-btns { flex: 0 0 100%; order: 3; justify-content: flex-start; gap: 6px; }
  .sb-info { flex: 1 1 auto; min-width: 0; }

  /* Landscape phones: calc(100dvh - 320px) left the checker table ~70px
     tall — one clipped row. Keep a usable floor. */
  .checker-table-wrap {
    max-height: 260px;
    max-height: max(260px, calc(100dvh - 320px));
  }

  /* Touch targets: these measured 28×28, 14×14 and 28px-tall. iOS asks for
     44pt and Material for 48dp; anything under ~40px is fiddly on a phone. */
  .btn-hamburger { width: 44px; height: 44px; }
  .btn-icon { width: 40px; height: 40px; border-radius: 11px; }
  .tabs { padding: 5px; }
  .tab { padding: 13px 0; font-size: 12px; }        /* 40px tall */
  .btn-sm { height: 32px; padding: 0 12px; }        /* mail / section actions */
  .btn-md { height: 38px; }
  .detail-actions .btn { height: 38px; }
  .checker-controls select, .inbox-limit-select { padding: 8px 10px; }
  .acc-sel, .chk-sel, .mail-sel { width: 18px; height: 18px; }
  .fix-show input { width: 18px; height: 18px; }
  .fix-btns .btn { height: 40px; }
  /* Text-style buttons: give them a real tap area. NOTE the two-class
     selectors: these rules sit ABOVE the merged base block at the end of this
     file, so an equal-specificity rule here would lose the cascade. */
  .auth-form .auth-forgot,
  .auth-form .auth-back { padding: 10px 2px; }
  .auth-pw-wrap .auth-eye { width: 40px; height: 40px; right: 4px; font-size: 17px; }
  .io-item { padding: 12px 10px; }
  .mail-left { gap: 8px; }
}

/* ── Phones (≤767px) ───────────────────────────────────────────────── */
@media (max-width: 767px) {
  /* iOS Safari zooms the entire page when a form control under 16px
     receives focus, which makes filling the form feel broken. Keep text
     entry — and the selects, whose native picker iOS also zooms for — at
     16px. This selector outranks the class-based font sizes above. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
  textarea,
  .paste-box,
  select,
  .checker-controls select,
  .inbox-limit-select { font-size: 16px; }
  /* keep the taller glyphs centred in the fixed-height rows */
  .auth-input, .form-input, .fix-input, .paste-box { line-height: 1.35; }
}

/* ── Small phones (≤430px): backup-code grid goes single-column ──────
   16px code cells no longer fit two-up in a phone-width card, and ten
   slightly taller cells beat ten clipped ones. Tablets keep 2 columns. */
@media (max-width: 430px) {
  .codes-edit-grid { grid-template-columns: minmax(0,1fr); }
}

/* ══════════════════════════════════════════════════════════════════
   v24 MOBILE INBOX + DETAIL LAYOUT
   Measured on the rendered DOM at 375 / 390 / 430 px. On a phone the
   detail page was 2,561px tall and the inbox started 1,065px down
   (~1.3 screens of scrolling past account info, 2FA and a 460px backup
   code list) — and every message card wasted 79px because its three
   action buttons wrapped onto two rows.
   ══════════════════════════════════════════════════════════════════ */

@media (max-width: 1023px) {
  /* Bring the mail list up under the header instead of last. .detail-scroll
     is already a flex column, so this is pure ordering.
     Order: header card (0) → inbox (1) → account info / 2FA / codes (2). */
  #inbox-section { order: 1; }
  .detail-body { order: 2; }

  /* The backup-code list was the single biggest block (460px) and pushed the
     inbox below the fold. Cap it on phones — it scrolls internally, nothing
     is hidden. */
  .codes-grid { max-height: 210px; }

  /* Safe areas (iPhone home indicator / notch): the drawer's last child is
     the "Add Account" button and it sat flush against the bottom edge —
     under the home bar. */
  .sidebar { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .content { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 767px) {
  /* Inbox header: the label was vertically centred beside a 65px-tall pile of
     wrapped controls. Stack them instead. */
  .inbox-hdr { flex-direction: column; align-items: stretch; gap: 8px; }

  /* Mail cards: the three action buttons each started on their own line
     (79px of buttons per message). Let them share one row. */
  body .mail-actions { margin-top: 8px; padding-top: 6px; gap: 5px; }
  body .mail-actions .btn { flex: 1 1 0; min-width: 0; padding: 0 4px; font-size: 10px; }
  .mail-item { padding: 10px 12px; }
  body .detect-box { margin: 6px 0; }

  /* "▼ Show full message" was a 15px-tall tap target. */
  .mail-expand-btn { display: block; padding: 13px 0 12px; font-size: 12px; }

  /* OTP row: 6 digits at 3px letter-spacing plus a Copy button did not fit —
     it overflowed the row by 3px and then clipped the digits once the row was
     allowed to shrink. Let the row wrap instead: label + code on line 1, the
     Copy button on line 2 when space runs out. */
  .detect-row { flex-wrap: wrap; min-width: 0; }
  body .detect-otp { flex: 0 0 auto; letter-spacing: 1.5px; font-size: 17px; }
  .detect-link { min-width: 0; }
}

/* Backup-code cells: two columns only fit above ~430px on a phone (a tile
   needs ~171px of content). Below that they clip. */
@media (max-width: 430px) {
  .codes-grid { grid-template-columns: 1fr; }
}

/* ── Very small phones (≤360px) ──────────────────────────────────────
   The mail body is only ~143px wide here, so three equal-width action
   buttons clip their labels ("🗄 Archive" needs 47px, gets 42px). Let them
   keep their natural size and wrap onto a second row instead. */
@media (max-width: 360px) {
  body .mail-actions .btn { flex: 0 1 auto; }
}


/* ══════════════════════════════════════════════════════════════════
   v24 TEXT-OVERFLOW + TAP-SIZE ROBUSTNESS
   Found by sweeping every view/width with non-selector-specific
   detectors (spill / parent-escape / text-clip / vertical-clip /
   tap-size / flex-wrap). These are the same classes of bug as the
   mobile inbox round, just in other components.
   ══════════════════════════════════════════════════════════════════ */

/* 1) Long unbreakable strings (URLs, tokens, pasted secrets, server error
      text) had no wrap rule, so they ran off the right edge and were cut by
      the page's scroll container. Worst case: an expanded email whose body
      held a long link — measured 537px of content in a 213px box. */
.mail-full-body,
.detail-meta,
.loading-inline,
.auth-err,
.auth-ok,
.auth-desc,
.splash-err,
.fix-dialog .sub,
.fix-input,
.info-value.empty,
.toast {
  overflow-wrap: break-word;   /* fallback for older Safari/Chrome */
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* 2) The sidebar header's title + logged-in email sit in a `min-width: 0`
      flex child and had no ellipsis, so they were cut mid-character with no
      indication (measured cw=93 vs sw=97 on desktop — it happens on every
      screen, not just mobile). */
.sb-title,
.sb-sub { overflow: hidden; text-overflow: ellipsis; }

/* 3) The search box is a 40px row but the input inside it was only 20px tall,
      so the real tap target was half the row. */
.search-inp { align-self: stretch; }

/* 4) A long toast could outgrow a narrow desktop window (white-space: nowrap,
      no max-width). */
.toast { max-width: min(92vw, 900px); white-space: normal; text-align: center; }

/* 5) Dense `btn-sm` controls were 32px tall on phones. 38px keeps them inside
      the 50px code tiles and 58px info rows while being far easier to hit. */
@media (max-width: 767px) {
  .btn-sm { height: 38px; }
}

/* 6) Form fields: `.form-input` inside a 50px `.form-row` (and
      `.code-edit-input` inside a 36px `.code-edit-tile`) was only 22px /
      14px tall — the input's own intrinsic height. Tapping the row's padding
      did nothing, so the real tap target on the Add/Edit Account form was
      less than half the visible field. Stretch the control to fill its row. */
.form-input,
.code-edit-input { align-self: stretch; }

@media (max-width: 767px) {
  /* 7) Checkboxes and selects: give them phone-sized hit areas. */
  .acc-sel, .chk-sel, .mail-sel, #inbox-select-all-cb { width: 20px; height: 20px; }
  .inbox-limit-select, .checker-controls select { min-height: 38px; }
}

/* ══════════════════════════════════════════════════════════════════
   v24 VERIFICATION LINKS
   A "Verify your email" BUTTON in an HTML mail is an <a href>; the server
   now extracts the href so it can be rendered as a real, tappable primary
   button instead of being thrown away with the tags.
   NOTE the 3-class selector: the base block at the END of this file has
   `.detect-box .btn { font-size: 11px; padding: 3px 10px; flex-shrink: 0 }`,
   which comes later, so an equal-specificity rule here would lose.
   ══════════════════════════════════════════════════════════════════ */
.detect-box .detect-verify {
  display: flex; align-items: center; gap: 6px; margin: 4px 0 2px;
}
.detect-box .detect-verify .mail-verify-btn {
  flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 12px;
  font-size: 13px; font-weight: 700; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.detect-box .detect-verify > .btn-sm { flex: 0 0 auto; height: 44px; }
.mail-verify-btn .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The whole row expands the message now, so say so with the cursor. */
.mail-item { cursor: pointer; }
.mail-item .mail-full-body, .mail-item .detect-box, .mail-item .mail-actions { cursor: auto; }

/* ======================================================================
   BASE COMPONENT STYLES
   Moved here verbatim from a <style> block that used to live in
   index.html's <body>. That block came AFTER the style.css <link>, so its
   equal-specificity rules silently beat every @media rule above it (a media
   query adds no specificity) - which is why the <=767px phone tuning for
   .mail-actions / .detect-* had no effect at all. Keeping it at the END of
   this file preserves the identical cascade order, and the phone rules above
   are `body`-qualified so they now win on specificity rather than order.
   ====================================================================== */

/* ── Login Page ──────────────────────────────────────────────────── */
.login-page {
  position: fixed; inset: 0; display: flex; align-items: safe center;
  justify-content: center; z-index: 998; background: var(--bg);
  overflow-y: auto; padding: clamp(16px, 5vh, 48px) 16px 24px; box-sizing: border-box;
}
.login-bg-blob {
  position: fixed; border-radius: 50%;
  filter: blur(100px); pointer-events: none; z-index: 0;
}
.login-blob-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,.10), transparent 70%);
  top: -150px; left: -100px;
}
.login-blob-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,.08), transparent 70%);
  bottom: -120px; right: -80px;
}
.login-box {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
  padding: 44px 40px 40px;
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--border-bright);
  border-radius: 28px;
  backdrop-filter: blur(24px);
  box-shadow: 0 40px 80px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.08);
  margin: 0 auto;
  animation: loginAppear .4s cubic-bezier(.22,1,.36,1) both;
}
@keyframes loginAppear {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo {
  width: 72px; height: 72px; margin: 0 auto 18px;
  position: relative; display: flex; align-items: center; justify-content: center;
}
.login-logo-img {
  width: 52px; height: 52px; object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(255,255,255,.5));
  animation: iconFloat 3s ease-in-out infinite;
}
.login-logo-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid transparent;
  background: linear-gradient(135deg,rgba(255,255,255,.5),rgba(255,255,255,.2)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out; mask-composite: exclude;
  animation: ringRotate 6s linear infinite;
}
@keyframes ringRotate { to { transform: rotate(360deg); } }
@keyframes iconFloat {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-5px) scale(1.04); }
}
.login-title {
  text-align: center; font-size: 26px; font-weight: 800; margin-bottom: 6px;
  background: var(--grad); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
}
.login-sub {
  text-align: center; color: var(--t3); font-size: 13px; margin-bottom: 32px;
}
/* Auth forms */
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form.hidden { display: none; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-label {
  font-size: 11px; font-weight: 700; color: var(--t3);
  text-transform: uppercase; letter-spacing: .5px;
}
.auth-input {
  width: 100%; padding: 11px 14px; border-radius: 10px;
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  color: var(--t1); font-size: 14px; font-family: var(--font);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,255,255,.14);
}
.auth-input::placeholder { color: var(--t3); }
.auth-pw-wrap { position: relative; }
.auth-pw-wrap .auth-input { padding-right: 44px; }
.auth-eye {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 15px;
  opacity: .45; transition: opacity .2s; padding: 4px; line-height: 1;
}
.auth-eye:hover { opacity: 1; }
.btn-auth {
  width: 100%; padding: 13px; font-size: 15px; font-weight: 700;
  border-radius: 12px; margin-top: 4px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  letter-spacing: .3px;
}
/* FIX: the ring was hard-coded white (rgba(255,255,255,.3) + a #fff head),
   so on the dark theme's WHITE .btn-accent it was white-on-white — tapping
   Sign In / Send reset link dimmed the label and appeared to do nothing.
   currentColor makes it the button's own text colour (black on the dark
   theme's white button, near-white on the light theme's dark button) while
   the transparent head keeps a visible rotating gap. */
.auth-spinner {
  width: 16px; height: 16px; border: 2px solid currentColor;
  border-top-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.auth-err {
  font-size: 12px; color: var(--red); text-align: center;
  padding: 9px 12px; background: rgba(244,63,94,.1);
  border: 1px solid rgba(244,63,94,.25); border-radius: 8px; line-height: 1.4;
}
.auth-ok {
  font-size: 12px; color: var(--green); text-align: center;
  padding: 9px 12px; background: rgba(16,185,129,.1);
  border: 1px solid rgba(16,185,129,.25); border-radius: 8px; line-height: 1.4;
}
.auth-forgot {
  background: none; border: none; color: var(--t3); font-size: 12px;
  cursor: pointer; text-align: right; padding: 0; font-family: var(--font);
  transition: color .2s; margin-top: -4px;
}
.auth-forgot:hover { color: var(--accent); }
.auth-back {
  background: none; border: none; color: var(--t3); font-size: 13px;
  cursor: pointer; font-family: var(--font); transition: color .2s; padding: 0;
  text-align: left;
}
.auth-back:hover { color: var(--t1); }
.auth-desc { font-size: 13px; color: var(--t2); line-height: 1.5; }

/* Logout icon */
.btn-icon-logout:hover { color: var(--red) !important; }

/* icon image styles */
.splash-icon-img {
  width: 52px; height: 52px; object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(255,255,255,.55)) drop-shadow(0 0 28px rgba(255,255,255,.28));
  animation: iconFloat 3s ease-in-out infinite, iconGlow 2.5s ease-in-out infinite alternate;
}
@keyframes iconGlow {
  from { filter: drop-shadow(0 0 10px rgba(255,255,255,.4)) drop-shadow(0 0 20px rgba(255,255,255,.2)); }
  to   { filter: drop-shadow(0 0 20px rgba(255,255,255,.75)) drop-shadow(0 0 40px rgba(255,255,255,.35)); }
}
.sb-logo-img {
  width: 26px; height: 26px; object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(255,255,255,.5));
  animation: logoSpin 0.6s ease both;
}
@keyframes logoSpin {
  from { opacity: 0; transform: rotate(-20deg) scale(0.7); }
  to   { opacity: 1; transform: rotate(0deg) scale(1); }
}
/* FIX: the matching logo-image hover puff — same dead affordance, removed. */
.mobile-logo-img {
  width: 18px; height: 18px; object-fit: contain; vertical-align: middle;
  filter: drop-shadow(0 0 5px rgba(255,255,255,.55));
}

@media (max-width: 480px) {
  .login-box { padding: 32px 20px 28px; border-radius: 20px; }
  .login-title { font-size: 22px; }
}

/* ── NEW: Inbox mail actions ─────────────────────────────────────── */
.mail-actions {
  display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap;
  padding-top: 8px; border-top: 1px solid var(--border);
}
.mail-actions .btn { font-size: 11px; padding: 4px 10px; }

/* ── NEW: OTP / link detect box ──────────────────────────────────── */
.detect-box {
  margin: 8px 0; padding: 8px 10px; border-radius: 10px;
  background: rgba(255,255,255,.05); border: 1px solid var(--border-bright);
  display: flex; flex-direction: column; gap: 6px;
}
.detect-row { display: flex; align-items: center; gap: 8px; }
.detect-label {
  font-size: 10px; font-weight: 700; color: var(--t3);
  text-transform: uppercase; letter-spacing: .5px; flex-shrink: 0; min-width: 38px;
}
.detect-otp {
  font-family: var(--mono, monospace); font-size: 18px; font-weight: 800;
  letter-spacing: 3px; color: var(--accent); flex: 1;
}
.detect-link {
  font-size: 12px; color: var(--accent); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.detect-link:hover { text-decoration: underline; }
.detect-box .btn { font-size: 11px; padding: 3px 10px; flex-shrink: 0; }

/* ── NEW: Tags ───────────────────────────────────────────────────── */
.tag-bar {
  display: flex; gap: 6px; flex-wrap: wrap; padding: 0 4px 8px;
}
.tag-chip {
  font-size: 11px; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  color: var(--t2); font-family: var(--font); transition: all .15s;
}
.tag-chip:hover { border-color: var(--accent); color: var(--t1); }
/* FIX: --accent is white (#fff). background:var(--accent) + color:#fff was
   white text on a white chip — the label vanished the instant a tag was
   clicked/activated. Active chip now uses dark text like the .tab.active
   style elsewhere in the app. */
.tag-chip.active {
  background: var(--accent); border-color: var(--accent); color: #000; font-weight: 700;
}
/* v24 LAYOUT FIX (LAY1): the chips are `nowrap`, so their min-content width
   used to pin this flex item open and starve .acc-label — a tagged account's
   email collapsed to ~8px on a phone and ~56px on desktop. Let the container
   shrink, cap its width, and clip instead of pushing the label out. */
.acc-tags {
  display: flex; gap: 4px; margin-left: 4px;
  flex: 0 1 auto; min-width: 0; max-width: 40%;
  overflow: hidden; flex-wrap: nowrap;
}
.acc-tag {
  font-size: 9px; padding: 1px 6px; border-radius: 999px; white-space: nowrap;
  background: rgba(255,255,255,.07); color: var(--t2);
  border: 1px solid var(--border); font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════
   v25 FIX ROUND — geometry / tap-target / contrast fixes measured on the
   rendered DOM at 320, 390, 430, 767, 1023 and 1440 px, both themes.
   Kept at the END of the file so these equal-specificity rules win the
   cascade against the earlier @media tuning they correct.
   ══════════════════════════════════════════════════════════════════ */

/* ── 1) Drawer mode (≤1023px): the Import/Export menu was off-canvas ──
   .io-menu is absolutely positioned and RIGHT-anchored to its 40px icon.
   On desktop the icon row sits at the right of the header, so that is
   correct (measured: it fits with ~2px to spare). In drawer mode the
   wrapped icon row (flex: 0 0 100%; justify-content: flex-start) sits at
   the LEFT of the sidebar, and the menu rendered off-canvas + clipped:
   measured x=-89.5, w=241.5 at 390px, and the drawer's scrollWidth was
   277 vs clientWidth 259.
   NOTE the trap: just making .menu-wrap static resolves `top: calc(100% +
   6px)` against the (fixed, full-height) .sidebar and drops the menu below
   the drawer. So the containing block is moved to the icon ROW itself,
   which is full-width in drawer mode, and the menu is left-anchored to it:
   it then spans the sidebar's padding box (x=16 … 243 at 260px) and hangs
   immediately below its own icon row. Items wrap instead of spilling, so
   the drawer can no longer scroll sideways. ≥1024px is untouched. */
@media (max-width: 1023px) {
  .sb-hdr-btns { position: relative; }
  .menu-wrap   { position: static; }
  .io-menu {
    top: calc(100% + 8px); left: 0; right: auto;
    min-width: 0; width: 100%; max-width: 100%;
  }
  .io-item { white-space: normal; }
}

/* ── 2) Small phones (≤430px): let the detect rows WRAP ──────────────
   .detect-link is `flex: 1` (= flex-basis 0), so it never wrapped and was
   squeezed instead: at 320px it measured 13.5px wide (scrollWidth 66 —
   i.e. "…") and the verify button's label only 18.3px of its 77px text.
   A 100% basis forces the URL onto its own full-width line, and wrapping
   .detect-verify lets the verify button keep its natural width and push
   the Copy button down instead of being crushed. */
@media (max-width: 430px) {
  .detect-row    { flex-wrap: wrap; }
  .detect-link   { flex-basis: 100%; }
  .detect-verify { flex-wrap: wrap; }
  /* On its own line the verify button now measures the full row (121px at
     320px) but the ✅ + 12px side padding still left the label 2px short of
     its text, so trim the padding a little. */
  .detect-box .detect-verify .mail-verify-btn { padding: 0 8px; }
}

/* ── 3) Phones (≤767px): tap targets ────────────────────────────────
   Measured before: .tag-chip 36×22, .detect-link 15px tall,
   .auth-forgot 35px / .auth-back 36px (the ≤1023px "real tap area" padding
   of 10px only reached 34-36px). The two-class selectors are needed for the
   auth buttons to beat the equal-specificity rule in the ≤1023px block. */
@media (max-width: 767px) {
  .tag-chip { min-height: 38px; display: inline-flex; align-items: center; }
  .auth-form .auth-forgot,
  .auth-form .auth-back { padding: 12px 2px; }
  /* padding + line-height (not display:flex) so the ellipsis still works */
  .detect-link { line-height: 22px; padding: 8px 0; }
  /* bare 20×20 checkboxes with no wrapping label — a slightly bigger box is
     the only hit area there is. */
  .mail-sel, .chk-sel { width: 24px; height: 24px; }
}

/* ── 4) Missing interaction states ──────────────────────────────────
   The file already had :focus-visible, .btn:active and .btn:disabled;
   these fill the gaps, in the same style as `.btn:active`. */
.tab:active, .tag-chip:active, .io-item:active, .btn-icon:active { transform: translateY(1px) scale(.98); }
.btn-hamburger:hover span { background: var(--t1); }
/* a full-screen click-to-close target that showed no pointer */
.sb-overlay { cursor: pointer; }


/* ── Supabase Auth Google button (v27) ───────────────────────────── */
.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0 12px; color: var(--t3); font-size: 10px;
  text-transform: uppercase; letter-spacing: 1px;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.btn-google { display: flex; align-items: center; justify-content: center; gap: 9px; }
.google-g {
  width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: #111; font-weight: 800; font-size: 12px;
}
