/* ============================================================
   ADMIN SHELL — shared styles for all /admin/ pages
   ============================================================ */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: #f5f2ec;
  color: #0a0a0f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}
a { color: #b8960c; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top header (sticky) ── */
.adm-header {
  background: #0a0a0f;
  color: #f0f0f0;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.adm-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 0.95rem;
}
.adm-brand .dot {
  display: inline-block; width: 8px; height: 8px;
  background: #d4af37; border-radius: 50%;
}
.adm-brand small {
  color: #909090; font-weight: 500; font-size: 0.78rem;
}
.adm-nav {
  display: flex; gap: 4px; flex-wrap: wrap; align-items: center;
}
.adm-nav a {
  padding: 7px 12px; border-radius: 6px;
  font-size: 0.84rem; font-weight: 600;
  color: #c0c0c0; text-decoration: none;
}
.adm-nav a:hover { background: rgba(255,255,255,0.06); color: #f0f0f0; text-decoration: none; }
.adm-nav a.active { background: rgba(212,175,55,0.18); color: #d4af37; }
.adm-nav .sep { width: 1px; height: 18px; background: rgba(255,255,255,0.1); margin: 0 6px; }
.adm-nav button {
  background: transparent; border: 1px solid rgba(255,255,255,0.18);
  color: #aaa; padding: 6px 12px; border-radius: 6px;
  font-family: inherit; font-size: 0.78rem; font-weight: 600;
  cursor: pointer;
}
.adm-nav button:hover { color: #f0f0f0; border-color: rgba(255,255,255,0.3); }

/* ── Page wrapper ── */
.adm-shell {
  max-width: 1180px;
  margin: 24px auto 80px;
  padding: 0 24px;
}
.adm-page-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
  margin: 8px 0 24px;
}
.adm-page-header h1 { margin: 0; font-size: 1.5rem; color: #0a0a0f; font-weight: 700; }
.adm-page-header .subtitle { color: #888; font-size: 0.88rem; margin-top: 4px; }

/* ── Buttons ── */
.adm-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 6px;
  font-size: 0.86rem; font-weight: 700;
  font-family: inherit; cursor: pointer;
  border: 1px solid #ddd; background: #fff; color: #0a0a0f;
  text-decoration: none;
}
.adm-btn:hover { background: #f8f5ee; text-decoration: none; }
.adm-btn.gold {
  background: linear-gradient(135deg, #d4af37 0%, #b8960c 100%);
  color: #0a0a0f; border-color: transparent;
}
.adm-btn.dark { background: #0a0a0f; color: #fff; border-color: transparent; }
.adm-btn.danger { background: #c0392b; color: #fff; border-color: transparent; }
.adm-btn.ghost { background: transparent; color: #555; border-color: #ddd; }
.adm-btn.sm { padding: 6px 11px; font-size: 0.78rem; }
.adm-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Tiles (dashboard) ── */
.adm-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}
.adm-tile {
  background: #fff;
  border: 1px solid #f0ece4;
  border-radius: 12px;
  padding: 22px 24px;
  text-decoration: none;
  color: #0a0a0f;
  display: flex; flex-direction: column;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.adm-tile:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: rgba(212,175,55,0.5);
  box-shadow: 0 6px 16px rgba(0,0,0,0.05);
}
.adm-tile-icon { font-size: 1.6rem; margin-bottom: 8px; }
.adm-tile-title { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.adm-tile-desc { font-size: 0.86rem; color: #666; line-height: 1.55; flex: 1; }
.adm-tile-meta {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid #f5f0e6;
  font-size: 0.78rem; color: #888;
}
.adm-tile-meta strong { color: #b8960c; }

/* ── Cards ── */
.adm-card {
  background: #fff;
  border: 1px solid #f0ece4;
  border-radius: 12px;
  padding: 22px 26px;
  margin-bottom: 18px;
}
.adm-card h2 { margin: 0 0 6px; font-size: 1.05rem; font-weight: 700; }
.adm-card .subtitle { color: #888; font-size: 0.86rem; margin-bottom: 16px; }

/* ── Forms ── */
.adm-field {
  margin-bottom: 14px;
}
.adm-field label {
  display: block; font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: #888; margin-bottom: 5px;
}
.adm-field input[type="text"],
.adm-field input[type="number"],
.adm-field input[type="url"],
.adm-field input[type="datetime-local"],
.adm-field input[type="email"],
.adm-field select,
.adm-field textarea {
  width: 100%; padding: 9px 12px;
  font-size: 0.92rem;
  font-family: inherit;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  color: #0a0a0f;
}
.adm-field textarea { resize: vertical; min-height: 80px; line-height: 1.55; }
.adm-field input:focus, .adm-field select:focus, .adm-field textarea:focus {
  outline: none; border-color: #d4af37; box-shadow: 0 0 0 3px rgba(212,175,55,0.15);
}
.adm-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media(max-width:640px){ .adm-field-row { grid-template-columns: 1fr; } }
.adm-field-help { font-size: 0.78rem; color: #999; margin-top: 4px; line-height: 1.55; }
.adm-checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: 0.88rem; cursor: pointer; padding: 6px 0; }
.adm-checkbox input { margin-top: 3px; }

/* ── Tables ── */
.adm-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.88rem;
}
.adm-table th, .adm-table td {
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid #f0ece4;
  vertical-align: top;
}
.adm-table th {
  font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: #888; background: #faf8f3;
}
.adm-table tr:hover td { background: #fcfaf5; }
.adm-table .row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Auth gate ── */
.adm-auth {
  max-width: 460px; margin: 80px auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: 36px 36px 32px;
  text-align: center;
}
.adm-auth h2 { font-size: 1.25rem; margin: 0 0 8px; color: #0a0a0f; }
.adm-auth p { font-size: 0.88rem; color: #555; line-height: 1.65; margin: 0 0 20px; }
.adm-auth p code { background: #f0ece4; padding: 2px 6px; border-radius: 4px; font-size: 0.84rem; }
.adm-auth input {
  width: 100%; padding: 12px 14px; font-size: 0.92rem;
  border: 1px solid #ddd; border-radius: 6px; margin-bottom: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, monospace;
}
.adm-auth input:focus { outline: none; border-color: #d4af37; }
.adm-auth .adm-btn { width: 100%; padding: 12px; }
.adm-auth-error { color: #c0392b; font-size: 0.86rem; margin-top: 8px; }

/* ── State indicators ── */
.adm-pill {
  display: inline-block;
  padding: 3px 10px; border-radius: 12px;
  font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.04em;
}
.adm-pill.green { background: rgba(76,175,80,0.15); color: #1d7a3f; }
.adm-pill.gold { background: rgba(212,175,55,0.15); color: #b8960c; }
.adm-pill.red { background: rgba(229,57,53,0.15); color: #c0392b; }
.adm-pill.gray { background: rgba(0,0,0,0.06); color: #777; }

.adm-loading {
  text-align: center; padding: 50px 20px;
  background: #fff; border-radius: 10px;
  color: #888;
}
.adm-loading::before {
  content: '';
  display: inline-block;
  width: 22px; height: 22px;
  border: 3px solid #f0ece4;
  border-top-color: #d4af37;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 10px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.adm-error-box {
  background: #fff5f5; border: 1px solid #fee;
  border-radius: 10px; padding: 18px 22px;
  color: #a93226; font-size: 0.9rem; line-height: 1.6;
}
.adm-error-box strong { display: block; font-size: 0.95rem; margin-bottom: 4px; }

.adm-success-box {
  background: rgba(76,175,80,0.08); border: 1px solid rgba(76,175,80,0.3);
  border-radius: 10px; padding: 16px 22px;
  color: #1d7a3f; font-size: 0.9rem; line-height: 1.6;
  margin-bottom: 16px;
}

.adm-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(10,10,15,0.96); color: #d4af37;
  padding: 11px 22px; border-radius: 30px;
  font-size: 0.86rem; font-weight: 600;
  z-index: 9999; box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  border: 1px solid rgba(212,175,55,0.3);
  opacity: 0; transition: opacity 0.25s;
}
.adm-toast.visible { opacity: 1; }

/* ── Pre / code ── */
.adm-code {
  background: #fafafa;
  border: 1px solid #f0ece4;
  border-radius: 8px;
  padding: 16px 18px;
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  color: #444;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ────────────────────────────────────────────────────────────────────
   GLOBAL MOBILE / TOUCH POLISH
   Applies to every admin page. Larger tap targets, comfortable
   spacing, no horizontal scrolling on phones, native-feeling buttons.
──────────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  html, body { font-size: 15px; }
  .adm-shell { padding: 0 14px; margin: 14px auto 80px; }
  .adm-page-header { margin: 6px 0 18px; }
  .adm-page-header h1 { font-size: 1.3rem; }
  .adm-page-header .subtitle { font-size: 0.84rem; }
  .adm-card { padding: 18px; border-radius: 12px; margin-bottom: 14px; }
  .adm-card h2 { font-size: 1rem; }
  .adm-card .subtitle { font-size: 0.82rem; margin-bottom: 12px; }
  .adm-tiles { grid-template-columns: 1fr; gap: 14px; }
  .adm-tile { padding: 18px; min-height: auto; }
  .adm-tile-title { font-size: 0.98rem; }
  .adm-tile-desc { font-size: 0.84rem; line-height: 1.5; }
  /* Comfortable touch targets: 44px+ Apple HIG / 48px+ Material */
  .adm-btn { padding: 11px 18px; font-size: 0.9rem; min-height: 42px; }
  .adm-btn.sm { padding: 9px 14px; font-size: 0.82rem; min-height: 36px; }
  .adm-field input,
  .adm-field select,
  .adm-field textarea { padding: 11px 14px; font-size: 16px; /* prevent iOS zoom */ }
  .adm-table { font-size: 0.86rem; }
  .adm-table th, .adm-table td { padding: 11px 10px; }
  /* Tables: hide overflow + allow scroll wrapper */
  .adm-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* iOS safe-area for sticky elements */
@supports (padding: max(0px)) {
  .adm-shell { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
