/* Sacred Manage — editor styles (js/editors/*). Namespaced .sm-ed / .sm-* only.
   Tokens defer to the shell's theme when present via var(..., fallback) chains. */

.sm-ed {
  --_bg: var(--sm-card-bg, var(--card-bg, #ffffff));
  --_ink: var(--sm-ink, var(--ink, #16181d));
  --_muted: var(--sm-muted, var(--muted, #5b626e));
  --_line: var(--sm-line, var(--line, #e3e6ea));
  --_accent: var(--sm-accent, var(--accent, #a31226));
  --_accent-ink: var(--sm-accent-ink, var(--accent-ink, #ffffff));
  --_field-bg: var(--sm-field-bg, var(--field-bg, #f6f7f8));
  --_ok: var(--sm-ok, #157a3d);
  --_warn: var(--sm-warn, #8a6100);
  --_err: var(--sm-err, #b3132b);
  color: var(--_ink);
}
@media (prefers-color-scheme: dark) {
  .sm-ed {
    --_bg: var(--sm-card-bg, var(--card-bg, #17191f));
    --_ink: var(--sm-ink, var(--ink, #eceef2));
    --_muted: var(--sm-muted, var(--muted, #9aa1ad));
    --_line: var(--sm-line, var(--line, #2a2e37));
    --_accent: var(--sm-accent, var(--accent, #e04358));
    --_field-bg: var(--sm-field-bg, var(--field-bg, #1f2229));
    --_ok: var(--sm-ok, #4fc97e);
    --_warn: var(--sm-warn, #e0b64e);
    --_err: var(--sm-err, #ff6b81);
  }
}
:root[data-theme="dark"] .sm-ed {
  --_bg: var(--sm-card-bg, var(--card-bg, #17191f));
  --_ink: var(--sm-ink, var(--ink, #eceef2));
  --_muted: var(--sm-muted, var(--muted, #9aa1ad));
  --_line: var(--sm-line, var(--line, #2a2e37));
  --_accent: var(--sm-accent, var(--accent, #e04358));
  --_field-bg: var(--sm-field-bg, var(--field-bg, #1f2229));
  --_ok: var(--sm-ok, #4fc97e);
  --_warn: var(--sm-warn, #e0b64e);
  --_err: var(--sm-err, #ff6b81);
}
:root[data-theme="light"] .sm-ed {
  --_bg: var(--sm-card-bg, var(--card-bg, #ffffff));
  --_ink: var(--sm-ink, var(--ink, #16181d));
  --_muted: var(--sm-muted, var(--muted, #5b626e));
  --_line: var(--sm-line, var(--line, #e3e6ea));
  --_accent: var(--sm-accent, var(--accent, #a31226));
  --_field-bg: var(--sm-field-bg, var(--field-bg, #f6f7f8));
  --_ok: var(--sm-ok, #157a3d);
  --_warn: var(--sm-warn, #8a6100);
  --_err: var(--sm-err, #b3132b);
}

/* ---- cards ---- */
.sm-card {
  background: var(--_bg);
  border: 1px solid var(--_line);
  border-radius: 14px;
  padding: 18px 16px;
  margin: 0 0 14px;
}
.sm-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.sm-card-title { font-size: 1.05rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.sm-loading { color: var(--_muted); padding: 8px 0; font-size: 0.95rem; }
.sm-hint { color: var(--_muted); font-size: 0.85rem; line-height: 1.45; margin: 4px 0 10px; }
.sm-group-label {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--_muted); margin: 18px 0 2px;
}

/* ---- fields ---- */
.sm-form { display: block; }
.sm-field { margin: 0 0 14px; }
.sm-label { display: block; font-size: 0.86rem; font-weight: 600; margin: 0 0 6px; }
.sm-input {
  display: block; width: 100%; box-sizing: border-box;
  min-height: 48px; padding: 12px 14px;
  font: inherit; font-size: 1rem;
  color: var(--_ink); background: var(--_field-bg);
  border: 1px solid var(--_line); border-radius: 10px;
  -webkit-appearance: none; appearance: none;
}
.sm-input:focus { outline: 2px solid var(--_accent); outline-offset: 1px; border-color: var(--_accent); }
.sm-field.has-error .sm-input { border-color: var(--_err); }
.sm-field-error, .sm-form-error {
  color: var(--_err); font-size: 0.85rem; line-height: 1.4;
  margin: 6px 0 0; padding: 0;
}
.sm-form-error {
  border: 1px solid var(--_err); border-radius: 10px;
  padding: 10px 12px; margin: 0 0 12px;
}
.sm-row-3 { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 480px) {
  .sm-row-3 { grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
}

/* ---- buttons ---- */
.sm-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.sm-btn {
  min-height: 48px; padding: 12px 18px;
  font: inherit; font-size: 0.95rem; font-weight: 700;
  border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; touch-action: manipulation;
}
.sm-btn:disabled { opacity: 0.6; cursor: default; }
.sm-btn-primary { background: var(--_accent); color: var(--_accent-ink); }
.sm-btn-primary.is-flash { background: var(--_ok); }
.sm-btn-ghost { background: transparent; color: var(--_ink); border-color: var(--_line); }
.sm-btn-ghost.is-flash { border-color: var(--_ok); color: var(--_ok); }
.sm-btn-wide { width: 100%; }
.sm-btn-remove { min-height: 44px; padding: 10px 14px; font-weight: 600; color: var(--_muted); }
.sm-btn-remove.is-armed { color: var(--_err); border-color: var(--_err); }

/* ---- checklist ---- */
.sm-progress-label { color: var(--_muted); font-size: 0.85rem; font-weight: 600; }
.sm-progress {
  height: 8px; border-radius: 4px; background: var(--_field-bg);
  overflow: hidden; margin: 4px 0 14px;
}
.sm-progress-fill { height: 100%; background: var(--_accent); border-radius: 4px; transition: width 300ms ease; }
.sm-check-list { list-style: none; margin: 0; padding: 0; }
.sm-check-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 60px; padding: 10px 6px;
  background: none; border: 0; border-bottom: 1px solid var(--_line);
  font: inherit; color: var(--_ink); text-align: left; cursor: pointer;
}
.sm-check-list li:last-child .sm-check-row { border-bottom: 0; }
.sm-check-dot {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--_line);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 800; color: var(--_accent-ink);
}
.sm-check-row.is-done .sm-check-dot { background: var(--_ok); border-color: var(--_ok); }
.sm-check-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.sm-check-label { font-weight: 700; font-size: 0.95rem; }
.sm-check-row.is-done .sm-check-label { color: var(--_muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.sm-check-detail { color: var(--_muted); font-size: 0.82rem; }
.sm-check-go { color: var(--_muted); font-size: 1.4rem; line-height: 1; }

/* ---- hours ---- */
.sm-hours-grid { display: flex; flex-direction: column; }
.sm-hours-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  min-height: 56px; margin: 0; padding: 8px 0;
  border-bottom: 1px solid var(--_line);
}
.sm-hours-grid .sm-hours-row:last-child { border-bottom: 0; }
.sm-hours-day { display: flex; align-items: center; gap: 10px; flex: 1 1 130px; }
.sm-hours-label { font-weight: 600; font-size: 0.92rem; }
.sm-hours-times { display: flex; align-items: center; gap: 6px; }
.sm-time { width: 108px; min-height: 44px; padding: 8px 8px; }
.sm-hours-dash { color: var(--_muted); }
.sm-hours-closed { color: var(--_muted); font-size: 0.88rem; font-style: italic; }

/* switch */
.sm-switch { position: relative; display: inline-block; width: 46px; height: 28px; flex: 0 0 auto; }
.sm-switch-input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.sm-switch-track {
  position: absolute; inset: 0; border-radius: 14px;
  background: var(--_line); transition: background 150ms ease;
}
.sm-switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--_bg); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 150ms ease;
}
.sm-switch-input:checked + .sm-switch-track { background: var(--_ok); }
.sm-switch-input:checked + .sm-switch-track::after { transform: translateX(18px); }
.sm-switch-input:focus-visible + .sm-switch-track { outline: 2px solid var(--_accent); outline-offset: 2px; }

/* ---- services + roster rows ---- */
.sm-svc-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.sm-svc-row {
  display: grid; grid-template-columns: 1fr; gap: 8px; margin: 0;
  padding: 10px; border: 1px solid var(--_line); border-radius: 12px;
}
@media (min-width: 480px) {
  .sm-svc-row { grid-template-columns: 1fr 130px auto; align-items: center; }
}
.sm-svc-row.has-error, .sm-roster-row.has-error { border-color: var(--_err); }
.sm-roster-row {
  display: flex; flex-direction: column; gap: 8px; margin: 0;
  padding: 10px; border: 1px solid var(--_line); border-radius: 12px;
}
.sm-roster-main { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sm-roster-row .sm-btn-remove { align-self: flex-end; }

/* ---- members / seats ---- */
.sm-seat-count { color: var(--_muted); font-size: 0.85rem; font-weight: 700; }
.sm-seat-count.is-full { color: var(--_warn); }
.sm-member-list { list-style: none; margin: 0 0 12px; padding: 0; }
.sm-member-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 56px; padding: 8px 0; border-bottom: 1px solid var(--_line);
}
.sm-member-list .sm-member-row:last-child { border-bottom: 0; }
.sm-member-main { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.sm-member-email { font-weight: 600; font-size: 0.92rem; word-break: break-all; }
.sm-chip {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  background: var(--_field-bg); color: var(--_muted);
  border: 1px solid var(--_line);
}
.sm-chip-owner { color: var(--_accent); border-color: var(--_accent); background: transparent; }
.sm-chip-you { background: var(--_line); color: var(--_ink); }
.sm-chip-live { color: var(--_ok); border-color: var(--_ok); background: transparent; }
.sm-chip-pending { color: var(--_warn); border-color: var(--_warn); background: transparent; }
.sm-chip-founding { color: var(--_accent); border-color: var(--_accent); background: transparent; margin-left: 8px; }

/* seat cap */
.sm-cap-card {
  border: 1px dashed var(--_line); border-radius: 12px;
  padding: 14px; text-align: center;
}
.sm-cap-text { font-weight: 600; font-size: 0.92rem; margin: 0 0 10px; }

/* invite link (shown once) */
.sm-invite-slot:empty { display: none; }
.sm-invite-box {
  border: 1px solid var(--_ok); border-radius: 12px;
  padding: 14px; margin: 0 0 14px;
}
.sm-invite-title { font-weight: 700; font-size: 0.92rem; margin: 0 0 4px; }
.sm-invite-warn { color: var(--_warn); font-size: 0.83rem; margin: 0 0 10px; line-height: 1.4; }
.sm-invite-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sm-invite-link { flex: 1 1 180px; font-size: 0.85rem; }

/* ---- SMS status ---- */
.sm-sms-text { font-size: 0.95rem; font-weight: 600; margin: 4px 0 6px; line-height: 1.45; }

/* ---- billing ---- */
.sm-plan {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin: 6px 0 4px;
}
.sm-plan-name { font-weight: 700; font-size: 1rem; }
.sm-plan-price { white-space: nowrap; }
.sm-plan-amount { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.sm-plan-per { color: var(--_muted); font-size: 0.9rem; margin-left: 2px; }
.sm-founding-note { margin-top: 0; }
.sm-billing-slot { margin-top: 12px; }
.sm-billing-wait {
  border: 1px solid var(--_line); border-radius: 12px;
  padding: 14px; text-align: center;
}
.sm-billing-wait-title { font-weight: 700; margin: 0 0 4px; }

/* wider screens: cards breathe a little more */
@media (min-width: 700px) {
  .sm-card { padding: 22px 22px; }
}
