/* Freshlyx CRM — iOS-style interface. Light and dark mode via tokens. */
:root {
  --bg: #F2F2F7;
  --bg2: #FFFFFF;
  --card: #FFFFFF;
  --card2: #F2F2F7;
  --label: #000000;
  --label2: rgba(60, 60, 67, 0.62);
  --label3: rgba(60, 60, 67, 0.36);
  --sep: rgba(60, 60, 67, 0.18);
  --fill: rgba(118, 118, 128, 0.12);
  --fill2: rgba(118, 118, 128, 0.2);
  --tint: #1E3A5F;
  --tint-text: #FFFFFF;
  --link: #2C5C8F;
  --red: #FF3B30;
  --green: #34C759;
  --green-ink: #248A3D;
  --orange: #FF9500;
  --yellow: #FFCC00;
  --blue: #007AFF;
  --navy: #12213D;
  --bar: rgba(249, 249, 249, 0.86);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.25);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg2: #1C1C1E;
    --card: #1C1C1E;
    --card2: #2C2C2E;
    --label: #FFFFFF;
    --label2: rgba(235, 235, 245, 0.62);
    --label3: rgba(235, 235, 245, 0.32);
    --sep: rgba(84, 84, 88, 0.62);
    --fill: rgba(118, 118, 128, 0.24);
    --fill2: rgba(118, 118, 128, 0.36);
    --tint: #7FA0C4;
    --tint-text: #0B1528;
    --link: #8FB3DA;
    --red: #FF453A;
    --green: #30D158;
    --green-ink: #30D158;
    --orange: #FF9F0A;
    --blue: #0A84FF;
    --bar: rgba(22, 22, 24, 0.86);
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--label); font: 17px/1.35 var(--font); -webkit-font-smoothing: antialiased; }
body { overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.25em; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }

