/* Admin sign-in and dashboard. Uses the tokens and base styles from site.css. */

.admin-loading {
  padding-block: 80px;
  text-align: center;
}

/* Sign-in */
.login {
  max-width: 460px;
  margin: clamp(32px, 8vw, 88px) auto;
  padding: clamp(22px, 4vw, 36px);
  display: grid;
  gap: 18px;
}
.login-title {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin-top: 12px !important;
}
.btn.wide {
  justify-content: center;
}
.linkish {
  background: none;
  border: 0;
  padding: 4px 0;
  color: var(--amber);
  font: inherit;
  font-size: 0.95rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  justify-self: start;
}
.err {
  color: oklch(0.78 0.16 25);
  font-size: 0.92rem;
}
.ok {
  color: oklch(0.82 0.14 160);
  font-size: 0.92rem;
}

/* Fields */
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.field label,
.field .label {
  font: 600 0.72rem/1.2 var(--f-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.field input,
.field select,
.field textarea {
  font: inherit;
  font-size: 1rem;
  padding: 11px 13px;
  border: 1px solid var(--input);
  border-radius: 12px;
  background: oklch(0.12 0.03 265 / 0.6);
  color: var(--foreground);
  width: 100%;
  min-width: 0;
}
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}
.field input[aria-invalid='true'],
.field textarea[aria-invalid='true'] {
  border-color: oklch(0.7 0.18 25);
}
.field textarea {
  min-height: 88px;
  resize: vertical;
}
.field .hint {
  font-size: 0.85rem;
  color: var(--muted-foreground);
}
.field input[readonly] {
  opacity: 0.75;
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.95rem;
  cursor: pointer;
}
.check input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--amber);
  flex: none;
}
.check input:disabled + span {
  opacity: 0.55;
}

/* Dashboard layout */
.dash-top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  padding-block: 32px 0;
}
.dash-title {
  font-size: clamp(2rem, 4.4vw, 2.8rem);
  margin-top: 10px !important;
}
.dash {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 24px;
  padding-block: 24px 72px;
  align-items: start;
}
@media (max-width: 860px) {
  .dash {
    grid-template-columns: 1fr;
  }
}
.side {
  display: grid;
  gap: 4px;
  padding: 8px;
  position: sticky;
  top: 96px;
}
.side button {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted-foreground);
}
.side button:hover {
  color: var(--foreground);
}
.side button[aria-current='page'] {
  background: oklch(0.8 0.16 75 / 0.14);
  color: var(--amber);
  font-weight: 700;
}
.side button:focus-visible {
  outline: 2px solid var(--amber);
}
.side .count {
  font: 500 0.8rem/1.6 var(--f-mono);
}
.side .live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  align-self: center;
}
@media (max-width: 860px) {
  .side {
    display: flex;
    overflow-x: auto;
    position: static;
  }
  .side button {
    white-space: nowrap;
  }
}

.panel {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.panel:focus {
  outline: none;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-head h2 {
  font-size: clamp(1.6rem, 3vw, 2rem);
}
.sync {
  font-size: 0.9rem;
  color: var(--muted-foreground);
}
.item {
  padding: 18px;
  display: grid;
  gap: 14px;
  min-width: 0;
}
.item.draft {
  border-color: oklch(0.8 0.16 75 / 0.45);
}
.item.is-urgent {
  border-color: oklch(0.63 0.22 25 / 0.6);
}
.item-title {
  font-size: 1.15rem;
}
.grid2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.item-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.status {
  font-size: 0.88rem;
  min-height: 1.3em;
  color: var(--muted-foreground);
}
.status.saved {
  color: oklch(0.82 0.14 160);
}
.status.error {
  color: oklch(0.78 0.16 25);
}
.empty {
  color: var(--muted-foreground);
  font-style: italic;
}
.notice {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  background: oklch(0.8 0.16 75 / 0.1);
  border: 1px solid oklch(0.8 0.16 75 / 0.35);
}
.notice.danger {
  background: oklch(0.63 0.22 25 / 0.14);
  border-color: oklch(0.63 0.22 25 / 0.5);
}
.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag-soft {
  font: 600 0.66rem/1 var(--f-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  color: var(--muted-foreground);
}
.tag-soft.live {
  background: var(--live);
  color: var(--accent-foreground);
  border-color: transparent;
}
.tag-soft.public {
  color: var(--amber);
}
details.past {
  padding: 6px 4px;
}
details.past > summary {
  cursor: pointer;
  color: var(--muted-foreground);
  font-weight: 600;
  padding: 8px 0;
}
details.past > .stack {
  margin-top: 10px;
}
.stack {
  display: grid;
  gap: 12px;
}

/* Buttons */
.btn.small {
  padding: 8px 14px;
  font-size: 0.84rem;
}
.btn.danger {
  background: transparent;
  border: 1px solid var(--glass-line);
  color: oklch(0.78 0.16 25) !important;
}
.btn.danger.armed {
  background: oklch(0.63 0.22 25 / 0.2);
  border-color: oklch(0.63 0.22 25 / 0.6);
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-line);
  background: var(--glass-strong);
  color: var(--foreground);
  cursor: pointer;
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Photos */
.photo {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.photo .thumb {
  width: 120px;
  aspect-ratio: 16/9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--shade);
  border: 1px solid var(--glass-line);
  display: grid;
  place-items: center;
  color: var(--muted-foreground);
  font-size: 0.78rem;
  text-align: center;
}
.photo .thumb.square {
  width: 72px;
  aspect-ratio: 1;
}
.photo .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo input[type='file'] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Switch */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.switch {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}
.switch .track {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  position: relative;
  transition: background 0.2s;
}
.switch .track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--foreground);
  transition: transform 0.2s;
}
.switch[aria-checked='true'] .track {
  background: var(--amber);
}
.switch[aria-checked='true'] .track::after {
  transform: translateX(20px);
  background: var(--amber-ink);
}
.switch:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 4px;
  border-radius: 999px;
}
.switch:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Platform pills */
.pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pills button {
  font: 600 0.9rem/1 var(--f-body);
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--glass-strong);
  color: var(--foreground);
  cursor: pointer;
}
.pills button[aria-pressed='true'] {
  background: var(--amber);
  color: var(--amber-ink);
  border-color: transparent;
}
.pills button:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.live-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.live-status i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--live);
  animation: pulse 1.4s infinite;
}

/* Confirm dialog */
dialog.confirm {
  max-width: 440px;
  width: calc(100% - 32px);
  padding: 22px;
  color: var(--foreground);
  background: oklch(0.2 0.03 265 / 0.96);
}
dialog.confirm::backdrop {
  background: oklch(0.08 0.02 265 / 0.6);
}
dialog.confirm p {
  margin: 0 0 18px;
  font-size: 1.02rem;
}
.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
  .switch .track,
  .switch .track::after {
    transition: none;
  }
  .live-status i {
    animation: none;
  }
}

/* Small phones: keep the header on one line (the church name already links to the website). */
@media (max-width: 520px) {
  .bar-actions .hide-sm {
    display: none;
  }
  header.top .brand small {
    display: none;
  }
}

/* "Add photo" when the 5 homepage photos are used up. */
.btn.disabled {
  opacity: 0.55;
  pointer-events: none;
}

/* A file picker opened by its "Add photo" label; the browser's own box stays out of sight. */
.file-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
