:root {
  --bg: #fff7f3;
  --paper: #fff9f5;
  --paper-strong: #ffffff;
  --ink: #2f2825;
  --muted: #82736c;
  --line: rgba(72, 50, 42, 0.13);
  --rose: #d99b8d;
  --cocoa: #7c5f55;
  --sage: #8ca58f;
  --teal: #2da6a1;
  --gold: #c79a54;
  --danger: #b45454;
  --shadow: 0 18px 48px rgba(84, 56, 45, 0.14);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(217, 155, 141, 0.18), rgba(255, 250, 246, 0.82) 42%, rgba(45, 166, 161, 0.12)),
    var(--bg);
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: max(12px, env(safe-area-inset-top)) 0 max(18px, env(safe-area-inset-bottom));
}

.app-header {
  padding: 4px 16px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 249, 245, 0.72);
  backdrop-filter: blur(16px);
}

.section-title span,
.calendar-head span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-header h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0;
}

.app-main {
  display: grid;
  gap: 0;
  min-width: 0;
}

.owner-view-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 249, 245, 0.72);
  backdrop-filter: blur(16px);
}

.owner-view-switch[hidden] {
  display: none;
}

.view-button {
  min-width: 0;
  min-height: 40px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
  cursor: pointer;
  font-weight: 900;
  white-space: nowrap;
}

.view-button.active {
  color: #ffffff;
  background: var(--ink);
  box-shadow: 0 10px 26px rgba(84, 56, 45, 0.14);
}

.calendar-card,
.soft-panel,
.owner-panel {
  min-width: 0;
  max-width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 250, 246, 0.7);
  box-shadow: none;
  backdrop-filter: blur(14px);
}

.calendar-card {
  padding: 14px 16px 16px;
}

.soft-panel,
.owner-panel {
  padding: 16px;
}

.section-title,
.calendar-head,
.panel-head,
.booking-item-header,
.admin-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.section-title strong {
  color: var(--cocoa);
  font-size: 13px;
}

.service-strip,
.date-strip {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  padding: 10px 0 8px;
  cursor: grab;
  scrollbar-color: rgba(47, 40, 37, 0.28) rgba(255, 255, 255, 0.42);
  scrollbar-width: thin;
}

.service-strip.dragging,
.date-strip.dragging {
  cursor: grabbing;
  scroll-behavior: auto;
  user-select: none;
}

.service-card,
.date-button,
.time-button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper-strong);
  cursor: pointer;
}

.service-card {
  min-width: 142px;
  max-width: 170px;
  padding: 10px;
  text-align: left;
}

.service-card h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.service-card p {
  display: none;
}

.service-card.active {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--cocoa), #a87868);
}

.service-meta {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
}

.service-meta span {
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.service-card.active .service-meta span {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
}

.calendar-head {
  align-items: center;
  margin-top: 14px;
}

.calendar-head h2,
.panel-head h2,
.admin-item h3,
.booking-item h3 {
  margin: 2px 0 0;
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: 0;
}

.calendar-head svg {
  color: var(--gold);
}

.date-button {
  width: 76px;
  min-height: 88px;
  padding: 10px 7px;
  text-align: center;
}

.date-button strong,
.date-button span {
  display: block;
}

.date-button strong {
  font-size: 31px;
  line-height: 1;
}

.date-button span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.date-button small {
  display: block;
  margin-top: 7px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.date-button.active {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(160deg, var(--teal), #246d6b);
}

.date-button.active span,
.date-button.active small {
  color: rgba(255, 255, 255, 0.82);
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-height: 50px;
  padding-top: 8px;
}

.time-button {
  min-width: 0;
  min-height: 46px;
  padding: 8px 6px;
  font-size: 15px;
  font-weight: 900;
}

.time-button.active {
  color: #ffffff;
  border-color: transparent;
  background: var(--ink);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 14px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
  text-align: center;
  font-size: 14px;
}

.note-field,
.admin-form label {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  background: var(--paper-strong);
  padding: 10px 11px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 166, 161, 0.16);
}

.booking-summary {
  position: sticky;
  bottom: max(8px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 12px -4px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 32px rgba(84, 56, 45, 0.1);
  z-index: 3;
}

.booking-summary span,
.booking-summary strong {
  display: block;
}

.booking-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.booking-summary strong {
  margin-top: 2px;
  font-size: 19px;
}

.primary-button,
.secondary-button,
.ghost-button,
.small-button,
.tab,
.status-button {
  min-height: 42px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.primary-button {
  padding: 0 14px;
  color: #ffffff;
  background: var(--ink);
}

.secondary-button {
  width: 100%;
  padding: 0 12px;
  color: #ffffff;
  background: var(--teal);
}

.ghost-button,
.small-button {
  padding: 0 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.booking-list,
.admin-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.booking-item,
.admin-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
}

.booking-item p,
.admin-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.status-pill {
  flex: 0 0 auto;
  padding: 5px 7px;
  border-radius: 999px;
  color: var(--cocoa);
  background: #f3e5dc;
  font-size: 11px;
  font-weight: 900;
}

.status-cancelled {
  color: var(--danger);
}

.client-link {
  color: var(--teal);
  font-weight: 900;
  text-decoration: none;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 10px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(124, 95, 85, 0.08);
}

.tab {
  min-height: 36px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.tab.active {
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: 0 8px 22px rgba(84, 56, 45, 0.08);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.admin-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.service-options {
  align-items: end;
}

.checkbox-label {
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
}

.checkbox-label input {
  width: 18px;
  height: 18px;
}

.form-actions,
.admin-actions,
.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.form-actions .secondary-button {
  flex: 1 1 160px;
}

.status-button {
  min-height: 34px;
  padding: 0 9px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.status-button.active {
  color: #ffffff;
  border-color: transparent;
  background: var(--ink);
}

.small-button.danger {
  color: var(--danger);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(420px, calc(100% - 24px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--ink);
  box-shadow: var(--shadow);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  visibility: hidden;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
  visibility: visible;
}

.toast.error {
  background: var(--danger);
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

@media (max-width: 380px) {
  .app-header h1 {
    font-size: 24px;
  }

  .time-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .booking-summary {
    grid-template-columns: 1fr;
  }

  .primary-button {
    width: 100%;
  }
}

@media (hover: none) and (pointer: coarse) {
  .service-strip,
  .date-strip {
    scrollbar-width: none;
  }

  .service-strip::-webkit-scrollbar,
  .date-strip::-webkit-scrollbar {
    display: none;
  }
}

@media (hover: hover) and (pointer: fine) {
  .service-strip::-webkit-scrollbar,
  .date-strip::-webkit-scrollbar {
    height: 9px;
  }

  .service-strip::-webkit-scrollbar-track,
  .date-strip::-webkit-scrollbar-track {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.44);
  }

  .service-strip::-webkit-scrollbar-thumb,
  .date-strip::-webkit-scrollbar-thumb {
    border: 2px solid rgba(255, 255, 255, 0.44);
    border-radius: 999px;
    background: rgba(47, 40, 37, 0.28);
  }
}