#app { height: 100%; }
.splash { height: 100%; display: grid; place-items: center; background: var(--navy); }
.splash img { border-radius: 18px; animation: pulse 1.4s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.6; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* ------------------------------------------------------------- layout */
.shell { height: 100%; display: flex; flex-direction: column; }
.screen { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(76px + var(--safe-bottom)); }
.screen--flush { padding-bottom: 0; overflow: hidden; display: flex; flex-direction: column; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.topbar { position: sticky; top: 0; z-index: 20; padding: calc(var(--safe-top) + 8px) 16px 8px; background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
.topbar__row { display: flex; align-items: center; justify-content: space-between; min-height: 36px; gap: 8px; max-width: 760px; margin: 0 auto; }
.topbar__title { font: 700 34px/1.1 var(--display); letter-spacing: 0.01em; margin: 6px 0 2px; max-width: 760px; margin-inline: auto; }
.topbar__small { font: 600 17px/1.2 var(--display); text-align: center; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar--line { border-bottom: 0.5px solid var(--sep); }
.tbtn { color: var(--tint); font-size: 17px; display: inline-flex; align-items: center; gap: 2px; min-height: 36px; padding: 0 2px; white-space: nowrap; }
.tbtn--icon { width: 36px; height: 36px; justify-content: center; border-radius: 50%; }
.tbtn--icon svg.i { width: 24px; height: 24px; }
.tbtn:disabled { opacity: 0.4; }
.tbtn--bold { font-weight: 600; }
.tbtn--red { color: var(--red); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; padding: 6px 4px calc(4px + var(--safe-bottom)); background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 0.5px solid var(--sep); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 500; color: var(--label3); padding: 2px 0; max-width: 110px; }
.tab svg.i { width: 26px; height: 26px; }
.tab--on { color: var(--tint); }
.tab__badge { position: absolute; margin: -2px 0 0 22px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; padding: 0 5px; }

/* ------------------------------------------------------------- lists (iOS grouped) */
.group { background: var(--card); border-radius: var(--radius); overflow: hidden; margin: 0 0 22px; }
.group__head { font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em; color: var(--label2); margin: 22px 16px 7px; display: flex; justify-content: space-between; align-items: baseline; }
.group__head button { color: var(--tint); text-transform: none; font-size: 15px; letter-spacing: 0; }
.group__foot { font-size: 13px; color: var(--label2); margin: -14px 16px 22px; line-height: 1.4; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; min-height: 44px; position: relative; width: 100%; text-align: left; }
.row + .row::before, .row + .field::before, .field + .row::before, .field + .field::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--sep); }
.row--tap:active { background: var(--fill); }
.row__main { flex: 1; min-width: 0; }
.row__title { font-size: 17px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__sub { font-size: 14px; color: var(--label2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__sub--wrap { white-space: normal; }
.row__end { color: var(--label2); font-size: 16px; display: flex; align-items: center; gap: 6px; flex: none; }
.row__chev { color: var(--label3); }
.row__icon { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: #fff; flex: none; }
.row__icon svg.i { width: 18px; height: 18px; }
.row--danger { color: var(--red); justify-content: center; }
.row--action { color: var(--tint); }

.field { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 46px; position: relative; }
.field label, .field .field__label { min-width: 96px; flex: none; font-size: 16px; color: var(--label); white-space: nowrap; }
.field input, .field select, .field textarea { flex: 1; min-width: 0; border: 0; background: transparent; padding: 12px 0; font-size: 17px; outline: none; }
.field input::placeholder, .field textarea::placeholder { color: var(--label3); }
.field--stack { flex-direction: column; align-items: stretch; gap: 0; padding: 10px 16px 6px; }
.field--stack label, .field--stack .field__label { width: auto; font-size: 13px; color: var(--label2); text-transform: uppercase; letter-spacing: 0.02em; }
.field--stack textarea { padding: 6px 0 8px; resize: none; line-height: 1.45; min-height: 96px; }
.field select { appearance: none; -webkit-appearance: none; color: var(--label2); text-align: right; }
.field__money { display: flex; align-items: center; flex: 1; min-width: 0; }
.field__money span { color: var(--label2); }
.field input[type=date], .field input[type=time] { text-align: left; min-height: 24px; }
.field--error { box-shadow: inset 3px 0 0 var(--red); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 16px 14px; }
.chip { font-size: 14px; padding: 7px 12px; border-radius: 99px; background: var(--fill); color: var(--label); display: inline-flex; align-items: center; gap: 6px; }
.chip--on { background: var(--tint); color: var(--tint-text); }
.chip:active { opacity: 0.7; }
.chip__dot { width: 10px; height: 10px; border-radius: 50%; }

.search { margin: 4px 0 8px; display: flex; align-items: center; gap: 6px; background: var(--fill); border-radius: 10px; padding: 0 8px; height: 36px; color: var(--label2); }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 17px; color: var(--label); }
.search input::placeholder { color: var(--label2); }

.seg { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; margin: 8px 0; }
.seg button { flex: 1; padding: 6px 8px; font-size: 14px; font-weight: 500; border-radius: 7px; }
.seg button.on { background: var(--bg2); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.1); font-weight: 600; }

/* ------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border-radius: 14px; font-size: 17px; font-weight: 600; background: var(--tint); color: var(--tint-text); width: 100%; transition: transform 0.08s, opacity 0.15s; }
.btn:active { transform: scale(0.985); opacity: 0.88; }
.btn:disabled { opacity: 0.45; }
.btn--soft { background: var(--fill); color: var(--tint); }
.btn--green { background: var(--green); color: #fff; }
.btn--red { background: transparent; color: var(--red); min-height: 44px; }
.btn--sm { min-height: 36px; font-size: 15px; border-radius: 10px; padding: 0 14px; width: auto; }
.btn-stack { display: grid; gap: 10px; padding: 8px 0 12px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 6px; }
.quick button, .quick a { background: var(--card); border-radius: 12px; padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--tint); }
.quick button:disabled, .quick a[aria-disabled=true] { opacity: 0.35; pointer-events: none; }
.quick svg.i { width: 22px; height: 22px; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--fill); color: var(--label2); white-space: nowrap; }
.badge--green { background: rgba(52, 199, 89, 0.16); color: var(--green-ink); }
.badge--orange { background: rgba(255, 149, 0, 0.16); color: #B86E00; }
.badge--red { background: rgba(255, 59, 48, 0.14); color: var(--red); }
.badge--blue { background: rgba(0, 122, 255, 0.14); color: var(--blue); }
@media (prefers-color-scheme: dark) { .badge--orange { color: var(--orange); } }

.empty { text-align: center; color: var(--label2); padding: 40px 24px; font-size: 15px; line-height: 1.5; }
.empty svg.i { width: 44px; height: 44px; color: var(--label3); margin-bottom: 8px; }
.empty b { display: block; color: var(--label); font-size: 19px; margin-bottom: 4px; }

/* ------------------------------------------------------------- calendar */
.cal { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg2); }
.cal__head { padding: calc(var(--safe-top) + 6px) 12px 0; background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); position: relative; z-index: 5; }
.cal__bar { display: flex; justify-content: space-between; align-items: center; min-height: 36px; max-width: 1100px; margin: 0 auto; }
.cal__year { color: var(--red); font-size: 17px; display: inline-flex; align-items: center; gap: 2px; }
.cal__month { font: 700 32px/1.15 var(--display); margin: 4px 4px 8px; max-width: 1100px; margin-inline: auto; padding-left: 4px; display: flex; align-items: baseline; gap: 10px; }
.cal__month small { font-size: 17px; font-weight: 500; color: var(--label2); }
.cal__dow { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 12px; font-weight: 600; color: var(--label2); text-align: center; padding: 2px 0 6px; max-width: 1100px; margin: 0 auto; border-bottom: 0.5px solid var(--sep); }
.cal__dow span:first-child, .cal__dow span:last-child { color: var(--label3); }
.cal__viewport { flex: 1; min-height: 0; position: relative; overflow: hidden; touch-action: pan-y; }
.cal__grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, 1fr); max-width: 1100px; margin: 0 auto; padding-bottom: calc(60px + var(--safe-bottom)); will-change: transform; }
.cal__grid.anim { transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
.day { border-bottom: 0.5px solid var(--sep); padding: 4px 1px 2px; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 2px; text-align: center; overflow: hidden; cursor: pointer; }
.day:active { background: var(--fill); }
.day--out { visibility: hidden; }
.day__num { align-self: center; font-size: 15px; font-weight: 500; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; margin-bottom: 1px; flex: none; }
.day--weekend .day__num { color: var(--label2); }
.day--today .day__num { background: var(--red); color: #fff; font-weight: 700; }
.day--sel:not(.day--today) .day__num { background: var(--label); color: var(--bg2); font-weight: 700; }
.pill { display: flex; align-items: center; gap: 2px; font-size: 10.5px; line-height: 1.25; font-weight: 600; padding: 1px 3px; border-radius: 4px; text-align: left; white-space: nowrap; overflow: hidden; color: var(--pc); background: color-mix(in srgb, var(--pc) 16%, transparent); min-height: 15px; flex: none; }
.pill__t { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.pill--paid { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 55%, transparent); }
.pill__check { width: 11px; height: 11px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; flex: none; }
.pill__check svg { width: 8px; height: 8px; stroke-width: 4; }
.pill--cancelled .pill__t { text-decoration: line-through; opacity: 0.6; }
.pill--done:not(.pill--paid) { opacity: 0.78; }
.pill--more { color: var(--label2); background: transparent; font-weight: 500; justify-content: center; }
@media (min-width: 700px) { .pill { font-size: 12px; padding: 2px 5px; min-height: 18px; } .day__num { font-size: 16px; } }
.cal__fab { position: absolute; right: 16px; bottom: calc(76px + var(--safe-bottom)); z-index: 6; }
.cal__today { position: fixed; left: 16px; bottom: calc(66px + var(--safe-bottom)); z-index: 25; color: var(--red); font-size: 17px; background: var(--bar); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); padding: 6px 12px; border-radius: 99px; box-shadow: var(--shadow); }

/* day sheet & job cards */
.jobcard { background: var(--card); border-radius: 14px; margin: 0 0 12px; overflow: hidden; border-left: 4px solid var(--pc, var(--tint)); }
.jobcard__head { padding: 12px 14px 4px; display: flex; gap: 10px; align-items: flex-start; }
.jobcard__name { font-size: 19px; font-weight: 700; line-height: 1.25; }
.jobcard__meta { font-size: 14px; color: var(--label2); margin-top: 2px; }
.jobcard__price { margin-left: auto; font-size: 19px; font-weight: 700; text-align: right; white-space: nowrap; }
.jobcard__body { padding: 4px 14px 10px; font-size: 15px; }
.jobcard__line { display: flex; gap: 8px; padding: 4px 0; color: var(--label); align-items: flex-start; }
.jobcard__line svg.i { color: var(--label2); margin-top: 1px; }
.jobcard__line a { color: var(--link); }
.jobcard__scope { white-space: pre-wrap; background: var(--card2); border-radius: 10px; padding: 9px 11px; margin: 6px 0; font-size: 15px; line-height: 1.45; }
.jobcard__notes { white-space: pre-wrap; color: var(--label2); font-size: 14px; }
.jobcard__actions { display: flex; gap: 6px; padding: 8px 10px 12px; flex-wrap: wrap; }
.jobcard__actions .btn { flex: 1 1 40%; min-height: 42px; font-size: 15px; border-radius: 11px; padding: 0 10px; }
.paidmark { display: inline-flex; align-items: center; gap: 5px; color: var(--green-ink); font-weight: 600; font-size: 14px; }
.paidmark span { width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; }
.paidmark span svg { width: 12px; height: 12px; stroke-width: 3.4; }

/* ------------------------------------------------------------- sheets & dialogs */
.backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.36); animation: fade 0.22s ease both; }
.backdrop--out { animation: fadeout 0.2s ease both; }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeout { to { opacity: 0; } }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 101; max-height: calc(100% - var(--safe-top) - 10px); background: var(--bg); border-radius: 14px 14px 0 0; display: flex; flex-direction: column; animation: up 0.34s cubic-bezier(0.2, 0.9, 0.25, 1) both; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18); max-width: 760px; margin: 0 auto; }
.sheet--full { height: calc(100% - var(--safe-top) - 10px); }
.sheet--out { animation: down 0.24s ease-in both; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes down { to { transform: translateY(100%); } }
.sheet__grab { width: 36px; height: 5px; border-radius: 3px; background: var(--fill2); margin: 6px auto 0; flex: none; }
.sheet__bar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; min-height: 52px; flex: none; }
.sheet__title { flex: 1; text-align: center; font: 600 17px/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet__body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px calc(24px + var(--safe-bottom)); overscroll-behavior: contain; }
.sheet__foot { flex: none; padding: 10px 16px calc(10px + var(--safe-bottom)); border-top: 0.5px solid var(--sep); background: var(--bar); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.sheet__big { font: 700 28px/1.15 var(--display); margin: 2px 0 12px; }
.sheet__big small { display: block; font: 500 15px/1.3 var(--font); color: var(--label2); margin-top: 2px; }
@media (min-width: 800px) {
  .sheet { bottom: auto; top: 50%; left: 50%; right: auto; width: min(640px, 92vw); transform: translate(-50%, -50%); border-radius: 16px; max-height: 88vh; animation: pop 0.26s ease both; }
  .sheet--full { height: 88vh; }
  .sheet--out { animation: fadeout 0.18s ease both; }
  .sheet__grab { display: none; }
  @keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(0.98); } }
}

