/* =============================================
   Variables
   ============================================= */
:root {
  --green-deep:   #1a6b3c;
  --green-mid:    #2a8c52;
  --green-light:  #3db870;
  --amber:        #f5a623;
  --red-sos:      #d93025;
  --video-blue:   #1a73e8;

  --bg:           #f5f5f0;
  --card-bg:      #ffffff;
  --border:       #e2e8e4;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --text-light:   #94a3b8;

  --radius-card:  20px;
  --radius-btn:   16px;
  --radius-full:  9999px;

  --nav-height:   70px;

  --shadow-card: 0 2px 16px rgba(0,0,0,0.07);
}

/* =============================================
   Reset
   ============================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
}

input {
  font-family: inherit;
  font-size: inherit;
}

.hidden { display: none !important; }

/* =============================================
   Screen System
   ============================================= */
.screen {
  position: fixed;
  inset: 0;
  bottom: var(--nav-height);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transform: translateX(18px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 10;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: none;
}

/* =============================================
   Green Gradient Header (Your People tab)
   ============================================= */
.app-header {
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.25) 100%),
    url("https://images.pexels.com/photos/8631628/pexels-photo-8631628.jpeg?auto=compress&cs=tinysrgb&w=800") center/cover no-repeat;
  padding: 14px 18px 20px;
  padding-top: calc(14px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  min-height: 90px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 11px;
}

.header-logo {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.header-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: block;
}

.header-title {
  font-size: 22px;
  font-weight: 900;
  color: white;
  letter-spacing: -0.2px;
}

.header-right { text-align: right; }

.header-time {
  font-size: 26px;
  font-weight: 800;
  color: white;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.header-date {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 2px;
}

/* =============================================
   Sub-screen Header (Keypad, Messages, Settings)
   ============================================= */
.sub-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sub-header-title {
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  flex: 1;
}

/* =============================================
   Install Banner Card
   ============================================= */
.install-card {
  background: var(--green-mid);
  border-radius: var(--radius-card);
  margin: 12px 16px 0;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(42,140,82,0.3);
}

.install-card-icon {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.18);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.install-card-icon .material-icons-round { color: white; font-size: 24px; }

.install-card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.install-card-text strong { font-size: 14px; font-weight: 800; color: white; }
.install-card-text span   { font-size: 12px; color: rgba(255,255,255,0.82); line-height: 1.3; }

.install-card-action {
  background: white;
  color: var(--green-mid);
  padding: 7px 13px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}

.install-card-dismiss {
  color: rgba(255,255,255,0.65);
  display: flex;
  align-items: center;
  padding: 4px;
  flex-shrink: 0;
}
.install-card-dismiss .material-icons-round { font-size: 20px; }

/* =============================================
   Your People — Hero Grid
   ============================================= */
.people-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.section-label {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 1.3px;
  margin-bottom: 13px;
  padding-left: 2px;
  text-align: center;
}

/* 2×2 grid — square cards, equal size, responsive */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

/* ---- Filled hero card ---- */
.hero-card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  gap: 4px;
  position: relative;
  cursor: pointer;
  aspect-ratio: 1;
  overflow: hidden;
  /* Glow set inline by JS via --glow-color */
  box-shadow: 0 4px 20px var(--glow-color, rgba(0,0,0,0.08));
  border: 1px solid rgba(255,255,255,0.6);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  -webkit-user-select: none;
  user-select: none;
}

.hero-card:active {
  transform: scale(1.04) translateY(-4px);
  box-shadow:
    0 12px 36px var(--glow-color, rgba(0,0,0,0.22)),
    0 2px 8px rgba(0,0,0,0.12);
  border-color: rgba(255,255,255,0.95);
  z-index: 2;
}

/* Avatar circle */
.hero-avatar {
  width: clamp(44px, 15vw, 76px);
  height: clamp(44px, 15vw, 76px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(18px, 6.5vw, 32px);
  font-weight: 900;
  color: white;
  border: 3px solid rgba(255,255,255,0.85);
  /* Outer ring glow set inline */
  box-shadow: 0 4px 16px var(--glow-color, rgba(0,0,0,0.15));
  flex-shrink: 0;
}

.hero-avatar-photo {
  width: clamp(44px, 15vw, 76px);
  height: clamp(44px, 15vw, 76px);
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,0.85);
  box-shadow: 0 4px 16px var(--glow-color, rgba(0,0,0,0.15));
  flex-shrink: 0;
}

