:root {
  --bg: #14151a;
  --bg-elevated: #1d1f25;
  --surface-2: #262933;
  --border: #33363f;
  --text: #f3f1ea;
  --text-dim: #9a9da8;
  --accent: #3ecf8e;      /* mint green — основной CTA, в тон бренду */
  --accent-2: #f5b942;    /* chalk yellow — запланировано */
  --success: #3ecf8e;     /* проведено (тот же зелёный — логично) */
  --danger: #ff4b3e;      /* не пришёл / алерт */
  --muted: #5b5e68;       /* отменено — приглушено */
  --radius: 14px;
}

* { box-sizing: border-box; }

button {
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

.font-display {
  font-family: 'Oswald', 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.mono {
  font-family: 'IBM Plex Mono', monospace;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 76px;
}

/* ---------- HEADER / DAY PLATES (signature element) ---------- */

.topbar {
  padding: 18px 16px 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.topbar h1 {
  font-size: 22px;
  margin: 0;
  font-weight: 600;
}

.topbar .month {
  color: var(--text-dim);
  font-size: 13px;
}

.month-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.logout-btn:hover { color: var(--danger); }

.month-sheet { min-height: 420px; }

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.month-nav button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}

.month-title {
  font-size: 16px;
  color: var(--text);
}

.mgrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.mgrid.dow-row { margin-bottom: 8px; }

.dow-cell {
  color: var(--text-dim);
  font-size: 11px;
  text-align: center;
  text-transform: uppercase;
}

.mcell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
}

.mcell.empty { cursor: default; }
.mcell.today { border: 1px solid var(--accent-2); color: var(--accent-2); }
.mcell.sel { background: var(--accent); color: #fff; font-weight: 600; }

.day-strip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 4px 16px 18px;
  overflow-x: auto;
}

.day-connector {
  flex: 0 0 8px;
  width: 8px;
  height: 2px;
  background: var(--border);
}

.day-plate {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.day-plate .dow {
  position: absolute;
  top: -18px;
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.day-plate.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: scale(1.12);
}

.day-plate.today:not(.active) {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

/* ---------- AGENDA ---------- */

.agenda {
  flex: 1;
  padding: 4px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state {
  margin-top: 60px;
  text-align: center;
  color: var(--text-dim);
}

.empty-state .big {
  font-family: 'Oswald', sans-serif;
  font-size: 20px;
  color: var(--text);
  margin-bottom: 6px;
}

.event-card {
  display: flex;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  align-items: center;
  cursor: pointer;
}

.event-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px;
  font-weight: 600;
  min-width: 48px;
  color: var(--text);
}

.event-time .dur {
  display: block;
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 400;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.status-planned { background: var(--accent-2); }
.status-done { background: var(--success); }
.status-cancelled { background: var(--muted); }
.status-no_show { background: var(--danger); }

.event-body {
  flex: 1;
  min-width: 0;
}

.event-group {
  background: var(--bg-elevated);
  border: 1px solid var(--accent-2);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.event-group-time {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-2);
  margin-bottom: 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.event-group-time .dur {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 400;
  text-transform: none;
  font-family: 'Inter', sans-serif;
}

.event-group-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-group-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 10px;
  cursor: pointer;
}

.event-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  flex: 0 0 auto;
  white-space: nowrap;
}

.event-name {
  font-size: 15px;
  font-weight: 600;
}

.session-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-2);
  background: rgba(245, 185, 66, 0.12);
  border-radius: 6px;
  padding: 2px 6px;
  vertical-align: middle;
}

.event-note {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- FAB ---------- */

.fab {
  position: fixed;
  bottom: calc(84px + env(safe-area-inset-bottom));
  right: 50%;
  transform: translateX(190px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(62, 207, 142, 0.4);
  cursor: pointer;
}

@media (max-width: 480px) {
  .fab { right: 20px; transform: none; }
}

/* ---------- BOTTOM NAV ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  cursor: pointer;
}

.nav-btn .icon { font-size: 20px; }
.nav-btn.active { color: var(--accent); }

/* ---------- CLIENTS ---------- */

.search-bar {
  margin: 4px 16px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  width: calc(100% - 32px);
}
.search-bar::placeholder { color: var(--text-dim); }

.client-list {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.client-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
}

.client-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent-2);
  font-family: 'Oswald', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex: 0 0 auto;
}

.client-name { font-size: 15px; font-weight: 600; }
.client-phone { font-size: 12px; color: var(--text-dim); }

/* ---------- MODAL ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: flex-end;
  z-index: 50;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-elevated);
  border-radius: 20px 20px 0 0;
  padding: 20px 18px max(20px, env(safe-area-inset-bottom));
  max-height: 88vh;
  overflow-y: auto;
}

.modal-sheet h2 {
  font-family: 'Oswald', sans-serif;
  font-size: 18px;
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.field input, .field select, .field textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.field textarea { resize: vertical; min-height: 60px; }

.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.status-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
}
.pill.active { border-color: var(--accent); color: var(--text); background: rgba(62,207,142,0.15); }

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 6px;
  cursor: pointer;
}

.paid-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 6px;
  cursor: pointer;
}

.paid-checkbox input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

.btn-secondary {
  width: 100%;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  margin-top: 8px;
  cursor: pointer;
}

.btn-danger-text {
  width: 100%;
  background: transparent;
  color: var(--danger);
  border: none;
  padding: 10px;
  font-size: 13px;
  margin-top: 4px;
  cursor: pointer;
}

.close-x {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface-2);
  border: none;
  color: var(--text-dim);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}

.modal-sheet { position: relative; }

/* ---------- CABINET ---------- */

.push-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 16px 16px;
  padding: 14px;
  border-radius: var(--radius);
  cursor: default;
}

