:root {
  --bg: #f2f2f7;
  --card: #fff;
  --cell: #fff;
  --sheet: #f2f2f7;
  --ink: #000;
  --ink2: rgba(60, 60, 67, 0.85);
  --mut: rgba(60, 60, 67, 0.6);
  --mut2: rgba(60, 60, 67, 0.3);
  --sep: rgba(60, 60, 67, 0.14);
  --fill: rgba(118, 118, 128, 0.12);
  --fill2: rgba(118, 118, 128, 0.08);
  --blue: #007aff;
  --red: #ff3b30;
  --orange: #ff9500;
  --green: #34c759;
  --teal: #30b0c7;
  --navbg: rgba(242, 242, 247, 0.75);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.05);
  --shadow2: 0 2px 6px rgba(0, 0, 0, 0.06), 0 18px 40px rgba(0, 0, 0, 0.1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000;
    --card: #1c1c1e;
    --cell: #2c2c2e;
    --sheet: #1c1c1e;
    --ink: #fff;
    --ink2: rgba(235, 235, 245, 0.85);
    --mut: rgba(235, 235, 245, 0.6);
    --mut2: rgba(235, 235, 245, 0.3);
    --sep: rgba(84, 84, 88, 0.55);
    --fill: rgba(118, 118, 128, 0.24);
    --fill2: rgba(118, 118, 128, 0.16);
    --blue: #0a84ff;
    --red: #ff453a;
    --orange: #ff9f0a;
    --green: #30d158;
    --teal: #40c8e0;
    --navbg: rgba(22, 22, 24, 0.72);
    --shadow: none;
    --shadow2: 0 20px 50px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000;
  --card: #1c1c1e;
  --cell: #2c2c2e;
  --sheet: #1c1c1e;
  --ink: #fff;
  --ink2: rgba(235, 235, 245, 0.85);
  --mut: rgba(235, 235, 245, 0.6);
  --mut2: rgba(235, 235, 245, 0.3);
  --sep: rgba(84, 84, 88, 0.55);
  --fill: rgba(118, 118, 128, 0.24);
  --fill2: rgba(118, 118, 128, 0.16);
  --blue: #0a84ff;
  --red: #ff453a;
  --orange: #ff9f0a;
  --green: #30d158;
  --teal: #40c8e0;
  --navbg: rgba(22, 22, 24, 0.72);
  --shadow: none;
  --shadow2: 0 20px 50px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

html,
body,
* {
  touch-action: manipulation;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@supports (overflow: clip) {
  html {
    overflow-x: clip;
  }
}
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body.lock {
  overflow: hidden;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}
input,
select,
textarea {
  font: inherit;
  color: var(--ink);
}
svg.i {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------- Navigation bar ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top, 0px);
  transition:
    background 0.25s,
    border-color 0.25s,
    backdrop-filter 0.25s;
  border-bottom: 0.5px solid transparent;
}
.nav.solid {
  background: var(--navbg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom-color: var(--sep);
}
.nav-in {
  max-width: none;
  margin: 0;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 max(16px, env(safe-area-inset-left, 0px));
}
.nav-title {
  flex: 1;
  font-weight: 600;
  font-size: 17px;
  opacity: 0;
  transform: translateY(4px);
  transition: 0.25s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav.solid .nav-title {
  opacity: 1;
  transform: none;
}
.nb {
  height: 36px;
  min-width: 36px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--blue);
  font-size: 17px;
  padding: 0 8px;
  transition:
    background 0.15s,
    opacity 0.15s;
}
.nb:hover {
  background: var(--fill2);
}
.nb:active {
  opacity: 0.5;
}
.nb svg {
  font-size: 21px;
}
.nb.prim {
  background: var(--blue);
  color: #fff;
  padding: 0 14px 0 10px;
  font-weight: 600;
  font-size: 15px;
}
.nb.prim:hover {
  background: var(--blue);
  filter: brightness(1.08);
}
.nb.prim svg {
  font-size: 18px;
}
.spin svg {
  animation: sp 0.8s linear infinite;
}
@keyframes sp {
  to {
    transform: rotate(360deg);
  }
}
.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--mut);
  padding: 0 8px;
  font-weight: 500;
}
.live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mut2);
  display: block;
}
.live.on i {
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent);
}
@media (max-width: 640px) {
  .nb.prim span,
  .live b {
    display: none;
  }
  .nb.prim {
    padding: 0;
    width: 36px;
  }
}

/* ---------- Layout ---------- */
.wrap {
  max-width: none;
  margin: 0;
  min-height: calc(100vh - 52px);
  padding: 4px max(16px, env(safe-area-inset-left, 0px)) calc(48px + env(safe-area-inset-bottom, 0px));
}
.hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 22px;
}
.badge {
  width: 76px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(160deg, #1c2a3d, #05101d);
  display: grid;
  place-items: center;
  flex: none;
  box-shadow:
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.12),
    0 4px 14px rgba(5, 16, 29, 0.25);
}
.badge img {
  width: 62px;
  height: auto;
  display: block;
}
.hero h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.hero p {
  margin: 3px 0 0;
  color: var(--mut);
  font-size: 15px;
}
@media (max-width: 640px) {
  .sort select {
    width: 118px;
    font-size: 14px;
  }
  .hero p {
    font-size: 14px;
  }
  .hero h1 {
    font-size: 30px;
  }
  .badge {
    width: 64px;
    height: 44px;
    border-radius: 12px;
  }
  .badge img {
    width: 52px;
  }
}

