/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:        #1565C0;
  --blue-dark:   #0D47A1;
  --blue-mid:    #1976D2;
  --blue-light:  #42A5F5;
  --teal:        #00ACC1;
  --teal-dark:   #00838F;
  --green:       #2E7D32;
  --green-light: #4CAF50;
  --orange:      #E65100;
  --red:         #C62828;
  --yellow:      #F9A825;

  --bg:          #EEF4FB;
  --card:        #FFFFFF;
  --border:      #DDE8F5;
  --text:        #1A2B3C;
  --text-mid:    #3D5166;
  --text-muted:  #7B93AB;

  --shadow-sm:   0 1px 4px rgba(21,101,192,.10);
  --shadow:      0 3px 14px rgba(21,101,192,.13);
  --shadow-md:   0 6px 24px rgba(21,101,192,.16);

  --radius-sm:   10px;
  --radius:      16px;
  --radius-lg:   22px;

  --header-h:    54px;
  --nav-h:       62px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Safe area insets — iPhone notch & home bar */
.app-header {
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
}
.bottom-nav {
  padding-bottom: env(safe-area-inset-bottom, 0px);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}
.screen {
  padding-top: env(safe-area-inset-top, 0px);
}

input, select, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
a { cursor: pointer; }

/* ===== AUTH ===== */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.auth-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, #0D47A1 0%, #1565C0 45%, #00ACC1 100%);
  z-index: 0;
  overflow: hidden;
}

.wave {
  position: absolute;
  width: 250%;
  height: 250%;
  border-radius: 43%;
  opacity: 0.18;
  background: white;
  bottom: -180%;
  animation: waveAnim 8s linear infinite;
}
.wave1 { left: -75%; animation-duration: 8s; }
.wave2 { left: -60%; animation-duration: 12s; animation-delay: -2s; }

@keyframes waveAnim {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.auth-container {
  position: relative;
  z-index: 1;
  width: min(420px, 92vw);
  background: white;
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.22);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.logo-drop {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 6px;
  filter: drop-shadow(0 4px 8px rgba(0,172,193,0.4));
}
.auth-logo h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: -0.5px;
}
.auth-logo p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.auth-form h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 18px;
}

.input-group {
  display: flex;
  align-items: center;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  background: var(--bg);
  transition: border-color 0.2s;
  overflow: hidden;
}
.input-group:focus-within { border-color: var(--blue-light); background: white; }
.input-icon { padding: 0 10px 0 12px; font-size: 15px; user-select: none; }
.input-group input {
  flex: 1;
  padding: 13px 14px 13px 0;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--text);
}

.auth-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--teal) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  margin-top: 6px;
  transition: opacity 0.2s, transform 0.1s;
  letter-spacing: 0.2px;
}
.auth-btn:hover { opacity: 0.92; }
.auth-btn:active { transform: scale(0.98); }

.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-switch a { color: var(--blue); font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

/* ===== APP LAYOUT ===== */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.app-header {
  height: var(--header-h);
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  z-index: 20;
}
.header-drop { font-size: 22px; margin-right: 6px; }
.header-title { font-size: 17px; font-weight: 800; letter-spacing: 0.2px; }
.header-user { font-size: 12px; opacity: 0.8; margin-right: 8px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-logout {
  background: rgba(255,255,255,0.18);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s;
}
.header-logout:hover { background: rgba(255,255,255,0.28); }

.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  scroll-behavior: smooth;
}

.app-screen {
  display: none;
  min-height: calc(100vh - var(--header-h) - var(--nav-h));
  padding-bottom: 12px;
  animation: fadeIn 0.2s ease;
}
.app-screen.active { display: block; }

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

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  height: var(--nav-h);
  background: white;
  display: flex;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 20;
}
.bnav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 2px;
  transition: color 0.18s;
  position: relative;
}
.bnav-btn.active { color: var(--blue); }
.bnav-btn.active::after {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%;
  height: 3px;
  background: var(--blue);
  border-radius: 0 0 3px 3px;
}
.bnav-icon { font-size: 20px; }
.bnav-lbl { font-size: 10px; font-weight: 600; letter-spacing: 0.2px; }

/* ===== HOME ===== */
.home-hero {
  background: linear-gradient(145deg, var(--blue-dark) 0%, var(--blue) 55%, var(--teal) 100%);
  padding: 18px 16px 20px;
  color: white;
}
.hero-text h2 { font-size: 19px; font-weight: 700; }
.hero-text p  { font-size: 12px; opacity: 0.75; margin-bottom: 14px; }

