/* EVVidence caregiver app demo — light scheme tokens from mobile/constants/theme.ts.
   No inline styles anywhere (host CSP forbids them); everything lives here. */

:root {
  --bg: #FAFAF8;
  --card: #FFFFFF;
  --muted: #F0EFE9;
  --track: #EFEEE7;
  --text: #1A1D1A;
  --text2: #6B7068;
  --text-strong: #3F443D;
  --primary: #5B7F5E;
  --primary-light: #E8F0E8;
  --primary-dark: #3D5A3F;
  --success: #2D8A4E;
  --success-light: #E6F5EC;
  --warning: #C17A2F;
  --warning-light: #FFF3E0;
  --warning-text: #715C38;
  --destructive: #C4432B;
  --destructive-light: #FDE8E4;
  --border: #E4E2DA;
  --hairline: rgba(26, 29, 26, 0.08);
  --scrim: rgba(26, 29, 26, 0.42);
  --shadow-sm: 0 1px 3px rgba(26, 29, 26, 0.06);
  --shadow-md: 0 4px 12px rgba(26, 29, 26, 0.07);
  --shadow-lg: 0 8px 24px rgba(26, 29, 26, 0.12);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  overscroll-behavior: none;
}

/* Standalone (non-embed) viewing: center the phone-sized canvas. */
body.standalone { background: #E9E7DF; }
body.standalone #app { max-width: 375px; max-height: 724px; margin: 0 auto; box-shadow: var(--shadow-lg); }

#app {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#stage { flex: 1; min-height: 0; position: relative; }

/* ---------------------------------------------------------------- screens */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 8px;
  background: var(--bg);
  overflow: hidden; /* also keeps the parked bottom sheet out of the scroll area */
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
.screen.pre { opacity: 0; transform: translateY(8px); }
.screen.out { opacity: 0; transform: translateY(-6px); pointer-events: none; }

/* Sub-panes inside a screen (visit details -> GPS confirmed). */
.pane {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 8px;
  background: var(--bg);
  overflow-y: auto;
  scrollbar-width: none;
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.pane::-webkit-scrollbar { display: none; }
.pane.gone { opacity: 0; transform: translateY(6px); pointer-events: none; }

.spacer { flex: 1 1 auto; min-height: 10px; }
.mt { margin-top: 14px; }

button { font-family: inherit; cursor: pointer; }
button:focus-visible, textarea:focus-visible { outline: 2px solid rgba(91, 127, 94, 0.5); outline-offset: 1px; }

/* ---------------------------------------------------------------- type */

.title { font-size: 21px; font-weight: 600; letter-spacing: -0.2px; line-height: 26px; }
.sub { font-size: 15px; color: var(--text2); margin-top: 3px; }
.micro {
  font-size: 12px; font-weight: 600; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--text2);
}
.greet { margin-bottom: 12px; }
.sect { margin: 12px 2px 6px; }

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; text-align: left; }