.note {
  display: none;
  align-items: center;
  gap: 10px;
  background: color-mix(in srgb, var(--orange) 14%, var(--card));
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 15px;
  margin-bottom: 16px;
}
.note.on {
  display: flex;
}
.note svg {
  color: var(--orange);
  font-size: 20px;
}
.note button {
  margin-left: auto;
  color: var(--blue);
  font-weight: 600;
  font-size: 15px;
}

/* ---------- Stat widgets ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.stat {
  background: var(--card);
  border-radius: 20px;
  padding: 14px 16px 16px;
  box-shadow: var(--shadow);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s;
}
button.stat:active {
  transform: scale(0.97);
}
.stat .ic {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 16px;
}
.stat b {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat span {
  font-size: 14px;
  color: var(--mut);
  font-weight: 500;
}
.stat .top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.stat.sel {
  box-shadow:
    inset 0 0 0 2px var(--blue),
    var(--shadow);
}
@media (max-width: 760px) {
  .stats {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat b {
    font-size: 26px;
  }
}

/* ---------- Toolbar ---------- */
.tools {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.search {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}
.search svg {
  position: absolute;
  left: 10px;
  color: var(--mut);
  font-size: 17px;
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: var(--fill);
  padding: 0 34px 0 34px;
  font-size: 17px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.search input::placeholder {
  color: var(--mut);
}
.search input::-webkit-search-cancel-button {
  display: none;
}
.search .clr {
  position: absolute;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--mut2);
  color: var(--card);
  display: none;
  place-items: center;
  font-size: 12px;
}
.search .clr.on {
  display: grid;
}
.sort {
  position: relative;
  display: flex;
  align-items: center;
}
.sort select {
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: var(--fill);
  padding: 0 32px 0 12px;
  font-size: 15px;
  font-weight: 500;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  cursor: pointer;
}
.sort svg {
  position: absolute;
  right: 10px;
  pointer-events: none;
  color: var(--mut);
  font-size: 14px;
}

.seg {
  display: flex;
  background: var(--fill);
  border-radius: 10px;
  padding: 2px;
  margin-bottom: 18px;
  position: relative;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar {
  display: none;
}
.seg button {
  flex: 1 0 auto;
  min-width: max-content;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  z-index: 1;
  transition: color 0.2s;
}
.seg button em {
  font-style: normal;
  font-size: 12px;
  color: var(--mut);
  font-variant-numeric: tabular-nums;
}
.seg button.on {
  font-weight: 600;
}
.seg .thumb {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: 0;
  opacity: 0;
  border-radius: 8px;
  background: var(--card);
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.12),
    0 3px 1px rgba(0, 0, 0, 0.04);
  transition:
    left 0.28s cubic-bezier(0.3, 0.7, 0.2, 1),
    width 0.28s cubic-bezier(0.3, 0.7, 0.2, 1);
}
:root[data-theme="dark"] .seg .thumb {
  background: #636366;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .seg .thumb {
    background: #636366;
  }
}

/* ---------- Customer cards ---------- */
.list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 12px;
}
@media (min-width: 900px) {
  .nav-in,
  .wrap {
    padding-left: 32px;
    padding-right: 32px;
  }
  .list {
    gap: 16px;
  }
  .stats {
    gap: 16px;
  }
}
@media (min-width: 1600px) {
  .nav-in,
  .wrap {
    padding-left: 48px;
    padding-right: 48px;
  }
  .list {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  }
}
.theme-sw {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 6px 0 10px;
  border-radius: 18px;
  color: var(--ink2);
  font-size: 14px;
  font-weight: 500;
}
.theme-sw:hover {
  background: var(--fill2);
}
.theme-sw svg {
  font-size: 18px;
  color: var(--mut);
}
.tg {
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--fill);
  position: relative;
  transition: background 0.25s;
  flex: none;
}
.tg::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.theme-sw[aria-checked="true"] .tg {
  background: var(--green);
}
.theme-sw[aria-checked="true"] .tg::after {
  transform: translateX(18px);
}
@media (max-width: 640px) {
  .theme-sw b {
    display: none;
  }
  .theme-sw {
    padding: 0 4px;
  }
  .fsb {
    display: none;
  }
}
.card {
  background: var(--card);
  border-radius: 18px;
  padding: 14px 12px 14px 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  width: 100%;
  transition:
    transform 0.18s cubic-bezier(0.3, 0.7, 0.2, 1),
    box-shadow 0.18s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow2);
}
.card:active {
  transform: scale(0.98);
}
.card:focus-visible,
.stat:focus-visible,
.nb:focus-visible,
.seg button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 50%, transparent);
  outline-offset: 2px;
}
.ring {
  position: relative;
  width: 52px;
  height: 52px;
  flex: none;
}
.ring svg {
  width: 52px;
  height: 52px;
  transform: rotate(-90deg);
}
.ring circle {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
}
.ring .tr {
  stroke: var(--fill);
}
.ring .pr {
  transition: stroke-dashoffset 0.6s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.ring b {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.ring b small {
  font-size: 9px;
  color: var(--mut);
  font-weight: 600;
}
.cb {
  flex: 1;
  min-width: 0;
}
.cb h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cb p {
  margin: 1px 0 7px;
  color: var(--mut);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pill {
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--fill);
  color: var(--ink2);
  white-space: nowrap;
}
.pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill.overdue {
  background: color-mix(in srgb, var(--red) 14%, transparent);
  color: var(--red);
}
.pill.soon {
  background: color-mix(in srgb, var(--orange) 16%, transparent);
  color: color-mix(in srgb, var(--orange) 80%, var(--ink));
}
.pill.upcoming {
  background: color-mix(in srgb, var(--blue) 12%, transparent);
  color: var(--blue);
}
.pill.done {
  background: color-mix(in srgb, var(--green) 16%, transparent);
  color: color-mix(in srgb, var(--green) 75%, var(--ink));
}
.rel {
  font-size: 13px;
  color: var(--mut);
}
.chev {
  color: var(--mut2);
  font-size: 16px;
}
.empty {
  grid-column: 1/-1;
  text-align: center;
  color: var(--mut);
  padding: 70px 16px;
}
.empty .ei {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--fill);
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  font-size: 28px;
  color: var(--mut);
}
.empty h4 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
}
.empty p {
  margin: 0 0 16px;
  font-size: 15px;
}
.sk {
  background: var(--card);
  border-radius: 18px;
  height: 82px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.sk::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--fill2), transparent);
  animation: sh 1.2s infinite;
  transform: translateX(-100%);
}
@keyframes sh {
  to {
    transform: translateX(100%);
  }
}
.foot {
  color: var(--mut);
  font-size: 13px;
  text-align: center;
  margin-top: 22px;
}

