* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #f4f2fa;
  --card: #ffffff;
  --ink: #1c1a24;
  --muted: #8b87a0;
  --brand: #7c4dff;
  --brand-2: #b06bff;
  --accent: #19c37d;
  --danger: #ff5d5d;
  --warn: #f0a500;
  --line: #edeaf6;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(60, 40, 140, 0.12);
}

html, body { height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background: radial-gradient(1200px 900px at 20% -10%, #232040, #131221 55%, #09090f);
  color: var(--ink);
  display: flex;
  justify-content: center;
  padding: 32px 16px 40px;
}

#desktopHint .hint-card {
  background: #211d35;
  color: #cfc9e8;
  border: 1px solid #39336a;
  border-radius: 16px;
  padding: 18px 22px;
  width: 420px;
  position: fixed;
  left: 40px;
  top: 32px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.hint-logo { font-weight: 800; font-size: 22px; color: #fff; letter-spacing: .3px; margin-bottom: 10px; display:flex; align-items:center; gap:10px;}
.hint-logo::before { content:""; width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 0 14px var(--brand); }
.hint-meta { margin-top: 12px; font-size: 12px; color: #7f79a3; }
.hint-meta span { color: #b3acd6; }

.phone {
  width: 390px; height: 844px;
  background: var(--bg);
  border-radius: 44px;
  border: 10px solid #0c0b14;
  box-shadow: 0 40px 80px rgba(0,0,0,.6), inset 0 0 0 2px #191624;
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}

.statusbar {
  height: 34px; flex: 0 0 34px;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 28px; font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--bg);
}

.topbar {
  flex: 0 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 20px 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
}
.brand { font-weight: 800; font-size: 19px; letter-spacing: .2px; display:flex; align-items:center; gap:8px;}
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px #fff; opacity:.9;}
.user-mini { font-size: 13px; opacity: .92; background: rgba(255,255,255,.18); padding: 5px 12px; border-radius: 20px; }

.screen { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 16px 90px; scrollbar-width: none; }
.screen::-webkit-scrollbar { display: none; }

.section-title { font-size: 16px; font-weight: 800; margin: 18px 2px 10px; display:flex; align-items:center; justify-content:space-between; }
.section-title small { font-weight:600; font-size:12px; color: var(--brand); background:#ede6ff; padding:4px 10px; border-radius:20px;}

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px; }

.stat-row { display: flex; gap: 10px; margin: 4px 0 14px; }
.stat { flex:1; background: var(--card); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 11px; color: var(--muted); }

.item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.item:last-child { border-bottom: none; }
.item-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: 0 0 42px;
  background: linear-gradient(135deg, #dcd0ff, #b7a3ff);
  color: var(--brand); font-weight: 800; display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.item-body { flex: 1; min-width: 0; }
.item-title { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.item-right { text-align: right; flex: 0 0 auto; }

.chip { display:inline-block; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing:.3px;}
.chip.upcoming,.chip.awaiting_completion { background:#fdecc6; color:#b97b00; }
.chip.completed { background:#d9f7e8; color:#0b925f; }
.chip.cancelled { background:#ffdddd; color:#cf2f2f; }
.chip.new,.chip.pending { background:#ede6ff; color: var(--brand); }
.chip.confirmed { background:#d9f7e8; color:#0b925f; }
.chip.rejected { background:#ffdddd; color:#cf2f2f; }

.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 13px; }
.empty .big { font-size: 34px; opacity: .6; margin-bottom: 10px; }

.btn {
  display:block; width:100%; border: none; border-radius: 14px; padding: 14px; font-size: 15px; font-weight: 700;
  cursor: pointer; margin-top: 10px;
}
.btn:disabled { opacity:.6; cursor: default; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color:#fff; box-shadow: 0 8px 20px rgba(124,77,255,.35); }
.btn-ghost { background:#efeafc; color: var(--brand); }
.btn-danger { background:#ffecec; color: var(--danger); }
.btn-success { background:#d9f7e8; color:#0b925f; }

.field { margin-top: 12px; }
.field label { display:block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1.5px solid var(--line); background: #faf9fe; border-radius: 12px;
  padding: 12px; font-size: 14px; font-family: inherit; color: var(--ink); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); background: #fff; }
.field textarea { resize:none; }

.price { font-weight: 800; color: var(--brand); }

.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(12, 10, 24, .55);
  z-index: 40; backdrop-filter: blur(2px);
}
.sheet {
  position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 50;
  background: var(--card); border-radius: 22px; padding: 18px 16px 22px;
  max-height: 74%; overflow-y: auto; box-shadow: 0 -10px 40px rgba(0,0,0,.25);
}
.sheet .grab { width: 40px; height: 4px; border-radius: 3px; background: #ddd6f2; margin: 0 auto 14px; }
.sheet h3 { font-size: 17px; margin-bottom: 4px; }
.sheet .muted { color: var(--muted); font-size: 12.5px; }

.toast {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 110px; z-index: 80;
  background: #241f3d; color: #fff; font-size: 13px; font-weight: 600;
  padding: 10px 18px; border-radius: 30px; box-shadow: var(--shadow); max-width: 82%; text-align: center;
}
.toast.err { background: var(--danger); }

.login-wrap { min-height: 78vh; display: flex; flex-direction: column; justify-content: center; }
.login-logo { font-size: 40px; font-weight: 800; letter-spacing: 1px; text-align: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-logo small { display:block; font-size: 12px; color: var(--muted); font-weight:600; letter-spacing: .4px; -webkit-text-fill-color: var(--muted); background: none; margin-top: 6px;}
.login-card { margin-top: 26px; }
.login-foot { font-size: 12.5px; color: var(--muted); text-align:center; margin-top: 18px; }
.login-foot a { color: var(--brand); font-weight: 700; text-decoration: none; }

.online-flag { background: linear-gradient(135deg,#0ea5e9,#6366f1); }
.group-title { font-weight: 800; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin: 14px 2px 6px; }
.badge-mini { font-size:11px; color:var(--muted); }

.kv { display:flex; justify-content:space-between; padding: 8px 0; font-size: 14px; }
.kv span:first-child { color: var(--muted); }
.sum-line { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 10px; font-weight: 800; font-size: 15px; display:flex; justify-content:space-between;}

/* ---- календарь ---- */
.month-nav { display:flex; align-items:center; justify-content:space-between; }
.month-nav button { background:none; border:none; font-size:20px; cursor:pointer; color:var(--brand); padding: 4px 10px; }
.month-nav .cap { font-weight:800; font-size:16px; }
.cal-grid { display:grid; grid-template-columns: repeat(7,1fr); gap:4px; }
.cal-dow { text-align:center; font-size:11px; font-weight:700; color:var(--muted); padding:6px 0; }
.cal-day {
  aspect-ratio:1; border-radius:12px; background:var(--card); box-shadow:var(--shadow);
  display:flex; flex-direction:column; align-items:center; justify-content:center; cursor:pointer; position:relative;
  font-size:13px; font-weight:700;
}
.cal-day.out { opacity:.35; }
.cal-day.sel { background:linear-gradient(135deg,var(--brand),var(--brand-2)); color:#fff; box-shadow:0 6px 16px rgba(124,77,255,.35); }
.cal-day.today { outline:2px solid var(--brand-2); outline-offset:-2px; }
.cal-dots { display:flex; gap:3px; margin-top:3px; }
.cal-dots i { width:5px; height:5px; border-radius:50%; background:#c8c2e8; }
.cal-dots i.appt { background:var(--brand); }
.cal-dots i.day_off { background:var(--warn); }
.cal-dots i.vacation { background:#0ea5e9; }
.cal-dots i.personal { background:var(--accent); }
.day-list { margin-top:12px; }

/* ---- переключатели ---- */
.switchrow { display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px solid var(--line); font-size:14px; font-weight:600; }
.switch { position:relative; width:46px; height:26px; flex:0 0 46px; }
.switch input { opacity:0; width:0; height:0; }
.slider { position:absolute; inset:0; background:#ddd8ef; border-radius:20px; transition:.2s; cursor:pointer; }
.slider::before { content:""; position:absolute; width:20px; height:20px; border-radius:50%; background:#fff; top:3px; left:3px; transition:.2s; }
.switch input:checked + .slider { background:linear-gradient(135deg,var(--brand),var(--brand-2)); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ---- чипы «период» для отчётов ---- */
.per-chip { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:12px; }
.per-chip button { flex:1; min-width:60px; border:1.5px solid var(--line); background:#fff; border-radius:20px; padding:7px 4px; font-size:12px; font-weight:700; color:var(--muted); cursor:pointer; }
.per-chip button.on { background:linear-gradient(135deg,var(--brand),var(--brand-2)); color:#fff; border-color:transparent; box-shadow:0 6px 14px rgba(124,77,255,.3); }
.bar { height:8px; border-radius:6px; background:#efeafc; overflow:hidden; margin-top:6px; }
.bar > i { display:block; height:100%; border-radius:6px; background:linear-gradient(90deg,var(--brand),var(--brand-2)); }

.menu-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:6px; }
.menu-card { background:var(--card); border-radius:var(--radius); box-shadow:var(--shadow); padding:18px 12px; text-align:center; cursor:pointer; }
.menu-card .m-ic { font-size:26px; margin-bottom:8px; }
.menu-card b { display:block; font-size:14px; }
.menu-card span { display:block; font-size:11.5px; color:var(--muted); margin-top:4px; }

.back-row { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.back-row button { background:none; border:none; color:var(--brand); font-size:15px; font-weight:700; cursor:pointer; padding:6px 0; }

/* ---- нижнее меню (таббар) ---- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: stretch;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px rgba(60,40,140,.08);
  padding: 6px 6px calc(10px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 7px 2px; border-radius: 14px;
  font-family: inherit; font-size: 10px; font-weight: 700; color: var(--muted);
  letter-spacing: .2px;
}
.tab .tab-ic { font-size: 21px; line-height: 1; opacity: .85; transition: transform .15s ease; }
.tab:active .tab-ic { transform: scale(.9); }
.tab.active {
  color: var(--brand);
  background: linear-gradient(135deg, rgba(124,77,255,.10), rgba(176,107,255,.10));
}
.tab.active .tab-ic {
  color: var(--brand);
  opacity: 1;
  filter: drop-shadow(0 3px 8px rgba(124,77,255,.45));
}
/* ---- экран визита ---- */
.chip.in_progress { background: #ede6ff; color: var(--brand); }
.visit-row {
  display: flex; align-items: center; gap: 10px;
  background: #faf9fe; border-radius: 14px; padding: 10px 12px; margin-top: 8px;
}
.visit-row-main { flex: 1; min-width: 0; font-size: 14px; }
.visit-row-main select { width: 100%; }
.visit-row input.qty { width: 68px; text-align: right; }
.visit-row input.price { width: 82px; text-align: right; }
.btn-mini { padding: 8px 10px; font-size: 12px; width: auto; margin: 0; border-radius: 10px; }
.visit-total {
  margin-top: 14px; padding: 12px 14px;
  background: #faf9fe; border-radius: 14px;
  font-size: 13px;
}
.visit-total div { display: flex; justify-content: space-between; padding: 3px 0; }
.visit-total .grand {
  margin-top: 6px; padding-top: 8px;
  border-top: 1px solid var(--line); font-size: 15px;
}
.visit-total .grand b { color: var(--brand); }

/* ---------------------------------------------------------------- photos */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.photo-thumb { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: #eceaf5; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .rm {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border: none; border-radius: 50%;
  background: rgba(17,17,25,.72); color: #fff; font-size: 13px; line-height: 22px; cursor: pointer;
}
.photo-empty { font-size: 13px; color: var(--muted); padding: 10px 0; }

/* ---------------------------------------------------------------- day hint */
.hint { font-size: 13px; font-weight: 700; padding: 8px 10px; border-radius: 10px; }
.hint.ok { background: #d9f7e8; color: #0b925f; }
.hint.warn { background: #ffdddd; color: #cf2f2f; }
.section-title small.ghost { background: #eceaf5; color: var(--muted); margin-left: 6px; }
