:root {
  color-scheme: light;
  --ink: #2f3934;
  --muted: #718078;
  --paper: #fffdf9;
  --mist: #f8f4f0;
  --panel: rgba(255, 253, 249, 0.88);
  --line: rgba(126, 94, 98, 0.18);
  --dusty: #c58f98;
  --dusty-deep: #9f6871;
  --sage: #91aa92;
  --lavender: #b6a7c8;
  --clay: #c89b75;
  --shadow: 0 24px 70px rgba(94, 76, 70, 0.12);
  font-family: Inter, "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  letter-spacing: 0;
  background: #f8f3ef;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(197, 143, 152, 0.12), transparent 360px),
    linear-gradient(90deg, rgba(145, 170, 146, 0.08), transparent 44%),
    #f8f3ef;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid rgba(159, 104, 113, 0.28);
  outline-offset: 3px;
}

.admin-shell {
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 48px;
}

.admin-top,
.admin-middle,
.admin-bottom {
  border: 1px solid var(--line);
  border-radius: 28px 8px 28px 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.admin-top {
  padding: 14px;
}

.admin-middle,
.admin-bottom {
  margin-top: 18px;
  padding: 24px;
}

.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
}

.admin-brand {
  display: inline-grid;
  grid-template-columns: 48px auto;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.admin-brand span {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  color: #fffdf9;
  background: var(--dusty-deep);
  font-weight: 950;
}

.admin-brand strong,
.admin-brand small {
  grid-column: 2;
}

.admin-brand small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.admin-actions,
.month-controls,
.crm-tools,
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.admin-actions time,
.admin-actions a,
.admin-actions button,
.month-controls button,
.schedule-form button,
.client-form button,
.profile-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 253, 249, 0.74);
  text-decoration: none;
  font-weight: 900;
}

.admin-actions button,
.schedule-form button,
.client-form button {
  color: #fffdf9;
  border-color: transparent;
  background: var(--dusty-deep);
  box-shadow: 0 16px 38px rgba(159, 104, 113, 0.16);
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  gap: 18px;
  align-items: end;
  padding: 48px 6px 8px;
}

.overview-copy {
  max-width: 860px;
}

.eyebrow {
  margin: 0;
  color: var(--dusty-deep);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.admin-title {
  margin-top: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
  font-weight: 650;
  line-height: 1.08;
}

.overview-copy p:not(.eyebrow),
.today-focus small,
.client-profile p,
.form-feedback,
.event-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.overview-copy p:not(.eyebrow) {
  max-width: 700px;
  font-size: 17px;
}

.today-focus {
  min-height: 184px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 24px;
  border: 1px solid rgba(159, 104, 113, 0.2);
  border-radius: 8px 32px 8px 32px;
  background:
    linear-gradient(140deg, rgba(197, 143, 152, 0.16), transparent 64%),
    rgba(255, 253, 249, 0.7);
}

.today-focus span {
  color: var(--clay);
  font-weight: 950;
}

.today-focus strong {
  font-size: 34px;
  line-height: 1.05;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.metric-row article {
  min-height: 102px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px 22px 8px 22px;
  background: rgba(255, 253, 249, 0.64);
}

.metric-row span,
.schedule-form label,
.client-form label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.metric-row strong {
  font-size: 36px;
  line-height: 1;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 8px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  line-height: 1.1;
}

.month-controls strong {
  min-width: 150px;
  text-align: center;
  font-size: 18px;
}

.calendar-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(320px, 0.62fr);
  gap: 16px;
}

.calendar-panel,
.day-panel,
.event-panel,
.client-list-panel,
.client-profile,
.client-form,
.schedule-form {
  border: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.68);
  box-shadow: 0 16px 42px rgba(94, 76, 70, 0.08);
}

.calendar-panel {
  overflow: hidden;
  border-radius: 24px 8px 24px 8px;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row {
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: rgba(159, 104, 113, 0.08);
}

.weekday-row span {
  min-height: 44px;
  display: grid;
  place-items: center;
  color: var(--dusty-deep);
  font-size: 13px;
  font-weight: 950;
}

.calendar-grid {
  gap: 1px;
  background: var(--line);
}

.calendar-day {
  min-height: 152px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  padding: 10px;
  background: rgba(255, 253, 249, 0.9);
}

.calendar-day.is-muted {
  color: rgba(47, 57, 52, 0.38);
  background: rgba(247, 244, 239, 0.76);
}

.calendar-day.is-selected {
  background: rgba(197, 143, 152, 0.12);
  box-shadow: inset 0 0 0 2px rgba(159, 104, 113, 0.22);
}

.calendar-day.is-today .date-button {
  color: #fffdf9;
  background: var(--sage);
}

.date-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 253, 249, 0.9);
  font-weight: 950;
}

.events {
  display: grid;
  gap: 6px;
  align-content: start;
}

.event-chip {
  width: 100%;
  border: 1px solid rgba(159, 104, 113, 0.18);
  border-radius: 12px 4px 12px 4px;
  padding: 7px 8px;
  color: var(--ink);
  background: rgba(255, 253, 249, 0.86);
  text-align: left;
}