/* ---------- Sheets ---------- */
.ov {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s,
    visibility 0s 0.3s;
}
.ov.on {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s;
}
.sheet {
  background: var(--sheet);
  width: 100%;
  max-width: 600px;
  max-height: calc(100% - 28px - env(safe-area-inset-top, 0px));
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 14px 14px 0 0;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: var(--shadow2);
}
.ov.on .sheet {
  transform: none;
}
@media (min-width: 720px) {
  .ov {
    align-items: center;
  }
  .sheet {
    border-radius: 18px;
    max-height: 88vh;
    transform: translateY(24px) scale(0.98);
  }
  .ov.on .sheet {
    transform: none;
  }
}
.grab {
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: var(--mut2);
  margin: 6px auto 0;
}
@media (min-width: 720px) {
  .grab {
    display: none;
  }
}
.sh-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 8px;
  background: var(--sheet);
}
.sh-bar h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}
.sh-bar .nb {
  font-weight: 400;
}
.sh-bar .nb.b {
  font-weight: 600;
}
.sh-c {
  padding: 4px 16px calc(28px + env(safe-area-inset-bottom, 0px));
}

.grp {
  background: var(--cell);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 22px;
}
.gh {
  font-size: 13px;
  color: var(--mut);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0 16px 7px;
  display: flex;
  justify-content: space-between;
}
.gf {
  font-size: 13px;
  color: var(--mut);
  margin: -15px 16px 22px;
}
.r {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 8px 16px;
  position: relative;
}
.r + .r::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  height: 0.5px;
  background: var(--sep);
}
.r .k {
  color: var(--ink);
  flex: none;
  min-width: 110px;
  font-size: 16px;
}
.r .val {
  flex: 1;
  text-align: right;
  color: var(--mut);
  font-size: 16px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.r input,
.r textarea {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  text-align: right;
  font-size: 16px;
  min-width: 0;
  padding: 4px 0;
  color: var(--ink);
}
.r textarea {
  text-align: left;
  resize: vertical;
  min-height: 64px;
}
.r.col {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.r.col .k {
  min-width: 0;
}
.r input::placeholder,
.r textarea::placeholder {
  color: var(--mut2);
}
.r input[type="date"] {
  text-align: right;
  -webkit-appearance: none;
  appearance: none;
  min-height: 30px;
}
.r input[type="date"]::-webkit-date-and-time-value {
  text-align: right;
}
.r.err .k {
  color: var(--red);
}
.r.tap {
  width: 100%;
  text-align: left;
  justify-content: center;
  color: var(--blue);
  font-size: 16px;
}
.r.tap.red {
  color: var(--red);
}
.r.tap:active {
  background: var(--fill2);
}

.prof {
  text-align: center;
  padding: 6px 0 18px;
}
.av {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, #a5adb8, #858c97);
}
.prof h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.prof p {
  margin: 3px 0 0;
  color: var(--mut);
  font-size: 15px;
}
.acts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}
.act {
  text-decoration: none;
  background: var(--cell);
  border-radius: 12px;
  padding: 10px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 500;
  transition: opacity 0.15s;
}
.act svg {
  font-size: 20px;
}
.act:active {
  opacity: 0.5;
}
.act[aria-disabled="true"] {
  color: var(--mut2);
  pointer-events: none;
}

.prog {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}
.prog .bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--fill);
  overflow: hidden;
}
.prog .bar div {
  height: 100%;
  border-radius: 4px;
  background: var(--green);
  transition: width 0.5s;
}
.prog b {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.v {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  min-height: 60px;
  position: relative;
}
.v + .v::before {
  content: "";
  position: absolute;
  top: 0;
  left: 58px;
  right: 0;
  height: 0.5px;
  background: var(--sep);
}
.v .n {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  flex: none;
  background: var(--fill);
  color: var(--ink2);
}
.v.done .n {
  background: var(--green);
  color: #fff;
}
.v.overdue .n {
  background: var(--red);
  color: #fff;
}
.v.soon .n {
  background: var(--orange);
  color: #fff;
}
.v .t {
  flex: 1;
  min-width: 0;
}
.v .t div {
  font-size: 16px;
}
.v .t small {
  display: block;
  font-size: 13px;
  color: var(--mut);
}
.v.overdue .t small {
  color: var(--red);
}
.v .dd {
  width: auto;
  border: 0;
  background: transparent;
  color: var(--mut);
  font-size: 13px;
  padding: 0;
  outline: none;
  font-family: inherit;
}
.v .dd::-webkit-calendar-picker-indicator {
  display: none;
}
.mk {
  height: 30px;
  padding: 0 14px;
  border-radius: 15px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition:
    filter 0.15s,
    transform 0.1s;
}
.mk:active {
  transform: scale(0.95);
}
.mk.u {
  background: var(--fill);
  color: var(--blue);
}
.mk[disabled] {
  opacity: 0.5;
}

/* ---------- Alert & toast ---------- */
.al {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s,
    visibility 0s 0.2s;
  padding: 20px;
}
.al.on {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s;
}
.al-b {
  width: 270px;
  max-width: 100%;
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  text-align: center;
  overflow: hidden;
  transform: scale(1.12);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.al.on .al-b {
  transform: none;
}
.al-b h4 {
  margin: 20px 16px 2px;
  font-size: 17px;
  font-weight: 600;
}
.al-b p {
  margin: 0 16px 18px;
  font-size: 13px;
  color: var(--ink2);
}
.al-a {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 0.5px solid var(--sep);
}
.al-a button {
  height: 44px;
  color: var(--blue);
  font-size: 17px;
}
.al-a button + button {
  border-left: 0.5px solid var(--sep);
}
.al-a .d {
  color: var(--red);
  font-weight: 600;
}
.al-a .p {
  font-weight: 600;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  transform: translate(-50%, 30px);
  opacity: 0;
  transition: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  background: color-mix(in srgb, var(--card) 85%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow2);
  border: 0.5px solid var(--sep);
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  pointer-events: none;
}
.toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast svg {
  font-size: 18px;
}
.toast.ok svg {
  color: var(--green);
}
.toast.bad svg {
  color: var(--red);
}
@keyframes shake {
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}
.shake {
  animation: shake 0.35s;
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- Staff app additions ---------- */
.scr {
  display: none;
}
body[data-screen="auth"] #authScr,
body[data-screen="pending"] #pendScr,
body[data-screen="boot"] #bootScr {
  display: flex;
}
body[data-screen="app"] #appScr {
  display: block;
}
.center {
  min-height: 100vh;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px));
}
.auth {
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.auth .badge {
  margin: 0 auto 18px;
  width: 88px;
  height: 62px;
  border-radius: 18px;
}
.auth .badge img {
  width: 74px;
}
.auth h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.auth > p {
  margin: 4px 0 24px;
  color: var(--mut);
  font-size: 15px;
}
.auth .seg {
  margin-bottom: 20px;
}
.auth .grp {
  text-align: left;
  margin-bottom: 16px;
}
.auth .r .k {
  min-width: 96px;
}
.auth .r input {
  text-align: left;
}
.big {
  width: 100%;
  height: 50px;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    filter 0.15s,
    transform 0.1s;
}
.big:active {
  transform: scale(0.98);
}
.big[disabled] {
  opacity: 0.5;
}
.big.sec {
  background: var(--fill);
  color: var(--blue);
}
.authmsg {
  min-height: 20px;
  font-size: 14px;
  margin: 12px 0 0;
  color: var(--red);
}
.authmsg.ok {
  color: var(--green);
}
.small {
  font-size: 13px;
  color: var(--mut);
  margin-top: 18px;
  line-height: 1.45;
}
.bigic {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  font-size: 36px;
  color: #fff;
  background: var(--orange);
}
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--fill);
  border-top-color: var(--blue);
  animation: sp 0.8s linear infinite;
  margin: 0 auto;
}

