/* Kids on the Move — shared design system.
   Tokens read off the design boards in ui-design-ideas/. */

:root {
  /* --- BlueAura AI, the company behind Kids on the Move ------------------
     Taken from the live site's own theme (website/app/globals.css) rather
     than sampled by eye. Note the house rule that travels with them: coral
     is a focal accent only, roughly 5% of any composition. */
  --ba-midnight: #071426;
  --ba-summit-blue: #1677ff;
  --ba-glacier-cyan: #6de7f2;
  --ba-sunrise-coral: #ff7a59;
  --ba-ridge-blue: #0b2e59;

  --ba-font-head: "Manrope", "Avenir Next", system-ui, sans-serif;
  --ba-font-body: "Inter", system-ui, -apple-system, sans-serif;
  --ba-font-display: "Instrument Serif", Georgia, serif;

  /* --- Kids on the Move, the product ------------------------------------
     A warm consumer identity for parents, kept distinct from BlueAura's
     darker corporate palette. */
  --brand-coral: #ff735f;
  --brand-blue: #1676d2;
  --brand-green: #2ca65a;
  --brand-sun: #f6b817;
  --brand-ink: #17212c;

  --coral: var(--brand-coral);
  --coral-dark: #e85c47;
  --coral-tint: #ffebe6;
  --coral-tint-2: #fff7f4;

  --blue: var(--brand-blue);
  --blue-dark: #115aa3;
  --blue-tint: #eaf3fc;

  --green: var(--brand-green);
  --green-tint: #eaf6ef;
  --amber: #d9920b;
  --amber-tint: #fff5df;
  --red: #d9433d;
  --red-tint: #fcebea;

  --ink: #19212b;
  --ink-2: #3e4a59;
  --ink-3: #687586;
  --ink-4: #919cab;

  --paper: #ffffff;
  --canvas: #f7f8fa;
  --line: #e3e7ec;
  --line-soft: #eef1f4;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 8px;
  --r-xl: 8px;

  --shadow-card: 0 1px 2px rgba(25, 33, 43, 0.04), 0 5px 16px rgba(25, 33, 43, 0.045);
  --shadow-lift: 0 14px 40px rgba(25, 33, 43, 0.14);

  --font: "Avenir Next", Avenir, ui-rounded, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: 0;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
button:disabled { cursor: not-allowed; }
input, textarea { font-family: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(25, 118, 210, 0.28);
  outline-offset: 2px;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  display: inline-block;
  vertical-align: -0.18em;
  flex: none;
  stroke-width: 1.9;
  shape-rendering: geometricPrecision;
}

/* ------------------------------------------------------------------ phone */

.phone-stage {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  background: #eef1f4;
}

.phone {
  width: 420px;
  max-width: 100%;
  background: #111820;
  border-radius: 38px;
  padding: 9px;
  box-shadow: 0 28px 70px rgba(16, 24, 32, 0.24);
}

.phone-screen {
  background: var(--paper);
  border-radius: 30px;
  overflow: hidden;
  height: min(884px, calc(100vh - 48px));
  min-height: 640px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 26px 6px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  flex: none;
}
.status-bar .notch {
  width: 108px;
  height: 26px;
  background: #10131a;
  border-radius: 20px;
}
.status-icons { display: flex; gap: 6px; align-items: center; font-size: 13px; }

.app-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 16px 22px;
  scrollbar-width: thin;
}
.app-scroll::-webkit-scrollbar { width: 6px; }
.app-scroll::-webkit-scrollbar-thumb { background: #e3ded8; border-radius: 3px; }

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 14px;
}
.app-header .wordmark { flex: 1; }
.app-header h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 750;
  letter-spacing: 0;
}
.app-header p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-3); }

.logo-badge {
  width: 46px; height: 46px;
  flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--coral-tint);
  font-size: 24px;
}

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 18px;
  position: relative;
  flex: none;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--line-soft); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 7px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--coral);
  border: 2px solid var(--paper);
}

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

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
  overflow: hidden;
}
.card-pad { padding: 16px 18px; }
.card-split { border-top: 1px solid var(--line-soft); }

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--coral-tint);
  border-radius: var(--r-lg);
  padding: 15px 16px;
  margin-bottom: 14px;
}
.banner h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 750;
  color: var(--coral-dark);
  letter-spacing: 0;
}
.banner p { margin: 3px 0 0; font-size: 13.5px; color: #8a5544; }
.banner .shield {
  margin-left: auto;
  width: 44px; height: 44px;
  border-radius: 13px;
  background: var(--coral);
  color: #fff;
  display: grid; place-items: center;
  font-size: 21px;
  flex: none;
}

.avatar {
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  flex: none;
  letter-spacing: 0;
}
.avatar.lg { width: 74px; height: 74px; font-size: 24px; }
.avatar.md { width: 56px; height: 56px; font-size: 18px; }
.avatar.sm { width: 40px; height: 40px; font-size: 14px; }
.avatar.xs { width: 30px; height: 30px; font-size: 11px; }
.avatar.ring { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--blue-tint); }

