/* Admin — Apple-inspired console */

:root {
  --a-bg: #f5f5f7;
  --a-surface: #ffffff;
  --a-ink: #1d1d1f;
  --a-ink-2: #6e6e73;
  --a-line: rgba(0, 0, 0, 0.08);
  --a-accent: #1d6f42;
  --a-accent-strong: #175a36;
  --a-accent-soft: #e8f3ed;
  --a-danger: #e0342c;
  --a-warn: #b45309;
  --a-r: 14px;
  --a-r-l: 20px;
  --a-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Geist", "Segoe UI", Roboto, sans-serif;
  --a-shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 40px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--a-font);
  background: var(--a-bg);
  color: var(--a-ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--a-accent); text-decoration: none; }
a:hover { color: var(--a-accent-strong); }

:focus-visible {
  outline: 3px solid rgba(29, 111, 66, 0.4);
  outline-offset: 2px;
}

/* ——— Login ——— */
.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(ellipse 60% 50% at 80% 0%, rgba(29,111,66,.12), transparent 60%),
    radial-gradient(ellipse 50% 40% at 10% 100%, rgba(29,111,66,.08), transparent 60%),
    var(--a-bg);
}

.login-card {
  width: min(100%, 400px);
  background: var(--a-surface);
  border: 1px solid var(--a-line);
  border-radius: 24px;
  padding: 40px 36px 36px;
  box-shadow: var(--a-shadow);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  text-align: center;
}

.login-brand .mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(145deg, #1d6f42, #14532d);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.04em;
  box-shadow: 0 8px 24px rgba(29,111,66,.3);
}

.login-brand h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-brand p {
  font-size: 13.5px;
  color: var(--a-ink-2);
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--a-ink-2);
  margin-bottom: 7px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 12px;
  background: var(--a-surface);
  font-size: 15px;
  color: var(--a-ink);
  transition: border-color .2s, box-shadow .2s;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--a-accent);
  box-shadow: 0 0 0 3px rgba(29,111,66,.18);
}

.field .hint {
  font-size: 12px;
  color: var(--a-ink-2);
  margin-top: 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .15s, box-shadow .2s, color .2s, border-color .2s;
  text-decoration: none;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--a-accent);
  color: #fff;
  box-shadow: 0 6px 20px rgba(29,111,66,.28);
}

.btn-primary:hover { background: var(--a-accent-strong); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--a-ink);
  border: 1px solid rgba(0,0,0,.14);
}

.btn-ghost:hover { background: rgba(0,0,0,.04); color: var(--a-ink); }

.btn-danger {
  background: transparent;
  color: var(--a-danger);
  border: 1px solid rgba(224,52,44,.35);
}

.btn-danger:hover { background: rgba(224,52,44,.08); }

.btn-sm { padding: 7px 14px; font-size: 13px; }

.btn-block { width: 100%; }

.form-error {
  background: rgba(224,52,44,.08);
  border: 1px solid rgba(224,52,44,.25);
  color: var(--a-danger);
  font-size: 13.5px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  display: none;
}

.form-error.show { display: block; }

.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--a-ink-2);
}

/* ——— Dashboard shell ——— */
.admin-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "side top"
    "side main";
}

.a-side {
  grid-area: side;
  background: var(--a-surface);
  border-right: 1px solid var(--a-line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}

.a-side__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 24px;
}

.a-side__brand .mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(145deg, #1d6f42, #14532d);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
}

.a-side__brand strong {
  display: block;
  font-size: 13.5px;
  letter-spacing: 0.02em;
}

.a-side__brand span {
  font-size: 11.5px;
  color: var(--a-ink-2);
}

.a-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: none;
  background: transparent;
  border-radius: 11px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--a-ink);
  cursor: pointer;
  transition: background .18s, color .18s;
}

.a-nav-btn:hover { background: rgba(0,0,0,.045); }