/* view tabs (desktop) */
.vtabs {
  display: flex;
  gap: 4px;
  background: var(--fill);
  border-radius: 10px;
  padding: 2px;
  margin: 0 8px;
}
.vtabs button {
  height: 30px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
}
.vtabs button.on {
  background: var(--card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}
:root[data-theme="dark"] .vtabs button.on {
  background: #636366;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .vtabs button.on {
    background: #636366;
  }
}
.dotn {
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  font-style: normal;
}
.me-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-left: 4px;
  flex: none;
}
.adm-only,
.stf-only {
  display: none !important;
}
body.admin .adm-only:not(.jobs-only) {
  display: revert !important;
}
body.admin .sort.adm-only,
body.admin .tools.adm-only {
  display: flex !important;
}
body.staff .stf-only {
  display: revert !important;
}
.jobs-only {
  display: none !important;
}
body.admin.v-jobs .nb.adm-only.jobs-only {
  display: inline-flex !important;
}
.view {
  display: none;
}
body.v-jobs #vJobs,
body.v-staff #vStaff,
body.v-activity #vActivity,
body.v-att #vAtt,
body.v-tasks #vTasks,
body.v-guide #vGuide,
body.v-leads #vLeads {
  display: block;
}

/* tab bar (phone) */
.tabbar {
  display: none;
}
@media (max-width: 1040px) {
  .vtabs {
    display: none;
  }
  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    background: var(--navbg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--sep);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .tabbar button {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--mut);
    position: relative;
    white-space: nowrap;
    overflow: visible;
    line-height: 1.2;
  }
  .tabbar button svg {
    font-size: 24px;
  }
  .tabbar button.on {
    color: var(--blue);
  }
  .tabbar .dotn {
    position: absolute;
    top: -2px;
    left: calc(50% + 6px);
  }
  .wrap {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }
  .theme-sw.nav-theme {
    display: none !important;
  }
  .toast {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
}
.nav-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.nav-in > *:not(.nav-title) {
  flex: none;
}
.vtabs button {
  white-space: nowrap;
}
@media (max-width: 1180px) {
  .theme-sw.nav-theme b,
  .live b {
    display: none;
  }
  .nb.prim span {
    display: none;
  }
  .nb.prim {
    padding: 0;
    width: 36px;
  }
}
@media (max-width: 640px) {
  .tools {
    flex-wrap: wrap;
  }
  .tools .search {
    flex: 1 1 100%;
  }
  .tools .sort {
    flex: 1 1 0;
    min-width: 0;
  }
  .tools .sort select {
    width: 100%;
  }
}

