/* ==========================================================================
   Brand Hub :: dashboard
   Deliberately neutral, so it never competes with whichever brand is loaded.
   ========================================================================== */

:root {
  --ink:      #1c1d1f;
  --muted:    #6b6f76;
  --faint:    #9aa0a6;
  --line:     #e4e6e9;
  --bg:       #f6f7f8;
  --surface:  #ffffff;
  --accent:   #1f5eff;
  --accent-d: #1546c4;
  --danger:   #c0392b;
  --ok:       #1f7a4d;
  --radius:   10px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}

a { color: var(--accent); }

/* ---------------------------------------------------------------- topbar */
.topbar {
  display: flex; align-items: center; gap: 26px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 0 22px; height: 54px; position: sticky; top: 0; z-index: 20;
}
.topbar .logo { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 15px; }
.topbar nav { display: flex; gap: 20px; flex: 1; }
.topbar nav a, .topbar-right a {
  text-decoration: none; color: var(--muted); font-size: 13.5px; font-weight: 500;
}
.topbar nav a:hover, .topbar-right a:hover { color: var(--ink); }
.topbar nav a.view { color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-right .who { color: var(--faint); font-size: 12.5px; }

/* ----------------------------------------------------------------- shell */
.admin-main { max-width: 1180px; margin: 0 auto; padding: 26px 22px 120px; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; margin-bottom: 22px;
}
.page-head h1 { margin: 0; font-size: 23px; font-weight: 650; letter-spacing: -.01em; }
.page-head .sub { margin: 6px 0 0; color: var(--muted); max-width: 620px; }
.back { display: inline-block; font-size: 12.5px; text-decoration: none; margin-bottom: 6px; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin-bottom: 16px;
}
.panel h2 { margin: 0 0 14px; font-size: 15px; font-weight: 650; }
.panel.narrow { max-width: 620px; }
.panel hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

.split-cols { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .split-cols { grid-template-columns: 1fr; } }

.empty { color: var(--faint); padding: 18px 0; }

/* ----------------------------------------------------------------- flash */
.flash {
  max-width: 1180px; margin: 14px auto -4px; padding: 11px 16px;
  border-radius: 8px; font-size: 13.5px; font-weight: 500;
}
.flash.ok    { background: #e8f6ee; color: var(--ok);     border: 1px solid #c3e6d3; }
.flash.error { background: #fdeceb; color: var(--danger); border: 1px solid #f5cfcc; }

/* ---------------------------------------------------------------- fields */
.field { margin-bottom: 15px; }
.field label {
  display: block; font-size: 12.5px; font-weight: 600;
  margin-bottom: 5px; color: var(--ink);
}
.field input[type=text], .field input[type=email], .field input[type=password],
.field select, .field textarea {
  width: 100%; padding: 8px 11px; font: inherit; font-size: 13.5px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink);
}
.field textarea { resize: vertical; line-height: 1.6; }
.field textarea.rich { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,94,255,.12);
}
.field input:disabled { background: var(--bg); color: var(--faint); }
.hint { margin: 5px 0 0; font-size: 11.5px; color: var(--faint); line-height: 1.5; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; margin-bottom: 8px; }
.check input { width: auto; }

.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 700px) { .row-3 { grid-template-columns: 1fr; } }

.colour-input { display: flex; gap: 8px; align-items: center; }
.colour-input input[type=color] {
  width: 38px; height: 34px; padding: 2px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; cursor: pointer; flex: none;
}
.colour-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 800px) { .colour-grid { grid-template-columns: 1fr 1fr; } }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-block; border: 1px solid var(--line); background: #fff;
  color: var(--ink); border-radius: 7px; padding: 8px 16px;
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); border-color: var(--accent-d); }
.btn.wide { width: 100%; text-align: center; }
.btn-sm {
  border: 1px dashed var(--line); background: #fff; color: var(--muted);
  border-radius: 6px; padding: 6px 12px; font: inherit; font-size: 12.5px;
  font-weight: 600; cursor: pointer;
}
.btn-sm:hover { color: var(--accent); border-color: var(--accent); }

.link-btn {
  background: none; border: none; padding: 0; font: inherit; font-size: 12px;
  color: var(--accent); cursor: pointer; text-decoration: underline;
}
.link-btn.danger { color: var(--danger); }

.icon {
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  width: 28px; height: 28px; cursor: pointer; font-size: 13px; color: var(--muted);
  line-height: 1;
}
.icon:hover { color: var(--ink); border-color: var(--muted); }
.icon.danger:hover { color: var(--danger); border-color: var(--danger); }

.pill {
  display: inline-block; font-style: normal; font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  background: var(--bg); color: var(--muted);
  border: 1px solid var(--line); border-radius: 20px; padding: 1px 8px; margin-left: 6px;
}
.tag { font-size: 11px; color: var(--ok); font-weight: 600; }

