/* The gate, app shell and post editor all set their own display value, which
   overrides the browser's default [hidden] rule. Without this line every one
   of them stays visible at once and the editor overlay blocks the whole page. */
[hidden] { display: none !important; }

/* Stolet studio admin — uses the same brand tokens as the public site */
.admin-body { background: var(--white); font-size: 0.98rem; }
.admin-body * { box-sizing: border-box; }
.admin-body code {
  background: rgba(5,6,8,0.06); padding: 2px 6px; border-radius: 3px;
  font-size: 0.88em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---- Gate ---- */
.gate {
  min-height: 100vh; display: grid; place-items: center; background: var(--black);
  padding: 24px;
}
.gate-card {
  background: var(--white); border-radius: 10px; padding: clamp(32px, 5vw, 48px);
  width: 100%; max-width: 380px; text-align: center;
}
.gate-logo { margin: 0 auto 22px; }
.gate-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.gate-card .muted { margin-bottom: 24px; }
#gate-form input[type="password"] {
  width: 100%; padding: 13px 14px; border-radius: 6px; border: 1px solid var(--line);
  font: inherit; margin-bottom: 12px;
}
#gate-form .btn { width: 100%; border: none; cursor: pointer; }
.gate-error { color: #b23b3b; font-size: 0.88rem; margin-top: 12px; }
.gate-note { font-size: 0.78rem; color: var(--muted); margin-top: 22px; line-height: 1.5; }
.gate-diag { font-size: 0.78rem; margin-top: 10px; line-height: 1.5; padding: 8px 10px; border-radius: 6px; }
.gate-diag.is-ok { color: #1a7f4a; background: rgba(26,127,74,0.08); }
.gate-diag.is-bad { color: #b23b3b; background: rgba(178,59,59,0.08); }

/* ---- Shell ---- */
.admin-app { min-height: 100vh; display: flex; flex-direction: column; }
.admin-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 3vw, 32px); background: var(--black); color: var(--white);
  position: sticky; top: 0; z-index: 40; flex-wrap: wrap; gap: 12px;
}
.admin-top-left { display: flex; align-items: center; gap: 12px; }
.admin-top-left img { filter: invert(1) brightness(2); }
.admin-title { font-weight: 700; letter-spacing: -0.01em; }
.admin-top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.save-state { font-size: 0.8rem; color: rgba(247,248,250,0.55); margin-right: 6px; }
.save-state.is-dirty { color: var(--yellow); }

.btn--sm { padding: 9px 16px; font-size: 0.85rem; border: none; cursor: pointer; }
.admin-top .btn--line { border-color: rgba(247,248,250,0.35); color: var(--white); }
.admin-top .btn--line:hover { background: rgba(247,248,250,0.12); }

.admin-body-grid { display: grid; grid-template-columns: 220px 1fr; flex: 1; }
.admin-nav {
  background: var(--paper); border-right: 1px solid var(--line);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 57px; align-self: start; height: calc(100vh - 57px);
}
.admin-nav-btn {
  text-align: left; background: none; border: none; padding: 11px 14px;
  border-radius: 6px; font: 600 0.92rem/1.3 var(--body); color: var(--black);
  cursor: pointer; opacity: 0.6;
}
.admin-nav-btn:hover { opacity: 1; background: rgba(5,6,8,0.05); }
.admin-nav-btn.is-active { opacity: 1; background: var(--yellow); }

.admin-main { padding: clamp(24px, 3vw, 44px); max-width: 900px; }
.admin-panel { display: none; }
.admin-panel.is-active { display: block; }
.admin-panel h2 { font-size: 1.7rem; margin-bottom: 8px; }
.admin-panel .muted { color: var(--muted); max-width: 62ch; margin-bottom: 26px; }
.sub-h { font-size: 1.05rem; margin: 30px 0 14px; }

/* ---- Fields ---- */
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 8px; }
.field { margin-bottom: 20px; }
.field label { display: block; font-weight: 700; font-size: 0.86rem; margin-bottom: 7px; }
.field input[type="text"], .field input[type="email"], .field input[type="url"],
.field input[type="password"], .field textarea {
  width: 100%; padding: 11px 13px; border-radius: 6px; border: 1px solid var(--line);
  font: inherit; background: var(--white); color: var(--black);
}
.field textarea { resize: vertical; }
.field textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; line-height: 1.55; }
.field input:focus, .field textarea:focus { outline: none; box-shadow: 0 0 0 3px rgba(251,223,87,0.55); border-color: var(--black); }