/* customer card extras */
.who {
  font-size: 12.5px;
  color: var(--mut);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.who.none {
  color: var(--orange);
  font-weight: 600;
}
.who svg {
  font-size: 13px;
}

/* staff list */
.slist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 12px;
}
.scard {
  background: var(--card);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  width: 100%;
  transition:
    transform 0.18s,
    box-shadow 0.18s;
}
.scard:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow2);
}
.sav {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 18px;
  flex: none;
}
.scard h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.scard p {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--mut);
}
.tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tag.adm {
  background: color-mix(in srgb, var(--blue) 14%, transparent);
  color: var(--blue);
}
.tag.pend {
  background: color-mix(in srgb, var(--orange) 16%, transparent);
  color: color-mix(in srgb, var(--orange) 80%, var(--ink));
}
.tag.off {
  background: var(--fill);
  color: var(--mut);
}
.mini {
  display: flex;
  gap: 6px 12px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 13px;
  color: var(--mut);
}
.mini span {
  white-space: nowrap;
}
.mini b {
  color: var(--ink);
  font-weight: 600;
}
.mini .bad b {
  color: var(--red);
}
.sect {
  font-size: 20px;
  font-weight: 700;
  margin: 6px 0 10px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.invite {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.invite .ic {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  flex: none;
}
.invite div {
  flex: 1;
  font-size: 14px;
  color: var(--mut);
}
.invite b {
  display: block;
  color: var(--ink);
  font-size: 16px;
  margin-bottom: 2px;
}
.invite .mk {
  flex: none;
}

/* activity */
.day {
  font-size: 13px;
  color: var(--mut);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 18px 4px 8px;
}
.act-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  position: relative;
  width: 100%;
  text-align: left;
}
.act-row + .act-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 62px;
  right: 0;
  height: 0.5px;
  background: var(--sep);
}
.act-row .sav {
  width: 36px;
  height: 36px;
  font-size: 14px;
}
.act-row .t {
  flex: 1;
  min-width: 0;
  font-size: 15px;
}
.act-row .t small {
  display: block;
  color: var(--mut);
  font-size: 13px;
  margin-top: 2px;
}
.act-row .t q {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  color: var(--ink2);
  quotes: none;
  font-style: italic;
}
.thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: var(--fill);
  flex: none;
  object-fit: cover;
  display: block;
}

/* visit extras */
.v .by {
  color: var(--mut);
}
.v .vnote {
  display: block;
  font-size: 13px;
  color: var(--ink2);
  margin-top: 2px;
  font-style: italic;
}
.ph {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--fill);
  color: var(--blue);
  display: grid;
  place-items: center;
  flex: none;
  font-size: 16px;
}
.photo-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
}
.photo-pick img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 10px;
  background: #000;
}
.photo-pick .row2 {
  display: flex;
  gap: 10px;
  width: 100%;
}
.photo-pick .row2 .big {
  height: 44px;
  font-size: 15px;
}