.hero-name {
  font-size: clamp(15px, 5.5vw, 26px);
  font-weight: 900;
  color: var(--text);
  text-align: center;
  line-height: 1.15;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-phone {
  font-size: clamp(11px, 3.5vw, 17px);
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tap-to-call hint */
.hero-call-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--green-mid);
  color: white;
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: clamp(10px, 3vw, 15px);
  font-weight: 800;
}

.hero-call-hint .material-icons-round { font-size: clamp(13px, 3.5vw, 16px); }

/* ---- Empty slot ---- */
.hero-empty {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  cursor: pointer;
  aspect-ratio: 1;
  transition: border-color 0.15s, background 0.15s;
}

.hero-empty:active {
  background: #f0f4f0;
  border-color: var(--green-light);
}

.hero-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(42,140,82,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-mid);
}

.hero-empty-icon .material-icons-round { font-size: 28px; }

.hero-empty-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}

/* =============================================
   SOS Card
   ============================================= */
.sos-card {
  margin-top: 18px;
  background: var(--red-sos);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 20px rgba(217,48,37,0.32);
  cursor: pointer;
  transition: transform 0.12s;
}

.sos-card:active { transform: scale(0.98); }

.sos-icon  { font-size: 30px; color: white; flex-shrink: 0; }
.sos-arrow { font-size: 28px; color: rgba(255,255,255,0.8); }

.sos-text { flex: 1; }
.sos-title    { font-size: 20px; font-weight: 900; color: white; }
.sos-subtitle { font-size: 13px; color: rgba(255,255,255,0.78); margin-top: 2px; }

/* =============================================
   Keypad
   ============================================= */
.keypad-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 20px;
  gap: 13px;
  overflow: hidden;
}

.keypad-display {
  width: 100%;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-card);
  min-height: 62px;
}

.keypad-digits {
  flex: 1;
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 3px;
  font-variant-numeric: tabular-nums;
  min-height: 1.2em;
}

.keypad-delete {
  color: var(--text-muted);
  padding: 8px;
  border-radius: 10px;
  display: flex;
  align-items: center;
}
.keypad-delete:active { background: var(--border); }

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
  width: 100%;
  max-width: 340px;
}

.key-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 64px;
  border-radius: var(--radius-card);
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: transform 0.1s, background 0.1s;
}

.key-btn:active {
  transform: scale(0.91);
  background: var(--border);
}

.key-num { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.key-sub { font-size: 10px; font-weight: 700; color: var(--text-light); letter-spacing: 1px; margin-top: 3px; height: 13px; }

.keypad-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  width: 100%;
  max-width: 340px;
}

.keypad-call-btn {
  width: 74px; height: 74px;
  border-radius: 50%;
  background: var(--green-mid);
  color: white;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 18px rgba(42,140,82,0.45);
  transition: transform 0.1s;
}
.keypad-call-btn:active { transform: scale(0.92); }
.keypad-call-btn .material-icons-round { font-size: 32px; }

.keypad-sms-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--amber);
  color: white;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(245,166,35,0.45);
  transition: transform 0.1s;
}
.keypad-sms-btn:active { transform: scale(0.92); }
.keypad-sms-btn .material-icons-round { font-size: 24px; }

.keypad-clear-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card);
  transition: transform 0.1s;
}
.keypad-clear-btn:active { transform: scale(0.92); }
.keypad-clr-label { font-size: 13px; font-weight: 800; color: var(--text-muted); }

/* =============================================
   Messages
   ============================================= */
.messages-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.message-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  min-height: 70px;
}

.message-avatar {
  width: 50px; height: 50px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900; color: white;
  flex-shrink: 0;
}

.message-info { flex: 1; min-width: 0; }
.message-name  { font-size: 17px; font-weight: 800; color: var(--text); }
.message-phone { font-size: 13px; color: var(--text-muted); font-family: 'Literata', serif; margin-top: 2px; }

.message-sms-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 11px 16px;
  background: var(--amber);
  color: white;
  border-radius: var(--radius-full);
  font-size: 14px; font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(245,166,35,0.35);
  transition: transform 0.1s;
}
.message-sms-btn:active { transform: scale(0.94); }
.message-sms-btn .material-icons-round { font-size: 18px; }