.row { display: flex; align-items: center; gap: 14px; }
.row-top { display: flex; align-items: flex-start; gap: 14px; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; }

.title-lg { font-size: 22px; font-weight: 750; letter-spacing: 0; margin: 0; }
.title-md { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: 0; }
.sub { font-size: 14px; color: var(--ink-3); margin: 3px 0 0; }
.meta { font-size: 13px; color: var(--ink-4); margin: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 620;
  white-space: nowrap;
}
.pill.green { background: var(--green-tint); color: var(--green); }
.pill.blue { background: var(--blue-tint); color: var(--blue); }
.pill.coral { background: var(--coral-tint); color: var(--coral-dark); }
.pill.amber { background: var(--amber-tint); color: #9a6b04; }
.pill.red { background: var(--red-tint); color: var(--red); }
.pill.grey { background: #f2f0ee; color: var(--ink-3); }

.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

.verified-tick {
  color: var(--green);
  font-size: 15px;
}

.shield-tile {
  width: 56px; height: 56px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  font-size: 25px;
  flex: none;
}
.shield-tile.green { background: var(--green-tint); }
.shield-tile.blue { background: var(--blue-tint); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 15.5px;
  padding: 15px 18px;
  transition: transform 0.08s, filter 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover:not(:disabled) { background: var(--blue-dark); }
.btn-red { background: var(--coral); color: #fff; }
.btn-red:hover:not(:disabled) { background: var(--coral-dark); }
.btn-green { background: var(--green); color: #fff; }
.btn-outline-blue {
  background: var(--paper);
  color: var(--blue);
  border: 1.5px solid var(--blue);
}
.btn-outline-blue:hover:not(:disabled) { background: var(--blue-tint); }
.btn-outline-green {
  background: var(--paper);
  color: var(--green);
  border: 1.5px solid var(--green);
}
.btn-outline-green:hover:not(:disabled) { background: var(--green-tint); }
.btn-ghost {
  background: var(--paper);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.btn-ghost:hover:not(:disabled) { background: var(--line-soft); }
.btn-sm { padding: 9px 14px; font-size: 13.5px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }

.action-bar {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 11px;
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
  background: var(--paper);
  flex: none;
}

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

.tab-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 9px 6px 16px;
  border-top: 1px solid var(--line-soft);
  background: var(--paper);
  flex: none;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-4);
  padding: 4px 0;
  min-width: 0;
}
.tab .glyph { font-size: 19px; line-height: 1; height: 22px; display: grid; place-items: center; }
.tab.active { color: var(--coral); }

/* ---------------------------------------------------------------- map */

.map-frame {
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #eef2ea;
  position: relative;
}
.map-frame svg { display: block; width: 100%; height: auto; }
.map-note {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  background: var(--paper);
  border-top: 1px solid var(--line-soft);
}

/* ------------------------------------------------------------- timeline */

.timeline { padding: 4px 4px 4px 2px; }
.tl-item {
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  gap: 0 12px;
  align-items: start;
  position: relative;
  padding-bottom: 18px;
}
.tl-item:last-child { padding-bottom: 2px; }
.tl-item::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 38px;
  bottom: 2px;
  width: 2px;
  background: var(--line);
}
.tl-item:last-child::before { display: none; }
.tl-item.pending::before { background: transparent; border-left: 2px dashed #cdd5e0; }

.tl-dot {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 17px;
  z-index: 1;
  flex: none;
}
.tl-dot .icon { width: 18px; height: 18px; }
.tl-item.done .tl-dot { background: var(--green); color: #fff; }
.tl-item.current .tl-dot { background: var(--blue); color: #fff; box-shadow: 0 0 0 5px var(--blue-tint); }
.tl-item.pending .tl-dot { background: #eef2f8; color: #98a4b6; }

.tl-label { font-size: 16px; font-weight: 640; margin: 8px 0 0; }
.tl-item.current .tl-label { color: var(--blue); }
.tl-item.pending .tl-label { color: #8d97a6; }
.tl-note { font-size: 13.5px; color: var(--ink-3); margin: 3px 0 0; }
.tl-time {
  font-size: 14.5px;
  color: var(--ink-3);
  margin: 10px 0 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tl-check { font-size: 19px; color: var(--green); margin: 8px 0 0; line-height: 1; }

/* --------------------------------------------------------------- toast */

.toast-host {
  position: absolute;
  left: 14px; right: 14px; bottom: 96px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 40;
}
.toast {
  background: #171a20;
  color: #fff;
  border-radius: var(--r-md);
  padding: 12px 15px;
  font-size: 13.5px;
  font-weight: 550;
  box-shadow: var(--shadow-lift);
  animation: toast-in 0.22s ease-out;
}
.toast.good { background: #14663c; }
.toast.bad { background: #b32820; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------- sheet */

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 19, 26, 0.42);
  display: flex;
  align-items: flex-end;
  z-index: 60;
  animation: fade-in 0.15s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: var(--paper);
  width: 100%;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 8px 18px 22px;
  max-height: 86%;
  overflow-y: auto;
  animation: sheet-up 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-grip {
  width: 42px; height: 4px;
  border-radius: 2px;
  background: #ddd8d2;
  margin: 6px auto 14px;
}
.field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 13px;
  font-size: 14.5px;
  resize: vertical;
  color: var(--ink);
}
.field:focus { outline: 2px solid var(--blue-tint); border-color: var(--blue); }

/* --------------------------------------------------------- alert states */

.alert-strip {
  border-radius: var(--r-md);
  padding: 13px 15px;
  margin-bottom: 12px;
  display: flex;
  gap: 11px;
  align-items: flex-start;
}
.alert-strip.critical { background: var(--red-tint); border: 1px solid #f6c7c4; }
.alert-strip.info { background: var(--blue-tint); border: 1px solid #cfe0fb; }
.alert-strip.good { background: var(--green-tint); border: 1px solid #c6e6d3; }
.alert-strip strong { display: block; font-size: 14.5px; }
.alert-strip span { font-size: 13px; color: var(--ink-2); }

@keyframes flash-red {
  0%, 100% { background: var(--red-tint); }
  50% { background: #fbd5d2; }
}
.flashing { animation: flash-red 1.1s ease-in-out infinite; }

.connection-chip {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  font-size: 12px;
  font-weight: 620;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  box-shadow: var(--shadow-lift);
}

@media (min-width: 900px) {
  .phone-stage {
    min-height: 100vh;
    display: block;
    padding: 0;
    background: var(--paper);
  }

  .phone {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    padding: 0;
    border-radius: 0;
    background: var(--paper);
    box-shadow: none;
  }

  .phone-screen {
    width: 100%;
    height: 100vh;
    min-height: 720px;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    border-radius: 0;
  }

  .phone-screen > .status-bar { display: none; }

  .phone-screen > .app-scroll {
    grid-column: 2;
    grid-row: 1 / -1;
    padding: 22px clamp(24px, 3vw, 48px) 30px;
  }

  .phone-screen > .tab-bar {
    grid-column: 1;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 118px 14px 24px;
    border-top: 0;
    border-right: 1px solid var(--line);
    background: #fff;
  }

  .phone-screen > .tab-bar::before {
    content: "WORKSPACE";
    position: absolute;
    top: 84px;
    left: 28px;
    color: var(--ink-4);
    font-size: 10px;
    font-weight: 700;
  }

  .phone-screen > .tab-bar .tab {
    min-height: 46px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 14px;
    border-radius: 7px;
    font-size: 14px;
  }

  .phone-screen > .tab-bar .tab:hover { background: var(--line-soft); }

  .phone-screen > .tab-bar .tab.active {
    background: var(--coral-tint);
    color: var(--coral-dark);
  }

  .phone-screen > .tab-bar .tab .glyph {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 520px) {
  .phone-stage {
    min-height: 100svh;
    padding: 0;
    background: var(--paper);
  }
  .phone {
    width: 100%;
    padding: 0;
    border-radius: 0;
    background: var(--paper);
    box-shadow: none;
  }
  .phone-screen {
    height: 100svh;
    min-height: 560px;
    border-radius: 0;
  }
  .status-bar .notch { background: var(--ink); }
  .app-scroll { padding-inline: 14px; }
  .action-bar { padding: 10px 14px; }
  .tab-bar { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .approved-seal { transform: scale(.88); transform-origin: right center; }
}

@media (max-width: 370px) {
  .app-header p { display: none; }
  .btn { padding-inline: 12px; font-size: 14px; }
  .tl-item { grid-template-columns: 36px 1fr auto; gap: 0 9px; }
  .tl-check { display: none; }
  .tl-dot { width: 34px; height: 34px; }
  .tl-item::before { left: 17px; top: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