/* checklist (assign) */
.ck {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  min-height: 54px;
  width: 100%;
  text-align: left;
  position: relative;
}
.ck + .ck::before {
  content: "";
  position: absolute;
  top: 0;
  left: 52px;
  right: 0;
  height: 0.5px;
  background: var(--sep);
}
.ck .box {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--mut2);
  flex: none;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.ck.on .box {
  background: var(--blue);
  border-color: var(--blue);
}
.ck .box svg {
  opacity: 0;
}
.ck.on .box svg {
  opacity: 1;
}
.ck .t {
  flex: 1;
  min-width: 0;
}
.ck .t div {
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ck .t small {
  display: block;
  font-size: 13px;
  color: var(--mut);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sticky-tools {
  position: sticky;
  top: 52px;
  z-index: 1;
  background: var(--sheet);
  padding: 4px 0 10px;
}
.r select {
  flex: 1;
  border: 0;
  background: transparent;
  text-align: right;
  text-align-last: right;
  font-size: 16px;
  color: var(--blue);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  cursor: pointer;
}
.r select:disabled {
  color: var(--mut);
  cursor: default;
}

/* lightbox */
.lb {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lb.on {
  display: flex;
}
.lb img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}
.lb button {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
}

/* ---------- Attendance ---------- */
.punch {
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px 18px 18px;
  text-align: center;
  margin-bottom: 22px;
}
.punch .clock {
  font-size: clamp(30px, 12.5vw, 50px);
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}
.punch .pdate {
  color: var(--ink2);
  font-size: 16px;
  font-weight: 500;
  margin: 6px 0 2px;
}
.punch .phours {
  color: var(--mut);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}
.punch .pstat {
  margin: 16px 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.punch .big {
  max-width: 360px;
  margin: 0 auto;
}
.big.green {
  background: var(--green);
}
.big.orange {
  background: var(--orange);
}
.ptimes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px auto 0;
  max-width: 420px;
}
.ptimes div {
  background: var(--fill2);
  border-radius: 12px;
  padding: 10px 4px;
}
.ptimes b {
  display: block;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}
.ptimes span {
  font-size: 12px;
  color: var(--mut);
}
.toolrow {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolrow input[type="date"],
.toolrow input[type="month"] {
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: var(--fill);
  padding: 0 12px;
  font-size: 15px;
  font-weight: 500;
  outline: none;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}
.toolrow .sp {
  flex: 1;
}
.chip {
  height: 38px;
  padding: 0 14px;
  border-radius: 11px;
  background: var(--fill);
  color: var(--blue);
  font-size: 15px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.chip.icon {
  width: 38px;
  padding: 0;
  justify-content: center;
}
@media (max-width: 640px) {
  .toolrow .chip:not(.icon) {
    padding: 0 11px;
  }
}
.ainfo {
  display: flex;
  gap: 4px 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--mut);
  margin-top: 6px;
  align-items: center;
}
.ainfo b {
  color: var(--ink);
  font-weight: 600;
}
.ainfo a {
  color: var(--blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.selfies {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
}
img.sf {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--fill);
  cursor: zoom-in;
  display: block;
}
.lact {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.mk.red {
  background: color-mix(in srgb, var(--red) 14%, transparent);
  color: var(--red);
}
.mk.green {
  background: var(--green);
}
.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  padding: 12px;
}
.cal .wd {
  font-size: 11px;
  color: var(--mut);
  text-align: center;
  font-weight: 600;
}
.cal .d {
  aspect-ratio: 1;
  max-height: 52px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  background: var(--fill2);
  font-variant-numeric: tabular-nums;
}
.cal .d.present {
  background: color-mix(in srgb, var(--green) 26%, transparent);
}
.cal .d.half {
  background: color-mix(in srgb, var(--orange) 26%, transparent);
}
.cal .d.absent {
  background: color-mix(in srgb, var(--red) 20%, transparent);
  color: var(--red);
}
.cal .d.paidL,
.cal .d.unpaidL {
  background: color-mix(in srgb, var(--blue) 20%, transparent);
}
.cal .d.off {
  background: transparent;
  color: var(--mut2);
}
.cal .d.future,
.cal .d.pending {
  background: transparent;
}
.cal .d.today {
  box-shadow: inset 0 0 0 2px var(--blue);
}
.cal .d.late::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  margin-left: -2.5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--orange);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--mut);
  padding: 0 14px 12px;
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
}
.sumgrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.sumgrid div {
  background: var(--card);
  border-radius: 14px;
  padding: 12px 6px;
  text-align: center;
  box-shadow: var(--shadow);
}
.sheet .sumgrid div {
  background: var(--cell);
  box-shadow: none;
}
.sumgrid b {
  display: block;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.sumgrid span {
  font-size: 12px;
  color: var(--mut);
}
.camwrap {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 1;
  max-width: 420px;
  margin: 0 auto 12px;
}
.camwrap video,
.camwrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.camwrap video {
  transform: scaleX(-1);
}
.camhint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-align: center;
  padding: 28px;
  font-size: 15px;
  pointer-events: none;
}
.camhint:empty {
  display: none;
}
.camring {
  position: absolute;
  inset: 14% 18%;
  border: 2px dashed rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  pointer-events: none;
}
.camwrap .camring[hidden] {
  display: none;
}
.netpay {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.scard[role="button"] {
  cursor: pointer;
}
.r input[type="time"] {
  text-align: right;
  -webkit-appearance: none;
  appearance: none;
  min-height: 30px;
}
.sect .mk {
  font-size: 14px;
}
.eye {
  flex: none;
  width: 34px;
  height: 34px;
  margin-right: -6px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mut);
  font-size: 19px;
}
.eye:active {
  background: var(--fill);
}
.eye.on {
  color: var(--blue);
}
.pinshow {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-align: center;
  padding: 18px 10px;
  user-select: all;
  -webkit-user-select: all;
}
.seg .thumb {
  height: auto;
  object-fit: initial;
}
.seg .thumb.ready {
  opacity: 1;
}
.sav,
.av,
.me-btn {
  position: relative;
  overflow: hidden;
}
.avimg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: inherit;
}
.avedit {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: -6px 0 18px;
  flex-wrap: wrap;
}
.seg .thumb.nt {
  transition: none !important;
}
/* ---------- Tasks ---------- */
.tlist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 10px;
}
@media (max-width: 640px) {
  .tlist {
    grid-template-columns: 1fr;
  }
}
.tcard {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 12px 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  width: 100%;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s;
}
.tcard::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--pc);
}
.tcard:active {
  transform: scale(0.985);
}
.tcard h3 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  margin: 1px 0 0;
  word-break: break-word;
}
.tcard.isdone h3 {
  color: var(--mut);
  text-decoration: line-through;
}
.tcard .chev {
  color: var(--mut2);
  margin-top: 3px;
  flex: none;
}
.tchk {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--mut2);
  flex: none;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  margin-top: 1px;
}
.tchk.doing {
  border-color: var(--orange);
  background: conic-gradient(var(--orange) 0 50%, transparent 50% 100%);
}
.tchk.done {
  background: var(--green);
  border-color: var(--green);
}
.tmeta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  align-items: center;
  font-size: 13px;
  color: var(--mut);
  margin-top: 5px;
}
.tmeta > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tmeta svg {
  font-size: 14px;
}
.tmeta .bad {
  color: var(--red);
  font-weight: 600;
}
.tmeta .ok {
  color: var(--green);
  font-weight: 600;
}
.tav .sav {
  width: 20px;
  height: 20px;
  font-size: 9px;
  border-radius: 50%;
}
.tpeople {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.tp {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  width: 100%;
}
.tp.on {
  box-shadow:
    inset 0 0 0 2px var(--blue),
    var(--shadow);
}
.tp .sav {
  width: 38px;
  height: 38px;
  font-size: 14px;
}
.tp b {
  font-size: 14px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tp small {
  font-size: 12px;
  color: var(--mut);
}
.tp .bar {
  height: 6px;
  border-radius: 3px;
  background: var(--fill);
  margin: 5px 0 3px;
  overflow: hidden;
}
.tp .bar i {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.4s;
}
.tring {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 22px;
  position: relative;
}
.tring svg {
  width: 80px;
  height: 80px;
  transform: rotate(-90deg);
  flex: none;
}
.tring circle {
  fill: none;
  stroke-width: 8;
}
.tring .bg {
  stroke: var(--fill);
}
.tring .fg {
  stroke: var(--green);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s;
}
.tring > b {
  position: absolute;
  left: 18px;
  width: 80px;
  text-align: center;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.tring h3 {
  font-size: 19px;
  margin: 0;
}
.tring p {
  font-size: 14px;
  color: var(--mut);
  margin: 3px 0 0;
}
.tchips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.tchip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px 0 5px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 15px;
  font-weight: 500;
}
.tchip .sav {
  width: 30px;
  height: 30px;
  font-size: 11px;
  border-radius: 50%;
}
.tchip.on {
  background: var(--blue);
  color: #fff;
}
.tday {
  height: 34px;
  min-width: 46px;
  padding: 0 10px;
  border-radius: 17px;
  background: var(--fill);
  font-size: 14px;
  font-weight: 500;
}
.tday.on {
  background: var(--blue);
  color: #fff;
}
.ttitle {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  word-break: break-word;
}
.tdetails {
  white-space: pre-wrap;
  color: var(--ink2);
  font-size: 16px;
  line-height: 1.45;
  margin: 0 0 16px;
}
.tdot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  margin-top: 6px;
}
.toolrow .nb.prim {
  height: 38px;
  border-radius: 11px;
}
.toolrow .sort select {
  height: 38px;
}
@media (max-width: 640px) {
  .toolrow .sort {
    flex: 1 1 100%;
    order: 9;
  }
  .toolrow .sort select {
    width: 100%;
  }
  .toolrow .nb.prim span {
    display: none;
  }
  .toolrow .nb.prim {
    width: 38px;
    padding: 0;
  }
}
.wapreview {
  background: #e7ffdb;
  color: #111;
  border-radius: 14px 14px 14px 4px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
:root[data-theme="dark"] .wapreview {
  background: #005c4b;
  color: #e9edef;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wapreview {
    background: #005c4b;
    color: #e9edef;
  }
}
.fixbox {
  background: color-mix(in srgb, var(--orange) 10%, var(--card));
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink2);
}
.fixbox .fixt {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 16px;
  margin-bottom: 6px;
}
.fixbox .fixt svg {
  color: var(--orange);
}
.fixbox p {
  margin: 0 0 8px;
}
.fixbox b {
  color: var(--ink);
}
ol.fix {
  margin: 6px 0 10px;
  padding-left: 22px;
}
ol.fix li {
  margin: 6px 0;
}
.locban {
  width: 100%;
  text-align: left;
  background: color-mix(in srgb, var(--red) 12%, var(--card)) !important;
  color: var(--ink);
  margin-bottom: 16px;
  cursor: pointer;
}
.locban > svg:first-child {
  color: var(--red);
}
.locban span {
  flex: 1;
}
.camph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 15px;
  text-align: center;
  padding: 24px;
  background: linear-gradient(160deg, #3a3a3c, #1c1c1e);
}
.camph svg {
  font-size: 64px;
  opacity: 0.7;
}
details.fixbox {
  background: var(--fill2);
  padding: 12px 14px;
}
details.fixbox summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 500;
  font-size: 15px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