.event-chip b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-chip b {
  color: var(--dusty-deep);
  font-size: 12px;
}

.event-chip span {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.35;
  overflow: visible;
  overflow-wrap: anywhere;
  white-space: normal;
}

.event-chip.is-active {
  border-color: transparent;
  color: #fffdf9;
  background: var(--dusty-deep);
}

.event-chip.is-active b {
  color: #fffdf9;
}

.calendar-day small {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.day-panel {
  position: sticky;
  top: 16px;
  min-height: 360px;
  padding: 20px;
  border-radius: 8px 28px 8px 28px;
}

.day-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.day-heading h3,
.event-panel h3,
.client-profile h3,
.client-form h3 {
  margin: 6px 0 0;
  font-size: 24px;
  line-height: 1.18;
}

.day-heading span {
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--dusty-deep);
  background: rgba(197, 143, 152, 0.12);
  font-size: 13px;
  font-weight: 950;
}

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

.day-item {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 18px 6px 18px 6px;
  padding: 12px;
  background: rgba(255, 253, 249, 0.72);
}

.day-item time {
  color: var(--dusty-deep);
  font-weight: 950;
}

.day-item button {
  justify-self: start;
  margin-top: 8px;
  border: 0;
  border-radius: 999px;
  padding: 7px 10px;
  color: #fffdf9;
  background: var(--sage);
  font-size: 13px;
  font-weight: 900;
}

.schedule-tools {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 16px;
  margin-top: 16px;
}

.schedule-form,
.client-form {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 8px 26px 8px 26px;
}

.schedule-form {
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 253, 249, 0.9);
}

.event-panel {
  padding: 20px;
  border-radius: 26px 8px 26px 8px;
}

dl {
  display: grid;
  gap: 1px;
  overflow: hidden;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 16px 6px 16px 6px;
  background: var(--line);
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  padding: 13px;
  background: rgba(255, 253, 249, 0.88);
}

dt {
  color: var(--muted);
  font-weight: 900;
}

dd {
  margin: 0;
  text-align: right;
  font-weight: 950;
}

.crm-tools input,
.crm-tools select {
  min-width: 220px;
}

.client-workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.85fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.client-list-panel {
  padding: 12px;
  border-radius: 24px 8px 24px 8px;
}

.client-list {
  display: grid;
  gap: 10px;
}

.client-card {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 18px 6px 18px 6px;
  padding: 14px;
  color: var(--ink);
  background: rgba(255, 253, 249, 0.78);
  text-align: left;
}

.client-card.is-active {
  border-color: rgba(159, 104, 113, 0.38);
  background: rgba(197, 143, 152, 0.12);
}

.client-card strong,
.client-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-card strong {
  font-size: 18px;
}

.client-card small {
  color: var(--muted);
  font-weight: 850;
}

.status-pill {
  align-self: start;
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--dusty-deep);
  background: rgba(197, 143, 152, 0.12);
  font-size: 12px;
  font-weight: 950;
}

.status-pill.is-active {
  color: #4f6d50;
  background: rgba(145, 170, 146, 0.16);
}

.status-pill.is-follow {
  color: #9b714c;
  background: rgba(200, 155, 117, 0.18);
}

.client-profile {
  padding: 20px;
  border-radius: 8px 28px 8px 28px;
}

.profile-actions {
  justify-content: flex-start;
}

.profile-actions button {
  min-height: 38px;
  font-size: 13px;
}

.client-form {
  align-content: start;
}

.empty-state {
  margin: 0;
  border: 1px dashed rgba(159, 104, 113, 0.26);
  border-radius: 18px 6px 18px 6px;
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 253, 249, 0.55);
  line-height: 1.7;
}

button:hover,
a:hover {
  transform: translateY(-1px);
}

button,
a {
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

@media (max-width: 1180px) {
  .overview-layout,
  .calendar-workspace,
  .schedule-tools,
  .client-workspace {
    grid-template-columns: 1fr;
  }

  .metric-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .schedule-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .day-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .admin-shell {
    width: min(100% - 24px, 1540px);
    padding-top: 12px;
  }

  .admin-top,
  .admin-middle,
  .admin-bottom,
  .calendar-panel,
  .day-panel,
  .event-panel,
  .client-list-panel,
  .client-profile,
  .client-form,
  .schedule-form {
    border-radius: 18px;
  }

  .admin-nav,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-actions,
  .month-controls,
  .crm-tools {
    justify-content: flex-start;
  }

  .admin-title {
    font-size: 32px;
  }

  .section-head h2 {
    font-size: 28px;
  }

  .overview-layout {
    padding-top: 28px;
  }

  .metric-row,
  .schedule-form {
    grid-template-columns: 1fr;
  }

  .calendar-panel {
    overflow-x: auto;
  }

  .weekday-row,
  .calendar-grid {
    min-width: 720px;
  }

  .crm-tools input,
  .crm-tools select {
    min-width: 100%;
  }

  dl div {
    display: grid;
    gap: 5px;
  }

  dd {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
