:root{
  --primary:#1d4ed8; --primary-dark:#0b1f4d; --accent:#2563eb; --gold:#f59e0b;
  --bg:#eef2fb; --card:#ffffff; --text:#0f172a; --muted:#64748b; --line:#e2e8f0;
  --found:#15803d; --found-bg:#dcfce7; --lost:#b91c1c; --lost-bg:#fee2e2;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0b1220; --card:#16203a; --text:#e7ecf7; --muted:#93a1c0; --line:#25324f;
    --found-bg:#0d2f1d; --lost-bg:#3a1414;
  }
}
:root[data-theme="dark"]{
  --bg:#0b1220; --card:#16203a; --text:#e7ecf7; --muted:#93a1c0; --line:#25324f;
  --found-bg:#0d2f1d; --lost-bg:#3a1414;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
html{height:100%;}
body{
  margin:0; min-height:100%; font-family:-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  background:radial-gradient(circle at 30% 0%,#13327a 0%,#0a1230 60%,#070a18 100%);
  color:var(--text); display:flex; justify-content:center; padding:22px 12px;
  padding-top:calc(22px + env(safe-area-inset-top,0px));
  padding-bottom:calc(22px + env(safe-area-inset-bottom,0px));
}
.phone{
  width:100%; max-width:400px; background:var(--bg); border-radius:30px; overflow:hidden;
  box-shadow:0 30px 70px rgba(0,0,0,.45); min-height:760px; display:flex; flex-direction:column;
}
.top{padding:16px 20px 10px; display:flex; align-items:center; justify-content:space-between;}
.brand{display:flex; align-items:center; gap:8px; font-weight:800; color:var(--primary); font-size:15.5px;}
.bell{position:relative; width:36px; height:36px; border-radius:50%; background:var(--card); display:flex;
  align-items:center; justify-content:center; cursor:pointer; border:1px solid var(--line);}
.dot{position:absolute; top:5px; right:6px; width:8px; height:8px; border-radius:50%; background:var(--lost);}
.screen{flex:1; overflow-y:auto; padding:2px 20px 22px; -webkit-overflow-scrolling:touch;}
.nav{display:flex; justify-content:space-around; padding:9px 4px calc(9px + env(safe-area-inset-bottom,0px));
  background:var(--card); border-top:1px solid var(--line);}
.navbtn{display:flex; flex-direction:column; align-items:center; gap:3px; font-size:10px; color:var(--muted);
  background:none; border:none; cursor:pointer; padding:4px 6px; font-family:inherit;}
.navbtn.active{color:var(--primary); font-weight:700;}
.card{background:var(--card); border-radius:16px; padding:15px; border:1px solid var(--line);}
.btn{display:block; width:100%; padding:13px; border-radius:12px; border:none; font-weight:700; font-size:14px;
  cursor:pointer; text-align:center; font-family:inherit;}
.btn-primary{background:var(--primary); color:#fff;}
.btn-primary:active{background:#1740b8;}
.btn-primary:disabled{opacity:.5; cursor:not-allowed;}
.btn-outline{background:transparent; color:var(--primary); border:1.5px solid var(--primary);}
.btn-gold{background:var(--gold); color:#3a2600;}
.label{font-size:12.5px; font-weight:700; color:var(--muted); margin:14px 0 6px; display:block;}
.input,select,textarea{width:100%; padding:11px 12px; border-radius:11px; border:1px solid var(--line);
  background:var(--card); color:var(--text); font-size:14px; font-family:inherit; outline:none;}
.input:focus,select:focus,textarea:focus{border-color:var(--primary);}
textarea{resize:vertical; min-height:64px;}
.tabs{display:flex; background:var(--card); border-radius:12px; padding:4px; border:1px solid var(--line); margin:14px 0;}
.tab{flex:1; text-align:center; padding:9px; border-radius:9px; font-weight:700; font-size:13.5px; cursor:pointer; color:var(--muted);}
.tab.active{background:var(--primary); color:#fff;}
.h1{font-size:21px; font-weight:800; margin:8px 0 2px;}
.h2{font-size:15px; font-weight:800; margin:0 0 8px;}
.tagline{font-style:italic; color:var(--accent); font-size:13px; letter-spacing:.2px; margin:2px 0 4px;}
.sub{color:var(--muted); font-size:13.5px; margin:0 0 10px; line-height:1.45;}
.pillrow{display:flex; gap:8px; margin:12px 0; overflow-x:auto; padding-bottom:2px;}
.pill{padding:7px 14px; border-radius:20px; border:1px solid var(--line); font-size:13px; font-weight:700;
  color:var(--muted); white-space:nowrap; cursor:pointer; background:var(--card); font-family:inherit;}
.pill.active{background:var(--primary); color:#fff; border-color:var(--primary);}
.item{display:flex; gap:12px; padding:12px; border-radius:14px; background:var(--card); border:1px solid var(--line);
  margin-bottom:10px; cursor:pointer; align-items:center;}
.item:active{border-color:var(--primary);}
.ico{width:44px; height:44px; border-radius:11px; display:flex; align-items:center; justify-content:center;
  font-size:20px; background:#dbe6ff; flex-shrink:0;}
.iname{font-weight:700; font-size:14.5px;}
.imeta{color:var(--muted); font-size:11.5px; margin-top:3px;}
.tag{font-size:10.5px; font-weight:800; padding:3px 8px; border-radius:20px; letter-spacing:.3px; white-space:nowrap;}
.tag.found{background:var(--found-bg); color:var(--found);}
.tag.lost{background:var(--lost-bg); color:var(--lost);}
.tag.ret{background:#e0e7ff; color:#3730a3;}
.grid4{display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:14px;}
.qbtn{border-radius:14px; padding:15px 10px; border:1px solid var(--line); background:var(--card); text-align:center;
  cursor:pointer; font-weight:700; font-size:12.5px; color:var(--text); font-family:inherit;}
.qbtn:active{border-color:var(--primary);}
.qbtn .qi{font-size:22px; display:block; margin-bottom:6px;}
.notif{display:flex; gap:11px; padding:12px; border-radius:14px; background:var(--card); border:1px solid var(--line); margin-bottom:9px;}
.ntext{font-size:13.5px; line-height:1.4;}
.ntime{color:var(--muted); font-size:11.5px; margin-top:4px;}
.avatar{width:64px; height:64px; border-radius:50%; background:var(--primary); color:#fff; display:flex;
  align-items:center; justify-content:center; font-weight:800; font-size:24px; margin:0 auto 8px;}
.prow{display:flex; justify-content:space-between; align-items:center; padding:14px 4px; border-bottom:1px solid var(--line);
  font-size:14px; cursor:pointer;}
.prow:last-child{border-bottom:none;}
.stat3{display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; margin:14px 0;}
.stat{background:var(--card); border:1px solid var(--line); border-radius:13px; padding:10px 6px; text-align:center;}
.stat b{font-size:19px; display:block;}
.stat span{font-size:10px; color:var(--muted); display:block; margin-top:2px; line-height:1.3;}
.toast{position:fixed; bottom:calc(30px + env(safe-area-inset-bottom,0px)); left:50%; transform:translateX(-50%);
  background:#0f172a; color:#fff; padding:11px 18px; border-radius:30px; font-size:13px; z-index:999;
  box-shadow:0 8px 20px rgba(0,0,0,.35); max-width:88vw; text-align:center;}
.linkbtn{color:var(--primary); font-weight:700; font-size:13px; text-align:center; margin-top:12px; cursor:pointer;}
.divider{display:flex; align-items:center; gap:10px; color:var(--muted); font-size:12px; margin:16px 0;}
.divider::before,.divider::after{content:""; flex:1; height:1px; background:var(--line);}
.backrow{display:flex; align-items:center; gap:8px; padding:12px 0 4px; font-weight:700; cursor:pointer; font-size:14.5px;}
.chev{font-size:18px; line-height:1;}
.hero-card{background:linear-gradient(135deg,#1d4ed8,#3b82f6); color:#fff; border:none;}
.matchbox{background:var(--card); border:1px dashed var(--primary); border-radius:14px; padding:12px; margin-bottom:10px; cursor:pointer;}
.loading{text-align:center;padding:40px 0;color:var(--muted);}
.spinner{display:inline-block;width:28px;height:28px;border:3px solid var(--line);border-top-color:var(--primary);
  border-radius:50%;animation:spin .8s linear infinite;}
@keyframes spin{to{transform:rotate(360deg)}}
/* ============ SESSION 1 ADDITIONS ============ */

/* Back button in top bar */
.back-btn{
  width:36px; height:36px; border-radius:50%; background:var(--card);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; border:1px solid var(--line); font-size:18px;
  color:var(--primary); flex-shrink:0;
}
.back-btn:active{background:#dbe6ff;}

/* Arrival animation for every screen */
@keyframes fadeSlideIn{
  from{opacity:0; transform:translateY(14px);}
  to{opacity:1; transform:translateY(0);}
}
.screen{
  animation:fadeSlideIn .35s ease-out;
}
.item, .notif, .matchbox, .card, .qbtn, .stat{
  animation:fadeSlideIn .4s ease-out backwards;
}
.item:nth-child(1){animation-delay:0.02s;}
.item:nth-child(2){animation-delay:0.06s;}
.item:nth-child(3){animation-delay:0.10s;}
.item:nth-child(4){animation-delay:0.14s;}
.item:nth-child(5){animation-delay:0.18s;}

/* Rotating quote */
.quote-wrap{
  min-height:26px;
  margin:8px 0 4px;
  display:flex;
  justify-content:center;
  align-items:center;
}
.quote-text{
  font-style:italic;
  color:var(--accent);
  font-size:13.5px;
  letter-spacing:.2px;
  opacity:0;
  transform:translateY(6px);
  transition:opacity .5s ease, transform .5s ease;
}
.quote-text.show{
  opacity:1;
  transform:translateY(0);
}

/* Toast entrance */
@keyframes toastIn{
  from{opacity:0; transform:translate(-50%, 12px);}
  to{opacity:1; transform:translate(-50%, 0);}
}
.toast{
  animation:toastIn .25s ease-out;
}
/* ============ SESSION 2 ADDITIONS ============ */

/* Dashboard stat cards */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}
.dash-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
}
.dash-card .dc-val {
  font-size: 26px;
  font-weight: 800;
  display: block;
  line-height: 1.1;
}
.dash-card .dc-lbl {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}
.dash-card.lost .dc-val { color: var(--lost); }
.dash-card.found .dc-val { color: var(--found); }
.dash-card.ret .dc-val { color: var(--primary); }

/* Category bars */
.cat-row {
  margin-bottom: 12px;
}
.cat-row .cat-label {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
}
.cat-row .cat-label span:last-child {
  color: var(--muted);
}
.cat-bar {
  height: 10px;
  border-radius: 6px;
  background: #e2e8f0;
  overflow: hidden;
}
.cat-bar i {
  display: block;
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s ease;
}

/* Recovery rate ring */
.recovery-wrap {
  text-align: center;
  padding: 10px 0;
}
.recovery-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin: 10px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.recovery-ring .rr-inner {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.recovery-ring .rr-inner b {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}
.recovery-ring .rr-inner small {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

/* Notification sound toggle */
.sound-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.sound-toggle:last-child { border-bottom: none; }
.sound-toggle .st-label {
  font-weight: 700;
  color: var(--text);
}
.sound-toggle .st-hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--line);
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-switch.on {
  background: var(--primary);
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch.on::after {
  transform: translateX(20px);
}