details.fixbox summary::-webkit-details-marker {
  display: none;
}
details.fixbox[open] summary {
  margin-bottom: 8px;
  color: var(--ink);
}
@media (max-width: 345px) {
  .tabbar {
    padding-left: 2px;
    padding-right: 2px;
  }
  .tabbar button {
    font-size: 9.5px;
    letter-spacing: -0.02em;
  }
  .tabbar button svg {
    font-size: 22px;
  }
  .hero h1 {
    font-size: 28px;
  }
  .r .k {
    min-width: 84px;
  }
  .toolrow input[type="date"],
  .toolrow input[type="month"] {
    flex: 1 1 140px;
    min-width: 140px;
    padding: 0 8px;
    font-size: 14px;
  }
  .sumgrid {
    gap: 6px;
  }
  .sumgrid b {
    font-size: 20px;
  }
  .sumgrid span {
    font-size: 11px;
  }
  .cal {
    gap: 3px;
    padding: 8px;
  }
}
[hidden] {
  display: none !important;
}
.scard h3 .tag {
  flex: none;
}
.invite .mk {
  text-decoration: none;
}

/* GPS camera container: hidden until opened (its own styles live in css/gps-camera.css) */
#gpscam {
  display: none;
}
#gpscam.open {
  display: block;
}