.a-nav-btn.is-active {
  background: var(--a-accent-soft);
  color: var(--a-accent);
  font-weight: 600;
}

.a-nav-btn .ico { width: 18px; text-align: center; opacity: .85; }

.a-side__spacer { flex: 1; }

.a-top {
  grid-area: top;
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--a-line);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.a-top h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.a-top__right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13.5px;
  color: var(--a-ink-2);
}

.a-main {
  grid-area: main;
  padding: 32px;
  max-width: 1100px;
  width: 100%;
}

.a-panel { display: none; }
.a-panel.is-active { display: block; }

.a-card {
  background: var(--a-surface);
  border: 1px solid var(--a-line);
  border-radius: var(--a-r-l);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.a-card h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 4px;
}

.a-card > .sub {
  font-size: 13.5px;
  color: var(--a-ink-2);
  margin-bottom: 22px;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--a-surface);
  border: 1px solid var(--a-line);
  border-radius: var(--a-r-l);
  padding: 20px 22px;
}

.stat-card .label {
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--a-ink-2);
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat-card .value.is-warn { color: var(--a-warn); }
.stat-card .value.is-ok { color: var(--a-accent); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid .span-2 { grid-column: 1 / -1; }

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.toolbar h3 { margin: 0; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--a-line);
  border-radius: var(--a-r);
  background: var(--a-surface);
}

table.a-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 640px;
}

.a-table th,
.a-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--a-line);
  vertical-align: middle;
}

.a-table th {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--a-ink-2);
  background: #fafafa;
}

.a-table tr:last-child td { border-bottom: none; }

.a-table tr:hover td { background: #fafafa; }

.a-table .thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--a-bg);
  border: 1px solid var(--a-line);
}

.a-table .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.pill-ok { background: var(--a-accent-soft); color: var(--a-accent); }
.pill-warn { background: #fef3c7; color: var(--a-warn); }
.pill-danger { background: #fee2e2; color: var(--a-danger); }
.pill-mute { background: #eee; color: var(--a-ink-2); }

/* Modal */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(6px);
  z-index: 1000;
  padding: 40px 16px;
  overflow-y: auto;
}

.modal-backdrop.is-open { display: block; }

.modal {
  background: var(--a-surface);
  width: min(100%, 640px);
  margin: 0 auto;
  border-radius: 22px;
  padding: 28px;
  box-shadow: 0 24px 64px rgba(0,0,0,.2);
  border: 1px solid var(--a-line);
}

.modal h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* Repeaters */
.repeater-item {
  border: 1px solid var(--a-line);
  border-radius: var(--a-r);
  padding: 16px;
  margin-bottom: 12px;
  background: #fafafa;
  position: relative;
}

.repeater-item__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--a-ink-2);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: -80px;
  transform: translateX(-50%);
  background: var(--a-ink);
  color: #fff;
  padding: 13px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 3000;
  opacity: 0;
  transition: bottom .35s var(--a-shadow), opacity .35s, transform .35s;
  max-width: min(92vw, 440px);
  text-align: center;
}

.toast.show {
  bottom: 28px;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.is-error { background: var(--a-danger); }

.empty-note {
  padding: 40px;
  text-align: center;
  color: var(--a-ink-2);
  font-size: 14.5px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
}

.check-row input { width: 18px; height: 18px; accent-color: var(--a-accent); }

.img-preview {
  width: 96px;
  height: 96px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--a-line);
  background: var(--a-bg);
  display: block;
  margin-top: 8px;
}

.photo-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 8px;
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "main";
  }
  .a-side {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    top: auto;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-top: 1px solid var(--a-line);
    padding: 10px;
    z-index: 100;
    gap: 6px;
  }
  .a-side__brand, .a-side__spacer { display: none; }
  .a-nav-btn { width: auto; font-size: 12.5px; padding: 9px 12px; }
  .a-main { padding: 20px 16px 100px; }
  .a-top { padding: 0 16px; }
}
