:root {
  --ground: #edf1f2;
  --paper: #fbfcfc;
  --ink: #13232b;
  --muted: #55666e;
  --line: #d3dcdf;
  --lagoon: #0b6b7a;
  --lagoon-deep: #084c57;
  --lagoon-wash: #dcecee;
  --sun: #e9a820;
  --sun-wash: #fbf0d4;
  --signal: #b3261e;
  --signal-wash: #f8e1df;
  --mint-wash: #dff0e8;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
  --radius: 10px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 1rem/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0;
}

p {
  margin: 0;
}

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

:focus-visible {
  outline: 3px solid var(--lagoon);
  outline-offset: 2px;
  border-radius: 4px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85em;
}

/* ---------- Shell ---------- */

.bar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-family: var(--display);
  font-weight: 750;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  margin-right: auto;
}

.wordmark span {
  color: var(--lagoon);
}

.who {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  text-align: right;
}

.who strong {
  display: block;
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tabs a {
  padding: 12px 14px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tabs a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--lagoon);
}

.tabs a:hover {
  color: var(--ink);
}

main {
  padding: clamp(24px, 5vw, 56px) var(--gutter) 96px;
  max-width: 1180px;
  margin-inline: auto;
}

/* ---------- Buttons ---------- */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover:not(:disabled) {
  background: var(--lagoon-wash);
  border-color: var(--lagoon);
}

.btn.primary {
  background: var(--lagoon);
  border-color: var(--lagoon);
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--lagoon-deep);
  border-color: var(--lagoon-deep);
}

.btn.danger {
  color: var(--signal);
  border-color: color-mix(in srgb, var(--signal) 45%, white);
}

.btn.danger:hover:not(:disabled) {
  background: var(--signal-wash);
  border-color: var(--signal);
}

.btn.danger.solid {
  background: var(--signal);
  border-color: var(--signal);
  color: #fff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  color: var(--lagoon);
  font-weight: 550;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Page header ---------- */

.page-head {
  margin-bottom: 32px;
}

.page-head h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-variation-settings: "wdth" 90;
}

.page-head p {
  margin-top: 12px;
  font-size: 1.1rem;
  max-width: 60ch;
}

.page-head .flag {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- Seat strip ---------- */

.seats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.seat {
  width: 10px;
  height: 15px;
  border-radius: 4px 4px 2px 2px;
  background: var(--lagoon);
}

.seat.incoming {
  background: transparent;
  border: 1.5px dashed var(--sun);
}

.seat.leaving {
  background: repeating-linear-gradient(135deg, var(--muted) 0 2px, transparent 2px 4px);
  opacity: 0.6;
}

.seat.trial {
  background: var(--lagoon-wash);
  border: 1.5px solid var(--lagoon);
}

.seats .more {
  margin-left: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.seats.large .seat {
  width: 14px;
  height: 20px;
}

.intro .seat {
  animation: seat-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--row, 0) * 70ms + var(--i, 0) * 14ms);
}

@keyframes seat-in {
  from {
    transform: translateY(6px) scale(0.4);
    opacity: 0;
  }
}

/* ---------- Ledger ---------- */

.ledger {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.ledger-group + .ledger-group {
  border-top: 1px solid var(--line);
}

.ledger-group > h2 {
  font-size: 1rem;
  padding: 16px 20px 4px;
  color: var(--muted);
  font-weight: 600;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.5fr) minmax(0, 0.95fr) auto auto;
  align-items: center;
  gap: 8px 24px;
  padding: 16px 20px;
}

.row + .row {
  border-top: 1px solid var(--line);
}

.row .title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.25;
}

.row .sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.row .qty {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 6px;
}

.row .qty b {
  color: var(--ink);
  font-weight: 650;
}

.renews {
  font-size: 0.92rem;
}

.renews.soon::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sun);
  margin-right: 8px;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--mint-wash);
  color: #1b5b43;
  white-space: nowrap;
}

.badge.warn {
  background: var(--sun-wash);
  color: #7a5200;
}
.badge.bad {
  background: var(--signal-wash);
  color: var(--signal);
}
.badge.off {
  background: #e4e9eb;
  color: var(--muted);
}

/* ---------- Tables ---------- */