.home-week-chip {
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  letter-spacing: 0.3px;
}

.stats-card {
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  padding: 14px 8px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-bottom: 14px;
}
.stat-item { text-align: center; flex: 1; }
.stat-val   { font-size: 18px; font-weight: 800; }
.stat-lbl   { font-size: 10px; opacity: 0.8; margin-top: 2px; }
.stat-sep   { width: 1px; height: 36px; background: rgba(255,255,255,0.28); }

.usage-progress {}
.prog-header { display: flex; justify-content: space-between; font-size: 12px; opacity: 0.9; margin-bottom: 7px; }
.prog-track  { height: 10px; background: rgba(255,255,255,0.28); border-radius: 5px; overflow: hidden; }
.prog-fill   { height: 100%; background: white; border-radius: 5px; transition: width 0.6s ease; }
.prog-fill.warn  { background: #FFD54F; }
.prog-fill.over  { background: #EF9A9A; }

/* Alert banner */
.home-alert {
  margin: 10px 16px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.home-alert.alert-warn {
  background: #FFF8E1;
  color: #6D4C00;
  border-left: 4px solid var(--yellow);
}
.home-alert.alert-over {
  background: #FFEBEE;
  color: #7F0000;
  border-left: 4px solid var(--red);
}

/* Action grid */
.action-section { padding: 14px 16px 4px; }
.section-title  { font-size: 15px; font-weight: 700; margin-bottom: 10px; color: var(--text-mid); }

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 10px 16px;
  background: var(--card);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.1s, box-shadow 0.2s;
}
.action-card:hover  { box-shadow: var(--shadow-md); }
.action-card:active { transform: scale(0.97); }
.daily-card  { border-top: 4px solid var(--teal); }
.weekly-card { border-top: 4px solid var(--blue); }
.ac-icon  { font-size: 30px; margin-bottom: 8px; }
.ac-title { font-size: 13px; font-weight: 700; color: var(--text); }
.ac-desc  { font-size: 10px; color: var(--text-muted); margin-top: 3px; text-align: center; }

/* Recent readings */
.recent-section { padding: 12px 16px 0; }

.reading-row {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}
.rr-date  { font-size: 12px; color: var(--text-muted); }
.rr-val   { font-size: 15px; font-weight: 700; margin-top: 2px; }
.rr-badge {
  background: var(--bg);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}
.rr-badge.final-badge {
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: white;
}

/* ===== SUB-HEADER ===== */
.sub-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.back-btn {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 16px;
  font-weight: 700;
  padding: 4px 2px;
}
.sub-header h2 { font-size: 17px; font-weight: 700; }

/* ===== AWARENESS TAG ===== */
.awareness-tag {
  margin: 10px 16px;
  padding: 9px 14px;
  background: #E3F2FD;
  color: #0D47A1;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ===== WEEK BADGE ===== */
.week-badge-wrap { padding: 10px 16px 0; }
.week-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--teal) 100%);
  color: white;
  font-size: 13px;
  font-weight: 700;
}
.week-badge.final-week {
  background: linear-gradient(135deg, #BF360C 0%, #E65100 100%);
}
.week-badge.done-week {
  background: linear-gradient(135deg, #1B5E20 0%, #43A047 100%);
}

/* ===== WEEK PROGRESS DOTS ===== */
.week-progress-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 4px 16px 12px;
}
.week-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 68px;
  min-height: 56px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: border-color 0.2s, background 0.2s;
}
.week-dot span      { font-size: 15px; font-weight: 700; }
.week-dot small     { font-size: 9px; font-weight: 700; letter-spacing: 0.3px; }
.week-dot-val       { font-size: 9px; color: inherit; opacity: 0.85; margin-top: 1px; }
.week-dot.done      { background: var(--blue); border-color: var(--blue); color: white; }
.week-dot.is-final  { border-color: var(--teal); }
.week-dot.is-final.done {
  background: linear-gradient(135deg, var(--blue) 0%, var(--teal) 100%);
  border-color: transparent;
}

/* ===== UPLOAD AREA ===== */
.upload-section { padding: 12px 16px 8px; }
.upload-area {
  width: 100%;
  height: 200px;
  border: 2px dashed #A8C4DC;
  border-radius: var(--radius);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}
