:root {
  --bg: #faf8f9;
  --paper: #fff;
  --text: #1a1a1a;
  --muted: #8a7a82;
  --line: #ecdde5;
  --accent: #c73b7a;
  --accent-soft: #fff0f6;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(199, 59, 122, 0.1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 10px 24px;
  min-height: 100dvh;
}

.hidden { display: none !important; }

.app-banner {
  width: calc(100% + 20px);
  margin: 0 -10px 10px;
  padding: 0;
  background: #fff2b7;
  border-bottom: 1px solid rgba(20, 80, 50, 0.35);
}

.banner-bg {
  background: #fff2b7;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.banner-img {
  width: 100%;
  height: auto;
  height: 112px;
  object-fit: cover;
  object-position: center;
  display: block;
}

.top-bar {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 8px;
}

.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 9px;
  box-shadow: var(--shadow);
}

.stat-card span { display: block; color: var(--muted); font-size: 10px; }
.stat-card strong { color: var(--accent); font-size: 15px; }
.stat-card b { font-size: 13px; }

.top-subtitle {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.settings-btn { font-size: 18px; }

.month-btn {
  border: 1.5px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  font-family: inherit;
}

.icon-btn, .primary-btn, .secondary-btn, .danger-btn {
  border: none;
  font: inherit;
  cursor: pointer;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: var(--shadow);
  font-size: 22px;
  color: var(--accent);
}

.icon-btn.small { width: 32px; height: 32px; font-size: 18px; }

.primary-btn {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.secondary-btn {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.full-width { width: 100%; margin-bottom: 8px; }

.day-header-card {
  text-align: right;
  padding: 0 8px 8px;
}

.day-number-big {
  font-size: 64px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.hours-list {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 8px;
  box-shadow: var(--shadow);
}

.hour-row {
  display: grid;
  grid-template-columns: 48px 1fr 42px 72px;
  gap: 4px;
  align-items: center;
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
}

.hour-row.color-yellow { background: #fff8c9; }
.hour-row.color-purple { background: #f0e5ff; }
.hour-row.color-green { background: #e1f6df; }

.row-note {
  grid-column: 2 / -1;
  width: 100%;
  min-height: 30px;
  max-height: 92px;
  resize: vertical;
  border: 1px dashed var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  font: 12px/1.3 inherit;
  background: rgba(255,255,255,.7);
}

.row-note:focus { outline: 1px solid var(--accent); }

.color-picker { grid-column: 1; display: flex; justify-content: center; gap: 3px; }
.color-dot { width: 10px; height: 10px; border: 0; border-radius: 50%; padding: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.color-dot.none { background: #fff; }
.color-dot.yellow { background: #f4df54; }
.color-dot.purple { background: #ad78df; }
.color-dot.green { background: #6fc56a; }

.hour-row:has(.service-col.is-dual) {
  min-height: 78px;
  align-items: start;
  padding-top: 8px;
}

.hour-row:last-child { border-bottom: none; }

.time-col {
  display: flex;
  align-items: center;
  gap: 3px;
}

.hour-label {
  font-size: 15px;
  font-weight: 700;
  min-width: 16px;
  text-align: right;
}

.minutes-input {
  width: 28px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
  font-size: 12px;
  background: var(--accent-soft);
  padding: 0;
  -webkit-appearance: none;
}

.client-col { min-width: 0; }

.name-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 2px;
  padding-right: 32px;
}

.name-input, .phone-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--line);
  font-family: inherit;
  background: transparent;
  padding: 0 2px;
}

.name-input {
  height: 24px;
  font-size: 14px;
}

.phone-input {
  height: 20px;
  font-size: 12px;
  color: var(--muted);
}

.name-input:focus, .phone-input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.call-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--accent-soft);
  font-size: 14px;
  padding: 0;
}

.call-btn.hidden { display: none; }

.price-input {
  width: 42px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  font-family: inherit;
  background: var(--accent-soft);
  padding: 0;
  -webkit-appearance: none;
}

.service-col {
  width: 72px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.service-col.is-dual .service-select:first-child {
  height: 20px;
  font-size: 9px;
}

.service-dual {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.service-select {
  width: 72px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  font-family: inherit;
  background: var(--accent-soft);
  padding: 0 1px;
  -webkit-appearance: none;
  text-align: center;
  letter-spacing: -0.3px;
}

.dual-select {
  height: 28px;
  font-size: 9px;
}

.month-picker {
  border: none;
  border-radius: 18px 18px 0 0;
  position: fixed;
  inset: auto 0 0 0;
  top: auto;
  right: 0;
  left: 0;
  transform: none;
  width: calc(100% - 20px);
  max-width: 400px;
  padding: 0;
  margin: 0 auto;
}

.settings-dialog {
  border: none;
  border-radius: 18px 18px 0 0;
  position: fixed;
  inset: auto 0 0 0;
  top: auto;
  right: 0;
  left: 0;
  transform: none;
  width: calc(100% - 20px);
  max-width: 430px;
  max-height: 88dvh;
  padding: 0;
  margin: 0 auto;
}
.settings-dialog::backdrop { background: rgba(0,0,0,.4); }
.settings-inner { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto; }
.settings-head { display: flex; justify-content: space-between; align-items: start; }
.settings-head h3 { margin: 0; color: var(--accent); }
.settings-head p { margin: 3px 0 14px; color: var(--muted); font-size: 12px; }
.price-setting { display: grid; grid-template-columns: 1fr 90px; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.price-setting input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px; text-align: right; font: 600 14px inherit; background: var(--accent-soft); }
.backup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 8px; }
.import-label { text-align: center; font-size: 14px; }
.import-label input { display: none; }

@media (max-width: 380px) {
  #app { padding-left: 5px; padding-right: 5px; }
  .app-banner { width: calc(100% + 10px); margin-left: -5px; margin-right: -5px; }
  .hour-row { grid-template-columns: 44px minmax(0, 1fr) 42px 68px; gap: 3px; }
  .service-col, .service-select { width: 68px; }
  .top-bar { grid-template-columns: 34px minmax(0,1fr) auto; gap: 3px; }
  .top-actions { gap: 3px; }
  .icon-btn { width: 32px; height: 32px; }
  .month-btn { padding: 6px 7px; }
}

.month-picker::backdrop { background: rgba(0, 0, 0, 0.4); }
.picker-inner {
  width: 100%;
  max-width: 100%;
  padding: 18px 16px 24px;
  overflow: hidden;
}

.picker-head {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  margin-bottom: 12px;
}

.picker-head h3 {
  margin: 0;
  text-align: center;
  font-size: 18px;
  color: var(--accent);
}

.picker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.picker-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  max-width: 100%;
  margin-bottom: 12px;
}

.picker-empty { height: 40px; }

.picker-day {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}

.picker-day.today { border-color: var(--accent); color: var(--accent); }
.picker-day.selected { background: var(--accent); color: #fff; }

.picker-dot {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 8px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 1px 4px;
}

.overview-hint {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 10px;
}

.week-block { margin-bottom: 14px; }

.week-row-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin: 8px 0 6px;
}

.week-row-five {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.week-row-we {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

.day-col {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  padding: 8px 6px;
  min-height: 150px;
  text-align: left;
  font: inherit;
  box-shadow: var(--shadow);
  width: 100%;
}

.overview-grid.month .day-col { min-height: 100px; }
.overview-grid.month .day-col-body { max-height: 65px; font-size: 8px; }

.day-col.today { border-color: var(--accent); }
.day-col.active { background: var(--accent-soft); }

.day-col-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}

.day-col-head strong { font-size: 20px; color: var(--accent); }

.fill-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #f0e8ec;
  color: var(--muted);
}

.fill-badge.fill-low { background: var(--accent-soft); color: var(--accent); }
.fill-badge.fill-high { background: var(--accent); color: #fff; }

.day-col-body {
  font-size: 10px;
  line-height: 1.45;
  max-height: 200px;
  overflow-y: auto;
}

.slot-line { margin-bottom: 5px; word-break: break-word; }
.slot-line b { color: var(--muted); }
.slot-line i { font-style: normal; color: var(--accent); font-weight: 800; font-size: 9px; }
.slot-line em { font-style: normal; color: var(--muted); font-size: 9px; }

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 24px;
  background: #2a2030;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  text-align: center;
  z-index: 200;
}

.install-hint {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  background: #2a2030;
  color: #fff;
  border-radius: 14px;
  padding: 14px;
  z-index: 20;
}

.install-hint.hidden { display: none; }
.install-hint p { margin: 0 0 8px; font-size: 14px; }
.hint-small { font-size: 12px !important; opacity: 0.85; }
