:root {
  --brand: #2563eb;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f7f8fa;
  --card: #ffffff;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --ok: #065f46;
  --ok-bg: #d1fae5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--brand); }

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar-brand-colour { border-bottom: 3px solid var(--brand); }
.topbar-brand {
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.topbar-logo { height: 28px; width: auto; }
.topbar-logout { margin: 0; }

/* Layout */
.wrap { max-width: 860px; margin: 1.5rem auto; padding: 0 1.25rem; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.muted { color: var(--muted); }
.hint { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; }

/* Auth pages */
.auth {
  max-width: 400px;
  margin: 4rem auto;
  padding: 0 1.25rem;
  text-align: center;
}
.client-auth .brandhead { margin-bottom: 1.5rem; }
.client-logo { max-height: 72px; width: auto; margin-bottom: 0.5rem; }

/* Cards and forms */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: left;
  margin-bottom: 1.25rem;
}
label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.9rem;
}
label.checkbox { font-weight: 400; display: flex; align-items: center; gap: 0.5rem; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="tel"],
input[type="number"],
select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-weight: 400;
  background: var(--card);
  color: var(--ink);
}
input[type="color"] {
  margin-top: 0.35rem;
  width: 3rem;
  height: 2.2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

/* Buttons */
button, .btn {
  display: inline-block;
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-brand { background: var(--brand); }
.link-btn {
  background: none;
  color: var(--brand);
  padding: 0;
  font-weight: 600;
}
.link { color: var(--brand); text-decoration: none; }

/* App allocation (admin) + app buttons */
fieldset.appset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0 0 0.9rem;
}
.appset legend { font-weight: 600; padding: 0 0.35rem; }
.app-buttons { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: var(--card); }
.table th, .table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
.table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }

/* Flash */
.flash { padding: 0.7rem 0.9rem; border-radius: 8px; margin-bottom: 1rem; text-align: left; }
.flash ul { margin: 0; padding-left: 1.1rem; }
.flash-error { background: var(--danger-bg); color: var(--danger); }
.flash-success { background: var(--ok-bg); color: var(--ok); }
.flash-warn { background: #fef3c7; color: #92400e; }

/* Rota clash markers */
.cell-clash { color: var(--danger); font-weight: 600; }
.clash-tag {
  display: inline-block;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Client top nav */
.topbar-brand { min-width: 0; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}
.topnav a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}
.topnav a:hover { color: var(--brand); }

/* Burger (CSS-only, no inline script needed) */
.nav-toggle { display: none; }
.nav-burger {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  background: var(--card);
}
.nav-burger span,
.nav-burger span::before,
.nav-burger span::after {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}
.nav-burger span { position: relative; }
.nav-burger span::before { content: ""; position: absolute; top: -6px; }
.nav-burger span::after { content: ""; position: absolute; top: 6px; }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .nav-burger { display: inline-flex; }
  .topnav {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 0.9rem;
    padding-top: 0.9rem;
  }
  .nav-toggle:checked ~ .topnav { display: flex; }
  .topbar-logout { margin: 0; }
}

/* Branding preview */
.logo-preview {
  max-height: 96px;
  max-width: 100%;
  width: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem;
}
input[type="file"] {
  display: block;
  margin-top: 0.35rem;
  font: inherit;
  font-weight: 400;
}

/* Rota (zcoach module) */
.rota-tools { display: flex; gap: 1rem; }
.weeknav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.weeklabel { font-weight: 600; }
.weekcopy {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.weekcopy label.inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-weight: 600;
}
.weekcopy input[type="date"] { width: auto; margin-top: 0; }
.btn-sm {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.day-head h2 { margin: 0; font-size: 1.1rem; }
.row2 { display: flex; gap: 1rem; }
.row2 label { flex: 1; }
.danger { color: var(--danger); }

@media (max-width: 640px) {
  .row2 { flex-direction: column; gap: 0; }
}

/* Footer */
.site-footer {
  max-width: 860px;
  margin: 2rem auto;
  padding: 0 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