/* =============================================
   Settings
   ============================================= */
.contacts-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.contacts-body .settings-scroll {
  padding-right: 28px;
}

.alpha-strip {
  position: absolute;
  right: 2px;
  top: 0;
  bottom: 0;
  width: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  z-index: 50;
  pointer-events: none;
}
.alpha-letter {
  pointer-events: all;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  color: var(--green-deep);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
  -webkit-user-select: none;
  user-select: none;
}
.alpha-letter:active {
  background: var(--green-deep);
  color: white;
  border-radius: 50%;
}

.alpha-section-header {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-light);
  padding: 8px 16px 4px;
  background: var(--bg);
  text-transform: uppercase;
}

.settings-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px 40px;
}

.settings-section { margin-bottom: 28px; }

.settings-section-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--text-light);
  margin-bottom: 10px;
  padding-left: 4px;
}

.settings-card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

/* Import from phone — prominent green button */
.import-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--green-deep);
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.import-btn:active { background: var(--green-mid); }

.import-btn .material-icons-round:first-child {
  font-size: 26px;
  color: white;
  flex-shrink: 0;
}

.import-btn-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.import-btn-title { font-size: 16px; font-weight: 800; color: white; }
.import-btn-sub   { font-size: 12px; color: rgba(255,255,255,0.75); }

.import-btn-arrow { font-size: 22px; color: rgba(255,255,255,0.7); }

/* Standard settings rows */
.settings-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  min-height: 62px;
  width: 100%;
  text-align: left;
}
.settings-row:last-child { border-bottom: none; }

.settings-row-btn { cursor: pointer; transition: background 0.15s; }
.settings-row-btn:active { background: var(--border); }

.settings-row-icon { font-size: 22px; color: var(--green-deep); flex-shrink: 0; }
.settings-row-body { flex: 1; min-width: 0; }
.settings-row-label { font-size: 16px; font-weight: 700; color: var(--text); }
.settings-row-sub   { font-size: 13px; color: var(--text-muted); margin-top: 1px; }
.settings-chevron   { color: var(--text-light); font-size: 22px; flex-shrink: 0; }

.settings-inline-input {
  display: block;
  margin-top: 6px;
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s;
}
.settings-inline-input:focus { border-color: var(--green-deep); }

/* Manage contacts list (inside settings) */
.manage-list-card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.manage-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  min-height: 64px;
  cursor: pointer;
}
.manage-row:active { background: var(--bg); }
.manage-row:last-child { border-bottom: none; }

.manage-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 900; color: white;
  flex-shrink: 0;
}

