/* The panel's look: the site's graphite and construction amber, plain system fonts. */
:root {
  --ink: #1d2330;
  --ink-soft: #4b5262;
  --muted: #6b7180;
  --paper: #f7f5f1;
  --card: #ffffff;
  --line: #e5e0d8;
  --line-strong: #d3ccc1;
  --accent: #f2a43a;
  --accent-strong: #b8651b;
  --accent-soft: #fdf1df;
  --ok: #1f7a4d;
  --ok-soft: #e3f4ea;
  --warn: #9a5b00;
  --warn-soft: #fdf0d8;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(29 35 48 / 6%), 0 4px 16px rgb(29 35 48 / 5%);
  color-scheme: light;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  font-size: 15px;
  line-height: 1.5;
}
h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.01em;
}
a {
  color: var(--accent-strong);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
[hidden] {
  display: none !important;
}

.boot {
  display: grid;
  place-items: center;
  min-height: 100vh;
  color: var(--muted);
}

/* --- Buttons ---------------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-accent {
  background: var(--accent);
  color: var(--ink);
}
.btn-accent:hover:not(:disabled) {
  background: #f5b357;
}
.btn-outline {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--ink-soft);
}
.btn-ghost {
  background: transparent;
  color: inherit;
}
.btn-ghost:hover {
  background: rgb(255 255 255 / 10%);
}
.btn-small {
  min-height: 34px;
  padding: 0 14px;
  font-size: 14px;
}
.btn-block {
  width: 100%;
}
.danger {
  color: var(--bad) !important;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.icon-btn.wide {
  font-size: 13px;
  font-weight: 600;
}
.icon-btn:hover:not(:disabled) {
  border-color: var(--ink-soft);
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
label:has(> .file-input) {
  position: relative;
  cursor: pointer;
}
label:has(> .file-input:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* --- Sign-in ---------------------------------------------------------------------------------- */
.login-layer {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: radial-gradient(circle at 20% 0%, #2c3446 0%, var(--ink) 60%);
}
.login-layer.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgb(29 35 48 / 85%);
}
.login-card {
  width: min(400px, 100%);
  padding: 32px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 24px 64px rgb(0 0 0 / 30%);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.login-brand strong,
.brand strong {
  display: block;
  font-size: 17px;
}
.login-brand span,
.brand span {
  display: block;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.login-lead {
  margin: 0 0 20px;
  color: var(--ink-soft);
}
.form-error {
  min-height: 1.5em;
  margin: 4px 0 12px;
  color: var(--bad);
  font-weight: 600;
}
.logo-mark {
  width: 40px;
  height: 40px;
  flex: none;
}
.logo-bg {
  fill: var(--accent);
}
.logo-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 5.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Layout ----------------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: var(--ink);
  color: #fff;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand span {
  color: rgb(255 255 255 / 55%);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.who {
  padding: 0 8px;
  color: rgb(255 255 255 / 60%);
  font-size: 14px;
}
.shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 32px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 140px;
}
.sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-link {
  padding: 9px 14px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-weight: 500;
  text-decoration: none;
}
.nav-link:hover {
  background: #efebe4;
  color: var(--ink);
}
.nav-link.active {
  background: var(--ink);
  color: #fff;
}
.nav-link.separated {
  margin-top: 14px;
  position: relative;
}
.nav-link.separated::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 14px;
  right: 14px;
  border-top: 1px solid var(--line);
}
.main {
  min-width: 0;
}
.page > h1 {
  margin-bottom: 18px;
  font-size: 28px;
}
.page > .lead {
  max-width: 720px;
  margin: -6px 0 20px;
  color: var(--ink-soft);
}
.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.callout {
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid #f3d7a8;
  border-radius: 12px;
  background: var(--accent-soft);
}
.callout.error {
  border-color: #f5c2bd;
  background: var(--bad-soft);
}
.muted {
  color: var(--muted);
}

/* --- Fields ----------------------------------------------------------------------------------- */
.field {
  margin-bottom: 18px;
}
.field > label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
}
.req {
  color: var(--accent-strong);
}
input[type="text"],
input[type="tel"],
input[type="email"],
input[type="url"],
input[type="password"],
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea {
  resize: vertical;
  line-height: 1.55;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgb(242 164 58 / 30%);
}
.help {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.counter {
  display: block;
  margin-top: 4px;
  text-align: right;
  color: var(--muted);
  font-size: 12px;
}
.error {
  margin: 6px 0 0;
  color: var(--bad);
  font-size: 13px;
  font-weight: 600;
}
.has-error > input,
.has-error > textarea,
.has-error > .image-field {
  border-color: var(--bad) !important;
}
.field-check {
  margin-bottom: 14px;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
}
.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-strong);
}
.slug-preview {
  margin: 6px 0 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  color: var(--ink-soft);
  word-break: break-all;
}
.group {
  margin: 8px 0 22px;
  padding: 18px 18px 2px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.group > legend {
  padding: 0 8px;
  font-weight: 700;
}

/* --- Images ----------------------------------------------------------------------------------- */
.image-field {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfaf8;
}
.thumb {
  width: 180px;
  aspect-ratio: 4 / 3;
  flex: none;
  border-radius: 8px;
  object-fit: cover;
  background: #ece8e1;
}
.thumb.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}
.image-side {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.image-side .btn {
  align-self: flex-start;
}
.progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #ece8e1;
}
.progress-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.2s;
}

