/* Bootstrap 5.3 theming:
   CDN CSS is already compiled. Runtime theming is done by overriding
   --bs-* custom properties (no Sass rebuild). Custom --sep-* tokens
   drive SEP chrome; --bs-* retints Bootstrap components. */
:root,
body.theme-blossom {
  --sep-primary: #e91e63;
  --sep-primary-rgb: 233, 30, 99;
  --sep-primary-dark: #ad1457;
  --sep-primary-light: #f8bbd0;
  --sep-accent: #ff80ab;
  --sep-bg: #fff5f8;
  --sep-card: #ffffff;
  --sep-text: #3a2430;
  --sep-muted: #8a6a76;
  --sep-border: #f3c5d4;
  --sep-sidebar: #3d1f2d;
  --sep-sidebar-text: #ffe4ee;
  --sep-success: #2e9e6b;
  --sep-warn: #e6a817;
  --sep-danger: #d64545;
  --sep-radius: 14px;
  --sep-shadow: 0 8px 28px rgba(233, 30, 99, 0.12);
  --sep-font: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
}
body.theme-rose {
  --sep-primary: #c2185b;
  --sep-primary-rgb: 194, 24, 91;
  --sep-primary-dark: #880e4f;
  --sep-primary-light: #f48fb1;
  --sep-accent: #ec407a;
  --sep-bg: #fff0f4;
  --sep-border: #f3b3c8;
  --sep-sidebar: #2b101c;
}
body.theme-coral {
  --sep-primary: #ff6f61;
  --sep-primary-rgb: 255, 111, 97;
  --sep-primary-dark: #e2554a;
  --sep-primary-light: #ffd1cc;
  --sep-accent: #ff8a7a;
  --sep-bg: #fff6f4;
  --sep-border: #ffc9c3;
  --sep-sidebar: #3a1e1b;
}
body.theme-cream {
  --sep-primary: #d81b60;
  --sep-primary-rgb: 216, 27, 96;
  --sep-primary-dark: #ad1457;
  --sep-primary-light: #fce4ec;
  --sep-accent: #f8bbd0;
  --sep-bg: #fffaf4;
  --sep-card: #fffdf8;
  --sep-border: #f5d6c8;
  --sep-sidebar: #4a2c35;
}
body.theme-blossom,
body.theme-rose,
body.theme-coral,
body.theme-cream {
  --bs-primary: var(--sep-primary);
  --bs-primary-rgb: var(--sep-primary-rgb);
  --bs-link-color: var(--sep-primary);
  --bs-link-hover-color: var(--sep-primary-dark);
  --bs-focus-ring-color: rgba(var(--sep-primary-rgb), .25);
  --bs-primary-bg-subtle: var(--sep-primary-light);
  --bs-primary-border-subtle: var(--sep-border);
  --bs-primary-text-emphasis: var(--sep-primary-dark);
  --bs-body-bg: var(--sep-bg);
  --bs-body-color: var(--sep-text);
  --bs-border-color: var(--sep-border);
  --bs-tertiary-bg: var(--sep-primary-light);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sep-font);
  background: var(--sep-bg);
  color: var(--sep-text);
  min-height: 100vh;
}
a { color: var(--sep-primary); text-decoration: none; }
a:hover { color: var(--sep-primary-dark); }
.sep-topbar {
  background: linear-gradient(90deg, var(--sep-primary), var(--sep-accent));
  color: #fff;
  padding: .55rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .9rem;
}
.sep-navbar {
  background: #fff;
  border-bottom: 1px solid var(--sep-border);
  box-shadow: 0 2px 12px rgba(233,30,99,.06);
}
.sep-navbar .navbar-brand { font-weight: 700; color: var(--sep-primary) !important; display: flex; align-items: center; gap: .6rem; }
.sep-navbar .navbar-brand img { height: 40px; width: auto; }
.sep-navbar .nav-link { color: var(--sep-text) !important; font-weight: 500; }
.sep-navbar .nav-link:hover, .sep-navbar .nav-link.active { color: var(--sep-primary) !important; }
.hero {
  background: radial-gradient(1200px 400px at 10% -10%, var(--sep-primary-light), transparent),
              linear-gradient(135deg, #fff 0%, var(--sep-bg) 55%, #ffe4ee 100%);
  padding: 4.2rem 0 3.2rem;
  border-bottom: 1px solid var(--sep-border);
}
.hero h1 { color: var(--sep-primary-dark); font-weight: 800; letter-spacing: .02em; }
.hero p.lead { color: var(--sep-muted); max-width: 680px; }
.btn-sep {
  background: var(--sep-primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: .55rem 1.25rem;
  font-weight: 600;
}
.btn-sep:hover { background: var(--sep-primary-dark); color: #fff; }
.btn-sep-outline {
  border: 1.5px solid var(--sep-primary);
  color: var(--sep-primary);
  background: #fff;
  border-radius: 999px;
  padding: .5rem 1.15rem;
  font-weight: 600;
}
.card-sep {
  background: var(--sep-card);
  border: 1px solid var(--sep-border);
  border-radius: var(--sep-radius);
  box-shadow: var(--sep-shadow);
}
.stat-card {
  background: #fff;
  border-radius: var(--sep-radius);
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--sep-border);
  box-shadow: var(--sep-shadow);
}
.stat-card .label { color: var(--sep-muted); font-size: .82rem; }
.stat-card .value { font-size: 1.7rem; font-weight: 800; color: var(--sep-primary-dark); }
.admin-wrap { display: flex; min-height: 100vh; }
.admin-side {
  width: 260px;
  background: var(--sep-sidebar);
  color: var(--sep-sidebar-text);
  flex-shrink: 0;
  padding: 1rem 0 2rem;
}
.admin-side .brand {
  padding: .4rem 1.2rem 1rem;
  display: flex; align-items: center; gap: .6rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: .6rem;
  color: inherit;
  text-decoration: none;
}
.admin-side .brand img { height: 36px; }
.admin-side .brand span { font-weight: 700; color: #fff; font-size: .95rem; line-height: 1.2; }
.tree { list-style: none; padding: 0; margin: 0; }
.tree > li > a, .tree summary {
  display: flex; align-items: center; gap: .55rem;
  color: var(--sep-sidebar-text);
  padding: .52rem 1.2rem;
  cursor: pointer;
  font-size: .92rem;
}
.tree > li > a:hover, .tree a.active, .tree summary:hover { background: rgba(255,255,255,.08); color: #fff; }
.tree details { margin: 0; }
.tree details ul { list-style: none; padding: 0 0 .3rem 0; margin: 0; background: rgba(0,0,0,.15); }
.tree details ul a { display: block; padding: .4rem 1.2rem .4rem 2.4rem; color: #f3c5d4; font-size: .86rem; }
.tree details ul a:hover, .tree details ul a.active { color: #fff; background: rgba(233,30,99,.35); }
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-bar {
  background: #fff;
  border-bottom: 1px solid var(--sep-border);
  padding: .7rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
}
.admin-content { padding: 1.25rem; }
.table thead th { background: var(--sep-primary-light); color: var(--sep-primary-dark); font-size: .82rem; white-space: nowrap; }
.table-clip { max-height: 62vh; overflow: auto; }
.table-clip tbody tr {
  content-visibility: auto;
  contain-intrinsic-size: auto 38px;
}
.table-sm td, .table-sm th { padding: .28rem .4rem; }
.badge-st-submitted { background: #ffe0ec; color: #ad1457; }
.badge-st-contacted { background: #fff3cd; color: #856404; }
.badge-st-followed { background: #d1ecf1; color: #0c5460; }
.badge-st-closed, .badge-st-referred { background: #d4edda; color: #155724; }
.badge-st-audited { background: #cce5ff; color: #004085; }
.badge-st-cancelled { background: #e2e3e5; color: #383d41; }
.footer-sep { border-top: 1px solid var(--sep-border); padding: 1.6rem 0; color: var(--sep-muted); background: #fff; margin-top: 2rem; }
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #fff 0%, var(--sep-bg) 40%, var(--sep-primary-light) 100%);
}
.login-card { width: 100%; max-width: 420px; padding: 2rem; }
.req::after { content: " *"; color: #d64545; }
.flash { border-radius: 10px; }
#idleWarn { display: none; }
.admin-toggle { display: none; }
@media (max-width: 991px) {
  .admin-wrap { display: flex; flex-direction: column; }
  .admin-toggle { display: inline-flex; }
  .admin-side {
    display: none;
    width: 100%;
    max-height: none;
    order: 2;
    padding-bottom: 4rem;
  }
  .admin-wrap.nav-open .admin-side { display: block; }
  .admin-main { order: 1; }
  .admin-wrap.nav-open .admin-main .admin-content { display: none; }
  .admin-side .tree details { display: block; }
  .admin-side .tree details[open] ul,
  .admin-side .tree details ul { display: block; }
  .admin-side .tree > li > a,
  .admin-side .tree summary,
  .admin-side .tree details ul a {
    min-height: 44px;
    padding-top: .7rem;
    padding-bottom: .7rem;
  }
  .admin-bar { padding: .55rem .75rem; flex-wrap: wrap; gap: .4rem; }
  .admin-content { padding: .85rem; }
  .stat-card .value { font-size: 1.35rem; }
  .table { font-size: .86rem; }
  .btn { min-height: 40px; }
  .form-control, .form-select { font-size: 16px; }
  #stageWrap { max-height: 70vh; }
  #stage { transform-origin: top left; }
}
@media (max-width: 575.98px) {
  .admin-bar .bar-extra { display: none !important; }
  .login-card { margin: 1rem; padding: 1.25rem; }
  .sep-cal td { min-width: 2.4rem; font-size: .75rem; }
  .sep-inline-preview img, .sep-inline-preview embed { max-height: 64px !important; }
}

/* Retint compiled Bootstrap components that still hard-code $primary */
.btn-primary,
.nav-pills .nav-link.active,
.page-item.active .page-link,
.form-check-input:checked {
  background-color: var(--sep-primary);
  border-color: var(--sep-primary);
  color: #fff;
}
.page-link { color: var(--sep-primary); }
.page-link:hover { color: var(--sep-primary-dark); }
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--sep-accent);
  box-shadow: 0 0 0 .2rem rgba(var(--sep-primary-rgb), .25);
}
.table thead th {
  --bs-table-bg: var(--sep-primary-light);
}
.accordion-button:not(.collapsed) {
  background-color: var(--sep-primary-light);
  color: var(--sep-primary-dark);
  box-shadow: none;
}
.accordion-button:focus { box-shadow: 0 0 0 .2rem rgba(var(--sep-primary-rgb), .2); }

.sep-cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.sep-cal-hd {
  text-align: center;
  font-size: .8rem;
  color: var(--sep-muted);
  padding: .35rem 0;
  font-weight: 600;
}
.sep-cal-cell {
  min-height: 108px;
  background: #fff;
  border: 1px solid var(--sep-border);
  border-radius: 8px;
  padding: .35rem;
}
.sep-cal-cell.empty { background: transparent; border-color: transparent; }
.sep-cal-cell.today { outline: 2px solid var(--sep-primary); }
.sep-cal-num { font-weight: 700; font-size: .85rem; margin-bottom: .2rem; }
.sep-cal-ev {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  font-size: .72rem;
  text-align: left;
  padding: .15rem .35rem;
  margin-bottom: .2rem;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sep-cal-ev.workshop { background: #c8e6c9; color: #1b5e20; }
.sep-cal-ev.promo { background: #ffe082; color: #7a5800; }
.sep-cal-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; vertical-align: middle; }
.sep-cal-dot.ws { background: #43a047; }
.sep-cal-dot.pr { background: #f9a825; }
@media print {
  .admin-side, .admin-bar, .btn, form, .no-print { display: none !important; }
  .admin-content { padding: 0; }
}

.badge-st-pending_fix { background: #fff3cd; color: #856404; }
.badge-st-revised { background: #e2d4f0; color: #5a2d82; }

.add-fold > summary { cursor: pointer; list-style: none; }
.add-fold > summary::-webkit-details-marker { display: none; }
.add-fold > summary::before { content: "▸ "; color: var(--sep-primary); }
.add-fold[open] > summary::before { content: "▾ "; }
.add-fold > summary { margin-bottom: .4rem; }