.sticky-save {
  position: sticky; bottom: 0; z-index: 15;
  background: linear-gradient(to top, var(--bg) 62%, rgba(246,247,248,0));
  padding: 16px 0 10px; margin-top: 4px;
}

/* ------------------------------------------------------------ site cards */
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.site-card {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; text-decoration: none; color: var(--ink);
}
.site-card:hover { border-color: var(--muted); }
.site-swatch { display: block; width: 34px; height: 34px; border-radius: 8px; margin-bottom: 14px; }
.site-name { display: block; font-weight: 650; font-size: 15px; }
.site-url  { display: block; font-size: 12.5px; color: var(--faint); font-family: ui-monospace, Menlo, monospace; }
.site-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ------------------------------------------------------------- page list */
.page-list { list-style: none; margin: 0 0 16px; padding: 0; }
.page-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 7px; background: #fff; cursor: grab;
}
.page-list li.drag-over { border-color: var(--accent); background: #f4f7ff; }
.page-list li.dragging  { opacity: .45; }
.grip { color: var(--faint); font-size: 12px; letter-spacing: -2px; }
.page-title { font-weight: 600; text-decoration: none; color: var(--ink); flex: 1; }
.page-title:hover { color: var(--accent); }
.page-group { font-size: 11.5px; color: var(--muted); }
.page-slug  { font-size: 11.5px; color: var(--faint); font-family: ui-monospace, Menlo, monospace; }

/* ---------------------------------------------------------- block editor */
.block-panel { padding: 0; overflow: hidden; }
.block-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 20px; border-bottom: 1px solid var(--line); background: #fbfbfc;
}
.block-type { font-weight: 650; font-size: 13.5px; }
.block-hint { display: block; font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.block-tools { display: flex; gap: 6px; }
.block-body { padding: 20px; }
.block-panel.collapsed .block-body { display: none; }

.rep-rows { display: grid; gap: 10px; margin-bottom: 10px; }
.rep-row {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fbfbfc;
}
.rep-row-fields { flex: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.rep-row-fields .field { margin-bottom: 0; }
.rep-row-fields .field-textarea, .rep-row-fields .field-richtext { grid-column: 1 / -1; }
@media (max-width: 700px) { .rep-row-fields { grid-template-columns: 1fr; } }
.rep-remove {
  background: none; border: none; color: var(--faint); font-size: 19px;
  cursor: pointer; line-height: 1; padding: 2px 4px;
}
.rep-remove:hover { color: var(--danger); }

.add-block .block-picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px;
}
.block-choice {
  text-align: left; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 13px 15px; cursor: pointer; font: inherit;
}
.block-choice:hover { border-color: var(--accent); background: #f6f9ff; }
.block-choice strong { display: block; font-size: 13px; font-weight: 650; }
.block-choice span   { display: block; font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* ---------------------------------------------------------------- assets */
.asset-panel .asset-meta { border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 16px; }
.file-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.file-chip {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px;
  width: 132px; background: #fff;
}
.file-chip.is-preview { border-color: var(--ok); }
.chip-thumb {
  height: 58px; border-radius: 6px; background: var(--bg); padding: 6px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 8px;
}
.chip-thumb.on-dark { background: #63666a; }
.chip-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.chip-thumb span { font-size: 12px; font-weight: 700; color: var(--muted); }
.chip-meta strong { font-size: 11.5px; }
.chip-meta span { font-size: 11px; color: var(--faint); margin-left: 5px; }
.chip-actions { margin-top: 7px; display: grid; gap: 3px; }

.upload-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.upload-row input[type=file] { font-size: 12.5px; }
.danger-row { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- tables */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--faint); padding: 0 12px 9px 0; border-bottom: 1px solid var(--line);
}
.admin-table td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table td.right { text-align: right; }
.admin-table .muted { display: block; font-size: 12px; color: var(--faint); }
.pw-form { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 5px; }
.pw-form input { padding: 4px 8px; font-size: 12px; border: 1px solid var(--line); border-radius: 5px; }

/* ----------------------------------------------------------------- login */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.login-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 34px; width: 100%; max-width: 380px;
}
.login-card.wide-card { max-width: 460px; }
.login-card h1 { margin: 0 0 6px; font-size: 21px; }
.login-card .sub { margin: 0 0 20px; color: var(--muted); font-size: 13.5px; }
.plain-list { list-style: none; margin: 0 0 20px; padding: 0; }
.plain-list li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.plain-list a { text-decoration: none; font-weight: 600; }

.block-choice.is-disabled,
.block-choice:disabled {
  opacity: .45; cursor: not-allowed; background: var(--bg);
}
.block-choice:disabled:hover { border-color: var(--line); background: var(--bg); }
