/* ร้านอักษรศีล — ธีมม่วง/เขียว/น้ำเงินเข้ม บนพื้นขาว */
:root {
  --brand-deep: #563892;
  --brand-lav: #B6A2D9;
  --brand-lav-tint: #F0EBF8;
  --brand-mint: #78C8BB;
  --brand-mint-tint: #E4F5F1;
  --brand-mint-text: #2C7A6C;
  --status-past: #B9B3C6;
  --status-near: #D99A2B;
  --ink: #2b2440;
  --ink-soft: #7A7089;
  --ink-muted: #9C93AF;
  --hairline: #ECE7F5;
  --stamp: #A83E2C;
  --stamp-tint: #F6E4DF;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #ffffff;
  color: var(--ink);
  font-family: "Sarabun", "Noto Sans Thai", "Segoe UI", sans-serif;
  line-height: 1.6;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

header.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
header.brand .mark { display: flex; align-items: center; gap: 8px; }
header.brand .mark img { height: 34px; width: auto; display: block; }
header.brand .mark span { font-size: 1.05rem; font-weight: 500; color: var(--brand-deep); }
header.brand .tab {
  font-size: 0.8rem;
  color: var(--brand-deep);
  text-decoration: none;
  border: 1px solid var(--brand-lav);
  border-radius: var(--radius);
  padding: 0.4rem 0.9rem;
}
header.brand .tab:hover { background: var(--brand-lav-tint); }

.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--brand-lav-tint);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 1.1rem;
}
.view-toggle button {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.85rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--brand-deep);
  cursor: pointer;
}
.view-toggle button.active { background: var(--brand-deep); color: #ffffff; }

.filters { display: flex; gap: 0.5rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.filters button {
  font-size: 0.8rem;
  border: 1px solid var(--hairline);
  background: transparent;
  border-radius: 20px;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  color: var(--ink-muted);
}
.filters button.active { background: var(--brand-deep); color: #ffffff; border-color: var(--brand-deep); }

.card {
  background: #ffffff;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.9rem;
}
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.card-top h3 { margin: 0; font-size: 1.05rem; font-weight: 500; color: var(--ink); }

.badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  white-space: nowrap;
}
.badge.free { background: var(--brand-mint-tint); color: var(--brand-mint-text); }
.badge.paid { background: var(--brand-lav-tint); color: var(--brand-deep); }
.badge.full { background: #F1EFF7; color: var(--ink-muted); }

.meta { font-size: 0.85rem; color: var(--ink-soft); margin: 0.5rem 0 0; }
.meta i { color: var(--brand-lav); }

.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 0.85rem; }
.seats { font-size: 0.8rem; color: var(--ink-muted); }

button.cta {
  background: var(--brand-deep);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  font-size: 0.85rem;
}
button.cta:hover { background: #452c74; }
button.cta:disabled { background: #d8d0e8; cursor: not-allowed; }
button.cta.stamp { background: var(--stamp); }
button.cta.stamp:hover { background: #8a3223; }

button.ghost {
  background: transparent;
  border: 1px solid var(--brand-lav);
  border-radius: var(--radius);
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--brand-deep);
}

.overlay {
  position: fixed; inset: 0; background: rgba(43,36,64,0.45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
}
@media (min-width: 640px) { .overlay { align-items: center; } }
.sheet {
  background: #ffffff;
  width: 100%; max-width: 560px;
  border-radius: 16px 16px 0 0;
  padding: 1.5rem 1.4rem 2rem;
  max-height: 88vh; overflow-y: auto;
}
@media (min-width: 640px) { .sheet { border-radius: 16px; } }
.sheet h2 { margin-top: 0; font-size: 1.2rem; font-weight: 500; color: var(--ink); }
.sheet .close { float: right; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--ink-muted); }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 0.3rem; }
.field input, .field textarea, .field select {
  width: 100%;
  font-size: 0.95rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--brand-lav);
}

.notice { font-size: 0.85rem; padding: 0.7rem 0.9rem; border-radius: var(--radius); margin-bottom: 1rem; }
.notice.ok { background: var(--brand-mint-tint); color: var(--brand-mint-text); }
.notice.err { background: var(--stamp-tint); color: var(--stamp); }

.empty { color: var(--ink-muted); text-align: center; padding: 2.5rem 1rem; font-size: 0.9rem; }

table.admin { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.admin th, table.admin td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--hairline); }
table.admin th { color: var(--ink-soft); font-weight: 500; }

.section-title {
  font-size: 1rem; font-weight: 500; margin: 2rem 0 0.75rem; color: var(--ink);
  display: flex; align-items: center; gap: 0.5rem;
}
.section-title::before { content: ""; width: 6px; height: 6px; background: var(--brand-mint); border-radius: 50%; display: inline-block; }

/* ปฏิทิน */
.cal-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.cal-header button {
  background: none; border: none; cursor: pointer; color: var(--ink-soft); font-size: 1rem; padding: 4px 8px;
}
.cal-title { font-size: 0.95rem; font-weight: 500; color: var(--ink); }
.cal-grid-labels, .cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal-grid-labels { text-align: center; font-size: 0.7rem; color: var(--ink-muted); margin-bottom: 6px; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; color: var(--ink); border-radius: 50%; cursor: default;
}
.cal-day.blank { visibility: hidden; }
.cal-day.status-open { background: var(--brand-mint); color: #ffffff; font-weight: 500; cursor: pointer; }
.cal-day.status-near { background: var(--status-near); color: #ffffff; font-weight: 500; cursor: pointer; }
.cal-day.status-full { background: var(--stamp); color: #ffffff; font-weight: 500; cursor: pointer; }
.cal-day.status-past { background: var(--status-past); color: #ffffff; cursor: pointer; }
.cal-day.selected { outline: 2px solid var(--brand-deep); outline-offset: 1px; }

.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 14px; }
.cal-legend span { display: flex; align-items: center; gap: 5px; font-size: 0.75rem; color: var(--ink-soft); }
.cal-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.cal-agenda { margin-top: 14px; }
.cal-agenda .card { margin-bottom: 0.6rem; }
