/* Admin styling. Every value below is a printQuote token or a composition of them: the card, the 1px rule,
 * the 10px radius, the 6px inputs with a 2px accent focus ring, and the tag palette reused for statuses.
 */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- shell ---------------------------------------------------------------------------------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__inner,
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px;
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 22px;
  height: 56px;
}

.brand { font-size: 16px; color: var(--ink); white-space: nowrap; }
.brand__venue { color: var(--ink-soft); font-weight: 400; }

.nav { display: flex; align-items: center; gap: 2px; margin-left: 8px; flex: 1; }

.nav a,
.nav summary {
  padding: 6px 11px;
  border-radius: 6px;
  color: var(--ink-mid);
  font-weight: 500;
  white-space: nowrap;
}
.nav a:hover,
.nav summary:hover { background: var(--surface-alt); text-decoration: none; }
.nav a.is-current,
.nav summary.is-current { background: var(--accent-soft); color: var(--accent-press); }

.nav__more { position: relative; }
.nav summary { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; }
.nav summary::-webkit-details-marker { display: none; }
.nav summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.nav__more[open] summary::after { margin-top: 3px; transform: rotate(-135deg); }
.nav__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 170px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(20, 24, 33, .1);
}

.whoami { color: var(--ink-soft); font-size: 12.5px; white-space: nowrap; display: flex; align-items: center; gap: 10px; }

.page { padding-top: 26px; padding-bottom: 60px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
h1 { font-size: 22px; margin: 0; color: var(--ink); }
h2 { font-size: 15px; margin: 0 0 12px; color: var(--ink); }
.sub { margin: 3px 0 0; color: var(--ink-soft); font-size: 13px; }

/* ---- card ----------------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(20, 24, 33, .04);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card--tight { padding: 0; overflow: hidden; }
.card__head { padding: 15px 20px; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card__head h2 { margin: 0; }

/* ---- forms ---------------------------------------------------------------------------------- */

label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-mid); margin: 14px 0 5px; }

input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number],
input[type=date], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { min-height: 80px; resize: vertical; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row > div { flex: 1 1 180px; }
.hint { color: var(--ink-soft); font-size: 12px; margin: 5px 0 0; }

.btn {
  display: inline-block;
  padding: 9px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--accent-press); text-decoration: none; }