.table-wrap {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85rem;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tr:last-child td {
  border-bottom: 0;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 3px;
  margin-bottom: 16px;
}

.segmented button {
  appearance: none;
  border: 0;
  background: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 550;
  color: var(--muted);
}

.segmented button[aria-pressed="true"] {
  background: var(--lagoon);
  color: #fff;
}

/* ---------- Activity ---------- */

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.feed li {
  padding: 14px 20px;
  display: grid;
  gap: 2px;
}

.feed li + li {
  border-top: 1px solid var(--line);
}

.feed .when {
  font-size: 0.85rem;
  color: var(--muted);
}

.empty {
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 32px 24px;
}

.empty h2 {
  font-size: 1.2rem;
  margin-bottom: 6px;
}

/* ---------- Drawer and dialogs ---------- */

dialog {
  border: 0;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
}

dialog::backdrop {
  background: rgb(19 35 43 / 0.45);
}

dialog.drawer {
  margin: 0 0 0 auto;
  height: 100dvh;
  max-height: none;
  width: min(520px, 100vw);
  box-shadow: -12px 0 40px rgb(19 35 43 / 0.18);
}

dialog.drawer[open] {
  animation: drawer-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes drawer-in {
  from {
    transform: translateX(32px);
    opacity: 0;
  }
}

dialog.modal {
  border-radius: var(--radius);
  width: min(440px, calc(100vw - 32px));
  padding: 24px;
  margin: auto;
}

.drawer-head {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  font-size: 1.5rem;
}

.drawer-body {
  padding: 8px 24px 40px;
  overflow-y: auto;
  height: calc(100dvh - 98px);
}

.section {
  padding: 24px 0;
}

.section + .section {
  border-top: 1px solid var(--line);
}

.section h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.notice {
  background: var(--sun-wash);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.92rem;
  margin-bottom: 16px;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
}

.stepper input[type="number"] {
  width: 5.5rem;
  text-align: center;
  font-family: var(--display);
  font-weight: 650;
  font-size: 1.5rem;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stepper .btn {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.field {
  display: grid;
  gap: 6px;
  margin: 16px 0;
}

.field label {
  font-weight: 600;
  font-size: 0.92rem;
}

.field input,
.field textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  max-width: 100%;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.summary {
  min-height: 3em;
  margin-bottom: 16px;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 0;
  font-size: 0.95rem;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.switch {
  appearance: none;
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 0;
  background: #b9c5ca;
  cursor: pointer;
  flex: none;
  transition: background 0.15s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.switch[aria-checked="true"] {
  background: var(--lagoon);
}

.switch[aria-checked="true"]::after {
  transform: translateX(20px);
}

.switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ---------- Sign in ---------- */

.signin {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  gap: 40px;
  padding: var(--gutter);
  max-width: 760px;
  margin-inline: auto;
}

.signin h1 {
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  font-variation-settings: "wdth" 88;
  max-width: 14ch;
}

.signin .lede {
  font-size: 1.15rem;
  margin-top: 16px;
  max-width: 46ch;
}

.signin .seats {
  margin-bottom: 28px;
}

.gap-s {
  margin-top: 10px;
}

.gap-m {
  margin-top: 12px;
}

.gap-b {
  margin-bottom: 14px;
}

.error {
  color: var(--signal);
  font-weight: 550;
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 100;
  width: min(420px, calc(100vw - 32px));
}

.toast {
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(19 35 43 / 0.3);
}

.toast.error {
  background: var(--signal);
  color: #fff;
}

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .row {
    grid-template-columns: 1fr auto;
  }
  .row .seat-cell,
  .row .renews {
    grid-column: 1 / -1;
  }
  .who span.who-text {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Admin ---------- */

.page-head.split,
.split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.back {
  margin-bottom: 16px;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.panel h2 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.panel .split h2 {
  margin-bottom: 0;
}

/* A panel's title and its action sit on one centre line, with the same space before whatever follows, and no extra space after the last thing. */
.panel > .split {
  align-items: center;
  margin-bottom: 14px;
}

.panel > :last-child {
  margin-bottom: 0;
}

.inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.consent {
  margin-top: 20px;
  display: grid;
  gap: 10px;
  justify-items: start;
}

/* A read-only block of text to copy (the consent link, a certificate). Same border, radius and padding as the other fields. */
.copy {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ground);
  color: var(--ink);
  font: 0.85rem/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace;
  overflow-wrap: anywhere;
  resize: vertical;
}

.table-wrap.flat {
  border: 0;
  border-radius: 0;
  margin-top: 12px;
}

.table-wrap.flat th:first-child,
.table-wrap.flat td:first-child {
  padding-left: 0;
}

.row-actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
}

ul.plain {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.plain li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

ul.plain li:last-child {
  border-bottom: 1px solid var(--line);
}

.field select,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 36px 8px 10px;
  max-width: 100%;
  font: inherit;
  /* The browser's own chevron hugs the edge of the field, so draw one with room around it. */
  appearance: none;
  -webkit-appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2355666e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center / 12px 8px;
  text-overflow: ellipsis;
}

.field .hint {
  font-size: 0.85rem;
}

a.btn {
  display: inline-block;
  text-decoration: none;
  color: inherit;
}

.signin-form {
  display: grid;
  gap: 4px;
  justify-items: start;
  max-width: 380px;
}

.signin-form .field {
  width: 100%;
  margin: 0 0 8px;
}

.signin-form input {
  width: 100%;
}

.ok {
  color: #1b5b43;
  font-weight: 550;
}

@media (max-width: 900px) {
  .table-wrap.flat th,
  .table-wrap.flat td {
    white-space: normal;
    padding: 10px 8px;
  }
  .table-wrap.flat th:first-child,
  .table-wrap.flat td:first-child {
    padding-left: 0;
  }
  .row-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

.org-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}
.org-switch select {
  max-width: 14rem;
}

/* ---------- Sign-in: the same look as the rest of the portal, in a centred card ---------- */

body.signin-page .signin {
  max-width: none;
  margin: 0;
  gap: 0;
  place-items: center;
  align-content: center;
}

.login-card {
  width: min(100%, 420px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: 0 10px 30px rgba(19, 35, 43, 0.08);
  padding: 36px 28px 28px;
  text-align: center;
}

.signin .login-brand {
  margin: 0 0 8px;
  max-width: none;
  font-size: 2.1rem;
  font-variation-settings: normal;
  color: var(--ink);
}

.signin .login-brand span {
  color: var(--lagoon);
  font-weight: 500;
}

.login-tag {
  margin: 0 0 24px;
  color: var(--muted);
}

body.signin-page .signin-form {
  max-width: none;
  justify-items: stretch;
  text-align: left;
}

body.signin-page .signin-form .btn {
  width: 100%;
}

.login-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.login-or::before,
.login-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.panel > div > label.muted {
  display: block;
}