.alert { position: fixed; z-index: 201; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(290px, 84vw); background: var(--bar); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border-radius: 14px; text-align: center; overflow: hidden; animation: alertin 0.2s ease both; }
@keyframes alertin { from { opacity: 0; transform: translate(-50%, -50%) scale(1.12); } }
.alert__body { padding: 19px 16px 16px; }
.alert__title { font-weight: 600; font-size: 17px; line-height: 1.3; }
.alert__msg { font-size: 13px; line-height: 1.4; margin-top: 4px; }
.alert__btns { display: flex; border-top: 0.5px solid var(--sep); }
.alert__btns--stack { flex-direction: column; }
.alert__btns button { flex: 1; min-height: 44px; font-size: 17px; color: var(--blue); }
.alert__btns button + button { border-left: 0.5px solid var(--sep); }
.alert__btns--stack button + button { border-left: 0; border-top: 0.5px solid var(--sep); }
.alert__btns .bold { font-weight: 600; }
.alert__btns .red { color: var(--red); }
.backdrop--alert { z-index: 200; background: rgba(0, 0, 0, 0.3); }

.actionsheet { position: fixed; left: 8px; right: 8px; bottom: calc(8px + var(--safe-bottom)); z-index: 201; animation: up 0.3s cubic-bezier(0.2, 0.9, 0.25, 1) both; max-width: 520px; margin: 0 auto; }
.actionsheet__group { background: var(--bar); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border-radius: 14px; overflow: hidden; margin-bottom: 8px; }
.actionsheet__title { padding: 14px 16px; font-size: 13px; color: var(--label2); text-align: center; border-bottom: 0.5px solid var(--sep); line-height: 1.35; }
.actionsheet__title b { display: block; font-size: 15px; color: var(--label); margin-bottom: 2px; }
.actionsheet button { display: flex; width: 100%; min-height: 57px; align-items: center; justify-content: center; gap: 10px; font-size: 20px; color: var(--blue); }
.actionsheet button + button { border-top: 0.5px solid var(--sep); }
.actionsheet button.red { color: var(--red); }
.actionsheet button.cancel { font-weight: 600; background: var(--bg2); border-radius: 14px; }
.actionsheet small { display: block; font-size: 13px; color: var(--label2); }

