/* ==========================================================================
   Inn Church Admin - calm, warm, readable. Shares the site palette.
   Component classes (use these in every admin view):
     layout:  .admin-grid-2 .admin-grid-3 .panel .panel-head .panel-body
     actions: .toolbar .btn-a .btn-a-primary .btn-a-ghost .btn-a-danger .btn-a-sm
     data:    .table-a .stat .stat-num .stat-label .badge-a .badge-a-{green,gold,blue,red,gray}
     forms:   .form-a .fgrid .f .f-full .f label .hint .err .check .switch
     misc:    .empty .tabs .muted .thumb .kbd .inline-form .filters
   ========================================================================== */
:root {
  --terracotta: #B4532A; --ember: #9A4322; --honey: #E3A33B; --honey-soft: #F6DDAE;
  --dusk: #2F4A63; --sage: #56704F; --walnut: #2B211C; --walnut-2: #3A2D26;
  --linen: #FBF6EE; --sand: #F2E4D3; --cream: #FFFDF9; --ink: #3B2F28; --ink-soft: #6B5A4E; --line: #E9DCCB;
  --radius: 14px; --shadow: 0 1px 2px rgba(43,33,28,.06), 0 6px 20px rgba(43,33,28,.06);
}
* { box-sizing: border-box; }
body.admin { margin: 0; background: #F7F1E8; color: var(--ink); font: 16px/1.55 "Nunito Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif; }
a { color: var(--terracotta); }
h1, h2, h3 { font-family: "Lora", Georgia, serif; color: var(--walnut); line-height: 1.2; margin: 0 0 .5em; font-weight: 600; }
h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; flex: none; }
:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; }
.skip-link { position: absolute; left: 10px; top: -50px; background: var(--walnut); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 99; }
.skip-link:focus { top: 10px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Shell */
.admin-shell { display: flex; min-height: 100vh; }
.admin-side { width: 250px; flex: none; background: var(--walnut); color: #E9DCCB; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 12px; }
.admin-brand { display: flex; align-items: center; gap: 10px; color: #FFF8EE; text-decoration: none; font-family: "Lora", Georgia, serif; font-size: 1.15rem; padding: 4px 8px 18px; }
.admin-brand small { display: block; font-family: "Nunito Sans", sans-serif; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--honey); }
.admin-side nav { display: flex; flex-direction: column; gap: 2px; }
.admin-side nav a, .side-foot a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: #E9DCCB; text-decoration: none; font-weight: 600; font-size: .95rem; }
.admin-side nav a:hover, .side-foot a:hover { background: var(--walnut-2); color: #fff; }
.admin-side nav a.is-active { background: var(--terracotta); color: #fff; }
.side-group { margin: 16px 12px 6px; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: #A8978A; font-weight: 800; }
.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid #45362E; }
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-top { display: flex; align-items: center; gap: 16px; padding: 14px 28px; background: var(--cream); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.admin-title { font-size: 1.4rem; margin: 0; flex: 1; }
.admin-user { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: .92rem; }
.admin-user small { color: var(--ink-soft); font-weight: 600; }
.admin-user form { margin: 0; }
.admin-content { padding: 28px; max-width: 1280px; width: 100%; }
.side-toggle { display: none; background: var(--sand); border: 0; border-radius: 10px; width: 42px; height: 42px; cursor: pointer; }
@media (max-width: 960px) {
  .admin-side { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .admin-side.is-open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .side-toggle { display: inline-grid; place-items: center; }
  .admin-content { padding: 18px 16px; }
  .admin-top { padding: 12px 16px; flex-wrap: wrap; }
  .admin-user span { display: none; }
}

/* Panels & grids */
.panel { background: var(--cream); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 1.15rem; }
.panel-body { padding: 20px; }
.admin-grid-2 { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.admin-grid-3 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.toolbar .left, .toolbar .right { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters .f { min-width: 160px; }

/* Buttons */
.btn-a { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--walnut); font: 700 .92rem/1.2 inherit; font-family: inherit; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn-a:hover { border-color: #CDB79F; }
.btn-a-primary { background: var(--terracotta); border-color: var(--terracotta); color: #fff; }
.btn-a-primary:hover { background: var(--ember); border-color: var(--ember); color: #fff; }
.btn-a-ghost { background: transparent; border-color: transparent; }
.btn-a-ghost:hover { background: var(--sand); }
.btn-a-danger { color: #9B1C12; border-color: #EDC7C2; background: #fff; }
.btn-a-danger:hover { background: #FBEAE7; }
.btn-a-sm { padding: 6px 10px; font-size: .85rem; }
.inline-form { display: inline; margin: 0; }

/* Stats */
.stat { background: var(--cream); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
a.stat:hover { box-shadow: 0 8px 24px rgba(43,33,28,.12); }
.stat-num { font-family: "Lora", Georgia, serif; font-size: 2rem; color: var(--walnut); line-height: 1; }
.stat-label { color: var(--ink-soft); font-weight: 700; font-size: .9rem; }
.stat-hot .stat-num { color: var(--terracotta); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table-a { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table-a th { text-align: left; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FBF6EE; white-space: nowrap; }
.table-a td { padding: 12px 14px; border-bottom: 1px solid #F1E7DA; vertical-align: middle; }
.table-a tr:hover td { background: #FFF9F0; }
.table-a .actions { text-align: right; white-space: nowrap; }
.table-a .title-cell a { font-weight: 700; color: var(--walnut); text-decoration: none; }
.table-a .title-cell a:hover { color: var(--terracotta); }
.table-a .sub { display: block; color: var(--ink-soft); font-size: .85rem; }
.thumb { width: 64px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--sand); display: block; }

/* Badges */
.badge-a { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 800; letter-spacing: .03em; background: #EEE6DA; color: var(--ink-soft); white-space: nowrap; }
.badge-a-green { background: #DFEBDB; color: #2F4A2A; }
.badge-a-gold { background: var(--honey-soft); color: #6A4A10; }
.badge-a-blue { background: #DCE6EF; color: #22384D; }
.badge-a-red { background: #F8DEDA; color: #8A1E14; }
.badge-a-gray { background: #EEE6DA; color: #6B5A4E; }

/* Forms */
.form-a { max-width: 960px; }
.fgrid { display: grid; gap: 16px 20px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .fgrid { grid-template-columns: 1fr 1fr; } .fgrid .f-full { grid-column: 1 / -1; } }
.f { display: flex; flex-direction: column; gap: 5px; }
.f label, .f .label { font-weight: 700; font-size: .92rem; color: var(--walnut); }
.f input[type=text], .f input[type=email], .f input[type=url], .f input[type=tel], .f input[type=date], .f input[type=time], .f input[type=datetime-local], .f input[type=number], .f input[type=password], .f input[type=file], .f select, .f textarea {
  font: inherit; width: 100%; padding: 10px 12px; border: 1.5px solid #DDCBB6; border-radius: 10px; background: #fff; color: var(--ink); min-height: 44px;
}
.f textarea { min-height: 120px; resize: vertical; }
.f textarea.tall { min-height: 280px; }
.f input:focus, .f select:focus, .f textarea:focus { outline: none; border-color: var(--terracotta); box-shadow: 0 0 0 3px rgba(180,83,42,.14); }
.hint { font-size: .85rem; color: var(--ink-soft); }
.err { font-size: .85rem; color: #9B1C12; font-weight: 700; }
.f.has-err input, .f.has-err select, .f.has-err textarea { border-color: #C2372A; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--terracotta); }
.check small { display: block; font-weight: 400; color: var(--ink-soft); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
fieldset.fs { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px 18px; margin: 0; }
fieldset.fs legend { font-weight: 800; padding: 0 6px; color: var(--walnut); }
.img-preview { max-width: 280px; border-radius: 10px; margin-top: 6px; box-shadow: var(--shadow); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 600; }
.alert-success { background: #E3EEDF; color: #2F4A2A; }
.alert-error { background: #F8E1DE; color: #7A1D16; }
.alert-info { background: #E1EAF2; color: #22384D; }
.alert-warning { background: #FCEFD6; color: #6A4A10; }

/* Misc */
.muted { color: var(--ink-soft); }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-soft); }
.empty .icon { width: 40px; height: 40px; color: #CDB79F; margin-bottom: 10px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-soft); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.is-active { color: var(--walnut); border-color: var(--terracotta); }
.kbd { font-family: ui-monospace, Consolas, monospace; background: #F1E7DA; padding: 1px 6px; border-radius: 6px; font-size: .85rem; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 10px 0; border-bottom: 1px solid #F1E7DA; }
.list-plain li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; }
.kv dt { font-weight: 800; color: var(--ink-soft); font-size: .9rem; }
.kv dd { margin: 0; word-break: break-word; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; } }
.media-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.media-item { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); font-size: .82rem; }
.media-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--sand); }
.media-item .meta { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }

/* Bare (login) */
.admin-bare { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 20% 10%, #F6DDAE 0, rgba(246,221,174,0) 40%), var(--linen); }
.bare-wrap { width: min(440px, calc(100% - 32px)); padding: 32px 0; }
.bare-wrap .admin-brand { color: var(--walnut); justify-content: center; margin-bottom: 18px; }
.bare-wrap .panel-body { padding: 28px; }

/* ==========================================================================
   Spacing & control consistency (2026-10-23 layout pass).
   One control height for every input, select and button that share a row,
   room between neighbouring buttons, and air between stacked fields.
   ========================================================================== */
:root { --ctl-h: 44px; --ctl-h-sm: 36px; }
.admin-content input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]):not([type=color]):not([type=range]),
.admin-content select {
  font: inherit; height: var(--ctl-h); min-height: var(--ctl-h); padding: 0 12px; border: 1.5px solid #DDCBB6; border-radius: 10px; background: #fff; color: var(--ink); max-width: 100%;
}
.admin-content textarea { font: inherit; padding: 10px 12px; border: 1.5px solid #DDCBB6; border-radius: 10px; background: #fff; color: var(--ink); max-width: 100%; }
.admin-content input[type=file] { font: inherit; padding: 8px 10px; border: 1.5px dashed #DDCBB6; border-radius: 10px; background: #fff; max-width: 100%; }
.admin-content input:focus, .admin-content select:focus, .admin-content textarea:focus { outline: none; border-color: var(--terracotta); box-shadow: 0 0 0 3px rgba(180,83,42,.14); }
.admin-content .ac-alt input { height: 34px; min-height: 34px; font-size: .82rem; }

.btn-a { min-height: var(--ctl-h); padding: 0 16px; justify-content: center; line-height: 1.2; }
.btn-a-sm { min-height: var(--ctl-h-sm); padding: 0 12px; }
.btn-a .icon { width: 17px; height: 17px; }

/* Fields: label, control and hint each get their own breathing room */
.f { gap: 7px; }
.f .hint, .f .err { margin-top: 1px; line-height: 1.4; }
.hint { line-height: 1.45; }
.fgrid { gap: 20px 24px; }
.panel-body > .check + .check, .fgrid > .check + .check, form > .check + .check, .f-full > .check + .check { margin-top: 12px; }
.check + fieldset.fs, fieldset.fs + .check, fieldset.fs + fieldset.fs, .check + .f, .f + .check { margin-top: 18px; }
fieldset.fs { padding: 18px 20px 20px; }
fieldset.fs legend { padding: 0 8px; }
fieldset.fs > .fgrid { margin-top: 6px; }
.check { line-height: 1.4; }
.check small { margin-top: 2px; }

/* Rows of controls: same height, aligned, with a real gap */
.toolbar, .filters { gap: 12px; align-items: flex-end; }
.toolbar .left, .toolbar .right { gap: 10px; align-items: flex-end; }
.toolbar form, .filters form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0; }
.filters .f { min-width: 180px; }
.filters.panel { padding: 18px 20px; }
.form-actions { gap: 12px; align-items: center; }
.ac-actions, .ac-temp-row, .ac-media-actions { gap: 10px; }

/* Table action buttons: never touching */
.table-a .actions > * + * { margin-left: 8px; }
.table-a .actions .inline-form { display: inline-block; vertical-align: middle; }
.table-a .actions .btn-a { vertical-align: middle; }
.table-a td { padding: 14px 16px; }
.table-a th { padding: 12px 16px; }

/* Button groups anywhere (header links on edit pages, QR page, integrations) */
.btn-row, .ac-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.panel-body > .btn-a + .btn-a, .panel-body > .btn-a + .inline-form, .panel-body > .inline-form + .btn-a, p > .btn-a + .btn-a { margin-left: 10px; }
.panel-body > .btn-a + .hint, .panel-body > .inline-form + .hint { display: block; margin-top: 8px; }

/* Form builder */
.fb-actions { gap: 8px; align-items: center; }
.fb-item { padding: 14px 16px; margin-bottom: 12px; }
.fb-edit .fgrid { margin-top: 14px; }
.form-a { max-width: 1040px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 14px; } .mt-2 { margin-top: 22px; }
.inline-form > .btn-a + .hint, .inline-form > button + .hint { margin-left: 12px; }
