/* ==========================================================================
   Brand Brokery — admin panel
   ========================================================================== */

:root {
  --ink: #1c2321;
  --muted: #6b6f6e;
  --line: rgba(28, 35, 33, 0.14);
  --line-strong: rgba(28, 35, 33, 0.28);
  --bg: #f4f2ee;
  --panel: #ffffff;
  --ok-bg: #e8f0e8;
  --ok-ink: #24603a;
  --err-bg: #f6e7e5;
  --err-ink: #8a2b20;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

a { color: inherit; }

/* ── Top bar ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
  background: var(--ink);
  color: #fff;
}
.topbar__brand {
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.8rem;
}
.topbar__brand span { opacity: 0.55; font-weight: 500; }
.topbar__right { display: flex; align-items: center; gap: 1rem; font-size: 0.85rem; }
.topbar__user { opacity: 0.7; }
.topbar__logout {
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
}
.topbar__logout:hover { background: rgba(255, 255, 255, 0.12); }

/* ── Shell ───────────────────────────────────────────────────────────── */
.wrap { max-width: 1000px; margin: 0 auto; padding: clamp(1rem, 4vw, 2.25rem); }

/* ── Tabs ────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.tabs a {
  text-decoration: none;
  padding: 0.6rem 1rem;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); }
.tabs a.is-active { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .count {
  display: inline-block;
  min-width: 1.25rem;
  text-align: center;
  background: var(--line);
  color: var(--ink);
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 0 0.4rem;
  margin-left: 0.35rem;
  vertical-align: 1px;
}

/* ── Flash / banners ─────────────────────────────────────────────────── */
.flash, .banner {
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.flash--success { background: var(--ok-bg); color: var(--ok-ink); }
.flash--error { background: var(--err-bg); color: var(--err-ink); }
.banner {
  background: #fff6e5;
  color: #7a5200;
  border: 1px solid #f0d79a;
}
.banner a { font-weight: 600; }

/* ── Panels ──────────────────────────────────────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 3vw, 1.75rem);
}
.panel + .panel { margin-top: 1.25rem; }
.panel__head { margin-bottom: 1.1rem; }
.panel__head h2 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.panel__head p { margin: 0; color: var(--muted); font-size: 0.88rem; }

/* ── Content editor ──────────────────────────────────────────────────── */
.group { border-top: 1px solid var(--line); padding-top: 1.25rem; margin-top: 1.25rem; }
.group:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.group > h3 {
  margin: 0 0 1rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }

.field { margin-bottom: 1rem; }
.field--full { grid-column: 1 / -1; }
.field > label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
}
.field input[type="text"],
.field input:not([type]),
.field input[type="url"],
.field select,
.field input[type="password"],
.field textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  padding: 0.6rem 0.7rem;
  background: #fcfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--ink);
  background: #fff;
}
.field textarea { min-height: 4.5rem; line-height: 1.5; }
.field .hint { margin: 0.3rem 0 0; font-size: 0.78rem; color: var(--muted); }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0.6rem 1.15rem;
  border-radius: 8px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  text-decoration: none;
}
.btn:hover { background: #000; }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: rgba(28, 35, 33, 0.06); }
.btn--sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn--danger { border-color: var(--err-ink); color: var(--err-ink); background: transparent; }
.btn--danger:hover { background: var(--err-bg); }

.actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

/* ── Tables (submissions) ────────────────────────────────────────────── */
.toolbar { display: flex; justify-content: flex-end; margin-bottom: 0.9rem; }
.tablewrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th, table.data td {
  text-align: left;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data th {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
table.data tr:last-child td { border-bottom: 0; }
table.data td .who { font-weight: 600; }
table.data td .sub { color: var(--muted); font-size: 0.82rem; }
table.data td.msg { max-width: 32rem; white-space: pre-wrap; }
.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  white-space: nowrap;
}
.nowrap { white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }

/* ── Login ───────────────────────────────────────────────────────────── */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login__card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 2rem 1.75rem;
}
.login__brand {
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}
.login__title { text-align: center; margin: 0 0 1.5rem; font-size: 1.15rem; }
.login .btn { width: 100%; justify-content: center; margin-top: 0.5rem; }

@media (max-width: 620px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}

[hidden] { display: none !important; }
.editor-breadcrumb, .section-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.editor-breadcrumb span, .hint { color: var(--muted); font-size: 0.82rem; }
.section-heading h3 { margin: 0; font-size: 0.85rem; }
.page-create { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1.5rem 0; }
.page-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 1rem; }
.page-row-actions form { margin: 0; }
.text-button { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.editor-section { border: 1px solid var(--line); border-radius: 8px; margin: 1.5rem 0; padding: 1rem; }
.editor-section legend { font-weight: 600; padding: 0 0.4rem; }
.section-tools { display: flex; justify-content: flex-end; gap: 0.5rem; margin-bottom: 0.75rem; }
.btn:disabled { opacity: 0.4; cursor: default; }
.page-actions { flex-wrap: wrap; padding-bottom: 1rem; z-index: 2; }
.page-actions a { font-size: 0.85rem; }
.flash ul { margin: 0; padding-left: 1rem; }
.google-selector { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.google-selector .field { flex: 1 1 260px; margin: 0; }
.google-enable { display: flex; gap: 0.7rem; align-items: center; margin-top: 1.5rem; font-weight: 600; }
.google-enable input { width: 18px; height: 18px; accent-color: var(--ink); }
.google-help details + details { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.google-help summary { font-weight: 600; cursor: pointer; }
.google-help li { margin-block: 0.6rem; }
.google-help { overflow-wrap: anywhere; }
.google-delivery { min-width: 210px; }
.google-delivery .tag { white-space: normal; }
.google-delivery form { margin-top: 0.75rem; }
