/* ══════════════════════════════════════════
   ROUTR — Styles
   ══════════════════════════════════════════ */

/* ── TOKENS ────────────────────────────────── */
:root {
  --bg:       #F8F7F4;
  --surface:  #FFFFFF;
  --ink:      #0E0E0E;
  --ink-2:    #6B6B6B;
  --ink-3:    #B0B0B0;
  --accent:   #0E0E0E;
  --live:     #8bc34a; /* Adjusted to screenshot green */
  --live-bg:  #f1f8e9;
  --live-soft:#D4EDDA;
  --danger:   #d32f2f; /* Adjusted to red screenshot */
  --danger-bg:#FDEDEB;
  --warning:  #E67E22;
  --border:   #E8E6E1;
  --radius:   14px;
  --serif:    'Instrument Serif', Georgia, serif;
  --sans:     'Geist', system-ui, -apple-system, sans-serif;
  --mono:     'Geist Mono', 'SF Mono', monospace;
  --shadow:   0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:0 8px 32px rgba(0,0,0,.12);
  --shadow-xl:0 12px 48px rgba(0,0,0,.18);

}

/* ── RESET ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; height: 100dvh; overflow: hidden; overscroll-behavior-y: none; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── SCREENS ───────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .32s cubic-bezier(.4,0,.2,1), transform .32s cubic-bezier(.4,0,.2,1);
  will-change: opacity, transform;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: none !important;
}
.screen.slide-right { transform: translateX(100%); }
.screen.slide-up    { transform: translateY(60px); }

.bottom-nav-padded {
  padding-bottom: 30px;
}

/* ── RADIAL MENU ───────────────────────────── */
.radial-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 800; opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.radial-overlay.open { opacity: 1; pointer-events: all; }

/*
  Container is 160×160px so all transformed items stay WITHIN bounds.
  FAB sits at bottom-right corner. Items animate outward but never leave the container.
  pointer-events:none on container itself so it doesn't block the rest of the UI.
*/
.radial-container {
  position: fixed;
  bottom: 24px; right: 20px;
  width: 160px; height: 160px;
  z-index: 900;
  pointer-events: none;
}

.radial-item {
  position: absolute;
  bottom: 20px; right: 20px;   /* resting pos = center of FAB */
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transform: translate(0, 0) scale(0.5);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}
.radial-item:active { opacity: .7; transition: opacity 0.1s; }

/* Open states — all within 160×160 container */
.radial-container.open .radial-item { pointer-events: all; }

.radial-container.open #radAdd {
  opacity: 1;
  transform: translate(0px, -96px) scale(1);
  transition-delay: 0.12s;
}
.radial-container.open #radDash {
  opacity: 1;
  transform: translate(-52px, -82px) scale(1);
  transition-delay: 0.08s;
}
.radial-container.open #radCalendar {
  opacity: 1;
  transform: translate(-82px, -52px) scale(1);
  transition-delay: 0.04s;
}
.radial-container.open #radSettings {
  opacity: 1;
  transform: translate(-96px, 0px) scale(1);
  transition-delay: 0s;
}

/* ── TOPBAR ────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 56px 20px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.5px;
  background: linear-gradient(135deg, var(--ink) 0%, #444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar-back, .topbar-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--ink);
  border-radius: 10px;
  transition: background .15s, transform .1s;
}
.topbar-back:hover, .topbar-action:hover { background: var(--border); }
.topbar-back:active, .topbar-action:active { transform: scale(.92); }
.topbar-title {
  flex: 1;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -.3px;
}

/* ── SCROLL AREA ───────────────────────────── */
.scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
.scroll::-webkit-scrollbar { display: none; }

