/* Hayes Rentals — Control Panel
   Uses the shared brand tokens from /theme.css so the CMS feels like the same
   product as the public site. Layout/spacing tokens are local to the admin. */

:root {
  --c-primary: var(--brand-primary, #2f5d50);
  --c-accent: var(--brand-accent, #c79a52);
  --c-fg: var(--brand-fg, #0f172a);
  --c-muted: var(--brand-muted, #64748b);
  --c-bg: #f6f7f5;
  --c-surface: #ffffff;
  --c-border: #e3e6e1;
  --c-border-strong: #cfd4cc;
  --c-primary-soft: #eaf1ee;
  --c-accent-soft: #f7efdf;
  --c-danger: #b3261e;
  --c-danger-soft: #fbe9e8;
  --c-ok: #1f7a4d;
  --c-warn: #9a6b00;
  --c-warn-soft: #fdf3da;
  --font-head: var(--brand-font-heading, 'Fraunces', Georgia, serif);
  --font-body: var(--brand-font-body, 'Inter', system-ui, sans-serif);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, .08);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .18);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--c-fg);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; margin: 0; }
a { color: var(--c-primary); }
button { font-family: inherit; }

.boot {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  gap: 12px; color: var(--c-muted); font-weight: 500;
}
.boot__spin, .btn__spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--c-border-strong); border-top-color: var(--c-primary);
  display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border: 1px solid var(--c-border-strong); background: var(--c-surface);
  color: var(--c-fg); padding: 8px 14px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s, box-shadow .12s, opacity .12s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--c-primary); }
.btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.btn--primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn--primary:hover { background: #264a40; border-color: #264a40; }
.btn--accent { background: var(--c-accent); border-color: var(--c-accent); color: #2a2410; }
.btn--accent:hover { filter: brightness(.96); }
.btn--danger { color: var(--c-danger); border-color: #e7c3c0; background: var(--c-danger-soft); }
.btn--danger:hover { border-color: var(--c-danger); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--c-muted); }
.btn--ghost:hover { background: var(--c-primary-soft); color: var(--c-primary); border-color: transparent; }
.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn__spin { width: 14px; height: 14px; border-width: 2px; }

/* --------------------------------------------------------------- app shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--c-primary); color: #dfeae5;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px;
  font-family: var(--font-head); font-size: 19px; font-weight: 600; color: #fff;
}
.sidebar__brand .mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--c-accent);
  color: #2a2410; display: grid; place-items: center; font-weight: 700; font-size: 16px;
}
.sidebar__brand small { display: block; font-family: var(--font-body); font-size: 11px; font-weight: 500; color: #a9c4bb; letter-spacing: .04em; text-transform: uppercase; }
.nav { padding: 6px 12px; overflow-y: auto; flex: 1; }
.nav__group { margin: 14px 0 4px; padding: 0 10px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #8db3a8; font-weight: 700; }
.nav__item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px;
  color: #cfe0d9; text-decoration: none; font-weight: 500; font-size: 13.5px; cursor: pointer;
  border: 0; background: transparent; width: 100%; text-align: left; margin-bottom: 1px;
}
.nav__item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav__item.is-active { background: rgba(255,255,255,.14); color: #fff; }
.nav__item .ic { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav__item .badge { margin-left: auto; }
.sidebar__foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.12); }
.who { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.who__avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--c-accent); color: #2a2410; display: grid; place-items: center; font-weight: 700; flex: none; }
.who__name { font-weight: 600; color: #fff; font-size: 13px; line-height: 1.2; }
.who__role { font-size: 11.5px; color: #a9c4bb; }

/* ---------------------------------------------------------------- main col */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 16px 28px;
  background: var(--c-surface); border-bottom: 1px solid var(--c-border); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 22px; }
.topbar__crumb { color: var(--c-muted); font-size: 12.5px; margin-bottom: 2px; }
.topbar__spacer { flex: 1; }
.view { padding: 28px; max-width: 1180px; width: 100%; }

/* -------------------------------------------------------------- typography */
.muted { color: var(--c-muted); }
.eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); font-weight: 700; margin: 0 0 6px; }
.h-sub { color: var(--c-muted); margin: 4px 0 0; }
.section-h { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.section-h h2 { font-size: 18px; }
.section-h .btn { margin-left: auto; }

/* -------------------------------------------------------------------- card */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card__pad { padding: 18px; }
.grid { display: grid; gap: 18px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* dashboard stat */
.stat { padding: 16px 18px; }
.stat__label { font-size: 12px; color: var(--c-muted); font-weight: 600; }
.stat__value { font-family: var(--font-head); font-size: 30px; font-weight: 600; margin-top: 4px; }
.stat__value .ic { width: 22px; height: 22px; color: var(--c-accent); }

/* lists */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--c-border); align-items: flex-start; }
.feed li:last-child { border-bottom: 0; }
.feed__ic { width: 30px; height: 30px; border-radius: 8px; background: var(--c-primary-soft); color: var(--c-primary); display: grid; place-items: center; flex: none; }
.feed__ic .ic { width: 15px; height: 15px; }
.feed__main { min-width: 0; flex: 1; }
.feed__title { font-weight: 600; font-size: 13px; }
.feed__meta { color: var(--c-muted); font-size: 12px; }
.feed__time { color: var(--c-muted); font-size: 11.5px; white-space: nowrap; }

