/* YorCycle back office.
   A working tool for staff: calm, plain surfaces, one type scale, clear
   tables. The brand is in the type (Fraunces for page titles, Nunito Sans
   for everything else), the logo's ink, the berry accent and the season
   pastels, used sparingly as markers and never as whole backgrounds. */

@font-face { font-family: Fraunces; src: url(assets/fonts/Fraunces.ttf); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Nunito Sans"; src: url(assets/fonts/NunitoSans.ttf); font-weight: 200 1000; font-display: swap; }

:root {
  --page: #F8F5F2;
  --surface: #FFFFFF;
  --sunk: #F6F1EE;
  --line: #E8DFDA;
  --line-strong: #D9CDC6;
  --ink: #2A211C;
  --text: #3E3234;
  --muted: #74686B;
  --accent: #B5446E;
  --accent-deep: #8E2F54;
  --accent-wash: #FBEEF3;
  --on-accent: #FFFFFF;
  --danger: #B42318;
  --danger-wash: #FDECEA;
  --rose: #F7CBD8;       --rose-ink: #7A2145;
  --mint: #C7E7D4;       --mint-ink: #1D5A3E;
  --butter: #FBE5A6;     --butter-ink: #6A4A08;
  --apricot: #FBD0BA;    --apricot-ink: #7C3A1E;
  --periwinkle: #CFD8FA; --periwinkle-ink: #2C3F8F;
  --r: 14px;
  --r-control: 10px;
  --side-w: 256px;
  --shadow: 0 1px 2px rgba(42, 33, 28, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 15px/1.5 "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.wash { display: none; }

/* ---------- type ---------- */
h1 { font: 700 1.9rem/1.15 Fraunces, Georgia, serif; letter-spacing: -.015em; color: var(--ink); margin: 0 0 6px; }
h2 { font: 800 1.02rem/1.3 "Nunito Sans", sans-serif; color: var(--ink); margin: 0 0 12px; }
h3 { font: 800 .82rem/1.3 "Nunito Sans", sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
a { color: var(--accent-deep); }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}
.card + .card { margin-top: 16px; }
.block { background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.block + .block { margin-top: 10px; }
.builtin { background: var(--sunk); border-radius: 10px; padding: 10px 12px; color: var(--muted); }

/* ---------- controls ---------- */
label { display: block; font-weight: 700; font-size: .84rem; color: var(--ink); }
input, textarea, select {
  width: 100%;
  font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  padding: 9px 12px;
  min-height: 40px;
}
input::placeholder, textarea::placeholder { color: #9C9093; }
textarea { resize: vertical; min-height: 5em; font: 13px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; }
select { width: auto; min-width: 180px; padding-right: 32px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; flex: none; accent-color: var(--accent); box-shadow: none; }

button {
  font: inherit; font-weight: 700; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--r-control);
  padding: 8px 16px; min-height: 40px;
  color: var(--ink); background: transparent;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--on-accent); }
button.primary:hover:not(:disabled) { background: var(--accent-deep); }
button.secondary { background: var(--surface); border-color: var(--line-strong); }
button.secondary:hover:not(:disabled) { background: var(--sunk); }
button.plain { color: var(--accent-deep); padding-inline: 10px; }
button.plain:hover:not(:disabled) { background: var(--accent-wash); }
button.danger { background: var(--surface); color: var(--danger); border-color: #F0B8B2; }
button.danger:hover:not(:disabled) { background: var(--danger-wash); }

.notice { background: #FFF6DA; color: var(--butter-ink); border: 1px solid #F1DD9B; border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; }
.notice.bad { background: var(--danger-wash); color: #8A1C13; border-color: #F0B8B2; }
.notice.good { background: #E7F5EC; color: var(--mint-ink); border-color: #BFE0CC; }
.notice .row { margin-top: 10px; }

.chip, .role-chip { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .76rem; font-weight: 800; background: var(--sunk); color: var(--muted); vertical-align: middle; }
.chip.changed { background: var(--butter); color: var(--butter-ink); }
.chip.admin { background: var(--periwinkle); color: var(--periwinkle-ink); }
.chip.new { background: var(--mint); color: var(--mint-ink); }
.role-chip { background: var(--accent-wash); color: var(--accent-deep); }

/* ---------- sign-in ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.gate-card { width: 100%; max-width: 420px; padding: 32px; }
.gate-card .logo { margin-bottom: 18px; }
.gate-card form { display: grid; gap: 8px; margin-top: 18px; }
.gate-card button.primary { margin-top: 6px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 22px; padding: 22px 14px 18px;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 0 10px; }
.brand .logo { display: block; }
.brand span { font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tabs { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.tabs .group { margin: 16px 10px 6px; font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #9C9093; }
.tabs .group:first-child { margin-top: 0; }
.tabs button {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; padding: 8px 10px; min-height: 38px;
  border-radius: 9px; font-weight: 700; color: var(--text);
}
.tabs button:hover { background: var(--sunk); }
.tabs button[aria-current="page"] { background: var(--ink); color: #fff; }
.tabs .count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 800; text-align: center; }
.who { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px 10px 0; border-top: 1px solid var(--line); }
.who-email { font-weight: 700; font-size: .86rem; color: var(--ink); }
.who button { margin-left: -10px; min-height: 34px; }

.main { min-width: 0; }
.top { display: none; }
.crumb { font-weight: 800; color: var(--ink); }
.view { max-width: 1180px; padding: 36px clamp(16px, 4vw, 48px) 80px; outline: none; }
/* The line under a page's title explains the page; give it room. */
.view > h1 + p { margin-bottom: 22px; max-width: 70ch; }
.view > h1 + .card, .view > h1 + .tiles, .view > h1 + .notice { margin-top: 20px; }
.view > button.plain:first-child { margin: -8px 0 10px -10px; }

/* ---------- layout helpers ---------- */
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.spread { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.grow { flex: 1 1 240px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fields { display: grid; gap: 14px; }
.fields.two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.field { display: grid; gap: 6px; }
.card > .fields, .card > .row, .card > .field { margin-top: 14px; }
.count { font-size: .78rem; color: var(--muted); text-align: right; }
.count.over { color: var(--danger); font-weight: 800; }

/* ---------- totals ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  position: relative; display: flex; flex-direction: column-reverse; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 16px 18px 16px 22px; overflow: hidden;
}
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--line-strong); }
.tile b { font: 700 1.9rem/1 Fraunces, Georgia, serif; color: var(--ink); }
.tile span { font-size: .8rem; font-weight: 700; color: var(--muted); }
.tile.rose::before { background: #D9638A; }
.tile.mint::before { background: #4FA57C; }
.tile.butter::before { background: #E0A92E; }
.tile.apricot::before { background: #E38B63; }
.tile.periwinkle::before { background: #6C84DD; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.card > .table-wrap, .card > table { margin-top: 4px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--sunk); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 800; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td { overflow-wrap: anywhere; }
td select { min-width: 170px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--accent-wash); }
th.num, .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- lists of things to open ---------- */
.list { display: grid; gap: 8px; }
.item {
  display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between;
  width: 100%; text-align: left; font-weight: 600; white-space: normal;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; min-height: 48px;
}
.item:hover { border-color: var(--accent); background: var(--accent-wash); }

.feedback-msg { white-space: pre-wrap; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; }
dt { color: var(--muted); font-weight: 700; font-size: .86rem; }
dd { margin: 0; color: var(--ink); }

/* ---------- roles ---------- */
.role-card h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px 20px; margin: 16px 0; padding: 16px; background: var(--sunk); border-radius: 12px; }
.perms label { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: .9rem; color: var(--text); }

/* ---------- messages ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; border-radius: 10px; padding: 12px 18px;
  box-shadow: 0 12px 30px -10px rgba(42, 33, 28, .5); font-weight: 700; max-width: calc(100vw - 32px);
}
.toast.bad { background: var(--danger); }

/* ---------- narrow screens ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(84vw, var(--side-w)); z-index: 30; transform: translateX(-102%); transition: transform .2s; box-shadow: 0 0 40px rgba(42, 33, 28, .25); }
  .shell.menu-open .side { transform: none; }
  .top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
  .view { padding-top: 22px; }
  .card { padding: 18px 16px; }
  dl { grid-template-columns: 1fr; gap: 2px; }
  dt { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) { .side, button { transition: none; } }

/* The signed-in address stays on one line; a long one is cut with a dot-dot-dot and shown in full on hover. */
.who { min-width: 0; }
.who-email { max-width: 100%; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* After seeing every page signed in. */
textarea { font: inherit; line-height: 1.5; }
body, td { overflow-wrap: break-word; }
.view > h1 + p { max-width: 96ch; }
.who > * { max-width: 100%; }
.who span:first-child, .who strong, .who-email { display: block; width: 100%; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