/* ═══════════════════════════════════════════
   SCREEN 1 — DASHBOARD
═══════════════════════════════════════════ */
#screen-dash .topbar { padding-top: 56px; }
.dash-header { padding: 28px 20px 8px; }
.dash-greeting { font-family: var(--serif); font-size: 34px; line-height: 1.1; color: var(--ink); font-style: italic; }
.dash-sub { font-size: 13px; color: var(--ink-2); margin-top: 6px; font-weight: 400; }
.first-run-hint {
  margin: 8px 20px 4px;
  padding: 18px 18px 16px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid rgba(138, 201, 65, 0.22);
  background: linear-gradient(180deg, rgba(138, 201, 65, 0.12) 0%, rgba(138, 201, 65, 0.05) 100%);
  box-shadow: 0 14px 28px rgba(25, 31, 22, 0.06);
}
.first-run-hint-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.first-run-hint-text {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-2);
  white-space: pre-line;
}

.dash-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px 20px 4px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-value { font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: -.5px; }
.stat-label { font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .6px; margin-top: 4px; font-weight: 500; }

.dash-list { padding: 8px 20px 40px; display: flex; flex-direction: column; gap: 10px; }

.route-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 18px 20px; cursor: pointer; transition: transform .15s; display: flex; align-items: center; gap: 16px; position: relative; }
.route-card:active { transform: scale(.985); }
.route-card-icon { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--bg) 0%, var(--border) 100%); display: flex; align-items: center; justify-content: center; color: var(--ink-2); flex-shrink: 0; }
.route-card-body { flex: 1; min-width: 0; }
.route-card-name { font-size: 15px; font-weight: 600; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-card-meta { font-size: 12px; color: var(--ink-2); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.route-card-badge { display: flex; align-items: center; gap: 4px; }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: livepulse 1.6s ease infinite; }
@keyframes livepulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.3;transform:scale(.8)} }
.route-card-arrow { color: var(--ink-3); flex-shrink: 0; }

.fab {
  position: absolute;
  bottom: 0; right: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xl);
  transition: transform .3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: all;
  z-index: 10;
}
.fab:active { transform: scale(.92); }
.radial-container.open .fab { transform: rotate(45deg); }
.radial-container.open .fab:active { transform: rotate(45deg) scale(.92); }

.empty-dash { padding: 60px 20px 80px; text-align: center; color: var(--ink-3); }
.empty-icon { width: 80px; height: 80px; border-radius: 20px; background: var(--border); display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; opacity: .6; }
.empty-dash h2 { font-size: 18px; font-weight: 500; color: var(--ink-2); margin-bottom: 10px; }
.empty-dash p { font-size: 14px; line-height: 1.7; color: var(--ink-3); max-width: 260px; margin: 0 auto; }