.upload-area:hover { border-color: var(--blue-light); background: #F5F9FF; }

.upload-area.no-click { cursor: default; }

.upload-ph {
  text-align: center;
  z-index: 1;
}
.ph-icon { font-size: 42px; display: block; margin-bottom: 8px; }
.upload-ph p { font-size: 14px; color: var(--text-mid); font-weight: 500; margin-bottom: 14px; }

/* Camera / Gallery choice buttons */
.upload-choice-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 4px;
}
.choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100px;
  padding: 14px 8px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.choice-btn:active { border-color: var(--blue-light); background: #EBF5FF; }
.choice-icon { font-size: 26px; }
.choice-lbl  { font-size: 12px; font-weight: 700; color: var(--text-mid); }

.upload-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  border-radius: calc(var(--radius) - 2px);
}

/* ===== DETECTING ===== */
.detecting {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #E3F2FD;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--blue-dark);
  font-weight: 500;
}
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #BBDEFB;
  border-top-color: var(--blue);
  border-radius: 50%;
  flex-shrink: 0;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== DETECTED READING ===== */
.detected-label { font-size: 13px; font-weight: 700; color: var(--text-mid); margin-bottom: 8px; }
.big-input {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--blue-light);
  border-radius: var(--radius-sm);
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  color: var(--blue);
  outline: none;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.big-input:focus { border-color: var(--blue); }

.info-card {
  background: white;
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.info-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 5px 0;
  border-bottom: 1px solid var(--bg);
}
.info-row:last-child { border-bottom: none; }
.ir-lbl { color: var(--text-muted); }
.ir-val { font-weight: 700; }
.ir-val.over { color: var(--red); }
.ir-val.ok   { color: var(--green-light); }

/* ===== WEEKLY FORM ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-mid);
  margin-bottom: 7px;
}
.form-group input[type="number"],
.form-group input[type="date"] {
  width: 100%;
  padding: 13px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  background: white;
  color: var(--text);
}
.form-group input:focus { border-color: var(--blue-light); }

.primary-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--teal) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  transition: opacity 0.2s, transform 0.1s;
  letter-spacing: 0.2px;
  margin-top: 4px;
}
.primary-btn:hover  { opacity: 0.9; }
.primary-btn:active { transform: scale(0.98); }

/* ===== HISTORY ===== */
.page-title {
  padding: 16px 16px 6px;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}
.page-subtitle {
  padding: 0 16px 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.summary-row {
  display: flex;
  gap: 10px;
  padding: 12px 16px 8px;
}
.summary-card {
  flex: 1;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.sum-val { display: block; font-size: 20px; font-weight: 800; color: var(--blue); }
.sum-lbl { display: block; font-size: 10px; color: var(--text-muted); margin-top: 3px; }

.filter-row { padding: 4px 16px 10px; }
.filter-row select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: white;
  outline: none;
  color: var(--text);
}

.hist-entry {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.he-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.he-week-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: #E3F2FD;
  color: var(--blue);
}
.he-week-tag.he-final {
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: white;
}
.he-date   { font-size: 12px; color: var(--text-muted); }
.he-rdg    { font-size: 22px; font-weight: 800; color: var(--text); }
.he-usage  { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.he-thumb  { width: 56px; height: 38px; object-fit: cover; border-radius: 6px; margin-top: 8px; cursor: pointer; border: 1px solid var(--border); }
.he-del-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px;
  float: right;
}

/* ===== SAVINGS ===== */
.savings-nodata {
  margin: 4px 16px 10px;
  padding: 11px 14px;
  background: #FFF8E1;
  color: #5D4037;
  border-left: 4px solid var(--yellow);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
}
.br-val.red { color: var(--red) !important; }

.savings-cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 16px 12px;
}
.savings-tile {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  box-shadow: var(--shadow);
}
.water-tile { border-top: 4px solid var(--teal); }
.money-tile { border-top: 4px solid var(--green-light); }
.tile-icon { font-size: 28px; margin-bottom: 6px; }
.tile-val  { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 3px; }
.tile-lbl  { font-size: 11px; color: var(--text-muted); }

.chart-card, .billing-card {
  margin: 0 16px 12px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.chart-card h3, .billing-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-mid);
  margin-bottom: 12px;
}