/* ---- Image picker ---- */
.img-pick { position: relative; border-radius: 6px; overflow: hidden; background: var(--char); aspect-ratio: 16/9; cursor: pointer; }
.img-pick--small { aspect-ratio: 1/1; max-width: 96px; }
.img-pick-preview { width: 100%; height: 100%; object-fit: contain; background: var(--char); display: block; }
.img-pick input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.img-pick-btn {
  position: absolute; left: 8px; bottom: 8px; background: rgba(5,6,8,0.75); color: var(--white);
  font-size: 0.72rem; font-weight: 700; padding: 6px 10px; border-radius: 4px; pointer-events: none;
}

/* ---- Dashboard ---- */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.dash-card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 22px; }
.dash-card h3 { font-size: 1.02rem; margin-bottom: 12px; }
.dash-steps { margin: 0; padding-left: 20px; list-style: decimal; }
.dash-steps li { margin-bottom: 8px; font-size: 0.92rem; }
.dash-stats { display: flex; gap: 28px; margin: 0; }
.dash-stats dt { font: 800 2.1rem/1 var(--display); color: var(--black); }
.dash-stats dd { margin: 4px 0 0; font-size: 0.82rem; color: var(--muted); }
#import-file { font-size: 0.85rem; }

/* ---- Page sub-tabs ---- */
.page-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.page-tab-btn {
  background: var(--paper); border: 1px solid var(--line); padding: 8px 16px;
  border-radius: 100px; font: 600 0.85rem/1 var(--body); cursor: pointer;
}
.page-tab-btn.is-active { background: var(--black); color: var(--white); border-color: var(--black); }
.page-form { display: none; }
.page-form.is-active { display: block; }

/* ---- Blog list ---- */
.panel-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.panel-head-row h2 { margin-bottom: 6px; }
.panel-head-row .muted { margin-bottom: 0; }
.post-list-admin { display: flex; flex-direction: column; gap: 10px; }
.post-row {
  display: flex; align-items: center; gap: 16px; padding: 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--paper);
}
.post-row img { width: 84px; height: 56px; object-fit: cover; border-radius: 4px; background: var(--char); flex: none; }
.post-row-copy { flex: 1; min-width: 0; }
.post-row-copy h4 { margin: 0 0 3px; font-size: 1rem; font-family: var(--body); font-weight: 700; }
.post-row-copy p { margin: 0; font-size: 0.82rem; color: var(--muted); }
.post-row-tag {
  font: 700 0.68rem/1 var(--body); letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--yellow); padding: 5px 8px; border-radius: 3px; flex: none;
}
.post-row-actions { display: flex; gap: 8px; flex: none; }
.post-row-actions button {
  background: none; border: 1px solid var(--line); border-radius: 5px; padding: 7px 12px;
  font: 600 0.8rem/1 var(--body); cursor: pointer;
}
.post-row-actions button:hover { background: rgba(5,6,8,0.05); }
.post-row.is-drag { opacity: 0.4; }
.post-row-handle { flex: none; }
.post-row-handle button {
  background: none; border: 1px solid var(--line); border-radius: 5px; width: 30px; height: 26px;
  color: var(--muted); font-size: 0.68rem; cursor: pointer; display: grid; place-items: center;
}
.post-row-handle button:hover:not(:disabled) { background: rgba(5,6,8,0.05); color: var(--black); }
.post-row-handle button:disabled { opacity: 0.25; cursor: default; }

/* ---- Post editor modal ---- */
.post-editor { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; }
.post-editor-backdrop { position: absolute; inset: 0; background: rgba(5,6,8,0.6); }
.post-editor-card {
  position: relative; background: var(--white); width: 100%; max-width: 760px;
  max-height: 92vh; border-radius: 10px; display: flex; flex-direction: column; overflow: hidden;
}
.pe-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.pe-head h2 { margin: 0; font-size: 1.25rem; }
.pe-body { padding: 22px 24px; overflow-y: auto; flex: 1; }
.pe-foot { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-top: 1px solid var(--line); }
.pe-foot .btn, .pe-foot .btn--line { border: none; cursor: pointer; }
.pe-foot .btn--line { border: 1px solid var(--line); background: none; }
#pe-delete { color: #b23b3b; border-color: rgba(178,59,59,0.35); }

