/* BrickWise team lead tracker. Mobile first; brand colours from the main site. */
:root {
  --ink: #0b1630;
  --accent: #1d4ed8;
  --accent-soft: #e6edfb;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --line: #dde3f0;
  --muted: #5b6785;
  --ok: #0f7a4a;
  --ok-soft: #dcf3e8;
  --danger: #b42318;
  --radius: 10px;
  --tap: 44px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    16px/1.4 system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

input,
button {
  font: inherit;
  color: inherit;
}

input {
  min-height: var(--tap);
  width: 100%;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.icon-btn {
  display: grid;
  place-items: center;
  min-width: var(--tap);
  min-height: var(--tap);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  font-size: 1.25rem;
  cursor: pointer;
}

.error {
  min-height: 1.4em;
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
  text-align: center;
}

/* ---------- login ---------- */

.login {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 16px;
}

.login__card {
  display: grid;
  gap: 12px;
  justify-items: center;
  width: 100%;
  max-width: 320px;
}

.mark {
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
  border-radius: 14px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg fill='%23fff'%3E%3Crect x='6' y='19.5' width='9' height='5' rx='1.25'/%3E%3Crect x='17' y='19.5' width='9' height='5' rx='1.25'/%3E%3Crect x='6' y='13' width='4' height='5' rx='1.25'/%3E%3Crect x='12' y='13' width='14' height='5' rx='1.25'/%3E%3Crect x='6' y='6.5' width='9' height='5' rx='1.25'/%3E%3Crect x='17' y='6.5' width='9' height='5' rx='1.25'/%3E%3C/g%3E%3C/svg%3E")
      center / 100% no-repeat,
    var(--accent);
}

.login__card .btn {
  width: 100%;
}

/* ---------- app ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  background: var(--ink);
  color: #fff;
}

.bar h1 {
  flex: 1;
  margin: 0;
  font-size: 1.125rem;
}

.count {
  margin-left: 4px;
  color: #bfd0f8;
  font-weight: 500;
}

.who {
  padding: 4px 10px;
  border-radius: 999px;
  background: #fbbf24;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
}

.bar .icon-btn {
  color: #fff;
}

.add {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  padding: 12px 16px;
}

.add #new-map {
  grid-column: 1 / -1;
}

.add .btn {
  font-size: 1.4rem;
  padding: 0;
}

/* The spreadsheet: scrolls sideways on phones, header stays visible. */
.sheet {
  overflow: auto;
  max-height: calc(100svh - 190px);
  margin: 0 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  padding: 0;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: middle;
}

td:last-child {
  border-right: 0;
}

/* Cells look like a sheet: no box until you edit. */
td input {
  min-height: var(--tap);
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0 8px;
}

td input:focus {
  background: var(--accent-soft);
  outline-offset: -3px;
}

td.saving {
  background: #fff8e1;
}

.col-date input {
  width: 9.5rem;
}

.map {
  display: flex;
  align-items: center;
}

.map input {
  min-width: 6rem;
  text-overflow: ellipsis;
}

.map a {
  display: grid;
  place-items: center;
  min-width: var(--tap);
  min-height: var(--tap);
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.toggle {
  width: 100%;
  min-height: var(--tap);
  min-width: 5.5rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.toggle[aria-pressed='true'] {
  background: var(--ok-soft);
  color: var(--ok);
}

.del {
  width: var(--tap);
  min-height: var(--tap);
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.del:hover {
  color: var(--danger);
}

.empty {
  margin: 0;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  margin: 0;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.toast.show {
  opacity: 1;
}

@media (min-width: 48rem) {
  .add {
    grid-template-columns: 2fr 1fr 1fr auto;
    max-width: 1100px;
  }

  .add #new-map {
    grid-column: auto;
  }

  .map input {
    min-width: 14rem;
  }

  .sheet {
    max-height: calc(100svh - 140px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }
}