/* --- Lists ------------------------------------------------------------------------------------ */
.list {
  margin: 8px 0 22px;
}
.list-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.list-head h3 {
  font-size: 16px;
}
.count {
  min-width: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #efebe4;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
.list-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}
.list-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.list-row > .field {
  flex: 1;
  margin: 0;
}
.list-row > .item-actions {
  padding-top: 5px;
}
.item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.item.has-error {
  border-color: var(--bad);
}
.item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 6px;
}
.item.open .item-head {
  border-bottom: 1px solid var(--line);
}
.item-toggle {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 40px;
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-weight: 600;
  cursor: pointer;
}
.item-toggle.static {
  cursor: default;
}
.item-toggle:not(.static):hover {
  background: #f6f3ee;
}
.chevron {
  display: inline-block;
  width: 14px;
  color: var(--muted);
  font-size: 20px;
  transition: transform 0.15s;
}
.item.open .chevron {
  transform: rotate(90deg);
}
.item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-thumb {
  width: 54px;
  height: 40px;
  flex: none;
  border-radius: 6px;
  object-fit: cover;
}
.badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: #efebe4;
  color: var(--ink-soft);
  font-size: 12px;
}
.item-actions {
  display: flex;
  flex: none;
  gap: 4px;
}
.item-body {
  padding: 18px 16px 4px;
}
.add-btn {
  border-style: dashed;
}

/* --- Photo grids ------------------------------------------------------------------------------ */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.photo-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.photo-tile.has-error {
  border-color: var(--bad);
}
.photo-img {
  position: relative;
}
.photo-img img,
.photo-img .thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  object-fit: cover;
  background: #ece8e1;
}
.tile-badge {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgb(29 35 48 / 80%);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}
.photo-tile input[type="text"] {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 14px;
}
.tile-actions {
  display: flex;
  gap: 4px;
}
.tile-actions .danger {
  margin-left: auto;
}
.add-tile {
  justify-content: center;
  align-items: stretch;
  min-height: 200px;
  border: 2px dashed var(--line-strong);
  background: #fbfaf8;
  text-align: center;
}
.add-photos {
  display: grid;
  flex: 1;
  place-items: center;
  border-radius: 8px;
  color: var(--accent-strong);
  font-weight: 700;
}
.add-photos:hover {
  background: var(--accent-soft);
}
.add-note {
  font-size: 13px;
  font-weight: 600;
}

/* --- Enquiries and history -------------------------------------------------------------------- */
.enquiries {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.enquiry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}
.enquiry-head h3 {
  font-size: 18px;
}
.enquiry-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 6px;
  font-weight: 600;
}
.enquiry-message {
  margin: 12px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.enquiry-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.pill-ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.pill-pending,
.pill-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill-bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.releases {
  padding: 0;
}
.release {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
}
.release + .release {
  border-top: 1px solid var(--line);
}
.log {
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: var(--ink);
  color: #e8e6e1;
  font-size: 12px;
  white-space: pre-wrap;
}
details summary {
  margin-top: 8px;
  cursor: pointer;
  font-weight: 600;
}

/* --- Status bar ------------------------------------------------------------------------------- */
.statusbar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1200px, calc(100% - 24px));
  padding: 10px 10px 10px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 10px 40px rgb(29 35 48 / 18%);
  transform: translateX(-50%);
}
.status-text {
  font-weight: 600;
}
.status-error {
  color: var(--bad);
  font-weight: 500;
}
.status-actions {
  display: flex;
  flex: none;
  gap: 8px;
}
.tone-ok .status-text::before,
.tone-dirty .status-text::before,
.tone-pending .status-text::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--ok);
}
.tone-dirty .status-text::before {
  background: var(--bad);
}
.tone-pending .status-text::before {
  background: var(--accent);
}
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 10px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent-strong);
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Toasts ----------------------------------------------------------------------------------- */
.toasts {
  position: fixed;
  top: 76px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100% - 32px));
}
.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 30px rgb(0 0 0 / 20%);
  font-weight: 500;
  transition: opacity 0.4s, transform 0.4s;
}
.toast-success {
  background: var(--ok);
}
.toast-error {
  background: var(--bad);
}
.toast.leaving {
  opacity: 0;
  transform: translateY(-6px);
}

/* --- Phones ----------------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .shell {
    display: block;
    padding: 0 0 150px;
  }
  .sidebar {
    position: sticky;
    top: 60px;
    z-index: 10;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
    scrollbar-width: none;
  }
  .nav-link {
    flex: none;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    font-size: 14px;
  }
  .nav-link.separated {
    margin-top: 0;
    margin-left: 10px;
  }
  .nav-link.separated::before {
    display: none;
  }
  .main {
    padding: 20px 12px 0;
  }
  .page > h1 {
    font-size: 24px;
  }
  .card {
    padding: 16px;
  }
  .who,
  .topbar .btn-ghost[href] {
    display: none;
  }
  .topbar {
    padding: 8px 12px;
  }
  .image-field {
    flex-direction: column;
  }
  .thumb {
    width: 100%;
  }
  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .item-body {
    padding: 14px 12px 2px;
  }
  .group {
    padding: 14px 12px 2px;
  }
  .statusbar {
    bottom: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border-radius: 18px 18px 0 0;
  }
  .status-actions .btn {
    flex: 1;
  }
}
