:root {
  --teal: #0f766e;
  --teal-dark: #115e59;
  --ink: #101828;
  --muted: #667085;
  --line: #e5e7eb;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --warn: #fef3c7;
  --mine: #d1fae5;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  max-width: 720px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 14px 84px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 0 14px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.35;
}

.muted,
#modeText {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 4px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.hidden {
  display: none !important;
}

label {
  display: block;
  color: #344054;
  font-size: 13px;
  margin-top: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 0 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 82px;
  padding-top: 10px;
  resize: vertical;
}

.primary,
.secondary {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 700;
}

.primary {
  background: var(--teal);
  color: #fff;
}

.primary:active {
  background: var(--teal-dark);
}

.secondary {
  background: #eef4f3;
  color: var(--teal);
}

.compact {
  min-width: 72px;
}

.full {
  width: 100%;
  margin-top: 16px;
}

.date-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.date-chip {
  flex: 0 0 72px;
  min-height: 56px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #344054;
  text-align: center;
  padding: 8px 4px;
}

.date-chip.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.date-chip strong {
  display: block;
  font-size: 15px;
}

.date-chip span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.78;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
  margin: 2px 0 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid #d0d5dd;
  margin-right: 5px;
}

.dot.free {
  background: #fff;
}

.dot.booked {
  background: var(--warn);
}

.dot.mine {
  background: var(--mine);
}

.dot.past {
  background: #e5e7eb;
}

.timeline {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.slot {
  min-height: 46px;
  display: flex;
  border-bottom: 1px solid #eef2f6;
}

.slot:last-child {
  border-bottom: 0;
}

.slot-time {
  width: 66px;
  padding-top: 13px;
  background: #f9fafb;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.slot-body {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
}

.slot.booked .slot-body {
  background: var(--warn);
}

.slot.mine .slot-body {
  background: var(--mine);
}

.slot.past .slot-body,
.slot.past .slot-time {
  background: #f2f4f7;
  color: #98a2b3;
}

.booking-name {
  font-size: 14px;
  font-weight: 800;
}

.booking-detail {
  color: #475467;
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-text {
  color: #98a2b3;
  font-size: 12px;
  padding-top: 5px;
}

.profile-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

.item-title {
  font-weight: 800;
  line-height: 1.4;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.danger {
  border: 0;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  min-height: 38px;
  padding: 0 12px;
}

.section-title {
  margin: 18px 0 10px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  align-items: flex-end;
}

.modal-card {
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  margin: 0 auto;
  overflow-y: auto;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 16px 16px 0 0;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #f2f4f7;
  color: #344054;
  font-size: 24px;
  line-height: 1;
}

.summary {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: #f0fdfa;
  color: #134e4a;
  line-height: 1.6;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 40;
  transform: translateX(-50%);
  max-width: min(86vw, 360px);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 14px;
  text-align: center;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 10;
  width: min(720px, 100%);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.tab {
  height: 48px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  color: var(--teal);
}

@media (min-width: 760px) {
  .app-shell {
    padding-top: 24px;
  }

  .modal {
    align-items: center;
  }

  .modal-card {
    border-radius: 14px;
  }
}