.push-card.push-off {
  background: rgba(245, 185, 66, 0.1);
  border: 1px solid rgba(245, 185, 66, 0.3);
  cursor: pointer;
}

.push-card.push-on {
  background: rgba(62, 207, 142, 0.1);
  border: 1px solid rgba(62, 207, 142, 0.3);
}

.push-icon { font-size: 22px; flex: 0 0 auto; }
.push-title { font-size: 14px; font-weight: 600; }
.push-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.commission-card {
  border-color: rgba(62, 207, 142, 0.3);
}

.commission-setting {
  margin: 18px 16px 0;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.commission-setting label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.commission-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.commission-input-row input {
  width: 80px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 15px;
  font-family: 'IBM Plex Mono', monospace;
}

.commission-input-row span {
  color: var(--text-dim);
  font-size: 15px;
}

.period-pills {
  display: flex;
  gap: 6px;
  padding: 0 16px 16px;
}

.period-pills .pill { flex: 1; text-align: center; min-width: 0; padding: 8px 6px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cabinet-stats {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.stat-card.small { flex: 1; padding: 14px; }

.stat-row { display: flex; gap: 10px; }

.stat-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
}

.stat-card.small .stat-value { font-size: 20px; }

.stat-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}

.accent-text { color: var(--accent); }
.warn-text { color: var(--accent-2); }

.unpaid-section {
  padding: 22px 16px 0;
}

.unpaid-title {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.plans-section {
  padding: 22px 16px 16px;
}

.plans-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.plans-header .unpaid-title { margin-bottom: 0; }

.add-plan-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.plans-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
}

.plan-row-name { font-size: 15px; font-weight: 600; }
.plan-row-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.plan-row-price { font-size: 15px; font-weight: 600; color: var(--accent); }

.small-empty {
  margin-top: 0;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  font-size: 13px;
}

.plan-info {
  font-size: 13px;
  color: var(--text-dim);
  margin: -8px 0 14px;
  min-height: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.plan-info-badge {
  background: rgba(245, 185, 66, 0.15);
  color: var(--accent-2);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
}

.plan-info-empty {
  color: var(--text-dim);
  font-style: italic;
}

.field-hint {
  font-size: 12px;
  color: var(--accent-2);
  margin: 4px 0 10px;
  min-height: 14px;
}

.plan-badge {
  font-size: 11px;
  color: var(--accent-2);
  background: rgba(245, 185, 66, 0.12);
  border-radius: 8px;
  padding: 4px 8px;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* ---------- FREE SLOTS ---------- */

.day-off-note {
  margin: 0 16px 14px;
  padding: 10px 14px;
  background: rgba(255, 75, 62, 0.08);
  border: 1px solid rgba(255, 75, 62, 0.25);
  border-radius: 10px;
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}

.schedule-section {
  margin: 18px 16px 0;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
}

.schedule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.schedule-day-name {
  font-size: 13px;
  color: var(--text);
  flex: 0 0 100px;
}

.schedule-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: flex-end;
}

.schedule-controls.is-off { opacity: 0.5; }

.schedule-controls input[type="time"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--text);
  font-size: 12px;
  font-family: 'IBM Plex Mono', monospace;
  width: 84px;
}

.schedule-controls span { color: var(--text-dim); font-size: 12px; }

.sched-off-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
}

.sched-off-toggle input {
  width: 14px;
  height: 14px;
  accent-color: var(--danger);
}

.free-slots-toggle {
  padding: 0 16px 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
}

.toggle-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.free-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 12px;
}

.free-slot-time { color: var(--text-dim); font-weight: 600; }
.free-slot-label { text-transform: uppercase; letter-spacing: 0.05em; font-size: 10px; }

/* ---------- WARN BADGES / STATS ---------- */

.plan-badge-warn {
  color: var(--danger);
  background: rgba(255, 75, 62, 0.12);
}

.attendance-stats {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 16px;
}

.attendance-warn {
  color: var(--danger);
  background: rgba(255, 75, 62, 0.1);
}

/* ---------- MEASUREMENTS ---------- */

.measurements-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.measurement-row {
  position: relative;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 32px 10px 12px;
}

.measurement-date {
  font-size: 12px;
  color: var(--accent-2);
  font-weight: 600;
  margin-bottom: 4px;
}

.measurement-values {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
}

.measurement-note {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.measurement-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 4px;
}

.auth-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
}

.auth-screen .brand {
  font-family: 'Oswald', sans-serif;
  font-size: 30px;
  text-align: center;
  margin-bottom: 6px;
}
.auth-screen .brand span { color: var(--accent); }

.auth-screen .tagline {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 32px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.auth-tabs button {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
}
.auth-tabs button.active { color: var(--text); border-color: var(--accent); }

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
}

.password-wrap {
  position: relative;
  display: block;
}

.password-wrap input {
  padding-right: 44px;
  width: 100%;
}

.eye-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.eye-toggle:hover { color: var(--text); }

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.toast.show { opacity: 1; }