.btn--ghost { background: var(--surface); color: var(--ink-mid); border: 1px solid var(--rule-strong); }
.btn--ghost:hover { background: var(--surface-alt); }
.btn--danger { background: var(--surface); color: var(--flag); border: 1px solid var(--flag); }
.btn--danger:hover { background: #FCEEF5; }
.btn--sm { padding: 6px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; }

.err { background: #FCEEF5; border: 1px solid var(--flag); color: var(--flag); border-radius: 6px; padding: 9px 11px; font-size: 13px; margin-bottom: 12px; }
.ok  { background: var(--tag-eco-bg); border: 1px solid var(--tag-eco-tx); color: var(--tag-eco-tx); border-radius: 6px; padding: 9px 11px; font-size: 13px; margin-bottom: 12px; }
.note { background: var(--accent-soft); border: 1px solid #D6E0FC; color: var(--accent-press); border-radius: 6px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }

/* ---- tables --------------------------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 20px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); font-weight: 600; background: var(--surface-alt); }
tr:last-child td { border-bottom: 0; }
td.num, th.num, .figure { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-soft); }
.empty { padding: 34px 20px; text-align: center; color: var(--ink-soft); }

/* ---- status pills, reusing the tag palette --------------------------------------------------- */

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pill--confirmed { background: var(--tag-eco-bg); color: var(--tag-eco-tx); }
.pill--provisional { background: var(--tag-uv-bg); color: var(--tag-uv-tx); }
.pill--enquiry { background: var(--tag-fast-bg); color: var(--tag-fast-tx); }
.pill--declined { background: #FCEEF5; color: var(--flag); }
.pill--cancelled { background: var(--tag-slow-bg); color: var(--tag-slow-tx); }
.pill--role { background: var(--tag-mid-bg); color: var(--tag-mid-tx); }

/* ---- month grid ------------------------------------------------------------------------------ */

.months { display: grid; grid-template-columns: repeat(auto-fit, minmax(390px, 1fr)); gap: 18px; }

.month__name { font-size: 14px; margin: 0 0 10px; color: var(--ink); }
.month__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month__dow { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); text-align: center; padding-bottom: 4px; font-weight: 600; }

.day {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  min-height: 56px;
  padding: 4px 5px 5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.day:hover { border-color: var(--accent); }
.day--outside { visibility: hidden; }
.day--past { background: var(--surface-alt); color: var(--ink-soft); cursor: default; border-style: dashed; }
.day--past:hover { border-color: var(--rule); }
.day__num { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--ink-soft); display: flex; justify-content: space-between; align-items: center; gap: 3px; }
.day__holiday { width: 5px; height: 5px; border-radius: 50%; background: var(--flag); flex: none; }
.slot { font-size: 10.5px; border-radius: 4px; padding: 1px 4px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* A booking's time and name wrap rather than being cut off: "20:00–2…" told the committee nothing. */
.slot--busy, .slot--untimed { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; padding: 2px 4px; }
.slot--free { background: var(--tag-eco-bg); color: var(--tag-eco-tx); }
.slot--busy { background: var(--tag-slow-bg); color: var(--ink-mid); }
.slot--notice { background: var(--tag-uv-bg); color: var(--tag-uv-tx); }
.slot--past { background: transparent; color: var(--ink-soft); }
.slot--provisional { box-shadow: inset 3px 0 0 var(--tag-uv-tx); }
.slot--untimed { background: transparent; color: var(--ink-soft); border: 1px dashed var(--rule); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); margin-top: 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.toolbar label { margin: 0 0 4px; }
.toolbar > div { min-width: 170px; }

/* Two short rows: the venue and Sign out, then the menu. */
@media (max-width: 960px) {
  .topbar__inner { height: auto; padding: 10px 22px 8px; flex-wrap: wrap; gap: 8px 12px; justify-content: space-between; }
  .brand__app, .whoami > span { display: none; }
  .nav { order: 3; flex: 0 0 100%; margin-left: -11px; }
}

@media (max-width: 640px) {
  .topbar__inner { padding: 10px 16px 8px; }
  .nav__panel { left: auto; right: 0; }
  .page { padding-left: 16px; padding-right: 16px; }
  th, td { padding: 10px 14px; }
  .card { padding: 16px; }
}

/* ---- usage meter ---------------------------------------------------------------------------- */

.meter { padding: 12px 0; border-top: 1px solid var(--rule); }
.meter:first-of-type { border-top: 0; }
.meter__head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13.5px; margin-bottom: 7px; }
.meter__track { height: 10px; background: var(--tag-slow-bg); border-radius: 999px; overflow: hidden; }
.meter__fill { height: 100%; border-radius: 999px; min-width: 2px; }
.meter--low .meter__fill { background: var(--tag-eco-tx); }
.meter--mid .meter__fill { background: var(--tag-uv-tx); }
.meter--high .meter__fill { background: var(--flag); }
.meter__foot { font-size: 12px; margin-top: 6px; }

/* ---- editable rows (Settings: activities and rooms) ------------------------------------------ */

.editrow {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0 12px;
  align-items: end;
  padding: 6px 20px 16px;
  border-top: 1px solid var(--rule);
  margin: 0;
}
.editrow:first-of-type { border-top: 0; }
.editrow label { margin: 10px 0 4px; }
.editrow .wide { grid-column: span 2; }
.editrow .full { grid-column: 1 / -1; }
.editrow .check { display: flex; gap: 6px; align-items: center; font-weight: 400; margin: 10px 0 9px; }
.editrow .check input { width: auto; }
.editrow .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.editrow textarea { min-height: 60px; }
.editrow--new { background: var(--surface-alt); }
.editrow__title { grid-column: 1 / -1; margin: 12px 0 0; font-size: 13px; }
.slug { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; padding: 9px 0; color: var(--ink-soft); }
@media (max-width: 640px) {
  .editrow { padding: 6px 14px 14px; }
  .editrow .wide { grid-column: 1 / -1; }
}

/* Settings lists: one line per activity or room, opening into its form. <details> needs no script. */
.item { border-top: 1px solid var(--rule); }
.item > summary { list-style: none; cursor: pointer; }
.item > summary::-webkit-details-marker { display: none; }
.item__line {
  display: grid;
  grid-template-columns: minmax(170px, 2fr) 1fr 1.1fr 1.4fr 1.6fr 48px;
  gap: 12px;
  align-items: center;
  padding: 11px 20px;
  font-size: 13.5px;
}
.item__line--room { grid-template-columns: minmax(170px, 2fr) 1fr 1.6fr 1.6fr 48px; }
.item__head { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); font-weight: 600; background: var(--surface-alt); padding-top: 9px; padding-bottom: 9px; }
.item > .item__line:hover { background: var(--surface-alt); }
.item[open] > .item__line { background: var(--accent-soft); }
.item__edit { color: var(--accent); font-weight: 600; text-align: right; }
.item[open] .item__edit { visibility: hidden; }
.item__add { padding: 14px 20px; }
.item--new[open] > .item__add { display: none; }
.item .editrow { border-top: 0; }
.warn { color: var(--tag-uv-tx, #8A5A16); font-weight: 600; }
@media (max-width: 760px) {
  .item__head { display: none; }
  .item__line, .item__line--room { grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px 14px; }
  .item__line > span:first-child { grid-column: 1 / -1; }
}

/* ---- builder's credit -------------------------------------------------------------------------- */

.page-footer { max-width: 1180px; margin: -24px auto 0; padding: 0 22px 28px; display: flex; justify-content: center; }
.credit { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 12.5px; }
.credit:hover { color: var(--ink); text-decoration: none; }
.credit strong { color: var(--ink-mid); font-weight: 600; }
.credit__mark { display: block; flex-shrink: 0; }
