:root {
  --bg: #e8e0d4;
  --device: #f7f3ec;
  --surface: #fffcf7;
  --ink: #14221f;
  --muted: #6b736f;
  --line: rgba(20, 34, 31, 0.08);
  --moss: #0f3d3a;
  --sage: #1f6f68;
  --mint: #d7efe8;
  --gold: #c4a574;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 20px 50px rgba(20, 34, 31, 0.12);
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Manrope, ui-sans-serif, system-ui;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #f4ead8, transparent 50%),
    radial-gradient(900px 500px at 100% 0%, #cfe8e2, transparent 45%),
    var(--bg);
}

.app-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.device {
  width: min(430px, 100%);
  height: min(920px, calc(100dvh - 32px));
  background: var(--device);
  border-radius: 40px;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,255,255,0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  position: relative;
  z-index: 5;
}
.status-notch {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  width: 118px;
  height: 22px;
  background: #0b1f1d;
  border-radius: 16px;
}
.status-icons { opacity: 0.7; font-size: 11px; }

.device-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.screen {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 18px 96px;
  -webkit-overflow-scrolling: touch;
}
.screen.no-tab {
  padding-bottom: 24px;
}

.login-hero {
  background: linear-gradient(160deg, var(--moss), #1b5c56 55%, #c4a574);
  color: white;
  border-radius: 28px;
  padding: 28px 22px 26px;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
}
.login-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(20, 34, 31, 0.04);
}

.field {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 14px 14px;
  font: inherit;
  color: var(--ink);
  outline: none;
}
.remember {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.remember input {
  width: 18px;
  height: 18px;
  accent-color: var(--moss);
}

.btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  border-radius: 16px;
  padding: 14px 16px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--moss); color: #fff; }
.btn-ghost { background: var(--mint); color: var(--moss); }
.btn-soft { background: #efe8dc; color: var(--ink); }
.btn-danger { background: #fde8e6; color: var(--danger); }
.btn-block { width: 100%; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--mint);
  color: var(--moss);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 12px;
}
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -0.03em; }

.icon-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(20,34,31,0.06);
}

.tabbar {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  background: rgba(255,252,247,0.88);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 22px;
  display: grid;
  gap: 4px;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
}
.tabbar.cols-2 { grid-template-columns: repeat(2, 1fr); }
.tabbar.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tabbar.cols-4 { grid-template-columns: repeat(4, 1fr); }
.tabbar.cols-5 { grid-template-columns: repeat(5, 1fr); }
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 16px;
  cursor: pointer;
}
.tab.active { color: var(--moss); background: var(--mint); }
.tab svg { width: 18px; height: 18px; }

.stat {
  padding: 16px;
}
.stat .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 22px; font-weight: 800; letter-spacing: -0.04em; margin-top: 4px; }

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--moss);
  background: var(--mint);
  flex-shrink: 0;
}
.meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-head, .cal-day {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
}
.cal-head { color: var(--muted); padding-bottom: 6px; }
.cal-day {
  height: 40px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.cal-day.muted { color: #b7b2a8; }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--gold); }
.cal-day.selected { background: var(--moss); color: #fff; }
.cal-day.has-apt::after {
  content: "";
  display: block;
  width: 5px;
  height: 5px;
  margin: 2px auto 0;
  border-radius: 50%;
  background: var(--gold);
}
.cal-day.selected.has-apt::after { background: #fff; }

.badge {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
}
.badge-wait { background: #fef3c7; color: #92400e; }
.badge-done { background: #dcfce7; color: #166534; }
.badge-cancel { background: #fee2e2; color: #991b1b; }
.badge-pending { background: #e0e7ff; color: #3730a3; }
.badge-warn { background: #fff1f2; color: #be123c; }

.alert-warn {
  background: #fff1f2;
  color: #9f1239;
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 31, 29, 0.45);
  z-index: 40;
  display: flex;
  align-items: flex-end;
}
.sheet {
  width: 100%;
  max-height: 88%;
  overflow: auto;
  background: var(--device);
  border-radius: 28px 28px 0 0;
  padding: 10px 18px 24px;
}
.sheet-handle {
  width: 42px;
  height: 5px;
  border-radius: 99px;
  background: #d9d2c6;
  margin: 6px auto 12px;
}

.toggle {
  width: 44px;
  height: 26px;
  border-radius: 99px;
  border: 0;
  background: #d9d2c6;
  position: relative;
  cursor: pointer;
}
.toggle.on { background: var(--sage); }
.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s ease;
}
.toggle.on::after { left: 21px; }

.hours-row, .perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.empty {
  text-align: center;
  padding: 28px 12px;
  color: var(--muted);
}

.lbl {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  margin: 14px 0 6px;
}

.seg {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  background: #efe8dc;
  padding: 6px;
  border-radius: 16px;
}
.seg button {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  padding: 10px 4px;
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
}
.seg button.on {
  background: #fff;
  color: var(--moss);
  box-shadow: 0 4px 12px rgba(20,34,31,0.08);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.chip-btn.on {
  background: var(--moss);
  color: #fff;
  border-color: var(--moss);
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}
.time-slot {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 8px 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.15;
}
.time-slot small {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.75;
}
.time-slot.on {
  background: var(--moss);
  color: #fff;
  border-color: var(--moss);
}
.time-slot.on small { opacity: 0.9; }
.time-slot.ok {
  background: #eef8f4;
  border-color: rgba(31, 111, 104, 0.25);
}
.time-slot.full {
  background: #fde8e6;
  color: var(--danger);
  cursor: not-allowed;
  opacity: 0.7;
}
.time-slot:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.search {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px 12px 40px;
  font: inherit;
  margin-bottom: 12px;
  outline: none;
}
.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.toast {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 92px;
  background: var(--moss);
  color: #fff;
  text-align: center;
  padding: 12px;
  border-radius: 14px;
  font-weight: 700;
  z-index: 50;
  animation: pop 0.25s ease;
}
@keyframes pop {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.hub-card {
  text-align: left;
  width: 100%;
  padding: 16px;
}

.field-area {
  width: 100%;
  min-height: 96px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  font: inherit;
  color: var(--ink);
  outline: none;
  resize: vertical;
}
.field-area:focus { border-color: var(--sage); box-shadow: 0 0 0 4px rgba(31, 111, 104, 0.12); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.photo-item, .photo-add {
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: #efe8dc;
}
.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-add {
  border: 1.5px dashed rgba(20, 34, 31, 0.2);
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  color: var(--sage);
  cursor: pointer;
}
.photo-x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 34, 31, 0.72);
  color: #fff;
  font-size: 14px;
  line-height: 22px;
  cursor: pointer;
}
.file-hidden { display: none; }

@media (max-width: 480px) {
  .app-shell { padding: 0; }
  .device {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
  .status-notch { display: none; }
}
