/* ============================================================================
 *  Admin panel styles — deliberately plain and high-contrast. This is a tool
 *  a tradesperson uses on a phone in a ute, not a showcase.
 * ========================================================================= */

:root {
  --a-brand: #C56A20;   /* replaced per client at build time */
  --a-ink: #1A1D21;
  --a-soft: #5C646E;
  --a-line: #DFE3E8;
  --a-bg: #F4F6F8;
  --a-card: #FFFFFF;
  --a-ok: #1E7A4A;
  --a-err: #C0392B;
  --a-radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--a-bg);
  color: var(--a-ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--a-brand); }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; display: block; }

:focus-visible { outline: 3px solid var(--a-brand); outline-offset: 2px; border-radius: 4px; }

/* --- Top bar ------------------------------------------------------------- */
.abar { background: #fff; border-bottom: 1px solid var(--a-line); position: sticky; top: 0; z-index: 20; }
.abar__in {
  max-width: 1080px; margin: 0 auto; padding: 0 18px;
  display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap;
}
.abar__brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--a-ink); text-decoration: none; }
.abar__dot { width: 11px; height: 11px; border-radius: 3px; background: var(--a-brand); }
.abar__nav { display: flex; gap: 4px; margin-right: auto; flex-wrap: wrap; }
.abar__nav a {
  padding: 8px 13px; border-radius: 6px; text-decoration: none;
  color: var(--a-soft); font-weight: 600; font-size: 14.5px;
}
.abar__nav a:hover { background: var(--a-bg); color: var(--a-ink); }
.abar__nav a.is-on { background: var(--a-brand); color: #fff; }
.abar__right { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.abar__user { color: var(--a-soft); }
.abar__view, .abar__out { color: var(--a-soft); text-decoration: none; }
.abar__view:hover, .abar__out:hover { color: var(--a-brand); }

/* --- Layout -------------------------------------------------------------- */
.awrap { max-width: 1080px; margin: 0 auto; padding: 26px 18px 80px; }

.phead { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.phead h1 { font-size: 26px; letter-spacing: -0.01em; }
.phead__spacer { margin-left: auto; }
.phead__sub { color: var(--a-soft); font-size: 14.5px; width: 100%; margin-top: -8px; }

.card {
  background: var(--a-card); border: 1px solid var(--a-line);
  border-radius: var(--a-radius); padding: 22px; margin-bottom: 18px;
}
.card__title { font-size: 17px; margin-bottom: 14px; }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border: 1px solid transparent; border-radius: 6px;
  background: var(--a-brand); color: #fff;
  font: inherit; font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(0.93); }
.btn--ghost { background: #fff; color: var(--a-ink); border-color: var(--a-line); }
.btn--ghost:hover { background: var(--a-bg); filter: none; }
.btn--danger { background: #fff; color: var(--a-err); border-color: #E9C4BF; }
.btn--danger:hover { background: #FDF3F2; filter: none; }
.btn--sm { padding: 7px 12px; font-size: 13.5px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* --- Forms --------------------------------------------------------------- */
.field { margin-bottom: 17px; }
.field > label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field__hint { font-size: 13px; color: var(--a-soft); margin-top: 5px; }
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=url],
.field input[type=date],
.field select,
.field textarea {
  width: 100%; padding: 11px 12px;
  border: 1px solid var(--a-line); border-radius: 6px;
  font: inherit; background: #fff; color: var(--a-ink);
}
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--a-brand); box-shadow: 0 0 0 3px rgb(197 106 32 / 0.16);
}
.field--error input, .field--error textarea, .field--error select { border-color: var(--a-err); }
.field__err { color: var(--a-err); font-size: 13.5px; margin-top: 5px; font-weight: 600; }
.req { color: var(--a-err); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

.check { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.check input { width: 18px; height: 18px; accent-color: var(--a-brand); }

input[type=file] {
  width: 100%; padding: 14px; background: var(--a-bg);
  border: 2px dashed var(--a-line); border-radius: 6px; font: inherit;
}

/* --- Flash --------------------------------------------------------------- */
.flash {
  padding: 13px 16px; border-radius: 6px; margin-bottom: 18px;
  font-weight: 600; font-size: 15px; border: 1px solid;
}
.flash--ok { background: #EDF7F1; color: var(--a-ok); border-color: #BFE3CE; }
.flash--err { background: #FDF3F2; color: var(--a-err); border-color: #E9C4BF; }

/* --- Tables / lists ------------------------------------------------------ */
.rows { display: grid; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 15px;
  background: var(--a-card); border: 1px solid var(--a-line);
  border-radius: var(--a-radius); padding: 12px 15px;
}
.row__thumb {
  width: 74px; height: 56px; flex: 0 0 auto; border-radius: 5px;
  overflow: hidden; background: var(--a-bg);
}
.row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.row__main { min-width: 0; flex: 1; }
.row__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__meta { font-size: 13px; color: var(--a-soft); }
.row__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
.pill--live { background: #E6F4EC; color: var(--a-ok); }
.pill--draft { background: #F0F1F3; color: var(--a-soft); }

/* --- Media grid ---------------------------------------------------------- */
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.mtile {
  position: relative; border: 1px solid var(--a-line);
  border-radius: var(--a-radius); overflow: hidden; background: #fff;
}
.mtile img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.mtile__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; font-size: 12.5px; }
.mtile__pick { display: flex; align-items: center; gap: 7px; cursor: pointer; }

.preview { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.preview img { width: 110px; height: 84px; object-fit: cover; border-radius: 5px; border: 1px solid var(--a-line); }

/* --- Sortable image list on the edit screen ------------------------------ */
.imglist { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.imgcard { border: 1px solid var(--a-line); border-radius: var(--a-radius); overflow: hidden; background: #fff; }
.imgcard img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.imgcard__body { padding: 9px; display: grid; gap: 7px; }
.imgcard__body input { width: 100%; padding: 7px 9px; border: 1px solid var(--a-line); border-radius: 5px; font: inherit; font-size: 13.5px; }
.imgcard__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.imgcard__row .mtile__pick { white-space: nowrap; }

/* --- Empty state --------------------------------------------------------- */
.empty { text-align: center; padding: 54px 20px; color: var(--a-soft); }
.empty h2 { font-size: 19px; color: var(--a-ink); margin-bottom: 8px; }
.empty p { margin-bottom: 18px; }

/* --- Stats --------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--a-line); border-radius: var(--a-radius); padding: 18px; }
.stat__n { font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat__l { font-size: 13.5px; color: var(--a-soft); }

/* --- Login --------------------------------------------------------------- */
.login { max-width: 400px; margin: 9vh auto; padding: 0 18px; }
.login__card { background: #fff; border: 1px solid var(--a-line); border-radius: 12px; padding: 32px; }
.login__brand { text-align: center; margin-bottom: 24px; }
.login__brand strong { display: block; font-size: 19px; }
.login__brand span { color: var(--a-soft); font-size: 14px; }
.login__foot { text-align: center; margin-top: 20px; font-size: 13.5px; color: var(--a-soft); }

/* --- Pager --------------------------------------------------------------- */
.pager { display: flex; align-items: center; gap: 16px; justify-content: center; margin-top: 24px; font-size: 14.5px; }

@media (max-width: 700px) {
  .grid2 { grid-template-columns: 1fr; }
  .abar__in { min-height: 54px; padding: 8px 14px; }
  .abar__right { width: 100%; order: 3; justify-content: space-between; }
  .row { flex-wrap: wrap; }
  .row__actions { width: 100%; }
}
