/* ============================================
   Ri Koh PWA — Complete Stylesheet
   ============================================ */

/* --- Custom Properties --- */
:root {
  --primary: #1a1a2e;
  --primary-light: #2d2d4a;
  --accent: #16a085;
  --accent-light: #1abc9c;
  --accent-glow: rgba(22, 160, 133, 0.15);
  --bg: #f8f9fa;
  --card-bg: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --text-muted: #bdc3c7;
  --danger: #e74c3c;
  --warning: #f39c12;
  --success: #27ae60;
  --border: #ecf0f1;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --header-h: 56px;
  --tabbar-h: 72px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: var(--font);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  color: var(--text);
  background: var(--bg);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  position: fixed;
  width: 100%;
}

a { color: var(--accent); text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font); font-size: 16px; }
[hidden] { display: none !important; }

.screen { width: 100%; height: 100vh; height: 100dvh; }

/* --- Loading Spinner --- */
.app-loader {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.loader-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   LOGIN SCREEN
   ============================================ */
#login-screen {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #16213e 100%);
  padding: 24px;
}
.login-container {
  width: 100%; max-width: 380px;
  text-align: center;
}
.login-logo { margin-bottom: 40px; }
.logo-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 80px; height: 80px;
  background: var(--accent);
  color: #fff; font-size: 28px; font-weight: 700;
  border-radius: 22px;
  margin-bottom: 16px;
  box-shadow: 0 4px 24px rgba(22, 160, 133, 0.4);
}
.login-title { color: #fff; font-size: 32px; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { color: rgba(255,255,255,0.6); font-size: 15px; }

.google-signin-container {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 8px;
}
.google-signin-container > div { display: flex; justify-content: center; }
.google-loading {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,0.8); font-size: 14px;
  padding: 12px 0;
}
.google-loading .btn-spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.login-divider {
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,0.4); font-size: 13px;
  margin: 16px 0;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px;
  background: rgba(255,255,255,0.15);
}

.login-form {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
}
.input-group { margin-bottom: 18px; text-align: left; }
.input-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-light); margin-bottom: 6px;
}
.input-group input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s;
}
.input-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.login-error {
  background: rgba(231,76,60,0.1);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}
.btn-primary {
  width: 100%; padding: 14px;
  background: var(--accent);
  color: #fff; font-size: 16px; font-weight: 600;
  border-radius: var(--radius-sm);
  transition: background 0.2s, transform 0.1s;
  position: relative;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:hover { background: var(--accent-light); }
.btn-primary:disabled { opacity: 0.6; pointer-events: none; }
.btn-spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

.login-footer {
  color: rgba(255,255,255,0.35);
  font-size: 12px;
  margin-top: 28px;
}
.login-footer strong { color: rgba(255,255,255,0.5); }

/* ============================================
   APP SHELL
   ============================================ */
#app-shell {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  background: var(--bg);
}

/* Header */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h);
  padding: 0 16px;
  padding-top: var(--safe-top);
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-logo {
  width: 32px; height: 32px;
  background: var(--accent);
  color: #fff; font-size: 13px; font-weight: 700;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.header-title { font-size: 18px; font-weight: 700; }
.header-right { display: flex; align-items: center; }
.icon-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  position: relative;
  font-size: 20px;
}
.icon-btn:active { background: rgba(255,255,255,0.1); }
.notification-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* Offline Banner */
.offline-banner {
  background: var(--warning);
  color: #fff;
  text-align: center;
  padding: 6px 16px;
  font-size: 13px; font-weight: 500;
  flex-shrink: 0;
}

/* Pull to Refresh */
.pull-indicator {
  position: absolute; top: calc(var(--header-h) + var(--safe-top));
  left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px;
  background: var(--bg);
  transform: translateY(-100%);
  transition: transform 0.3s;
  z-index: 50;
  font-size: 13px; color: var(--text-light);
}
.pull-indicator.visible { transform: translateY(0); }
.pull-spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.tab-panel {
  display: none;
  padding: 20px 16px;
  padding-bottom: calc(20px + var(--safe-bottom));
  min-height: 100%;
  animation: fadeIn 0.25s ease;
}
.tab-panel.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: translateX(0); } }

/* Tab Bar */
.tab-bar {
  display: flex;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  flex-shrink: 0;
  z-index: 100;
}
.tab-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 0 6px;
  gap: 2px;
  color: var(--text-muted);
  transition: color 0.2s;
  position: relative;
}
.tab-item.active { color: var(--accent); }
.tab-item.active::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}
.tab-icon { font-size: 22px; line-height: 1; }
.tab-label { font-size: 10px; font-weight: 600; }