.manage-info { flex: 1; min-width: 0; }
.manage-name  { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.manage-phone { font-size: 13px; color: var(--text-muted); margin-top: 1px; }
.manage-fav-dot { color: #f59e0b; font-size: 13px; }

.manage-call-btn {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(30,125,58,0.1);
  color: #1e7d3a;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.1s;
}
.manage-call-btn:active { transform: scale(0.9); }
.manage-call-btn .material-icons-round { font-size: 20px; }

.manage-chevron {
  flex-shrink: 0;
  font-size: 20px;
  color: var(--text-light);
}

/* =============================================
   Manage Sheet (tap a contact row)
   ============================================= */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.manage-sheet {
  background: var(--card-bg);
  border-radius: 28px 28px 0 0;
  padding: 14px 20px calc(20px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 480px;
}
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin: 0 auto 16px;
}
.sheet-name {
  font-size: 20px; font-weight: 900;
  color: var(--text);
  text-align: center;
  margin-bottom: 20px;
}
.sheet-photo {
  width: 100%; padding: 16px;
  margin-bottom: 10px;
  border-radius: var(--radius-btn);
  background: #f0f7ff; border: 2px solid #bfdbfe;
  font-size: 16px; font-weight: 700; color: #1d4ed8;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background 0.15s;
}
.sheet-photo:active { background: #dbeafe; }
.sheet-photo .material-icons-round { font-size: 20px; }
.sheet-photo-remove {
  width: 100%; padding: 16px;
  margin-bottom: 10px;
  border-radius: var(--radius-btn);
  background: #fafafa; border: 2px solid #e5e7eb;
  font-size: 16px; font-weight: 700; color: #6b7280;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background 0.15s;
}
.sheet-photo-remove:active { background: #f3f4f6; }
.sheet-photo-remove .material-icons-round { font-size: 20px; }
.sheet-cancel {
  width: 100%; padding: 16px;
  border-radius: var(--radius-btn);
  background: var(--bg); border: 2px solid var(--border);
  font-size: 16px; font-weight: 700; color: var(--text-muted);
  text-align: center;
  transition: background 0.15s;
}
.sheet-cancel:active { background: var(--border); }
.sheet-star {
  width: 100%; padding: 16px;
  margin-bottom: 10px;
  border-radius: var(--radius-btn);
  background: #fffbeb; border: 2px solid #fde68a;
  font-size: 16px; font-weight: 700; color: #b45309;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background 0.15s;
}
.sheet-star.is-fav { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.sheet-star:active { background: #fde68a; }
.sheet-star .material-icons-round { font-size: 20px; }
.sheet-delete {
  width: 100%; padding: 16px;
  margin-bottom: 10px;
  border-radius: var(--radius-btn);
  background: #fff5f5; border: 2px solid #fecaca;
  font-size: 16px; font-weight: 700; color: #dc2626;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background 0.15s;
}
.sheet-delete:active { background: #fee2e2; }
.sheet-delete .material-icons-round { font-size: 20px; }

/* =============================================
   Bottom Navigation
   ============================================= */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  z-index: 100;
  box-shadow: 0 -2px 16px rgba(0,0,0,0.06);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 4px;
  color: var(--text-light);
  transition: color 0.18s;
}

.nav-btn.active { color: var(--green-deep); }
.nav-btn .material-icons-round { font-size: 27px; }
.nav-label { font-size: 13px; font-weight: 700; }


/* =============================================
   Add Contact Modal
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
}

.modal-sheet {
  background: var(--card-bg);
  border-radius: 28px 28px 0 0;
  padding: 16px 24px calc(28px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  align-self: center;
  margin-bottom: 4px;
}

.modal-title { font-size: 22px; font-weight: 900; color: var(--text); }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 11px; font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.form-input {
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-btn);
  font-size: 17px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
  font-family: inherit;
}
.form-input:focus { border-color: var(--green-deep); }

.modal-btn-row { display: flex; gap: 12px; margin-top: 4px; }

.modal-cancel-btn {
  flex: 1; padding: 15px;
  border-radius: var(--radius-btn);
  background: var(--bg);
  border: 2px solid var(--border);
  font-size: 16px; font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  min-height: 54px;
  transition: background 0.15s;
}
.modal-cancel-btn:active { background: var(--border); }

.modal-submit-btn {
  flex: 1; padding: 15px;
  border-radius: var(--radius-btn);
  background: var(--green-deep);
  color: white;
  font-size: 16px; font-weight: 800;
  text-align: center;
  min-height: 54px;
  border: none; cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.modal-submit-btn:active { background: var(--green-mid); }
.modal-submit-btn:disabled { opacity: 0.5; pointer-events: none; }

/* =============================================
   Empty State
   ============================================= */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 48px 24px;
  gap: 12px; color: var(--text-light);
  text-align: center;
}

.empty-state .material-icons-round { font-size: 54px; }
.empty-state p { font-size: 15px; max-width: 260px; line-height: 1.5; }

/* =============================================
   Setup Wizard
   ============================================= */
.wizard-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #1a6b3c 0%, #2a8c52 100%);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
  width: 100%;
  max-width: 360px;
  animation: toast-in 0.3s ease;
}

.wizard-logo {
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,0.2);
  border: 3px solid rgba(255,255,255,0.4);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 900;
  color: white;
  position: relative;
}

.wizard-logo-dot {
  position: absolute;
  bottom: -6px; right: -6px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--amber);
  border: 3px solid #1a6b3c;
}

.wizard-heading {
  font-size: 32px;
  font-weight: 900;
  color: white;
  line-height: 1.15;
}

.wizard-sub {
  font-size: 18px;
  color: rgba(255,255,255,0.85);
  line-height: 1.5;
}

.wizard-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.wizard-dots {
  display: flex;
  gap: 8px;
}

.wizard-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transition: background 0.2s;
}

.wizard-dot.active { background: white; }
.wizard-dot.done   { background: var(--amber); }

.wizard-step-label {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.wizard-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.wizard-input {
  width: 100%;
  background: white;
  border: none;
  border-radius: 16px;
  padding: 18px 20px;
  font-size: 20px;
  font-family: inherit;
  font-weight: 700;
  color: var(--text);
  outline: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.wizard-input::placeholder {
  color: var(--text-light);
  font-weight: 600;
}

.wizard-input:focus {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.5), 0 4px 16px rgba(0,0,0,0.15);
}

.wizard-primary-btn {
  width: 100%;
  background: white;
  color: var(--green-deep);
  border: none;
  border-radius: var(--radius-btn);
  padding: 20px;
  font-size: 20px;
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.wizard-primary-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.wizard-skip-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  padding: 8px;
  text-decoration: underline;
}

.wizard-done-icon .material-icons-round {
  font-size: 80px;
  color: var(--amber);
}

/* =============================================
   iOS Install Hint
   ============================================= */
.ios-hint {
  position: fixed;
  bottom: calc(var(--nav-height) + 12px);
  left: 16px;
  right: 16px;
  background: #1a1a2e;
  color: white;
  border-radius: 18px;
  padding: 16px 16px 12px;
  z-index: 250;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  animation: toast-in 0.3s ease;
}

.ios-hint-dismiss {
  position: absolute;
  top: 10px;
  right: 12px;
  color: rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
}
.ios-hint-dismiss .material-icons-round { font-size: 20px; }

.ios-hint-icon .material-icons-round {
  font-size: 32px;
  color: #4ade80;
}

.ios-hint-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 24px;
}
.ios-hint-text strong { font-size: 15px; font-weight: 800; }
.ios-hint-text span   { font-size: 13px; color: rgba(255,255,255,0.75); line-height: 1.4; }

.ios-hint-arrow {
  font-size: 22px;
  color: #4ade80;
  animation: bounce-down 1.2s ease infinite;
}

@keyframes bounce-down {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(5px); }
}

