/* Admin center layout (builds on styles.css tokens) */
.admin-body { background: var(--off); }
.admin-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.admin-header-inner { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.admin-user { display: flex; align-items: center; gap: 12px; font-size: .85rem; color: var(--muted); margin-left: auto; }
.admin-role { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; background: var(--ink); color: #fff; padding: 4px 8px; border-radius: 5px; }
.admin-role.community { background: var(--grass-light); color: var(--grass-dark); }
.admin-main { padding: 32px 0 80px; }
.admin-card { padding: 28px; max-width: 560px; margin: 40px auto; }
.admin-card h2 { font-size: 1.8rem; margin-bottom: 8px; }
.admin-card code { background: var(--off); padding: 2px 6px; border-radius: 4px; font-size: .85em; }
/* the tab strip is the real navigation, so it freezes just under the header */
.admin-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 10px 0; margin-bottom: 20px;
  scrollbar-width: thin; position: sticky; top: 64px; z-index: 40;
  background: var(--off, #F6F5F1); box-shadow: 0 1px 0 var(--line), 0 6px 12px -10px rgba(20,22,24,.5); }
.admin-tabs::after { content: ""; position: absolute; inset: 0 -100vw; z-index: -1;
  background: inherit; box-shadow: inherit; }
/* The header and the frozen tab strip together cover the top ~130px. The
   scroll-padding-top in styles.css clears only the header, so an anchor jump
   or a focused row button landed underneath the tabs (WCAG 2.2 SC 2.4.11,
   Focus Not Obscured). admin.css loads after styles.css, so this wins.
   --header-h has no mobile override, so the strip sits at 64px everywhere and
   the old `top: 56px` phone rule just tucked it 9px under the header. */
html { scroll-padding-top: calc(var(--header-h) + 78px); }
.admin-tabs button { padding: 10px 14px; border-radius: 999px; font-weight: 600; font-size: .9rem; color: var(--muted); white-space: nowrap; background: #fff; border: 1px solid var(--line); display: inline-flex; gap: 8px; align-items: center; }
.admin-tabs button.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.admin-tabs button .n { background: var(--gold); color: var(--ink); font-size: .68rem; padding: 1px 6px; border-radius: 999px; font-weight: 700; }
.admin-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.admin-toolbar h2 { font-size: 2rem; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-panel { display: grid; gap: 14px; }
.panel-note { font-size: .88rem; color: var(--muted); margin: 0 0 6px; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 4px; }
.tile strong { font-family: var(--display); font-size: 2rem; line-height: 1; }
.tile span { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.admin-table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 720px; }
.admin-table th { text-align: left; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; background: var(--off); border-bottom: 1px solid var(--line); }
.admin-table td { padding: 10px 14px; border-bottom: 1px solid var(--off-2); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table td.actions { white-space: nowrap; text-align: right; }
.admin-table .btn { padding: 6px 10px; font-size: .78rem; }
.admin-table .btn-danger { color: #8A3B2E; }
.admin-table .btn-danger:hover { background: #F3E3E0; }
.admin-table small { color: var(--muted); display: block; }
.filter-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-inline select, .filter-inline input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: .88rem; }
.drawer { position: fixed; inset: 0; z-index: 120; }
.drawer[hidden] { display: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(20,22,24,.55); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: #fff; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slideIn .25s var(--ease); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-size: 1.5rem; }
.drawer-head .modal-close { position: static; }
/* min-height:0 lets the scrolling form actually shrink; without it a long form
   grows past the panel and covers the Save button in the footer. */
/* Sits between the title and the form so aria-describedby reads it out with
   the dialog's name; `hidden` when the drawer is an edit rather than a copy. */
/* Outgoing-email switch on the Overview tab. Amber while paused so it reads
   as a deliberate hold rather than an error. */
.mail-switch { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  margin-top: 18px; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.mail-switch.is-paused { border-color: #E4C97A; background: #FDF8EC; }
.mail-switch strong { display: block; font-size: .95rem; margin-bottom: 2px; }
.mail-switch span { font-size: .85rem; color: var(--muted); display: block; max-width: 62ch; }
.mail-switch .btn { flex: none; }
.drawer-hint { margin: 0; padding: 14px 24px 0; flex: none; }
.drawer-panel .form-grid { padding: 20px 24px; overflow: auto; flex: 1 1 auto; min-height: 0; align-content: start; }
.drawer-panel .form-grid label { font-size: .78rem; }
.drawer-panel .form-grid input, .drawer-panel .form-grid select, .drawer-panel .form-grid textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: .92rem; }
.drawer-panel .form-grid textarea { min-height: 84px; }
.drawer-panel .form-grid input:focus, .drawer-panel .form-grid select:focus, .drawer-panel .form-grid textarea:focus { outline: none; border-color: var(--grass); box-shadow: 0 0 0 3px rgba(46,125,79,.15); }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.check-row label { flex-direction: row !important; align-items: center; gap: 6px; font-weight: 500 !important; font-size: .88rem !important; }
.check-row input { width: auto !important; accent-color: var(--grass); }
.field-help { font-size: .74rem; color: var(--muted); font-weight: 400; }
.drawer-foot { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--line); flex-wrap: wrap; flex: none; background: #fff; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: .9rem; box-shadow: var(--shadow-lg); z-index: 200; margin: 0; }
.toast.is-error { background: #8A3B2E; }
.empty { padding: 32px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
.pill { display: inline-block; font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border-radius: 5px; background: var(--off-2); color: var(--ink-3); }
.pill.ok { background: var(--grass-light); color: var(--grass-dark); }
.pill.warn { background: var(--gold-light); color: var(--gold-dark); }
.pill.bad { background: #F3E3E0; color: #8A3B2E; }
.login .form-grid { margin-top: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* table headers stay put while a long list scrolls */
/* No sticky thead here: .admin-table-wrap needs overflow-x for the 720px
   min-width table, and a scroll container with one axis auto computes the
   other to auto too, so the header would stick to a box that never scrolls
   vertically. The frozen page header and tab strip are the navigation. */
