:root {
  --cream: #F7F1EA;
  --ink: #2B2622;
  --ink-soft: #6B6058;
  --dusty-pink: #E8B4B8;
  --dusty-pink-deep: #D89AA0;
  --line: #E4D9CC;
  --white: #FFFFFF;
  --danger: #C4534E;
  --confirmed: #4A7A5C;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Noto Sans TC', -apple-system, sans-serif;
  background: var(--cream);
  color: var(--ink);
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 12px;
}
.admin-header .title { font-size: 18px; font-weight: 700; letter-spacing: 0.02em; }
.top-nav { display: flex; gap: 4px; }
.top-nav a {
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
}
.top-nav a.active, .top-nav a:hover { background: var(--cream); color: var(--ink); font-weight: 700; }

.date-nav { display: flex; align-items: center; gap: 8px; }
.date-nav input[type=date] {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
}
.icon-btn, .text-btn {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
}
.icon-btn:hover, .text-btn:hover { background: var(--cream); }

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: 16px;
  padding: 20px 24px;
  align-items: start;
}
.loading { padding: 40px; text-align: center; color: var(--ink-soft); }

.staff-col {
  background: var(--white);
  display: flex;
  flex-direction: column;
  min-width: 220px;
  border-radius: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
}
.staff-col .col-head {
  padding: 14px 16px;
  background: var(--white);
  border-bottom: 3px solid var(--staff-color, var(--dusty-pink));
  font-weight: 700;
}
.staff-col .col-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
}
.empty-note {
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
  margin: auto 0;
  padding: 20px 0;
}

.appt-card {
  background: var(--white);
  border-left: 4px solid var(--staff-color, var(--dusty-pink));
  border-radius: 4px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.appt-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.appt-card .time { font-weight: 700; font-size: 14px; }
.appt-card .service { font-size: 13px; margin-top: 2px; }
.appt-card .member { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.appt-card .status-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 6px;
}
.status-confirmed { background: #E4F0E7; color: var(--confirmed); }
.status-cancelled { background: #F5E1E0; color: var(--danger); text-decoration: line-through; }
.status-checked_in { background: #FFF3D6; color: #8A6A1F; }

.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(43,38,34,0.45);
  align-items: center; justify-content: center;
  z-index: 100;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: 8px;
  padding: 28px;
  width: 380px;
  max-width: 90vw;
}
.modal h3 { margin: 0 0 16px; }
.modal-body .field { margin-bottom: 14px; }
.modal-body label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.modal-body select, .modal-body input {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 4px; font-family: inherit;
}
.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.btn { padding: 10px 16px; border-radius: 4px; border: 1px solid var(--line); background: var(--white); cursor: pointer; font-size: 13px; }
.btn.primary { background: var(--ink); color: var(--white); border-color: var(--ink); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.ghost { background: transparent; }

@media (max-width: 680px) {
  .board { grid-auto-flow: row; grid-auto-columns: unset; grid-template-columns: 1fr; }
  .staff-col { min-width: unset; }
}

/* ---------- POS page ---------- */
.pos-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: calc(100vh - 65px);
}
.pos-sidebar {
  background: var(--white);
  border-right: 1px solid var(--line);
  padding: 20px;
}
.pos-sidebar input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  margin-bottom: 12px;
}
.member-row {
  padding: 12px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
}
.member-row:hover, .member-row.active { background: var(--cream); border-color: var(--line); }
.member-row .name { font-weight: 700; }
.member-row .phone { font-size: 12px; color: var(--ink-soft); }

.pos-main { padding: 24px; }
.balance-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.balance-card { background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.balance-card .label { font-size: 12px; color: var(--ink-soft); }
.balance-card .value { font-size: 24px; font-weight: 700; margin-top: 4px; }

.pos-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.pos-tab { padding: 10px 18px; cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent; }
.pos-tab.active { border-color: var(--ink); font-weight: 700; }
.pos-panel { display: none; }
.pos-panel.active { display: block; }

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--dusty-pink);
  color: var(--ink);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  margin: 0 6px 6px 0;
}
.tag-chip button { border: none; background: none; cursor: pointer; font-size: 13px; color: var(--ink); }

.list-item { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; }
.form-row .field { flex: 1; min-width: 140px; }
.form-row label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.form-row select, .form-row input {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 4px; font-family: inherit;
}
.empty-state { color: var(--ink-soft); text-align: center; padding: 60px 0; }

@media (max-width: 780px) {
  .pos-layout { grid-template-columns: 1fr; }
  .pos-sidebar { border-right: none; border-bottom: 1px solid var(--line); }
}
