/* ==========================================================================
   Admin area
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* Admin runs on neutral grays and Inter throughout; blue marks highlighted surfaces. */
body.admin {
  --font-display: var(--font-button);
  --font-body: var(--font-button);
  --admin-accent: #2563EB;
  --admin-accent-soft: #EFF4FF;
  --ink: #27272A;
  --ink-2: #3F3F46;
  --ink-3: #52525B;
  --paper-2: #F4F4F5;
  --text: #18181B;
  --muted: #52525B;
  --line: #E4E4E7;
  --line-strong: #D4D4D8;
  --on-dark: #FFFFFF;
  --on-dark-muted: #D4D4D8;
  --shadow-sm: 0 1px 2px rgb(24 24 27 / 0.06), 0 1px 1px rgb(24 24 27 / 0.04);
  --shadow: 0 1px 2px rgb(24 24 27 / 0.05), 0 8px 24px -6px rgb(24 24 27 / 0.14);
  background: #F4F4F5;
  font-size: 0.97rem;
}

/* Shell: sidebar + content --------------------------------------------------- */
.shell { display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: #fff;
  color: #3F3F46;
  border-right: 1px solid var(--line);
}
.sidebar__head { padding: 1.25rem 1.25rem 0.75rem; }
.sidebar__brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; }
.sidebar__brand:hover { text-decoration: none; }
.sidebar__brand img { width: auto; height: 2rem; }
.sidebar__title { padding-left: 0.7rem; border-left: 1px solid var(--line); color: #3F3F46; font-size: 0.88rem; font-weight: 600; }

.sidebar__nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0.25rem 0.75rem 1rem; overflow-y: auto; }
.sidebar__heading { padding: 1.1rem 0.75rem 0.4rem; color: #A1A1AA; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  border-radius: 7px;
  color: #3F3F46;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease);
}
.sidebar__link .icon { width: 1.1rem; height: 1.1rem; color: #71717A; }
.sidebar__link:hover { background: #F4F4F5; color: #18181B; text-decoration: none; }
.sidebar__link[aria-current="page"] { background: #F4F4F5; color: #18181B; font-weight: 600; box-shadow: inset 3px 0 0 var(--admin-accent); }
.sidebar__link[aria-current="page"] .icon { color: var(--admin-accent); }
.sidebar__count {
  margin-left: auto;
  min-width: 1.6rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: #F4F4F5;
  color: #52525B;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.sidebar__version { margin-top: auto; padding: 1rem 0.75rem 0; color: #A1A1AA; font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.sidebar__foot { display: flex; align-items: center; gap: 0.5rem; padding: 0.85rem 0.75rem 0.85rem 1rem; border-top: 1px solid var(--line); }
.sidebar__user { display: flex; flex: 1; align-items: center; gap: 0.6rem; min-width: 0; }
.sidebar__avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--admin-accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}
.sidebar__who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sidebar__username { overflow: hidden; color: #18181B; font-size: 0.88rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__role { color: #71717A; font-size: 0.72rem; }
.sidebar__actions { display: flex; gap: 0.15rem; }
.sidebar__icon-btn {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #52525B;
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease);
}
.sidebar__icon-btn .icon { width: 1.15rem; height: 1.15rem; }
.sidebar__icon-btn:hover,
.sidebar__icon-btn[aria-current="page"] { background: #F4F4F5; color: #18181B; }

.mobilebar { display: none; }
.sidebar-backdrop { display: none; }

.admin-main { min-width: 0; padding: var(--space-6) clamp(1rem, 0.5rem + 2.5vw, 2.5rem) var(--space-8); }
.admin-content { width: 100%; max-width: 90rem; margin-inline: auto; }

@media (max-width: 63.99rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .mobilebar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    background: #fff;
    color: #18181B;
    border-bottom: 1px solid var(--line);
  }
  .mobilebar__toggle { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 0; border-radius: 7px; background: transparent; color: #18181B; }
  .mobilebar__toggle:hover { background: #F4F4F5; }
  .mobilebar__toggle .icon { width: 1.4rem; height: 1.4rem; }
  .mobilebar__brand { display: flex; align-items: center; gap: 0.6rem; color: #3F3F46; font-size: 0.88rem; font-weight: 600; text-decoration: none; }
  .mobilebar__brand img { width: auto; height: 1.75rem; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(18rem, 86vw);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s var(--ease), visibility 0s linear 0.2s;
  }
  .sidebar.is-open { transform: none; visibility: visible; transition: transform 0.2s var(--ease); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 40; display: block; background: rgb(24 24 27 / 0.25); }
  .admin-main { padding-top: var(--space-5); }
}

/* Flash messages */
.flashes { display: grid; gap: var(--space-2); margin-bottom: var(--space-5); }
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--ink-3);
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}
.flash--success { border-left-color: var(--ink); background: #fff; }
.flash--error { border-left-color: var(--danger); background: var(--danger-soft); }
.flash--info { border-left-color: #A1A1AA; }

/* Buttons & inputs ---------------------------------------------------------- */
.a-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-family: var(--font-button);
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.a-btn:hover { background: var(--paper); border-color: #A1A1AA; text-decoration: none; }
.a-btn .icon { width: 1.05rem; height: 1.05rem; }
.a-btn--primary { background: var(--admin-accent); border-color: var(--admin-accent); color: #fff; }
.a-btn--primary:hover { background: #1D4ED8; border-color: #1D4ED8; }
.a-btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.a-btn--danger:hover { background: color-mix(in srgb, var(--danger) 82%, black); border-color: transparent; }
.a-btn--quiet { border-color: transparent; background: transparent; }
.a-btn--quiet:hover { background: rgb(24 24 27 / 0.06); border-color: transparent; }
.a-btn--sm { min-height: 2.1rem; padding: 0.35rem 0.7rem; font-size: 0.86rem; }
.a-btn--block { width: 100%; }
.a-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.a-input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 0.95rem;
}
.a-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgb(24 24 27 / 0.14); }
select.a-input { cursor: pointer; }
.a-textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }

.a-field { display: grid; gap: 0.35rem; }
.a-field > label,
.a-field > legend { font-weight: 600; font-size: 0.9rem; }
.a-field > legend { margin-bottom: 0.35rem; }
.a-optional { font-weight: 400; color: var(--muted); }
.a-check { display: flex; align-items: flex-start; gap: 0.55rem; font-size: 0.93rem; cursor: pointer; line-height: 1.4; }
.a-check input { width: 1.1rem; height: 1.1rem; margin-top: 0.12rem; accent-color: var(--primary); flex: none; }
.a-hint { font-size: 0.86rem; color: var(--muted); line-height: 1.45; }
.a-hint--warn { display: flex; gap: 0.4rem; align-items: flex-start; color: var(--ink-2); background: #E4E4E7; padding: 0.5rem 0.65rem; border-radius: var(--radius-sm); }
.a-hint--warn .icon { width: 1rem; height: 1rem; margin-top: 0.15rem; }
.a-hint a { color: inherit; font-weight: 600; }
.stack { display: grid; gap: var(--space-4); }

/* Page head ----------------------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.page-head__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}
.page-head__ref { font-weight: 600; font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.3rem; }
.page-head__sub { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; margin-top: 0.5rem; color: var(--muted); }
.page-head__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* Stats --------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
@media (min-width: 48rem) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--admin-accent); }
.stat--new::before { background: #D4D4D8; }
.stat--selected::before { background: #71717A; }
.stat--shortlisted::before { background: #A1A1AA; }
.stat:hover { border-color: var(--line-strong); transform: translateY(-1px); text-decoration: none; }
.stat.is-active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.stat__value { font-family: var(--font-display); font-weight: 800; font-size: 2rem; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat__label { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* Month board */
.month-board { margin-bottom: var(--space-5); padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.month-board__title { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--space-2); }
.month-board__list { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.35rem; }
@media (min-width: 56rem) { .month-board__list { grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 0.4rem; } }
.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.35rem 0.2rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--muted);
  line-height: 1.15;
}
.slot:hover { border-color: var(--ink); text-decoration: none; }
.slot__name { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.slot__count { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.slot--filled { border-style: solid; border-color: #A1A1AA; background: #F4F4F5; color: #18181B; }
.slot--conflict { border-style: solid; border-color: var(--admin-accent); background: var(--admin-accent-soft); color: var(--admin-accent); }

/* Filters ------------------------------------------------------------------- */
.filters {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.filters__search { position: relative; }
.filters__search .a-input { padding-left: 2.3rem; min-height: 2.75rem; }
.filters__search-icon { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); width: 1.1rem; height: 1.1rem; color: var(--muted); pointer-events: none; }
.filters__selects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.a-select-label { display: grid; gap: 0.2rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.a-select-label .a-input { text-transform: none; letter-spacing: normal; font-weight: 400; color: var(--text); }
.filters__actions { display: flex; gap: var(--space-2); align-items: end; }
@media (min-width: 64rem) {
  .filters { grid-template-columns: minmax(16rem, 1.3fr) minmax(0, 3fr) auto; align-items: end; }
  .filters__selects { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Bulk bar ------------------------------------------------------------------ */
.bulkbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding: 0.6rem var(--space-4);
  margin-bottom: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.bulkbar__count { font-weight: 600; font-variant-numeric: tabular-nums; }
.bulkbar__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.bulkbar__divider { display: none; width: 1px; align-self: stretch; background: var(--line); margin-inline: 0.2rem; }
@media (min-width: 56rem) {
  .bulkbar { position: sticky; top: 0; z-index: 5; }
  .bulkbar__divider { display: block; }
}
.bulkbar__label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.a-segment { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; }

/* Table --------------------------------------------------------------------- */
.table-wrap { container-type: inline-size; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; box-shadow: var(--shadow-sm); }
.subs { width: 100%; border-collapse: collapse; }
.subs th {
  padding: 0.7rem 0.75rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: #FAFAFA;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.subs td { padding: 0.65rem 0.75rem; border-bottom: 1px solid #F0F0F2; vertical-align: middle; }
.subs tbody tr:last-child td { border-bottom: 0; }
.subs__row { cursor: pointer; transition: background-color 0.12s var(--ease); }
.subs__row:hover { background: #FAFAFA; }
.subs__row:has(input:checked) { background: var(--admin-accent-soft); }
.subs .num { text-align: right; font-variant-numeric: tabular-nums; }
.subs__check { width: 2.5rem; }
.subs__check input { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); cursor: pointer; }
.subs__thumb { width: 5.5rem; }
.subs__thumb-wrap { position: relative; display: block; width: 72px; }
.subs__photo-count {
  position: absolute;
  right: 4px;
  bottom: 4px;
  min-width: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.94);
  color: #18181B;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.subs__thumb img,
.thumb-empty {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--paper-2);
}
.thumb-empty { display: grid; place-items: center; color: var(--muted); }
.subs__ref a { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.subs__primary { display: block; font-weight: 600; }
.subs__secondary { display: block; font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.subs__name .subs__primary,
.subs td[data-label="Location"],
.subs td[data-label="Submitted"] { white-space: nowrap; }
.subs__vehicle { min-width: 12rem; }
.subs__vehicle .subs__secondary { overflow-wrap: normal; }
.subs td[data-label="Status"] .badge { margin: 0.1rem 0; }

@container (max-width: 62rem) {
  .subs thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .subs,
  .subs tbody { display: block; }
  .subs tr {
    display: grid;
    grid-template-columns: 2rem 84px minmax(0, 1fr);
    column-gap: 0.75rem;
    padding: 0.85rem;
    border-bottom: 1px solid var(--line);
  }
  .subs tbody tr:last-child { border-bottom: 0; }
  .subs td { display: block; padding: 0.1rem 0; border: 0; grid-column: 3; }
  .subs td.subs__check { grid-column: 1; grid-row: 1 / span 8; padding-top: 0.2rem; width: auto; }
  .subs td.subs__thumb { grid-column: 2; grid-row: 1 / span 8; width: auto; }
  .subs__thumb img,
  .thumb-empty { width: 84px; height: 63px; }
  .subs__thumb-wrap { width: 84px; }
  .subs__vehicle { min-width: 0; }
  .subs td[data-label]::before { content: attr(data-label) ": "; font-size: 0.75rem; color: var(--muted); font-weight: 600; }
  .subs td.subs__name::before,
  .subs td.subs__vehicle::before { content: none; }
  .subs .num { text-align: left; }
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge--new { background: #fff; color: #3F3F46; border-color: #D4D4D8; }
.badge--shortlisted { background: #F4F4F5; color: #3F3F46; border-color: #D4D4D8; }
.badge--selected { background: var(--admin-accent-soft); color: #1D4ED8; border-color: #BFD3FB; }
.badge--rejected { background: transparent; color: #71717A; border-color: #E4E4E7; text-decoration: line-through; }
.badge--month { background: var(--admin-accent-soft); color: #1D4ED8; border-color: #BFD3FB; }
.chip { display: inline-block; padding: 0.05rem 0.45rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.chip--warn { background: #E4E4E7; color: #3F3F46; }

.empty { padding: var(--space-8) var(--space-5); text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: #fff; }
.empty__icon { width: 2.5rem; height: 2.5rem; margin: 0 auto var(--space-3); color: var(--muted); }
.empty h2 { font-family: var(--font-display); font-weight: 700; font-size: var(--step-1); letter-spacing: -0.01em; }
.empty p { color: var(--muted); margin-top: var(--space-2); }
.empty a { color: var(--primary); font-weight: 600; }

/* Pagination */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-2); margin-top: var(--space-5); }
.pager__pages { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.pager__page {
  display: grid;
  place-items: center;
  min-width: 2.2rem;
  height: 2.2rem;
  padding-inline: 0.4rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pager__page:hover { background: #fff; text-decoration: none; }
.pager__page.is-current { background: var(--admin-accent); color: #fff; }
.pager__gap { display: grid; place-items: center; min-width: 1.5rem; color: var(--muted); }

/* Detail -------------------------------------------------------------------- */
.detail-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.detail-nav__back { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); font-weight: 600; text-decoration: none; }
.detail-nav__back:hover { color: var(--text); }
.detail-nav__back .icon { width: 1.1rem; height: 1.1rem; }
.detail-nav__step { display: flex; gap: var(--space-1); }

.detail { display: grid; gap: var(--space-5); }
.detail__main,
.detail__side { display: grid; gap: var(--space-5); align-content: start; min-width: 0; }
@media (min-width: 64rem) {
  .detail { grid-template-columns: minmax(0, 1fr) 22rem; align-items: start; }
}

.panel { padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.panel__title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; line-height: 1.2; }
.panel > .panel__title { margin-bottom: var(--space-4); }
.panel__count { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; margin-left: 0.3rem; border-radius: 999px; background: var(--paper-2); font-size: 0.9rem; vertical-align: 0.15em; }
.panel__meta { font-size: 0.85rem; color: var(--muted); }
.panel--review { border-top: 0; position: relative; overflow: hidden; }
.panel--review::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--admin-accent); }
.panel--danger { border-color: var(--line); background: #fff; }
.panel--danger .panel__title { color: var(--danger); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: var(--space-4); }
.gallery__item { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #FFFFFF; }
.gallery__item--lead { grid-column: 1 / -1; }
@media (min-width: 48rem) {
  .gallery__item--lead { display: grid; grid-template-columns: minmax(0, 1fr) 16rem; }
}
.gallery__open { position: relative; display: block; padding: 0; border: 0; background: #F4F4F5; cursor: zoom-in; }
.gallery__open img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: opacity 0.2s var(--ease); }
.gallery__item--lead .gallery__open img { aspect-ratio: 3 / 2; object-fit: contain; }
.gallery__open:hover img { opacity: 0.9; }
.gallery__open:focus-visible { outline-offset: -4px; }
.gallery__zoom {
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.92);
  color: #18181B;
  box-shadow: var(--shadow-sm);
}
.gallery__zoom .icon { width: 1.1rem; height: 1.1rem; }
.photo-meta { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4) var(--space-4); align-content: start; }
.photo-meta__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-meta__list { display: grid; gap: 0.2rem; font-size: 0.86rem; }
.photo-meta__list div { display: flex; justify-content: space-between; gap: var(--space-3); }
.photo-meta__list dt { color: var(--muted); }
.photo-meta__list dd { text-align: right; font-variant-numeric: tabular-nums; }
.photo-meta__file { font-size: 0.75rem; color: var(--muted); overflow-wrap: anywhere; }

.story { font-size: 1.04rem; line-height: 1.7; max-width: 44rem; }
.story p { white-space: pre-line; }
.story p + p { margin-top: var(--space-4); }

.status-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; }
.status-picker__opt { position: relative; }
.status-picker__opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.status-picker__opt span {
  display: block;
  padding: 0.5rem 0.6rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  transition: 0.12s var(--ease);
}
.status-picker__opt:hover span { border-color: var(--line-strong); }
.status-picker__opt input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }
.status-picker__opt--new input:checked + span { background: #F4F4F5; border-color: #71717A; color: #18181B; }
.status-picker__opt--shortlisted input:checked + span { background: #F4F4F5; border-color: #71717A; color: #18181B; }
.status-picker__opt--selected input:checked + span { background: var(--admin-accent-soft); border-color: var(--admin-accent); color: #1D4ED8; }
.status-picker__opt--rejected input:checked + span { background: #F4F4F5; border-color: #A1A1AA; color: #71717A; text-decoration: line-through; }

.facts { display: grid; gap: var(--space-2); font-size: 0.93rem; }
.facts div { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--space-2); }
.facts dt { color: var(--muted); }
.facts dd { overflow-wrap: anywhere; }
.facts a { color: var(--primary); }

.consents { display: grid; gap: var(--space-2); margin-bottom: var(--space-3); font-size: 0.92rem; }
.consents li { display: flex; gap: 0.5rem; align-items: flex-start; }
.consents .icon { width: 1.1rem; height: 1.1rem; margin-top: 0.15rem; }
.consents .is-yes .icon { color: #52525B; }
.consents .is-no .icon { color: var(--danger); }

/* Lightbox */
.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(250 250 250 / 0.98);
  color: var(--text);
}
.lightbox::backdrop { background: rgb(244 244 245 / 0.9); }
.lightbox__frame { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 100%; }
.lightbox__img { width: 100%; height: 100%; object-fit: contain; padding: var(--space-4); }
.lightbox__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); background: #fff; }
.lightbox__caption { font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }
.lightbox__controls { display: flex; align-items: center; gap: var(--space-2); }
.lightbox__btn {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: #18181B;
}
.lightbox__btn:hover { background: #F4F4F5; }

/* Login */
.admin-main--bare { display: grid; place-items: center; min-height: 100vh; }
.login { width: 100%; max-width: 24rem; margin-inline: auto; }
.login__card { padding: var(--space-6); border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow); text-align: center; }
.login__card form { text-align: left; margin-top: var(--space-2); }
.login__logo { width: auto; height: 4.25rem; margin: 0 auto var(--space-4); }
.admin-main--bare .flashes { max-width: 24rem; margin-inline: auto; }

/* Live updates: newly arrived rows glow briefly */
@keyframes row-arrive { from { background: color-mix(in srgb, #2563EB 14%, white); } to { background: transparent; } }
.subs__row.is-new > td { animation: row-arrive 4s ease-out; }
@media (prefers-reduced-motion: reduce) { .subs__row.is-new > td { animation: none; background: color-mix(in srgb, #2563EB 8%, white); } }

/* Confirmation modal (bulk delete) ------------------------------------------ */
.a-btn--danger-quiet { color: var(--danger); }
.a-btn--danger-quiet:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 8%, white); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.confirm-modal {
  width: min(30rem, calc(100vw - 2rem));
  padding: 1.5rem;
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.45);
}
.confirm-modal::backdrop { background: rgb(24 24 27 / 0.55); }
.confirm-modal__icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; background: color-mix(in srgb, var(--danger) 10%, white); color: var(--danger); }
.confirm-modal__icon .icon { width: 1.3rem; height: 1.3rem; }
.confirm-modal__title { margin-top: 1rem; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.confirm-modal__text { margin-top: 0.35rem; color: var(--muted); font-size: 0.92rem; }
.confirm-modal__list {
  margin-top: 1rem;
  max-height: 12rem;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FAFAFA;
  font-size: 0.85rem;
  list-style: none;
  display: grid;
  gap: 0.3rem;
}
.confirm-modal__list li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.confirm-modal__list .confirm-modal__more { color: var(--muted); }
.confirm-modal__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }

/* Settings (modal + standalone page) --------------------------------------- */
.settings-modal {
  width: min(62rem, calc(100vw - 2rem));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.45);
}
.settings-modal::backdrop { background: rgb(24 24 27 / 0.55); }
.settings-modal .settings { display: flex; flex-direction: column; height: min(46rem, calc(100vh - 2rem)); height: min(46rem, calc(100dvh - 2rem)); }

.settings--page { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); overflow: hidden; }

.settings__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.5rem; border-bottom: 1px solid var(--line); }
.settings__title { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; }
.settings__intro { margin-top: 0.15rem; color: var(--muted); font-size: 0.88rem; }
.settings__close { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); }
.settings__close:hover { background: var(--paper-2); }
.settings__close .icon { width: 1.2rem; height: 1.2rem; }

.settings__body { display: grid; grid-template-columns: minmax(0, 1fr); flex: 1; min-height: 0; }
.js .settings__body { grid-template-columns: 13rem minmax(0, 1fr); }
.settings__tabs { display: none; flex-direction: column; gap: 2px; padding: 1rem 0.75rem; border-right: 1px solid var(--line); background: #FAFAFA; overflow-y: auto; }
.js .settings__tabs { display: flex; }
.settings__tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink-2);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
}
.settings__tab:hover { background: #F0F0F2; }
.settings__tab[aria-selected="true"] { background: #fff; color: var(--text); font-weight: 600; box-shadow: inset 3px 0 0 var(--admin-accent), var(--shadow-sm); }
.settings__tab-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--danger); flex: none; }

.settings__panels { padding: 1.5rem; overflow-y: auto; }
.settings--page .settings__panels { overflow: visible; }
.js .settings__panel[data-inactive] { display: none; }
.settings__panel + .settings__panel { margin-top: 2.25rem; }
.js .settings__panel + .settings__panel { margin-top: 0; }
.settings__panel-title { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.settings__panel-desc { margin: 0.2rem 0 1.25rem; color: var(--muted); font-size: 0.88rem; }
.settings__note { margin: -0.5rem 0 1.25rem; padding: 0.7rem 0.85rem; border-radius: 7px; background: var(--admin-accent-soft); color: #1E3A8A; font-size: 0.84rem; line-height: 1.5; }
.settings__note code { padding: 0.05rem 0.3rem; border-radius: 4px; background: #fff; font-size: 0.8rem; overflow-wrap: anywhere; }
.settings__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.15rem 1.25rem; }

.sfield { display: grid; gap: 0.35rem; align-content: start; min-width: 0; }
.sfield--bool { grid-column: 1 / -1; }
.sfield__label { font-size: 0.88rem; font-weight: 600; }
.sfield__req { color: var(--muted); font-weight: 500; }
.sfield__help { color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.sfield__error { color: var(--danger); font-size: 0.82rem; font-weight: 500; }
.sfield.has-error .a-input { border-color: var(--danger); }
.sfield--bool .sfield__help { padding-left: 3.25rem; margin-top: -0.2rem; }

.color-input { display: flex; align-items: center; gap: 0.5rem; }
.color-input input[type="color"] { flex: none; width: 2.5rem; height: 2.5rem; padding: 2px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; cursor: pointer; }
.color-input .a-input { font-variant-numeric: tabular-nums; text-transform: uppercase; }

.switch { position: relative; display: flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.switch__input { position: absolute; left: 0; top: 0; width: 2.5rem; height: 1.4rem; margin: 0; opacity: 0; cursor: pointer; }
.switch__track { position: relative; flex: none; width: 2.5rem; height: 1.4rem; border-radius: 999px; background: #D4D4D8; transition: background-color 0.15s var(--ease); }
.switch__track::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  transition: transform 0.15s var(--ease);
}
.switch__input:checked + .switch__track { background: var(--admin-accent); }
.switch__input:checked + .switch__track::after { transform: translateX(1.1rem); }
.switch__input:focus-visible + .switch__track { outline: 3px solid var(--ink); outline-offset: 2px; }
.switch__label { font-size: 0.9rem; font-weight: 600; }

.smtp-test {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FAFAFA;
}
.smtp-test__title { font-size: 0.9rem; font-weight: 600; }
.smtp-test__help { margin-top: 0.15rem; color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.smtp-test__result {
  grid-column: 1 / -1;
  padding: 0.65rem 0.8rem;
  border-radius: 7px;
  background: #F4F4F5;
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.45;
}
.smtp-test__result.is-ok { background: var(--admin-accent-soft); color: #1E3A8A; }
.smtp-test__result.is-error { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 47.99rem) {
  .smtp-test { grid-template-columns: minmax(0, 1fr); }
}

.settings__foot { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; padding: 0.85rem 1.5rem; border-top: 1px solid var(--line); background: #FAFAFA; }
.settings__status { margin-right: auto; color: var(--muted); font-size: 0.85rem; }
.settings__status.is-error { color: var(--danger); font-weight: 500; }
.settings__status.is-ok { color: #1D4ED8; font-weight: 600; }

@media (max-width: 47.99rem) {
  .settings-modal { width: 100vw; height: 100dvh; border-radius: 0; }
  .settings-modal .settings { height: 100dvh; }
  .js .settings__body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .js .settings__tabs { flex-direction: row; padding: 0.5rem; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .settings__tab { white-space: nowrap; }
  .settings__tab[aria-selected="true"] { box-shadow: inset 0 -3px 0 var(--admin-accent), var(--shadow-sm); }
  .settings__grid { grid-template-columns: minmax(0, 1fr); }
  .settings__panels { padding: 1.15rem; }
}

/* Sidebar account link ------------------------------------------------------- */
a.sidebar__user { margin: -0.35rem 0 -0.35rem -0.4rem; padding: 0.35rem 0.4rem; border-radius: 8px; color: inherit; text-decoration: none; }
a.sidebar__user:hover,
a.sidebar__user[aria-current="page"] { background: #F4F4F5; text-decoration: none; }

/* Users (a tab in the settings modal) --------------------------------------- */
.users-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.users-head .settings__panel-desc { margin-bottom: 1rem; }
.users-head .a-btn { flex: none; }
.users-flash { margin-bottom: 0.9rem; }
.users-flash .flash { box-shadow: none; }
.settings__tab-count {
  min-width: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: #E4E4E7;
  color: #3F3F46;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35rem;
  text-align: center;
}
.ulist { display: grid; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.ulist__item { display: flex; align-items: center; gap: 0.8rem; padding: 0.8rem 1rem; background: #fff; }
.ulist__item + .ulist__item { border-top: 1px solid #F0F0F2; }
.ulist__item.is-disabled .ulist__avatar,
.ulist__item.is-disabled .ulist__name > span:first-child { opacity: 0.55; }
.ulist__avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: #E4E4E7;
  color: #3F3F46;
  font-size: 0.85rem;
  font-weight: 700;
}
.ulist__main { flex: 1; min-width: 0; }
.ulist__name { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.45rem; font-weight: 600; }
.ulist__meta { margin-top: 0.15rem; color: var(--muted); font-size: 0.82rem; line-height: 1.4; }
.ulist__item .a-btn { flex: none; }
.tag { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; background: #F4F4F5; color: #3F3F46; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.badge--role-admin { background: var(--admin-accent-soft); color: #1D4ED8; border-color: #BFD3FB; }
.badge--role-standard { background: #F4F4F5; color: #3F3F46; border-color: #D4D4D8; }
.badge--disabled { background: var(--danger-soft); color: var(--danger); border-color: #F5C2BD; }
@media (max-width: 30rem) {
  .users-head { flex-direction: column; }
}

/* User form -------------------------------------------------------------------- */
.uform { display: grid; gap: var(--space-4); max-width: 52rem; }
.uform__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.uform__note { margin: -0.5rem 0 1rem; }
.uform__actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
.uform__danger { max-width: 52rem; margin-top: var(--space-5); }
.panel.has-error { border-color: var(--danger); }
.panel > .sfield__error { margin-top: 0.6rem; }
@media (max-width: 40rem) {
  .uform__grid { grid-template-columns: minmax(0, 1fr); }
}

.role-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
@media (max-width: 40rem) { .role-picker { grid-template-columns: minmax(0, 1fr); } }
.role-card { position: relative; display: block; cursor: pointer; }
.role-card input { position: absolute; top: 1rem; left: 1rem; width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--admin-accent); }
.role-card__body {
  display: grid;
  gap: 0.2rem;
  height: 100%;
  padding: 0.85rem 1rem 0.9rem 2.6rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.12s var(--ease), background-color 0.12s var(--ease);
}
.role-card:hover .role-card__body { border-color: var(--line-strong); }
.role-card input:checked + .role-card__body { border-color: var(--admin-accent); background: var(--admin-accent-soft); }
.role-card input:focus-visible + .role-card__body { outline: 3px solid var(--ink); outline-offset: 2px; }
.role-card__title { font-weight: 700; }
.role-card__desc { color: var(--muted); font-size: 0.85rem; line-height: 1.45; }

.perm-panel { min-width: 0; margin: 0; }
.perm-panel > legend { float: left; width: 100%; margin-bottom: 0.35rem; padding: 0; }
.perm-panel > legend + * { clear: both; }
.perm-panel__hint { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.9rem; }
.perm-panel__hint .icon { width: 1rem; height: 1rem; }
.perm-panel:disabled .perm-list { opacity: 0.5; }
.perm-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
@media (max-width: 40rem) { .perm-list { grid-template-columns: minmax(0, 1fr); } }
.perm { display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.perm:hover { border-color: var(--line-strong); }
.perm input { flex: none; width: 1.1rem; height: 1.1rem; margin-top: 0.15rem; accent-color: var(--admin-accent); }
.perm__label { display: block; font-size: 0.9rem; font-weight: 600; }
.perm__desc { display: block; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.perm-panel:disabled .perm { cursor: not-allowed; }

/* Account page ------------------------------------------------------------------ */
.account { display: grid; gap: var(--space-4); max-width: 60rem; }
@media (min-width: 56rem) { .account { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; } }
.access-list { display: grid; gap: 0.5rem; margin-bottom: 0.9rem; }
.access-list li { display: flex; align-items: center; gap: 0.55rem; font-size: 0.93rem; }
.access-list .icon { width: 1.05rem; height: 1.05rem; }
.access-list .is-yes .icon { color: var(--admin-accent); }
.access-list .is-no { color: var(--muted); }
.access-list .is-no .icon { color: #A1A1AA; }

.facts__notes { white-space: pre-line; }
.admin-error__title { font-size: var(--step-1); font-weight: 700; }
.a-hint > .icon { display: inline-block; width: 0.95rem; height: 0.95rem; vertical-align: -0.15em; }

/* Cloudflare Turnstile on the sign-in page */
.login__turnstile { min-height: 65px; }