/* ═══════════════════════════════════════════
   SCREEN 2 — ROUTE DETAIL
═══════════════════════════════════════════ */
#screen-route { background: var(--bg); z-index: 900; } /* over bottom nav */
.hero { position: relative; background: #E8E6E0; overflow: hidden; transition: height .4s cubic-bezier(.4,0,.2,1); flex-shrink: 0; }
.hero.half { height: 46vh; }
.hero.closed { height: 0; }
.hero.full { height: 100vh; }
#routeMap { width: 100%; height: 100%; }

.hero-controls { position: absolute; bottom: 12px; right: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 500; }
.hero-btn { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--ink); box-shadow: 0 1px 6px rgba(0,0,0,.12); }
.hero-btn.active { background: var(--ink); color: #fff; }

.hero-geo { position: absolute; bottom: 12px; left: 12px; z-index: 500; }
.geo-pill { display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 20px; background: rgba(255,255,255,.92); border: none; font-size: 12px; font-weight: 600; box-shadow: 0 1px 6px rgba(0,0,0,.12); }
.geo-pill.on { background: var(--live); color: #fff; }
.geo-pill .geo-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.geo-pill.on .geo-dot { animation: livepulse 1.2s infinite; }

.floating-back-btn { position: absolute; top: 56px; left: 12px; z-index: 500; width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.92); border: none; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 6px rgba(0,0,0,.12); }

.route-body { flex: 1; overflow-y: auto; }
.route-body::-webkit-scrollbar { display: none; }
.route-info { padding: 20px 20px 8px; display: flex; align-items: center; justify-content: space-between; }
.route-info-name { font-family: var(--serif); font-size: 28px; font-style: italic; letter-spacing: -.3px; }
.route-info-count { font-size: 12px; color: var(--ink-2); font-weight: 400; margin-top: 2px; }

.stop-list-wrap { padding: 0 20px 40px; display: flex; flex-direction: column; gap: 8px; }
.stop-row { display: flex; align-items: flex-start; gap: 14px; padding: 16px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); }
.stop-num { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; font-family: var(--mono); font-size: 12px; font-weight: 500; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.stop-num.status-inside { background: var(--live); animation: livepulse 1.2s infinite; }
.stop-num.status-done { background: var(--ink-3); }
.stop-body { flex: 1; min-width: 0; }
.stop-name { font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
.stop-addr { font-size: 12px; color: var(--ink-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-timing { font-family: var(--mono); font-size: 11px; color: var(--live); margin-top: 5px; background: var(--live-bg); padding: 3px 8px; border-radius: 6px; display: inline-block; }
.stop-radius-chip { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; color: var(--ink-3); font-family: var(--mono); margin-top: 4px; }
.stop-notes { font-size: 12px; color: var(--ink-2); margin-top: 4px; font-style: italic; }
.stop-actions { display: flex; gap: 4px; }
.stop-action-btn { width: 32px; height: 32px; border: none; background: none; color: var(--ink-3); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.stop-connector { width: 2px; height: 10px; background: linear-gradient(to bottom, var(--border), transparent); margin-left: 34px; }

/* ═══════════════════════════════════════════
   SCREEN 3 — ADD / EDIT STOP
═══════════════════════════════════════════ */
#screen-stop { background: var(--bg); z-index: 910; }
#screen-stop .scroll {
  flex: 1;
  min-height: 0;
  padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
}
.stop-form { padding: 8px 20px 40px; display: flex; flex-direction: column; gap: 22px; }
.field-group { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 11px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .8px; }
.field-input { width: 100%; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-family: var(--sans); font-size: 15px; color: var(--ink); outline: none; }
.field-input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(14,14,14,.06); }
.field-input::placeholder { color: var(--ink-3); }
.field-textarea { resize: vertical; min-height: 80px; }

.map-picker { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); position: relative; background: var(--surface); }
.map-picker-search { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.map-picker-search input { flex: 1; border: none; outline: none; font-size: 14px; background: transparent; }
.map-locate-btn {
  position: absolute;
  right: 14px;
  top: 74px;
  z-index: 700;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.7);
  background: rgba(255,255,255,.94);
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.map-locate-btn:active { transform: scale(.96); }
.search-spinner { color: var(--ink-3); display: flex; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin-anim { animation: spin 1s linear infinite; }
#formMap { height: 260px; }
.map-suggestions { position: absolute; top: 56px; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 1000; max-height: 220px; overflow-y: auto; }
.map-sug { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border); }
.map-sug-main { font-size: 14px; font-weight: 500; }
.map-sug-sub { font-size: 11px; color: var(--ink-2); }
.map-sug-type { font-size: 9px; color: var(--ink-3); text-transform: uppercase; font-weight: 600; }
.map-chosen { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; background: var(--live-bg); }
.map-chosen-name { flex: 1; font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-clear { background: none; border: none; cursor: pointer; color: var(--ink-3); }

.radius-field { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 16px; }
.radius-display { display: flex; align-items: baseline; justify-content: space-between; }
.radius-value { font-family: var(--mono); font-size: 28px; font-weight: 600; letter-spacing: -1px; }

.bottom-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  margin-top: auto;
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 200;
}
.btn-primary { width: 100%; padding: 16px; background: var(--ink); color: #fff; border: none; border-radius: var(--radius); font-weight: 600; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .25; }

.connection-badge {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 1200;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
}
.connection-badge.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.connection-badge.online {
  background: var(--live-bg);
  color: #2f7d32;
}
.connection-badge.offline {
  background: var(--danger-bg);
  color: var(--danger);
}

.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 18px;
  z-index: 1250;
  background: rgba(255,255,255,.96);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,.14);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.cookie-banner-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
}
.cookie-banner-btn {
  align-self: flex-end;
  min-width: 120px;
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.offline-check-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.offline-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
}
.offline-check-item.ok span:first-child {
  color: var(--live);
  font-weight: 700;
}
.offline-check-item.warn span:first-child {
  color: #d97706;
  font-weight: 700;
}
.offline-check-note {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
}
.cookie-banner-btn:active { transform: scale(.98); }

/* ═══════════════════════════════════════════
   SCREEN 4 — CALENDAR
═══════════════════════════════════════════ */
.calendar-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 56px 16px 12px;
  background: var(--surface);
  border-bottom: none;
  flex-shrink: 0;
}
.text-btn {
  background: none;
  border: none;
  color: #007aff;
  font-size: 16px;
  font-family: var(--sans);
  cursor: pointer;
}
.text-btn.primary { font-weight: 600; }
.calendar-title {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}

.calendar-days-header {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  position: relative;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.calendar-time-axis-spacer {
  width: 40px;
  flex-shrink: 0;
}
.calendar-day {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.calendar-day-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.calendar-day-num {
  font-size: 16px;
  color: var(--ink-2);
}
.calendar-day.active .calendar-day-num {
  color: var(--ink);
}
.calendar-day.active {
  background: linear-gradient(to bottom, #dcedc8, transparent);
}

.calendar-scroll {
  background: #fff;
  position: relative;
}
.calendar-grid {
  display: flex;
  position: relative;
  min-height: 1000px; /* will compute via JS */
}
.calendar-time-axis {
  width: 40px;
  border-right: 1px solid var(--border);
  position: relative;
  background: #fff;
  z-index: 5;
}
.calendar-hour-label {
  position: absolute;
  right: 6px;
  top: -8px; /* Offset to center on line */
  font-size: 10px;
  color: var(--ink-3);
  font-family: var(--mono);
}
.calendar-day-col {
  flex: 1;
  border-right: 1px solid var(--border);
  position: relative;
}
.calendar-day-col:last-child {
  border-right: none;
}
.calendar-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  z-index: 0;
}

/* Activity Blocks */
.activity-block {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 6px;
  padding: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
  cursor: pointer;
  z-index: 2;
  transition: transform 0.1s;
  /* Striped layout: use repeating linear gradient */
  background: repeating-linear-gradient(
    -45deg,
    rgba(255,255,255,0.1),
    rgba(255,255,255,0.1) 4px,
    transparent 4px,
    transparent 8px
  );
}
.activity-block:active {
  transform: scale(0.95);
}
.activity-block.green {
  background-color: var(--live);
}
.activity-block.red {
  background-color: var(--danger);
  color: #fff;
}
.activity-block-content {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  /* Writing mode to rotate text */
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════
   MODALS & DIALOGS
═══════════════════════════════════════════ */
.modal-backdrop, .confirm-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(6px); z-index: 1000; opacity: 0; pointer-events: none; transition: opacity .25s; }
.modal-backdrop.open, .confirm-backdrop.open { opacity: 1; pointer-events: all; }
.modal { position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg); border-radius: 22px 22px 0 0; padding: 24px 20px 48px; z-index: 1001; transform: translateY(100%); transition: transform .35s; box-shadow: var(--shadow-xl); }
.modal.open { transform: none; }
.modal-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 20px; }
.modal-title { font-family: var(--serif); font-size: 26px; font-style: italic; margin-bottom: 22px; }

/* Edit Activity Modal */
.edit-activity-modal {
  padding: 16px 0 32px 0;
}
.activity-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid transparent; /* or matching border */
}
.activity-title {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.activity-title .geo-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--live);
}
.activity-times {
  margin-top: 20px;
  background: var(--surface);
  padding: 0 16px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.activity-time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-time-row.no-border { border-bottom: none; }
.activity-time-label { font-size: 16px; color: var(--ink); }
.time-input {
  border: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 16px;
  text-align: right;
  color: var(--ink);
  outline: none;
}
.btn-danger-outline {
  width: calc(100% - 32px);
  margin: 30px 16px 0;
  padding: 16px;
  background: var(--surface);
  color: var(--danger);
  border: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

/* Confirm Dialog */
.confirm-backdrop {
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}
.confirm-dialog {
  background: var(--surface);
  border-radius: 18px;
  padding: 28px 24px 24px;
  width: min(100%, 340px);
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  transform: scale(.92);
  margin: 0 auto;
}
.confirm-backdrop.open .confirm-dialog { transform: scale(1); }
.confirm-title { font-size: 22px; font-style: italic; margin-bottom: 10px; }
.confirm-message { font-size: 14px; color: var(--ink-2); line-height: 1.6; margin-bottom: 24px; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-btn { flex: 1; padding: 13px 16px; border-radius: var(--radius); font-weight: 600; cursor: pointer; border: none; }
.confirm-btn.cancel { background: var(--bg); border: 1px solid var(--border); }
.confirm-btn.danger { background: var(--danger); color: #fff; }

@media (max-width: 480px) {
  .confirm-dialog {
    width: min(100%, 360px);
    max-width: calc(100vw - 24px);
    padding: 24px 18px 18px;
    border-radius: 16px;
  }
  .confirm-title {
    font-size: 20px;
  }
  .confirm-message {
    font-size: 13px;
    margin-bottom: 20px;
  }
  .confirm-actions {
    gap: 8px;
  }
  .confirm-btn {
    padding: 12px 12px;
  }
}

/* ── TOAST ─────────────────────────────────── */
.toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(12px); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 22px; font-size: 13px; font-weight: 500; z-index: 999; opacity: 0; transition: all .3s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── LEAFLET CUSTOM PIN ────────────────────── */
.custom-pin { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; font-weight: 600; border: 2.5px solid #fff; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.custom-pin.live { background: var(--live); box-shadow: 0 2px 12px rgba(139,195,74,.4); }
.custom-pin.done { background: var(--ink-3); }

.user-location-marker { width: 16px; height: 16px; border-radius: 50%; background: #4285F4; border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(66,133,244,.2), 0 2px 8px rgba(0,0,0,.2); animation: location-pulse 2s ease infinite; }
@keyframes location-pulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(66,133,244,.2), 0 2px 8px rgba(0,0,0,.2); } 50% { box-shadow: 0 0 0 10px rgba(66,133,244,.08), 0 2px 8px rgba(0,0,0,.2); } }

/* ═══════════════════════════════════════════
   SETTINGS & FORMS
═══════════════════════════════════════════ */
.settings-section { margin-bottom: 32px; }
.settings-header { font-size: 13px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 12px; padding-left: 4px; }
.settings-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.settings-label { font-size: 16px; font-weight: 500; color: var(--ink); }
.settings-sub { font-size: 12px; color: var(--ink-2); margin-top: 4px; line-height: 1.4; }
.settings-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  outline: none;
}

/* ═══════════════════════════════════════════
   SCREEN 6 — DEVELOPER TOOLS
═══════════════════════════════════════════ */
.dev-badge {
  font-size: 10px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
  background: var(--border); color: var(--ink-2);
}
.dev-badge.online  { background: var(--live-bg);   color: var(--live); }
.dev-badge.offline { background: var(--danger-bg); color: var(--danger); }

.dev-field {
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.dev-label {
  display: block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--ink-3); margin-bottom: 6px;
}
.dev-input { font-size: 13px !important; padding: 10px 14px !important; }

.dev-btn {
  padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: var(--sans); text-align: center;
  transition: background .15s;
}
.dev-btn:active { background: var(--border); }
.dev-btn-sm {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: var(--sans); white-space: nowrap; flex-shrink: 0;
}
.dev-browser-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px;
  transition: background .1s;
}
.dev-browser-item:last-child { border-bottom: none; }
.dev-browser-item:active { background: var(--bg); }

/* DNS Info Card */
.dns-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12px;
}
.dns-row:last-child { border-bottom: none; padding-bottom: 0; }
.dns-type {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  background: #dbeafe; color: #1d4ed8; padding: 2px 7px; border-radius: 5px;
  flex-shrink: 0;
}
.dns-host {
  font-family: var(--mono); color: var(--ink-2); width: 40px; flex-shrink: 0;
}
.dns-val {
  font-family: var(--mono); color: var(--ink); font-weight: 600;
  flex: 1; cursor: pointer; padding: 3px 8px; border-radius: 6px;
  transition: background .15s;
}
.dns-val:active { background: var(--border); }

.qr-reader-wrap {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 1 / 1;
}
.qr-reader-shell {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 360px;
  border-radius: 20px;
  overflow: hidden;
  border: 4px solid var(--border);
  background: #000;
}
.qr-reader-shell video,
.qr-reader-shell canvas,
.qr-reader-shell img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: 16px;
}
.qr-reader-shell > div {
  width: 100% !important;
  height: 100% !important;
}
.qr-scan-overlay {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  pointer-events: none;
  overflow: hidden;
}
.qr-corner {
  position: absolute;
  width: 46px;
  height: 46px;
  border-color: rgba(255,255,255,.96);
  border-style: solid;
  border-width: 0;
}
.qr-corner.tl { top: 16px; left: 16px; border-top-width: 6px; border-left-width: 6px; }
.qr-corner.tr { top: 16px; right: 16px; border-top-width: 6px; border-right-width: 6px; }
.qr-corner.bl { bottom: 16px; left: 16px; border-bottom-width: 6px; border-left-width: 6px; }
.qr-corner.br { bottom: 16px; right: 16px; border-bottom-width: 6px; border-right-width: 6px; }
.qr-scan-line {
  position: absolute;
  left: 12%;
  right: 12%;
  height: 3px;
  top: 16%;
  border-radius: 999px;
  background: rgba(255,255,255,.95);
  box-shadow: 0 0 18px rgba(255,255,255,.55);
  animation: qrScanSweep 2.1s ease-in-out infinite;
}
.qr-scan-overlay.success .qr-corner { border-color: #62d26f; }
.qr-scan-overlay.success .qr-scan-line {
  background: #62d26f;
  box-shadow: 0 0 18px rgba(98,210,111,.55);
}
.qr-scan-overlay.error .qr-corner { border-color: #e53935; }
.qr-scan-overlay.error .qr-scan-line {
  background: #e53935;
  box-shadow: 0 0 18px rgba(229,57,53,.55);
}
@keyframes qrScanSweep {
  0% { top: 14%; opacity: .9; }
  50% { top: 49%; opacity: 1; }
  100% { top: 84%; opacity: .9; }
}

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 28px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--border); transition: .3s; border-radius: 28px; }
.toggle-slider:before { position: absolute; content: ""; height: 22px; width: 22px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,.15); }
input:checked + .toggle-slider { background-color: var(--live); }
input:checked + .toggle-slider:before { transform: translateX(22px); }