.toast { position: fixed; z-index: 300; left: 50%; top: calc(var(--safe-top) + 10px); transform: translateX(-50%); background: var(--label); color: var(--bg2); padding: 10px 16px; border-radius: 99px; font-size: 15px; font-weight: 500; box-shadow: var(--shadow); animation: toast 2.8s ease both; max-width: 90vw; text-align: center; }
.toast--error { background: var(--red); color: #fff; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -12px); } 8%, 88% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -8px); } }

.spinner { width: 22px; height: 22px; border: 2.5px solid var(--fill2); border-top-color: var(--tint); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.busy { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; background: rgba(0, 0, 0, 0.25); }
.busy__box { background: var(--bar); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border-radius: 16px; padding: 22px 26px; display: flex; flex-direction: column; align-items: center; gap: 12px; font-weight: 600; font-size: 15px; min-width: 160px; }

/* switch (iOS toggle) */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--fill2); transition: background 0.2s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16); transition: transform 0.22s cubic-bezier(0.3, 0.7, 0.3, 1); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }

/* ------------------------------------------------------------- auth */
.auth { min-height: 100%; background: var(--navy); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(var(--safe-top) + 30px) 24px calc(var(--safe-bottom) + 30px); }
.auth__logo { width: 210px; height: auto; margin-bottom: 8px; }
.auth__tag { font-size: 12px; letter-spacing: 0.28em; text-transform: uppercase; color: #F2CD8C; margin-bottom: 30px; }
.auth form { width: 100%; max-width: 360px; display: grid; gap: 12px; }
.auth input { width: 100%; height: 52px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.08); color: #fff; padding: 0 16px; font-size: 17px; outline: none; }
.auth input::placeholder { color: rgba(255, 255, 255, 0.5); }
.auth input:focus { border-color: #7FA0C4; background: rgba(255, 255, 255, 0.12); }
.auth .btn { background: #fff; color: var(--navy); margin-top: 6px; }
.auth__err { color: #FFB4AE; font-size: 15px; text-align: center; min-height: 20px; }
.auth__note { font-size: 13px; color: rgba(255, 255, 255, 0.6); text-align: center; line-height: 1.5; max-width: 340px; margin-top: 18px; }

/* ------------------------------------------------------------- contacts */
.letter { position: sticky; top: 0; font-size: 13px; font-weight: 600; color: var(--label2); padding: 4px 16px; background: var(--bg); z-index: 1; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 15px; color: #fff; background: linear-gradient(180deg, #A5ACB8, #858C99); flex: none; letter-spacing: 0.02em; }
.avatar--lg { width: 88px; height: 88px; font-size: 34px; margin: 6px auto 10px; }
.contact-hero { text-align: center; padding: 8px 0 2px; }
.contact-hero h1 { font: 700 28px/1.2 var(--display); margin: 0; }
.contact-hero p { margin: 4px 0 0; color: var(--label2); font-size: 15px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 2px; }
.stat { background: var(--card); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 19px; }
.stat span { font-size: 12px; color: var(--label2); }
.notes-box { width: 100%; border: 0; background: transparent; outline: none; resize: none; padding: 12px 16px; min-height: 90px; font-size: 16px; line-height: 1.45; }

/* ------------------------------------------------------------- canvass map */
.map { position: absolute; inset: 0; background: #1b2430; }
.mapwrap { position: relative; flex: 1; min-height: 0; }
.map__top { position: absolute; top: calc(var(--safe-top) + 8px); left: 10px; right: 10px; z-index: 5; display: flex; gap: 8px; }
.map__search { flex: 1; display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px; border-radius: 12px; background: var(--bar); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: var(--shadow); color: var(--label2); }
.map__search input { flex: 1; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--label); min-width: 0; }
.map__btn { width: 44px; height: 44px; border-radius: 12px; background: var(--bar); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: var(--shadow); color: var(--tint); display: grid; place-items: center; flex: none; position: relative; }
.map__btn svg.i { width: 22px; height: 22px; }
.map__btn--on { color: var(--blue); }
.map__dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.map__side { position: absolute; right: 10px; bottom: calc(86px + var(--safe-bottom)); z-index: 5; display: grid; gap: 8px; }
.map__hint { position: absolute; left: 50%; bottom: calc(90px + var(--safe-bottom)); transform: translateX(-50%); z-index: 5; background: var(--bar); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); padding: 8px 14px; border-radius: 99px; font-size: 14px; box-shadow: var(--shadow); white-space: nowrap; }
.map__counts { position: absolute; left: 10px; bottom: calc(86px + var(--safe-bottom)); z-index: 5; background: var(--bar); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 12px; box-shadow: var(--shadow); padding: 6px 10px; font-size: 12px; display: grid; gap: 3px; }
.map__counts div { display: flex; align-items: center; gap: 6px; }
.map__missing { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; text-align: center; color: #fff; background: radial-gradient(circle at 50% 40%, #24344f, #0b1528); }
.map__missing svg.i { width: 46px; height: 46px; color: #7FA0C4; }
.map__missing p { max-width: 340px; line-height: 1.5; color: rgba(255, 255, 255, 0.75); }
.pinmark { width: 28px; height: 28px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--pc); border: 2.5px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45); display: grid; place-items: center; cursor: pointer; }
.pinmark svg { transform: rotate(45deg); width: 14px; height: 14px; color: #fff; stroke: currentColor; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.pinmark--customer { width: 30px; height: 30px; }
.pinmark--new { animation: drop 0.35s cubic-bezier(0.3, 1.4, 0.5, 1) both; }
@keyframes drop { from { transform: translateY(-30px) rotate(-45deg); opacity: 0; } }
.statusgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 16px; }
.statusbtn { border-radius: 14px; padding: 14px 10px; background: var(--card); display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; border: 2px solid transparent; }
.statusbtn span { width: 34px; height: 34px; border-radius: 50%; background: var(--pc); display: grid; place-items: center; color: #fff; }
.statusbtn span svg { width: 18px; height: 18px; stroke-width: 2.4; }
.statusbtn--on { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 12%, var(--card)); }

/* ------------------------------------------------------------- dashboard */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 18px; }
.kpi { background: var(--card); border-radius: 14px; padding: 14px; }
.kpi__label { font-size: 13px; color: var(--label2); font-weight: 500; }
.kpi__value { font: 700 28px/1.15 var(--display); margin-top: 6px; letter-spacing: -0.01em; }
.kpi__sub { font-size: 13px; color: var(--label2); margin-top: 2px; }
.kpi--wide { grid-column: span 2; }
.kpi--hero { background: linear-gradient(160deg, #1E3A5F, #12213D); color: #fff; }
.kpi--hero .kpi__label, .kpi--hero .kpi__sub { color: rgba(255, 255, 255, 0.7); }
.kpi--hero .kpi__value { font-size: 36px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; margin-top: 14px; }
.bars div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.bars i { display: block; width: 100%; border-radius: 4px 4px 2px 2px; background: rgba(255, 255, 255, 0.85); min-height: 2px; }
.bars i.cur { background: #F2CD8C; }
.bars span { font-size: 10px; color: rgba(255, 255, 255, 0.65); }

/* ------------------------------------------------------------- documents */
.doc-preview { background: #fff; color: #12213D; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); font-size: 14px; line-height: 1.5; }
.doc-preview__head { background: #12213D; color: #fff; padding: 20px 20px 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.doc-preview__head img { width: 140px; height: auto; }
.doc-preview__head h2 { margin: 0; font: 600 13px/1.3 var(--font); letter-spacing: 0.22em; text-transform: uppercase; color: #F2CD8C; text-align: right; }
.doc-preview__head p { margin: 4px 0 0; font-size: 13px; color: rgba(255, 255, 255, 0.75); text-align: right; }
.doc-preview__body { padding: 18px 20px 22px; }
.doc-preview h3 { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: #6B7A90; margin: 18px 0 6px; }
.doc-preview h3:first-child { margin-top: 0; }
.doc-preview p { margin: 0; }
.doc-preview .two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.doc-preview table { width: 100%; border-collapse: collapse; }
.doc-preview td { padding: 7px 0; border-bottom: 1px solid #E7E5DF; vertical-align: top; }
.doc-preview td:last-child { text-align: right; white-space: nowrap; padding-left: 10px; }
.doc-preview .total td { border: 0; font-weight: 700; font-size: 17px; padding-top: 10px; }
.doc-preview .scope { white-space: pre-wrap; background: #F7F6F3; border-radius: 8px; padding: 10px 12px; }
.doc-preview .terms { font-size: 12.5px; color: #3D4A5F; white-space: pre-wrap; }
.sigpad-wrap { margin: 16px 0 6px; }
.sigpad-wrap__label { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: #6B7A90; margin-bottom: 6px; }
.sigpad-wrap__label button { font-size: 14px; letter-spacing: 0; text-transform: none; color: #2C5C8F; }
.sigpad { position: relative; height: 150px; border: 1.5px dashed #B8C2D0; border-radius: 10px; background: #FBFBFA; touch-action: none; }
.sigpad canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.sigpad__x { position: absolute; left: 14px; bottom: 30px; font-size: 22px; color: #B8C2D0; pointer-events: none; }
.sigpad__line { position: absolute; left: 36px; right: 14px; bottom: 34px; border-top: 1px solid #C9D1DC; pointer-events: none; }
.sigpad__ph { position: absolute; inset: 0; display: grid; place-items: center; color: #9AA6B6; font-size: 15px; pointer-events: none; }
.sigpad--done { border-style: solid; border-color: #7FA0C4; }
.doc-preview input.printname { width: 100%; border: 0; border-bottom: 1px solid #C9D1DC; padding: 8px 0; font-size: 16px; color: #12213D; background: transparent; outline: none; }
.sigimg { height: 64px; width: auto; display: block; margin: 4px 0; }
.line-item { background: var(--card); border-radius: 12px; padding: 4px 0; margin-bottom: 10px; position: relative; }
.line-item .field { min-height: 42px; }
.line-item__x { position: absolute; top: 8px; right: 10px; color: var(--red); z-index: 1; }
.totals { background: var(--card); border-radius: 12px; padding: 10px 16px; margin-bottom: 22px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 16px; }
.totals .grand { font-weight: 700; font-size: 20px; border-top: 0.5px solid var(--sep); margin-top: 6px; padding-top: 10px; }

/* activity */
.activity__when { font-size: 12px; color: var(--label3); }

@media (min-width: 900px) {
  .screen { padding-bottom: 90px; }
}