/* ================= Guide (documents checklist) ================= */
#guideBody {
  max-width: 720px;
}
#guideBody button.r {
  width: 100%;
  text-align: left;
}
#guideBody button.r:active {
  background: var(--fill2);
}
.g-txt {
  flex: 1;
  min-width: 0;
}
.g-txt b {
  display: block;
  font-weight: 500;
}
.g-txt small {
  display: block;
  color: var(--mut);
  font-size: 13px;
  margin-top: 1px;
}
.g-proc svg {
  color: var(--mut2);
  font-size: 16px;
}
.g-proc .g-txt b {
  font-weight: 600;
}
.g-num {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}
.g-back {
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 17px;
  margin: 0 0 10px -4px;
}
.g-intro {
  margin: 0 4px 14px;
  color: var(--ink2);
  font-size: 15px;
}
.g-seg {
  display: flex;
  background: var(--fill);
  border-radius: 10px;
  padding: 2px;
  margin-bottom: 14px;
}
.g-seg button {
  flex: 1;
  height: 32px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
.g-seg button.on {
  background: var(--card);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.g-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--fill);
  overflow: hidden;
}
.g-bar i {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.25s;
}
.g-count {
  font-size: 13px;
  color: var(--mut);
  margin: 6px 4px 20px;
}
.g-box {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--mut2);
  display: grid;
  place-items: center;
  flex: none;
  color: #fff;
  font-size: 14px;
}
.g-item.on .g-box {
  background: var(--green);
  border-color: var(--green);
}
.g-item.on .g-txt b {
  color: var(--mut);
}
.g-tag {
  flex: none;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--orange);
  background: color-mix(in srgb, var(--orange) 15%, transparent);
  padding: 3px 8px;
  border-radius: 999px;
}
.g-actions {
  margin-top: 4px;
  display: grid;
  gap: 10px;
}

/* ================= Follow-ups (sales leads) ================= */
.ld-add {
  height: 38px;
  border-radius: 11px;
}
.ld-tabs {
  overflow-x: auto;
  scrollbar-width: none;
}
.ld-tabs::-webkit-scrollbar {
  display: none;
}
.ld-tabs button {
  flex: 1 0 auto;
  padding: 0 10px;
  white-space: nowrap;
}
.ld-tabs em {
  font-style: normal;
  font-size: 12px;
  color: var(--mut);
  font-variant-numeric: tabular-nums;
}
.ld-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.ld-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  background: var(--card);
  border-radius: 14px;
  padding: 13px 15px;
  min-width: 0;
  transition: transform 0.1s;
}
.ld-card:active {
  transform: scale(0.985);
}
.ld-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ld-top b {
  font-size: 17px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ld-sub {
  color: var(--ink2);
  font-size: 14.5px;
}
.ld-note {
  color: var(--mut);
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ld-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--mut);
  font-size: 12.5px;
  margin-top: 3px;
}
.ld-meta svg {
  font-size: 13px;
}
.ld-heat {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  display: inline-block;
}
.ld-heat.hot {
  background: var(--red);
}
.ld-heat.warm {
  background: var(--orange);
}
.ld-heat.cold {
  background: var(--blue);
}
.ld-head {
  margin: 4px 4px 14px;
}
.ld-head h3 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.ld-acts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.ld-acts .chip {
  flex: 1 1 0;
  justify-content: center;
  text-decoration: none;
}
.ld-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ld-text small {
  display: block;
  color: var(--mut);
  font-size: 13px;
  margin-top: 2px;
}
.ld-quick {
  flex-wrap: wrap;
  gap: 8px;
}
.ld-status {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ld-loc {
  flex: 1;
  min-width: 0;
  font-size: 15px;
}
.ld-hist .k {
  font-size: 13px;
}

/* ================= Phone tab bar: floating, icons only, selected tab shows its name ================= */
@media (max-width: 1040px) {
  .tabbar {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    max-width: 520px;
    margin: 0 auto;
    padding: 6px;
    gap: 2px;
    border-radius: 28px;
    border: 0.5px solid var(--sep);
    box-shadow:
      0 10px 30px rgba(0, 0, 0, 0.16),
      0 1px 3px rgba(0, 0, 0, 0.08);
  }
  .tabbar button {
    flex: 1 1 0;
    flex-direction: row;
    justify-content: center;
    gap: 6px;
    height: 44px;
    border-radius: 22px;
    font-size: 14px;
    font-weight: 600;
    transition:
      background 0.2s,
      color 0.2s;
  }
  .tabbar button svg {
    font-size: 23px;
    flex: none;
  }
  .tabbar button .tl {
    display: none;
  }
  .tabbar button.on {
    flex: 0 0 auto;
    padding: 0 15px 0 12px;
    background: color-mix(in srgb, var(--blue) 14%, transparent);
  }
  .tabbar button.on .tl {
    display: inline;
  }
  .tabbar .dotn {
    top: 1px;
    left: calc(50% + 3px);
  }
  .tabbar button.on .dotn {
    position: static;
    margin-left: 1px;
  }
  .wrap {
    padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px));
  }
  .toast {
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 1040px) {
  .tabbar {
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  }
  body.tb-hide .tabbar {
    transform: translateY(calc(100% + 24px + env(safe-area-inset-bottom, 0px)));
  }
  body.tb-hide .toast {
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }
}