/* Color Picker Button */
.color-picker-btn { -webkit-appearance: none; -moz-appearance: none; appearance: none; width: 100%; height: 50px; background-color: transparent; border: none; cursor: pointer; padding: 0; border-radius: 12px; overflow: hidden; }
.color-picker-btn::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker-btn::-webkit-color-swatch { border: 1px solid var(--border); border-radius: 12px; }
.color-picker-btn::-moz-color-swatch { border: 1px solid var(--border); border-radius: 12px; }

/* ═══════════════════════════════════════════
   Secret Notes & Security UI
═══════════════════════════════════════════ */
.secret-group .field-input:disabled { background: var(--bg); opacity: 0.6; cursor: not-allowed; }

/* Numpad Lockscreen */
.pin-dots { display: flex; gap: 16px; margin-bottom: 20px; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); transition: 0.2s ease; background: transparent; }
.pin-dot.filled { background: var(--ink); }
.pin-dot.error { border-color: var(--danger); background: var(--danger); animation: shake 0.4s; }

.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; width: 100%; max-width: 320px; padding: 0 20px 40px 20px; }
.num-btn { background: var(--surface); border: 1px solid var(--border); border-radius: 50px; font-size: 28px; font-weight: 500; font-family: var(--mono); color: var(--ink); height: 72px; width: 72px; display: flex; align-items: center; justify-content: center; margin: 0 auto; cursor: pointer; user-select: none; transition: 0.1s; }
.num-btn:active { background: var(--bg); transform: scale(0.92); }
.num-btn.action { font-family: var(--sans); font-size: 20px; background: transparent; border-color: transparent; }

@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