/* ============================================
   CARD COMPONENTS
   ============================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.card-subtitle { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* Section Headers */
.section-title {
  font-size: 13px; font-weight: 700; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin: 20px 0 10px;
}
.section-title:first-child { margin-top: 0; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-enterprise { background: #eaf2ff; color: #2e6be6; }
.badge-personal { background: #fef3e2; color: #d4851f; }
.badge-confidential { background: #fde8e8; color: var(--danger); }
.badge-success { background: #e8f8ef; color: var(--success); }

/* ============================================
   DOSSIER TAB
   ============================================ */
.dossier-greeting {
  font-size: 26px; font-weight: 700; color: var(--primary);
  line-height: 1.2; margin-bottom: 4px;
}
.dossier-date {
  font-size: 14px; color: var(--text-light); margin-bottom: 20px;
}
.dossier-format-toggle {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.format-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px; font-weight: 600;
  color: var(--text-light);
  background: var(--bg);
  border: 1.5px solid var(--border);
  transition: all 0.2s;
}
.format-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Calendar Events */
.event-item {
  display: flex; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.event-item:last-child { border-bottom: none; }
.event-time {
  font-size: 13px; font-weight: 700; color: var(--accent);
  min-width: 56px; padding-top: 2px;
}
.event-details { flex: 1; }
.event-title { font-size: 14px; font-weight: 600; color: var(--text); }
.event-location { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.event-prep {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--accent); margin-top: 4px;
  font-weight: 600;
}

/* Proposals */
.proposal-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.proposal-rank {
  width: 28px; height: 28px;
  background: var(--accent);
  color: #fff; font-size: 13px; font-weight: 700;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.proposal-info { flex: 1; }
.proposal-title { font-size: 14px; font-weight: 600; color: var(--text); }
.proposal-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-light); margin-top: 4px;
}
.match-score {
  color: var(--success); font-weight: 700;
}

/* Nudge Banner */
.nudge-banner {
  background: linear-gradient(135deg, #f8f4ff 0%, #f0e8ff 100%);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; gap: 12px;
  margin-bottom: 12px;
  border-left: 4px solid #9b59b6;
}
.nudge-avatar {
  width: 40px; height: 40px;
  background: #9b59b6;
  color: #fff; font-size: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nudge-content { flex: 1; }
.nudge-name { font-size: 12px; font-weight: 700; color: #9b59b6; margin-bottom: 4px; }
.nudge-text { font-size: 14px; color: var(--text); line-height: 1.4; }
.nudge-dismiss {
  font-size: 12px; color: var(--text-light); margin-top: 8px;
  font-weight: 600;
}
.nudge-dismiss:hover { color: #9b59b6; }

/* ============================================
   SEARCH TAB
   ============================================ */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s;
}
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-input {
  flex: 1; border: none; outline: none; background: none;
  font-size: 15px; color: var(--text);
}
.search-input::placeholder { color: var(--text-muted); }
.search-mic-btn {
  width: 36px; height: 36px;
  background: var(--accent-glow);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: background 0.2s;
}
.search-mic-btn:active { background: var(--accent); }

.search-recent { margin-bottom: 20px; }
.recent-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px; color: var(--text);
}
.recent-icon { color: var(--text-muted); font-size: 16px; }

/* Result Cards */
.result-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  transition: transform 0.15s;
  cursor: pointer;
}
.result-card:active { transform: scale(0.98); }
.result-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.result-title { font-size: 15px; font-weight: 600; color: var(--text); flex: 1; }
.result-badges { display: flex; gap: 4px; flex-shrink: 0; }
.result-snippet { font-size: 13px; color: var(--text-light); margin-top: 6px; line-height: 1.4; }
.result-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-muted); margin-top: 8px;
}

/* Document Detail */
.doc-detail { animation: slideInRight 0.25s ease; }
.doc-detail-back {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 14px; font-weight: 600; color: var(--accent);
  margin-bottom: 16px;
}
.doc-detail-title { font-size: 20px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.doc-detail-meta {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.doc-detail-body {
  font-size: 14px; line-height: 1.6; color: var(--text); margin-bottom: 20px;
}
.doc-actions {
  display: flex; gap: 10px;
}
.btn-action {
  flex: 1; padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  text-align: center;
  transition: all 0.2s;
}
.btn-action-primary { background: var(--accent); color: #fff; }
.btn-action-secondary { background: var(--bg); color: var(--accent); border: 1.5px solid var(--accent); }

/* FAB */
.fab {
  position: fixed;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  right: 16px;
  width: 56px; height: 56px;
  background: var(--accent);
  color: #fff; font-size: 24px;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(22,160,133,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 90;
  transition: transform 0.2s;
}
.fab:active { transform: scale(0.9); }
.fab[hidden] { display: none; }

/* ============================================
   GROWTH TAB
   ============================================ */
.growth-greeting {
  font-size: 18px; font-weight: 600; color: var(--primary);
  margin-bottom: 20px;
}

/* Circular Progress */
.circular-progress {
  position: relative;
  width: 140px; height: 140px;
  margin: 0 auto 20px;
}
.circular-progress svg { transform: rotate(-90deg); }
.circular-progress .bg { fill: none; stroke: var(--border); stroke-width: 8; }
.circular-progress .fg { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.circular-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.circular-value { font-size: 32px; font-weight: 700; color: var(--primary); }
.circular-text { font-size: 11px; color: var(--text-light); font-weight: 600; text-transform: uppercase; }

/* Stats Row */
.stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-light); font-weight: 600; margin-top: 2px; }

/* Energy Meter */
.energy-meter {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.energy-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.energy-title { font-size: 14px; font-weight: 700; color: var(--text); }
.energy-value { font-size: 13px; font-weight: 600; color: var(--success); }
.energy-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.energy-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--accent-light));
  border-radius: 4px;
  transition: width 1s ease;
}
.energy-label { font-size: 11px; color: var(--text-light); margin-top: 6px; }

/* Progress Bars */
.progress-item { margin-bottom: 14px; }
.progress-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.progress-title { font-size: 14px; font-weight: 600; color: var(--text); }
.progress-pct { font-size: 13px; font-weight: 700; color: var(--accent); }
.progress-bar {
  height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--accent); border-radius: 3px;
  transition: width 1s ease;
}

/* Streak */
.streak-counter {
  display: flex; align-items: center; gap: 4px;
}
.streak-day {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border);
}
.streak-day.active { background: var(--accent); }
.streak-day.today { box-shadow: 0 0 0 2px var(--accent-light); }

/* Badges Grid */
.badge-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-bottom: 16px;
}
.badge-item {
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 4px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  text-align: center;
}
.badge-icon { font-size: 28px; margin-bottom: 4px; }
.badge-name { font-size: 10px; font-weight: 600; color: var(--text-light); }
.badge-item.locked { opacity: 0.35; }

/* Reading Recs */
.reading-item {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.reading-item:last-child { border-bottom: none; }
.reading-thumb {
  width: 48px; height: 48px;
  background: var(--accent-glow);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.reading-info { flex: 1; }
.reading-title { font-size: 14px; font-weight: 600; color: var(--text); }
.reading-meta { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ============================================
   ME / PROFILE TAB
   ============================================ */
.profile-header {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 0;
  margin-bottom: 20px;
}
.profile-avatar {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff; font-size: 30px; font-weight: 700;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.profile-name { font-size: 20px; font-weight: 700; color: var(--primary); }
.profile-email { font-size: 13px; color: var(--text-light); margin-top: 2px; }
.profile-role {
  margin-top: 8px;
}

/* Settings */
.settings-group {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.settings-group-title {
  padding: 12px 16px 6px;
  font-size: 12px; font-weight: 700; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.setting-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.setting-item:last-child { border-bottom: none; }
.setting-label { font-size: 15px; color: var(--text); }
.setting-value { font-size: 14px; color: var(--text-light); }

/* Toggle Switch */
.toggle {
  position: relative;
  width: 48px; height: 28px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--text-muted);
  border-radius: 28px;
  cursor: pointer;
  transition: background 0.3s;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::after { transform: translateX(20px); }

/* Radio group */
.radio-group { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-pill {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px; font-weight: 500;
  border: 1.5px solid var(--border);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}
.radio-pill input { display: none; }
.radio-pill.active, .radio-pill:has(input:checked) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Slider */
.range-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* Connected Accounts */
.account-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.account-item:last-child { border-bottom: none; }
.account-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.account-icon.google { background: #fef3e2; }
.account-icon.microsoft { background: #eaf2ff; }
.account-icon.linkedin { background: #e8f4fd; }
.account-name { flex: 1; font-size: 15px; color: var(--text); }

/* Sign Out */
.btn-signout {
  width: 100%; padding: 14px;
  background: var(--bg);
  color: var(--danger);
  font-size: 15px; font-weight: 600;
  border-radius: var(--radius);
  border: 1.5px solid rgba(231,76,60,0.2);
  margin-top: 8px;
  transition: all 0.2s;
}
.btn-signout:active { background: rgba(231,76,60,0.05); }

.about-links {
  display: flex; justify-content: center; gap: 16px;
  margin-top: 20px; padding-bottom: 20px;
}
.about-link { font-size: 13px; color: var(--text-light); }
.app-version { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ============================================
   VOICE OVERLAY
   ============================================ */
.voice-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(26,26,46,0.95);
  display: flex; align-items: center; justify-content: center;
}
.voice-content { text-align: center; padding: 24px; }
.voice-close {
  position: absolute; top: 16px; right: 16px;
  color: rgba(255,255,255,0.5); font-size: 28px;
  padding-top: var(--safe-top);
}
.voice-mic-container { position: relative; margin-bottom: 24px; }
.voice-mic {
  width: 100px; height: 100px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  margin: 0 auto;
  cursor: pointer;
  transition: transform 0.2s;
}
.voice-mic.listening { animation: pulse 1.5s ease infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(22,160,133,0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 20px rgba(22,160,133,0); }
}
.voice-ripple {
  position: absolute; inset: -20px;
  border: 2px solid rgba(22,160,133,0.3);
  border-radius: 50%;
  opacity: 0;
}
.voice-mic.listening ~ .voice-ripple {
  animation: ripple 1.5s ease infinite;
}
@keyframes ripple {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
.voice-status { color: rgba(255,255,255,0.7); font-size: 16px; margin-bottom: 12px; }
.voice-transcript { color: #fff; font-size: 20px; font-weight: 600; min-height: 30px; margin-bottom: 24px; }
.btn-secondary {
  padding: 10px 28px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  color: rgba(255,255,255,0.7);
  border: 1.5px solid rgba(255,255,255,0.2);
}

/* ============================================
   QR SHARE MODAL
   ============================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%; max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
  padding-bottom: var(--safe-bottom);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close { font-size: 24px; color: var(--text-light); padding: 4px; }
.modal-body { padding: 20px; }

.qr-doc-list { margin-bottom: 16px; }
.qr-doc-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.qr-doc-remove { color: var(--danger); font-size: 18px; padding: 4px 8px; }

.qr-expiry { margin-bottom: 16px; }
.qr-expiry label { display: block; font-size: 13px; font-weight: 600; color: var(--text-light); margin-bottom: 6px; }
.qr-expiry select {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text); font-size: 14px;
}

.qr-warning {
  background: rgba(243,156,18,0.1);
  border-left: 3px solid var(--warning);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px; color: var(--text);
  margin-bottom: 16px;
}

.qr-generate-btn {
  width: 100%; padding: 14px;
  background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 600;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.qr-display {
  text-align: center;
  padding: 20px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.qr-placeholder {
  width: 180px; height: 180px;
  margin: 0 auto 12px;
}
.qr-brand {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 13px; color: var(--text-light);
  margin-top: 8px;
}
.qr-brand-logo {
  width: 24px; height: 24px;
  background: var(--accent);
  color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}

.qr-share-actions {
  display: flex; gap: 10px;
}
.qr-share-actions button {
  flex: 1; padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  border: 1.5px solid var(--border);
  color: var(--text);
  background: var(--card-bg);
}
.qr-share-actions button:active { background: var(--bg); }

/* ============================================
   SKELETON SCREENS
   ============================================ */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, #e8ecef 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.short { width: 60%; }
.skeleton-card { height: 80px; margin-bottom: 12px; border-radius: var(--radius); }
.skeleton-circle { border-radius: 50%; }

/* ============================================
   RESPONSIVE — iPad / Desktop (768px+)
   ============================================ */
@media (min-width: 768px) {
  .main-content { max-width: 600px; margin: 0 auto; }
  .tab-panel { padding: 28px 24px; }
  .login-container { max-width: 420px; }

  .stats-row { gap: 14px; }
  .badge-grid { grid-template-columns: repeat(6, 1fr); }

  .modal-content {
    border-radius: var(--radius-lg);
    max-width: 480px;
    margin-bottom: 40px;
  }
  .modal-overlay { align-items: center; }

  /* Tab bar: full-width background, centered content */
  .tab-bar {
    justify-content: center;
  }
  .tab-item {
    max-width: 120px;
  }
}

/* Large screens — cap the app width for a phone-like feel */
@media (min-width: 1024px) {
  #app-shell {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
  #login-screen {
    max-width: 480px;
    margin: 0 auto;
  }
  body {
    background: var(--primary);
  }
}