/* ------------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; background: var(--c-surface); }
.tbl th, .tbl td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
.tbl th { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--c-muted); font-weight: 700; background: #fbfcfb; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fbfcfb; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl .actions .btn { margin-left: 4px; }
.cell-strong { font-weight: 600; }

/* ------------------------------------------------------------------- badge */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em; background: #eef1ee; color: var(--c-muted);
  text-transform: capitalize; line-height: 1.4;
}
.badge--published, .badge--available, .badge--ok { background: #e3f3ea; color: var(--c-ok); }
.badge--draft, .badge--new { background: var(--c-accent-soft); color: var(--c-warn); }
.badge--hidden, .badge--leased, .badge--lost, .badge--archived { background: #eef1ee; color: var(--c-muted); }
.badge--warn { background: var(--c-warn-soft); color: var(--c-warn); }
.badge--danger { background: var(--c-danger-soft); color: var(--c-danger); }
.badge--accent { background: var(--c-accent-soft); color: var(--c-warn); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------------- forms */
.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 5px; }
.field .hint { color: var(--c-muted); font-size: 11.5px; margin: 4px 0 0; font-weight: 400; }
.input, .select, .textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13.5px; color: var(--c-fg); background: var(--c-surface);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }
.textarea { min-height: 90px; resize: vertical; }
.input[disabled], .select[disabled], .textarea[disabled] { background: #f3f4f2; color: var(--c-muted); cursor: not-allowed; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 160px; }
.checkbox { display: flex; align-items: center; gap: 9px; font-weight: 500; font-size: 13.5px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--c-primary); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 6px; }

/* color swatch */
.swatch { display: inline-flex; align-items: center; gap: 8px; }
.swatch input[type=color] { width: 38px; height: 32px; padding: 0; border: 1px solid var(--c-border-strong); border-radius: 6px; background: none; cursor: pointer; }

/* --------------------------------------------------------------- login */
.login {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
  background: var(--c-bg);
}
.login__aside {
  background: linear-gradient(150deg, #2f5d50, #1c3a32); color: #fff;
  padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.login__brand { font-family: var(--font-head); font-size: 26px; font-weight: 600; display: flex; gap: 12px; align-items: center; }
.login__brand .mark { width: 38px; height: 38px; border-radius: 9px; background: var(--c-accent); color: #2a2410; display: grid; place-items: center; font-weight: 700; }
.login__pitch h2 { font-size: 34px; line-height: 1.1; margin-bottom: 14px; }
.login__pitch p { color: #bcd3cb; max-width: 30ch; }
.login__foot { color: #93b4aa; font-size: 12.5px; }
.login__main { display: grid; place-items: center; padding: 40px; }
.login__card { width: 100%; max-width: 380px; }
.login__card h1 { font-size: 24px; margin-bottom: 6px; }
.login__hint { background: var(--c-accent-soft); border: 1px solid #ecd9ab; color: var(--c-warn); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 12px; margin-top: 16px; }
.login__err { background: var(--c-danger-soft); color: var(--c-danger); padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; font-weight: 600; }

/* ----------------------------------------------------------- section editor */
.editor-cols { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: start; }
.blocklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.block {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.block.is-hidden { opacity: .62; }
.block.is-selected { border-color: var(--c-primary); box-shadow: 0 0 0 2px var(--c-primary-soft); }
.block__head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; }
.block__grip { color: var(--c-border-strong); cursor: grab; display: grid; place-items: center; }
.block__grip .ic { width: 16px; height: 16px; }
.block__type { font-weight: 600; font-size: 13.5px; text-transform: capitalize; }
.block__sub { color: var(--c-muted); font-size: 12px; }
.block__tools { margin-left: auto; display: flex; gap: 2px; }
.block__tools .btn { padding: 5px 7px; }
.block__body { border-top: 1px solid var(--c-border); padding: 16px; background: #fbfcfb; }
.locked-note { display: flex; gap: 8px; align-items: flex-start; background: var(--c-primary-soft); color: #244c41; border-radius: var(--radius-sm); padding: 9px 12px; font-size: 12px; margin-bottom: 14px; }
.locked-note .ic { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.variant-row { display: flex; gap: 8px; flex-wrap: wrap; }
.variant {
  border: 1px solid var(--c-border-strong); background: var(--c-surface); border-radius: var(--radius-sm);
  padding: 7px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--c-muted);
}
.variant.is-on { border-color: var(--c-primary); background: var(--c-primary-soft); color: var(--c-primary); }
.repeater__item { border: 1px dashed var(--c-border-strong); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; position: relative; background: var(--c-surface); }
.repeater__rm { position: absolute; top: 8px; right: 8px; }

/* drag state */
.dragging { opacity: .4; }
.drag-over { border-color: var(--c-primary) !important; box-shadow: 0 0 0 2px var(--c-primary-soft); }

/* --------------------------------------------------------------- toast/modal */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #14241f; color: #fff; padding: 11px 18px; border-radius: 999px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600; z-index: 9000; max-width: 90vw;
}
.toast--err { background: var(--c-danger); }
.toast--ok { background: var(--c-primary); }

.modal-back {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); display: grid; place-items: center;
  z-index: 8000; padding: 20px;
}
.modal {
  background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
}
.modal--wide { max-width: 860px; }
.modal__head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--c-border); }
.modal__head h2 { font-size: 18px; }
.modal__head .btn { margin-left: auto; }
.modal__body { padding: 20px; }
.modal__foot { padding: 14px 20px; border-top: 1px solid var(--c-border); display: flex; gap: 10px; justify-content: flex-end; background: #fbfcfb; }

/* compare/diff */
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.diff__col h3 { font-size: 13px; margin-bottom: 8px; }
.diff__box { background: #fbfcfb; border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 12px; font-size: 12.5px; }
.diff__row { padding: 4px 0; border-bottom: 1px dashed var(--c-border); }
.diff__row:last-child { border-bottom: 0; }
.diff__k { font-weight: 700; color: var(--c-muted); font-size: 11px; text-transform: uppercase; }
.diff__v { white-space: pre-wrap; word-break: break-word; }
.diff--changed { background: var(--c-warn-soft); border-radius: 4px; padding: 2px 4px; }

.empty { text-align: center; padding: 40px 20px; color: var(--c-muted); }
.empty .ic { width: 34px; height: 34px; opacity: .5; margin-bottom: 8px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .input, .toolbar .select { width: auto; min-width: 160px; }
.toolbar__spacer { flex: 1; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.media-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.media-card img { width: 100%; aspect-ratio: 3/2; object-fit: cover; display: block; background: #eef1ee; }
.media-card__body { padding: 10px 12px; }
.media-card__alt { font-size: 12px; color: var(--c-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 30px; }
.media-card.no-alt { box-shadow: 0 0 0 2px var(--c-warn-soft); border-color: #e8cf94; }

.pill-link { font-size: 12px; }

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: column; }
  .nav { display: grid; grid-template-columns: repeat(2,1fr); gap: 2px; }
  .nav__group { grid-column: 1/-1; }
  .editor-cols { grid-template-columns: 1fr; }
  .grid--3, .grid--4 { grid-template-columns: repeat(2,1fr); }
  .login { grid-template-columns: 1fr; }
  .login__aside { display: none; }
  .diff { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .view, .topbar { padding: 16px; }
}

.ic { display: inline-block; vertical-align: middle; width: 16px; height: 16px; flex: none; }
.btn .ic { width: 15px; height: 15px; }
.stat__value .ic { width: 22px; height: 22px; }
.empty .ic { width: 34px; height: 34px; }
.feed__ic .ic { width: 15px; height: 15px; }
