/* ══════════════════════════════════════════════
   PHASE 4 — PWA · LIGHT MODE · SHORTCUTS · A11Y
   ══════════════════════════════════════════════ */

/* ── LIGHT THEME ── */
[data-theme="light"] {
  --bg0: #f0f2f5;
  --bg1: #ffffff;
  --bg2: #f5f7fa;
  --bg3: #ebeef3;
  --bg4: #dde2eb;
  --border: rgba(0,0,0,0.08);
  --border-hi: rgba(0,0,0,0.16);
  --txt: #1a1f2e;
  --txt2: #4a5568;
  --txt3: #8a95a8;
  --shadow-card: 0 1px 3px rgba(0,0,0,.1), 0 4px 16px rgba(0,0,0,.07);
  --shadow-pop:  0 2px 8px rgba(0,0,0,.15), 0 8px 32px rgba(0,0,0,.1);
  --glow-accent: 0 0 20px rgba(255,61,0,.1);
  --glow-teal:   0 0 20px rgba(0,219,168,.08);
}
[data-theme="light"] body { background: var(--bg0); }
[data-theme="light"] body::before { background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,.025) 1px, transparent 0); }
[data-theme="light"] .sidebar { box-shadow: 2px 0 12px rgba(0,0,0,.06); }
[data-theme="light"] .stab.active { background: rgba(255,61,0,.07); }
[data-theme="light"] .auth-overlay { background: var(--bg0); }
[data-theme="light"] .auth-box { background: var(--bg1); box-shadow: var(--shadow-pop); }

/* ── THEME TOGGLE BUTTON ── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  margin-bottom: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg2);
  cursor: pointer;
  width: 100%;
  color: var(--txt2);
  font-family: 'Barlow', sans-serif;
  font-size: 11px;
  font-weight: 500;
  transition: all .15s;
}
.theme-toggle:hover { border-color: var(--border-hi); color: var(--txt); }
.theme-toggle-track {
  width: 28px;
  height: 16px;
  background: var(--bg4);
  border-radius: 8px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.theme-toggle-track.on { background: var(--accent); }
.theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.theme-toggle-track.on .theme-toggle-thumb { transform: translateX(12px); }

/* ── INSTALL BANNER ── */
.install-banner {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  background: var(--bg1);
  border: 1px solid var(--border-hi);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-pop);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 300px;
  animation: toastIn .3s cubic-bezier(.34,1.56,.64,1);
}
.install-banner-icon { font-size: 24px; flex-shrink: 0; }
.install-banner-text { flex: 1; }
.install-banner-title { font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 800; margin-bottom: 2px; }
.install-banner-sub { font-size: 11px; color: var(--txt3); line-height: 1.4; }
.install-banner-btns { display: flex; gap: 6px; margin-top: 8px; }
.install-btn { padding: 5px 12px; background: var(--accent); border: none; border-radius: 5px; color: #fff; font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .05em; cursor: pointer; }
.install-dismiss { padding: 5px 10px; background: transparent; border: 1px solid var(--border); border-radius: 5px; color: var(--txt3); font-size: 11px; cursor: pointer; }
.install-dismiss:hover { border-color: var(--border-hi); }

/* ── OFFLINE INDICATOR ── */
.offline-bar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  z-index: 400;
  background: var(--gold);
  color: #000;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-align: center;
  padding: 5px;
  transform: translateY(-100%);
  transition: transform .25s ease;
}
.offline-bar.visible { transform: translateY(0); }
@media(max-width:900px) { .offline-bar { left: 60px; } }

/* ── KEYBOARD SHORTCUTS MODAL ── */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 700;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.shortcuts-overlay.open { display: flex; animation: fadeIn .15s ease; }
.shortcuts-modal {
  background: var(--bg1);
  border: 1px solid var(--border-hi);
  border-radius: 14px;
  padding: 1.75rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-pop);
  animation: pageIn .2s cubic-bezier(0.16,1,0.3,1);
  max-height: 80vh;
  overflow-y: auto;
}
.shortcuts-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.shortcuts-close { background: none; border: 1px solid var(--border); border-radius: 5px; color: var(--txt3); padding: 3px 8px; cursor: pointer; font-size: 12px; }
.shortcuts-close:hover { border-color: var(--border-hi); color: var(--txt); }
.shortcuts-section { margin-bottom: 1.25rem; }
.shortcuts-section-title { font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--txt3); margin-bottom: .5rem; }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--border); }
.shortcut-row:last-child { border-bottom: none; }
.shortcut-desc { font-size: 12px; color: var(--txt2); }
.shortcut-key {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg3);
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  padding: 2px 8px;
  color: var(--txt);
  letter-spacing: .04em;
  box-shadow: 0 1px 0 var(--border-hi);
}
.shortcut-hint {
  position: fixed;
  bottom: 1rem;
  left: calc(var(--sidebar-w) + 1rem);
  font-size: 10px;
  color: var(--txt3);
  pointer-events: none;
  opacity: .5;
  transition: opacity .2s;
}
.shortcut-hint:hover { opacity: 1; }
@media(max-width:900px) { .shortcut-hint { left: 70px; } }

/* ── FOCUS STATES (accessibility) ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Inputs already have border-color focus state — suppress duplicate outline */
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none;
}
.stab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ── SKIP TO CONTENT (a11y) ── */
.skip-link {
  position: fixed;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 6px 6px;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  transition: top .15s;
}
.skip-link:focus { top: 0; }