/* =============================================
   Toast
   ============================================= */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 14px);
  left: 50%; transform: translateX(-50%);
  background: rgba(15,23,42,0.88);
  color: white;
  padding: 11px 22px;
  border-radius: var(--radius-full);
  font-size: 14px; font-weight: 700;
  z-index: 300;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: toast-in 0.2s ease;
  white-space: nowrap;
  pointer-events: none;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* =============================================
   Loading Spinner
   ============================================= */
.loading-spinner {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 24px; gap: 12px;
  color: var(--text-muted);
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--green-deep);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================
   Help Screen — FAQ rows
   ============================================= */
.faq-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}
.faq-row:last-of-type { border-bottom: none; }
.faq-row:active { background: var(--border); }

.faq-chevron {
  font-size: 22px;
  color: var(--text-light);
  transition: transform 0.25s, color 0.25s;
  flex-shrink: 0;
}
.faq-row.open .faq-chevron {
  transform: rotate(180deg);
  color: var(--green-deep);
}

.faq-answer {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px 18px 54px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.015);
}
.faq-row.open + .faq-answer { display: flex; }

.faq-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(26,107,60,0.12);
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.faq-step span:last-child {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
}

.faq-tip {
  background: rgba(245,166,35,0.15);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #6b4800;
  line-height: 1.4;
}

/* =============================================
   Paywall Overlay
   ============================================= */
.paywall-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #1a6b3c 0%, #0f3d22 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.paywall-card {
  background: #fff;
  border-radius: 24px;
  padding: 36px 28px 32px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.paywall-logo {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  margin-bottom: 16px;
}

.paywall-title {
  font-size: 2rem;
  font-weight: 900;
  color: #1a6b3c;
  margin: 0 0 8px;
}

.paywall-tagline {
  font-size: 1.05rem;
  color: #555;
  margin: 0 0 24px;
}