.avatar {
  width: 52px; height: 52px; border-radius: 999px;
  background: var(--primary-light); color: var(--primary-dark);
  font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.avatar.sm { width: 42px; height: 42px; font-size: 14px; }
.avatar.lg { width: 56px; height: 56px; font-size: 17px; }
.avatar.warm { background: #EFEDE3; color: var(--text-strong); }

.client { gap: 12px; }
.name { font-size: 17px; font-weight: 600; line-height: 22px; }
.name.sm { font-size: 15px; }
.svc { font-size: 14px; color: var(--text2); margin-top: 1px; }

.hero .micro { letter-spacing: 0.8px; }
.eta { font-size: 14px; font-weight: 600; color: var(--primary-dark); }
.hero .client { margin: 14px 0 12px; }

.info { gap: 10px; margin-top: 9px; color: var(--text); font-size: 15px; }
.info .ic { color: var(--text2); flex: 0 0 auto; }
.info.top { align-items: flex-start; }
.info.top .ic { margin-top: 2px; }
.info span { line-height: 21px; }
.info .strong { font-weight: 600; }

.foot { text-align: center; font-size: 13px; color: var(--text2); margin-top: 18px; }

/* Row cards (later today / done today / schedule) */
.rowcard {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-sm); padding: 12px 14px; text-align: left;
}
.rowcard .chev { color: var(--text2); flex: 0 0 auto; }
.rowcard .name.sm, .rowcard .svc {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rowcard .svc { font-size: 13px; }

/* ---------------------------------------------------------------- pills */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 25px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; flex: 0 0 auto;
}
.pill .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.pill.ok { background: var(--success-light); color: var(--success); }
.pill.neutral { background: #EFEDE4; color: #74776D; }
.pill.lg { height: 30px; font-size: 14px; padding: 0 12px; }
.pills { gap: 8px; margin: 12px 0 2px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- buttons */

.btn {
  width: 100%; height: 50px; border: none; border-radius: 12px;
  font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  transition: transform 0.12s var(--ease), filter 0.12s var(--ease),
              background 0.2s var(--ease), color 0.2s var(--ease);
}
.btn:active { transform: scale(0.985); }
.btn.primary { background: var(--primary); color: #FFFFFF; }
.btn.primary:active { filter: brightness(0.94); }
.btn.primary.is-disabled { background: #ECEBE3; color: #A2A49B; pointer-events: none; }
.btn.danger {
  background: var(--destructive-light); color: var(--destructive);
  border: 1.5px solid var(--destructive);
}
.btn.danger.armed { background: var(--destructive); color: #FFFFFF; }
.hero .btn { margin-top: 14px; height: 48px; }

.textbtn {
  background: none; border: none; padding: 10px 6px;
  font-size: 14px; font-weight: 600; color: var(--text2);
}
.textbtn.accent { color: var(--warning); font-weight: 700; }

.linkquiet {
  background: none; border: none; padding: 12px;
  font-size: 14px; font-weight: 600; color: var(--primary-dark);
  align-self: center;
}

.linkrow {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: none; padding: 14px 4px;
  font-size: 15px; font-weight: 600; color: var(--text);
}
.linkrow .chev { color: var(--text2); }

.iconbtn {
  width: 36px; height: 36px; border: none; border-radius: 999px; background: none;
  display: flex; align-items: center; justify-content: center; color: var(--text);
  flex: 0 0 auto;
}
.iconbtn:active { background: var(--muted); }
.iconbtn.ghost { pointer-events: none; }

/* ---------------------------------------------------------------- nav header */

.nav { display: flex; align-items: center; justify-content: space-between; height: 42px; margin-bottom: 12px; }
.navtitle { font-size: 17px; font-weight: 600; }

/* ---------------------------------------------------------------- hints & banners */

.hint {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--muted); border-radius: 12px; padding: 12px 14px;
  font-size: 13.5px; line-height: 20px; color: var(--text2);
}
.hint .ic { flex: 0 0 auto; margin-top: 1px; }
.hint b { color: var(--text); font-weight: 600; }

.banner {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: 12px; padding: 12px 14px;
  font-size: 13.5px; line-height: 20px;
}
.banner.warn { background: var(--warning-light); color: var(--warning-text); }
.banner .ic { color: var(--warning); flex: 0 0 auto; margin-top: 1px; }

/* ---------------------------------------------------------------- GPS pane */

.gpswrap { display: flex; flex-direction: column; align-items: center; text-align: center; margin-top: 26px; }
.gpswrap .avatar { width: 56px; height: 56px; }
.gpswrap .name { margin-top: 10px; }
.gps-title { font-size: 20px; font-weight: 600; margin-top: 2px; }
.gps-sub { font-size: 14px; color: var(--text2); line-height: 21px; margin-top: 6px; }

.ring { position: relative; width: 118px; height: 118px; margin: 20px 0 14px; }
.ring svg.dial { display: block; transform: rotate(-90deg); }
.ring .track { stroke: #E9E8E0; }
.ring .prog {
  stroke: var(--success); stroke-linecap: round;
  stroke-dasharray: 339.29; stroke-dashoffset: 339.29;
  animation: ringdraw 1.1s 0.15s var(--ease) forwards;
}
.ring .ringcheck {
  position: absolute; inset: 0; margin: auto; width: 42px; height: 42px;
  color: var(--success); opacity: 0; transform: scale(0.8);
  animation: pop 0.4s 0.85s var(--ease) forwards;
}
@keyframes ringdraw { to { stroke-dashoffset: 14; } }
@keyframes pop { to { opacity: 1; transform: scale(1); } }

/* ---------------------------------------------------------------- active visit */

.checkedrow { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.checkedtime { font-size: 15px; color: var(--text2); }
.bigname { font-size: 25px; font-weight: 700; letter-spacing: -0.4px; margin-top: 12px; }
.svc.lg { font-size: 15px; }
.timerrow { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; }
.timerrow .ic { color: var(--text2); }
.timer {
  font-size: 34px; font-weight: 500; letter-spacing: 0.5px; line-height: 40px;
  font-variant-numeric: tabular-nums;
}

.doc { padding: 14px; }
.doc .micro { margin: 0 2px 10px; }
.docbtn {
  width: 100%; height: 46px; border: none; border-radius: 10px;
  background: #F4F3EE; color: var(--text);
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
}
.docbtn + .docbtn { margin-top: 8px; }
.docbtn:active { filter: brightness(0.97); }
.docbtn .ic.edit { color: var(--primary-dark); }
.docbtn .ic.alert { color: var(--warning); }

.spin { animation: rotate 1s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- completed */

.bigcheck {
  width: 62px; height: 62px; border-radius: 999px; margin: 22px auto 12px;
  background: var(--success-light); color: var(--success);
  display: flex; align-items: center; justify-content: center;
}
.center-title { text-align: center; }
.completed-sub { text-align: center; font-size: 14.5px; color: var(--text2); margin-top: 6px; }

.summary { padding: 0 16px; }
.srow { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--hairline); }
.srow:last-child { border-bottom: none; }
.srow .lbl { font-size: 14px; color: var(--text2); }
.srow .val { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- fallback */

.warnpanel {
  background: var(--warning-light); border-radius: 14px; padding: 16px;
  margin-top: 14px;
}
.warntitle { font-size: 16px; font-weight: 700; color: var(--text); }
.warnbody { font-size: 14px; line-height: 21px; color: var(--warning-text); margin-top: 6px; }
.warnbtns { display: flex; justify-content: flex-end; gap: 14px; margin-top: 6px; }

.scrim {
  position: absolute; inset: 0; background: var(--scrim);
  opacity: 0; pointer-events: none; transition: opacity 0.3s var(--ease); z-index: 2;
}
.scrim.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  background: var(--card); border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow-lg); padding: 8px 16px 16px;
  transform: translateY(105%); transition: transform 0.45s var(--ease);
}
.sheet.open { transform: translateY(0); }
.grabber { width: 36px; height: 4px; border-radius: 2px; background: #D8D6CC; margin: 0 auto 10px; }
.sheettitle { font-size: 19px; font-weight: 700; }
.sheetsub { font-size: 13px; color: var(--text2); margin: 3px 0 10px; }
.sheet textarea {
  width: 100%; height: 84px; resize: none;
  background: #F4F3EE; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: 14px; color: var(--text);
  user-select: text;
}
.sheet textarea:focus { border-color: var(--primary); outline: none; }
.sheet textarea::placeholder { color: rgba(107, 112, 104, 0.75); }
.countrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin: 7px 0 10px; }
.countrow .counthint { font-size: 12px; line-height: 16px; color: var(--text2); flex: 1 1 auto; }
.countrow .count { font-size: 12px; color: var(--text2); font-variant-numeric: tabular-nums; flex: 0 0 auto; }

/* ---------------------------------------------------------------- schedule */

.week { display: flex; align-items: center; margin: 4px 0 14px; }
.days { flex: 1; display: flex; justify-content: space-around; }
.daycol { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 34px; }
.dow { font-size: 10px; font-weight: 600; letter-spacing: 0.4px; color: var(--text2); }
.dnum {
  width: 30px; height: 30px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 500; color: var(--text);
}
.dnum.sel { background: var(--primary); color: #FFFFFF; font-weight: 600; }
.dcount { font-size: 11px; color: var(--text2); height: 13px; line-height: 13px; }

.visitcard { margin-top: 10px; align-items: center; }
.visitcard .pill { align-self: center; }
.pinline { display: flex; align-items: flex-start; gap: 5px; margin-top: 3px; }
.pinline .ic { flex: 0 0 auto; margin-top: 2px; }
.rowcard .svc.pinline { white-space: normal; }
.checkav {
  width: 40px; height: 40px; border-radius: 999px; flex: 0 0 auto;
  background: var(--success-light); color: var(--success);
  display: flex; align-items: center; justify-content: center;
}

/* ---------------------------------------------------------------- profile */

.idcard { display: flex; align-items: center; gap: 13px; padding: 12px 14px; }
.idcard .pill { margin-top: 6px; }

.stats { display: flex; align-items: stretch; padding: 10px 0; margin-top: 10px; }
.stat { flex: 1; text-align: center; }
.statnum { font-size: 17px; font-weight: 600; }
.statlbl { font-size: 12px; color: var(--text2); margin-top: 2px; }
.statdiv { width: 1px; background: var(--border); margin: 2px 0; }

.listcard { padding: 2px 0; }
.lrow {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 14px; background: none; border: none; text-align: left;
}
.lrow + .lrow { border-top: 1px solid var(--hairline); }
.lrow .ic { color: var(--primary-dark); flex: 0 0 auto; }
.lrow .chev { color: var(--text2); flex: 0 0 auto; }
button.lrow:active { background: var(--muted); }

.segment {
  display: flex; gap: 3px; background: var(--track);
  border-radius: 12px; padding: 3px;
}
.seg {
  flex: 1; height: 36px; border: none; border-radius: 9px; background: none;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text2);
}
.seg.active { background: #FFFFFF; color: var(--text); box-shadow: var(--shadow-sm); }

.toggle {
  width: 46px; height: 28px; border: none; border-radius: 999px;
  background: #DDDCD2; position: relative; flex: 0 0 auto;
  transition: background 0.2s var(--ease);
}
.toggle .knob {
  position: absolute; top: 2px; left: 2px; width: 24px; height: 24px;
  border-radius: 999px; background: #FFFFFF; box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease);
}
.toggle.on { background: var(--primary); }
.toggle.on .knob { transform: translateX(18px); }

/* ---------------------------------------------------------------- tab bar */

#tabbar {
  height: 62px; flex: 0 0 auto;
  background: #FFFFFF; border-top: 1px solid var(--border);
  display: flex;
}
#tabbar.hidden { display: none; }
.tab {
  flex: 1; border: none; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 500; color: var(--text2);
}
.tab.active { color: var(--primary-dark); }
.tab.active .ic { color: var(--primary-dark); }

/* ---------------------------------------------------------------- icons */

.ic { width: 18px; height: 18px; }
.ic.sm { width: 14px; height: 14px; }
.ic.lg { width: 22px; height: 22px; }
.ic.xl { width: 26px; height: 26px; }