.comp-labels-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.comp-track {
  height: 18px;
  background: var(--bg);
  border-radius: 9px;
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}
.comp-fill {
  height: 100%;
  border-radius: 9px;
  background: linear-gradient(90deg, var(--blue), var(--teal));
  transition: width 0.6s ease;
  min-width: 4px;
}
.comp-fill.over-limit {
  background: linear-gradient(90deg, var(--yellow), var(--orange));
}
.comp-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.legend-dot.blue { background: var(--blue); }
.legend-dot.gray { background: var(--bg); border: 1px solid var(--border); }

.bill-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--bg);
}
.bill-row:last-child { border-bottom: none; }
.br-label { font-size: 13px; color: var(--text-muted); }
.br-val   { font-size: 14px; font-weight: 700; color: var(--text); }
.br-val.green { color: var(--green-light); }
.bill-divider { height: 1px; background: var(--border); margin: 4px 0; }
.savings-highlight .br-label { font-weight: 600; color: var(--text-mid); }

/* ===== SETTINGS ===== */
.settings-block {
  margin: 10px 16px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.sb-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}
.sb-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.set-input {
  width: 100%;
  padding: 11px 13px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.set-input:focus { border-color: var(--blue-light); background: white; }

.unit-row { display: flex; align-items: center; gap: 8px; }
.unit-row .set-input { flex: 1; }
.unit-tag {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.unit-tag.prefix { flex-shrink: 0; }

/* Toggle */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.toggle-wrap input[type="checkbox"] { display: none; }
.toggle-track {
  width: 48px;
  height: 26px;
  background: #CBD5E0;
  border-radius: 13px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}
.toggle-thumb {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.22);
  transition: transform 0.2s;
}
.toggle-wrap input:checked ~ .toggle-track { background: var(--blue); }
.toggle-wrap input:checked ~ .toggle-track .toggle-thumb { transform: translateX(22px); }
.toggle-text { font-size: 13px; color: var(--text); line-height: 1.4; }

.account-block {}
.account-email { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.account-name  { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }

.danger-btn {
  width: 100%;
  padding: 12px;
  background: #FFEBEE;
  color: var(--red);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  transition: background 0.2s;
}
.danger-btn:hover { background: #FFCDD2; }

/* ===== HELP ===== */
.help-section { padding: 10px 16px; }
.help-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-mid);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}
.acc-item {
  background: white;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.acc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 15px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  gap: 8px;
}
.acc-head:hover { background: #F8FAFF; }
.acc-arrow { font-size: 18px; color: var(--blue); flex-shrink: 0; transition: transform 0.25s; }
.acc-item.open .acc-arrow { transform: rotate(45deg); }
.acc-body {
  max-height: 0;
  overflow: hidden;
  padding: 0 15px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  transition: max-height 0.3s ease, padding 0.3s ease;
}
.acc-item.open .acc-body { max-height: 300px; padding: 0 15px 14px; }

/* ===== INSTALL BANNER ===== */
.install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 16px 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--blue-dark), var(--teal));
  border-radius: var(--radius-sm);
  gap: 10px;
}
.install-banner-text {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.install-icon { font-size: 22px; flex-shrink: 0; }
.install-banner-text strong { display: block; font-size: 13px; color: white; }
.install-banner-text p { font-size: 11px; color: rgba(255,255,255,0.75); margin-top: 1px; }
.install-banner button {
  background: white;
  color: var(--blue);
  border: none;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  cursor: pointer;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: #1A2B3C;
  color: white;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  z-index: 999;
  max-width: 85vw;
  text-align: center;
  opacity: 1;
  transition: opacity 0.3s;
  pointer-events: none;
}
.toast.t-success { background: #1B5E20; }
.toast.t-error   { background: #B71C1C; }
.toast.t-warn    { background: #E65100; }

/* ===== IMAGE MODAL ===== */
.img-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 500;
  cursor: pointer;
}
.img-modal img {
  max-width: 92vw;
  max-height: 75vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.img-modal-close {
  margin-top: 14px;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  font-weight: 500;
}

/* ===== UTILITIES ===== */
.hidden { display: none !important; }

.empty-state {
  text-align: center;
  padding: 40px 24px;
}
.empty-ico { font-size: 40px; margin-bottom: 10px; }
.empty-state p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #A8C4DC; border-radius: 2px; }

/* Responsive tweak for larger screens */
@media (min-width: 480px) {
  .auth-container { padding: 40px 36px; }
  .action-grid { gap: 16px; }
}