.paywall-features {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paywall-features li {
  font-size: 1rem;
  color: #333;
  font-weight: 600;
}

.paywall-btn {
  display: block;
  background: #1a6b3c;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 16px 24px;
  border-radius: 14px;
  text-decoration: none;
  margin-bottom: 12px;
  transition: background 0.2s;
}

.paywall-btn:active {
  background: #0f3d22;
}

.paywall-small {
  font-size: 0.8rem;
  color: #999;
  margin: 0;
}

.paywall-signin {
  margin-top: 16px;
  font-size: 0.9rem;
  color: #666;
}

.paywall-signin a {
  color: #1a6b3c;
  font-weight: 700;
  text-decoration: none;
}

/* =============================================
   Hero card relationship label
   ============================================= */
.hero-label {
  font-size: clamp(10px, 2.8vw, 13px);
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* =============================================
   Recently Called Strip
   ============================================= */
.recently-called-label {
  padding-left: 16px;
  margin-bottom: 8px;
}
.recently-called-strip {
  display: flex;
  gap: 12px;
  padding: 0 16px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.recently-called-strip::-webkit-scrollbar { display: none; }
.recent-call-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.recent-call-item:active { opacity: 0.7; }
.recent-call-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900; color: white;
  flex-shrink: 0;
}
.recent-call-avatar-photo {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: cover;
}
.recent-call-name {
  font-size: 11px; font-weight: 700;
  color: var(--text);
  text-align: center;
  max-width: 60px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* =============================================
   Manage Sheet — Label button
   ============================================= */
.sheet-label {
  width: 100%; padding: 16px;
  margin-bottom: 10px;
  border-radius: var(--radius-btn);
  background: #f0fdf4; border: 2px solid #86efac;
  font-size: 16px; font-weight: 700; color: #166534;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background 0.15s;
}
.sheet-label:active { background: #dcfce7; }
.sheet-label .material-icons-round { font-size: 20px; }

/* =============================================
   Text Size Selector
   ============================================= */
.text-size-selector {
  display: flex;
  gap: 8px;
  padding: 4px 16px 16px;
}
.text-size-btn {
  flex: 1;
  padding: 10px 4px;
  border-radius: var(--radius-btn);
  border: 2px solid var(--border);
  background: var(--bg);
  font-size: 14px; font-weight: 700;
  color: var(--text-muted);
  transition: all 0.15s;
}
.text-size-btn.active {
  background: var(--green-deep);
  border-color: var(--green-deep);
  color: white;
}

/* Text size overrides — Large */
body.text-large .hero-name  { font-size: clamp(14px, 4.5vw, 22px); }
body.text-large .hero-phone { font-size: clamp(11px, 3.2vw, 15px); }
body.text-large .hero-label { font-size: clamp(11px, 3.2vw, 15px); }

/* Text size overrides — Extra Large */
body.text-xl .hero-name  { font-size: clamp(16px, 5.5vw, 26px); }
body.text-xl .hero-phone { font-size: clamp(12px, 3.8vw, 17px); }
body.text-xl .hero-label { font-size: clamp(12px, 3.8vw, 17px); }

/* =============================================
   PIN Overlay (Carer Lock)
   ============================================= */
.pin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.pin-card {
  background: var(--card-bg);
  border-radius: 28px;
  padding: 32px 24px 28px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.pin-icon {
  font-size: 44px;
  color: var(--green-deep);
}
.pin-title {
  font-size: 22px; font-weight: 900;
  color: var(--text);
  text-align: center;
}
.pin-sub {
  font-size: 14px; color: var(--text-muted);
  text-align: center;
  margin-top: -4px;
}
.pin-dots {
  display: flex;
  gap: 16px;
  margin: 8px 0;
}
.pin-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.pin-dot.filled {
  background: var(--green-deep);
  border-color: var(--green-deep);
}
.pin-error {
  font-size: 13px; font-weight: 700;
  color: var(--red-sos);
  text-align: center;
  min-height: 18px;
}
.pin-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}
.pin-key {
  padding: 16px;
  border-radius: var(--radius-btn);
  background: var(--bg);
  border: 2px solid var(--border);
  font-size: 22px; font-weight: 800;
  color: var(--text);
  transition: background 0.1s;
}
.pin-key:active { background: var(--border); }
.pin-key-action {
  font-size: 14px; font-weight: 700;
  color: var(--text-muted);
}
.pin-cancel {
  margin-top: 6px;
  font-size: 15px; font-weight: 700;
  color: var(--text-muted);
  background: none; border: none;
  padding: 8px 20px;
}