/* ---- Toast ---- */
.admin-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--black); color: var(--white); padding: 13px 22px; border-radius: 100px;
  font-size: 0.88rem; font-weight: 600; z-index: 100; box-shadow: 0 12px 30px -10px rgba(5,6,8,0.5);
}

@media (max-width: 820px) {
  .admin-body-grid { grid-template-columns: 1fr; }
  .admin-nav { position: static; height: auto; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .admin-nav-btn { white-space: nowrap; }
}

/* ---- Save / Publish additions ---- */
.admin-top .btn--line { border: 1px solid rgba(247,248,250,0.35); color: var(--white); }
.admin-top .btn--sun { background: var(--yellow); color: var(--black); }
.admin-top .btn--sun:hover:not(:disabled) { background: var(--white); }
.admin-top .btn:disabled { opacity: 0.4; cursor: not-allowed; }
.save-state.is-draft { color: #f0b35a; }
.save-state.is-live { color: #7fd19a; }
.save-state.is-error { color: #ff8a80; }

.admin-banner {
  background: rgba(5,6,8,0.05); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 18px; margin-bottom: 24px; font-size: 0.92rem; line-height: 1.5; max-width: 78ch;
}
.admin-banner--warn { background: rgba(251,223,87,0.28); border-color: rgba(5,6,8,0.25); }
.link-btn {
  background: none; border: none; padding: 0; font: inherit; font-weight: 700;
  color: inherit; text-decoration: underline; cursor: pointer;
}

/* ---- Nav badge ---- */
.nav-badge {
  display: inline-block; min-width: 20px; padding: 1px 7px; margin-left: 6px; border-radius: 100px;
  background: var(--black); color: var(--yellow); font-size: 0.72rem; font-weight: 700; text-align: center;
}
.admin-nav-btn.is-active .nav-badge { background: var(--black); color: var(--yellow); }

/* ---- Enquiries ---- */
.enq-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.enq-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.enq-filters button, .range-btns button {
  border: 1px solid var(--line); background: var(--paper); border-radius: 100px; padding: 7px 14px;
  font: 600 0.84rem var(--body); cursor: pointer; color: inherit;
}
.enq-filters button.is-active, .range-btns button.is-active { background: var(--black); color: var(--yellow); border-color: var(--black); }
#enq-search { padding: 10px 14px; border: 1px solid var(--line); border-radius: 6px; font: inherit; min-width: min(280px, 100%); }
.enq-list { display: flex; flex-direction: column; gap: 8px; }
.enq-row { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.enq-row.is-new { border-color: rgba(5,6,8,0.45); }
.enq-row.is-open { box-shadow: 0 10px 30px -18px rgba(5,6,8,0.5); }
.enq-head {
  display: grid; grid-template-columns: 12px minmax(160px, 1.1fr) minmax(0, 1.6fr) auto auto; gap: 14px; align-items: center;
  width: 100%; text-align: left; background: none; border: none; padding: 14px 16px; cursor: pointer; font: inherit; color: inherit;
}
.enq-head:hover { background: rgba(5,6,8,0.03); }
.enq-dot { width: 10px; height: 10px; border-radius: 50%; background: transparent; border: 1px solid var(--line); }
.enq-row.is-new .enq-dot { background: var(--yellow); border-color: var(--black); }
.enq-who { display: flex; flex-direction: column; min-width: 0; }
.enq-who strong { font-weight: 700; }
.enq-sub, .enq-preview, .enq-when { color: var(--muted); font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.enq-when { font-size: 0.8rem; }
.pill { font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: 100px; border: 1px solid var(--line); }
.pill--new { background: var(--yellow); border-color: var(--black); }
.pill--contacted { background: #e2f3e8; border-color: #9fd2b0; }
.pill--closed { background: #ececee; color: var(--muted); }
.enq-detail { padding: 4px 18px 18px 42px; border-top: 1px solid var(--line); }
.enq-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 22px; margin: 16px 0; }
.enq-facts dt { font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.enq-facts dd { margin: 3px 0 0; word-break: break-word; }
.enq-facts a { color: inherit; }
.enq-msg { white-space: pre-wrap; word-break: break-word; background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; margin: 0 0 16px; line-height: 1.55; }
.enq-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.enq-actions .btn { text-decoration: none; cursor: pointer; }
.enq-actions .btn--line { border: 1px solid var(--line); background: none; color: inherit; }
.btn-danger { color: #b23b3b !important; }

/* ---- Stats ---- */
.stats-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.range-btns { display: flex; gap: 6px; }
.stats-controls .btn--line, .panel-head-row .btn--line { border: 1px solid var(--line); background: none; color: inherit; cursor: pointer; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.stat-value { font: 800 2.1rem/1.1 var(--display); letter-spacing: -0.02em; }
.stat-delta { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.stat-delta.up { color: #1f7a3f; }
.stat-delta.down { color: #b23b3b; }
.stat-extra { font-size: 0.8rem; color: var(--muted); }
.chart-card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; }
.chart-card h3 { font-size: 1rem; margin: 0 0 12px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.chart-key { font-size: 0.8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chart-key i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; margin-left: 10px; }
.k-views { background: var(--yellow); border: 1px solid rgba(5,6,8,0.25); }
.k-vis { background: var(--black); }
.chart-svg { width: 100%; height: auto; display: block; }
.c-grid { stroke: rgba(5,6,8,0.1); stroke-width: 1; }
.c-axis { font: 11px var(--body); fill: #777b83; }
.c-views { fill: var(--yellow); stroke: rgba(5,6,8,0.25); stroke-width: 1; }
.c-vis { fill: var(--black); }
.c-enq { fill: #1f7a3f; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.stats-grid .chart-card { margin-bottom: 0; }
.bar-row { margin-bottom: 12px; }
.bar-line { display: flex; justify-content: space-between; gap: 12px; font-size: 0.88rem; margin-bottom: 4px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-num { font-weight: 700; white-space: nowrap; }
.bar-track { height: 6px; background: rgba(5,6,8,0.08); border-radius: 100px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--black); border-radius: 100px; }
.muted.small { font-size: 0.86rem; margin: 0; }
.owner-toggle { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 0.9rem; cursor: pointer; }

@media (max-width: 820px) {
  .enq-head { grid-template-columns: 12px 1fr auto; }
  .enq-preview, .enq-when { display: none; }
  .enq-detail { padding-left: 18px; }
}

/* ---------- Page content tab ---------- */
.content-frame { position: fixed; left: -9999px; top: 0; width: 1280px; height: 900px; border: 0; opacity: 0; pointer-events: none; }

.content-toolbar { display: flex; gap: 12px; align-items: center; margin: 18px 0 8px; flex-wrap: wrap; }
.content-toolbar input[type="search"] { flex: 1 1 260px; min-width: 200px; }

.content-list { display: grid; gap: 10px; margin-top: 14px; }

.content-row {
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  display: grid;
  gap: 8px;
}
.content-row.is-changed { border-color: #e0b400; box-shadow: inset 3px 0 0 #ffd23f; }

.content-row-head { display: flex; align-items: baseline; gap: 10px; }
.content-kind {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  color: #6b6b6b; background: rgba(0,0,0,.06); border-radius: 999px; padding: 3px 9px;
}
.content-orig { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: #77746c; overflow-wrap: anywhere; }
.content-revert {
  flex: 0 0 auto; border: 1px solid rgba(0,0,0,.16); background: transparent;
  border-radius: 999px; padding: 3px 12px; font-size: 12px; cursor: pointer; color: #333;
}
.content-revert:hover { background: rgba(0,0,0,.05); }

.content-input { width: 100%; font: inherit; }
textarea.content-input { min-height: 62px; line-height: 1.5; resize: vertical; }

.content-thumb { max-width: 180px; max-height: 110px; border-radius: 8px; object-fit: cover; background: rgba(0,0,0,.05); }
.content-pick { display: flex; }

.form-status.is-error { color: #a4322b; }
