/* EquiHub web client. Tokens are those of the specification, section 6.1, taken from the
   mockups in design/. Keycloak's pages use the same values (keycloak/themes/equihub). */

:root {
  --accent: #183e35;
  --accent-dark: #0f2a23;
  --ground: #f5f4ef;
  --card: #fffefb;
  --border: #e2e0d8;
  --divider: #eeece5;
  --field-border: #d9d7ce;
  --button-border: #c9c7bd;
  --text: #1b211e;
  --text-2: #5b645f;
  --text-3: #3d4541;
  --neutral: #ecebe5;
  --positive-bg: #e4ebe6;
  --positive: #2c6a4f;
  --attention-bg: #f5ead2;
  --attention: #6e4c0c;
  --attention-strong: #5a3e08;
  --attention-border: #d9b25c;
  --badge-on-accent: #f1c76a;
  --negative-bg: #f6e1dc;
  --negative: #8f2a1c;
  --on-accent: #ffffff;
  --on-accent-2: #c9d6cf;
  --on-accent-3: #d5e0da;
  --accent-raised: #2f5a4f;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --sidebar: 232px;
  --tabbar: 78px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

a:hover {
  color: var(--accent-dark);
}

button {
  font: inherit;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

.small {
  font-size: 13px;
}

.num {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--mono);
  font-weight: 500;
}

.serif {
  font-family: var(--serif);
  font-weight: 600;
}

.pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

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

.strike {
  text-decoration: line-through;
}

.grow {
  flex: 1;
  min-width: 0;
}

.right {
  text-align: right;
}

.nowrap {
  white-space: nowrap;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------------ boot and whole-page states */

.boot {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
}

.boot-brand {
  font: 600 28px var(--serif);
  color: var(--accent);
}

.plain-page {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: 28px 20px 34px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.plain-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  font: 600 24px var(--serif);
  color: var(--accent);
  text-decoration: none;
}

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

.shell {
  min-height: 100dvh;
  display: flex;
}

.shell-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px));
}

.page {
  flex: 1;
  width: 100%;
  padding: 14px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  /* A long title and its button do not fit side by side on a phone: the button drops below. */
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 4px;
}

.page-kicker {
  font-size: 13px;
  color: var(--text-2);
}

.page-title {
  font: 600 30px/1.1 var(--serif);
  text-wrap: balance;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 4px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  align-self: flex-start;
}

/* Side bar: design/Admin Sidebar.dc.html. Hidden on phones, where the tab bar takes over. */
.sidebar {
  display: none;
  width: var(--sidebar);
  flex: none;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  background: var(--accent);
  color: var(--on-accent);
  padding: 20px 14px;
  flex-direction: column;
  gap: 22px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  color: inherit;
  text-decoration: none;
}

.sidebar-head:hover {
  color: inherit;
}

.logo-tile {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 9px;
  background: var(--ground);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 14px var(--serif);
  overflow: hidden;
}

.logo-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-centre {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}

.sidebar-panel {
  font-size: 12px;
  color: var(--on-accent-2);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-accent-3);
  text-decoration: none;
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--on-accent);
}

.sidebar-nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.12);
  color: var(--on-accent);
  font-weight: 700;
}

.sidebar .nav-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--badge-on-accent);
  color: #2a2005;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: inherit;
  text-decoration: none;
}

.sidebar-user:hover {
  color: inherit;
}

.sidebar-user .avatar {
  width: 30px;
  height: 30px;
  background: var(--accent-raised);
  color: var(--on-accent);
  font-size: 12px;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
}

.sidebar-user-role {
  font-size: 12px;
  color: var(--on-accent-2);
}

.sidebar :focus-visible {
  outline-color: var(--on-accent);
}

/* Tab bar: design/Phone Tabbar.dc.html. */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 6px calc(22px + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-top: 1px solid var(--border);
}

.tabbar a,
.tabbar button {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  position: relative;
  border: 0;
  background: none;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

/* Five long Polish labels just fit a narrow phone; a longer one is cut with an ellipsis. */
.tabbar a > span:first-of-type,
.tabbar button > span:first-of-type {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabbar a::before,
.tabbar button::before {
  content: "";
  width: 44px;
  max-width: 100%;
  height: 6px;
  border-radius: 3px;
  background: transparent;
}

.tabbar [aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
}

.tabbar [aria-current="page"]::before {
  background: var(--accent);
}

.tabbar .nav-count {
  position: absolute;
  top: -2px;
  right: 8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 900px) {
  .sidebar {
    display: flex;
  }

  .tabbar {
    display: none;
  }

  .shell-main {
    padding-bottom: 0;
  }

  .page {
    max-width: 1120px;
    padding: 28px 32px;
    gap: 18px;
  }

  .page.wide {
    max-width: none;
  }

  .page-head {
    padding: 0;
  }

  .page-kicker {
    font-size: 14px;
  }

  .page-title {
    font-size: 34px;
  }
}

/* ------------------------------------------------------------------ building blocks */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

.card.flush {
  padding: 0;
  overflow: hidden;
}

.card.attention {
  border: 1.5px solid var(--attention-border);
}

.card.selected {
  border: 1.5px solid var(--accent);
}

.card.dashed {
  background: transparent;
  border: 1px dashed var(--button-border);
}

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

.card-title {
  font: 600 19px var(--serif);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stack.tight {
  gap: 4px;
}

.stack.loose {
  gap: 16px;
}

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

.row.top {
  align-items: flex-start;
}

.row.between {
  justify-content: space-between;
}

.row.wrap {
  flex-wrap: wrap;
}

.row.gap-s {
  gap: 8px;
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 6px 4px 0;
}

.horse-name {
  font: 600 18px var(--serif);
}

.horse-name.large {
  font-size: 22px;
}

.horse-name.xl {
  font-size: 28px;
  line-height: 1.1;
}

.box-tile {
  flex: none;
  min-width: 40px;
  height: 40px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--neutral);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

.avatar {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--positive-bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

a.avatar {
  text-decoration: none;
}

.photo {
  flex: none;
  border-radius: 12px;
  background: repeating-linear-gradient(135deg, #e7e5dd 0 6px, #efede6 6px 12px);
  overflow: hidden;
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo.s {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.photo.m {
  width: 48px;
  height: 48px;
}

.photo.l {
  width: 64px;
  height: 64px;
  border-radius: 16px;
}

.photo.banner {
  width: 100%;
  height: 170px;
  border-radius: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--neutral);
  color: var(--text-3);
  white-space: nowrap;
}

.badge.small {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 5px;
}

.badge.positive {
  background: var(--positive-bg);
  color: var(--positive);
}

.badge.go {
  background: var(--positive-bg);
  color: var(--accent);
}

.badge.attention {
  background: var(--attention-bg);
  color: var(--attention);
}

.badge.negative {
  background: var(--negative-bg);
  color: var(--negative);
}

.badge.accent {
  background: var(--accent);
  color: var(--on-accent);
}

.badge.large {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: normal;
}

.banner {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
  background: var(--neutral);
  color: var(--text-3);
}

.banner.info {
  background: var(--positive-bg);
  color: var(--accent);
}

.banner.attention {
  background: var(--attention-bg);
  color: var(--attention-strong);
  border-radius: 10px;
  padding: 10px 12px;
}

.banner.negative {
  background: var(--negative-bg);
  color: var(--negative);
}

.progress {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}

.progress > div {
  height: 100%;
  background: var(--accent);
}

.progress.thin {
  height: 5px;
}

/* Rows of a list inside a card. */
.lines > * {
  padding: 12px 0;
  border-top: 1px solid var(--divider);
}

.lines > *:first-child {
  border-top: 0;
}

.lines.padded > * {
  padding-left: 14px;
  padding-right: 14px;
}

a.line,
button.line {
  display: flex;
  width: 100%;
  gap: 12px;
  align-items: center;
  text-align: left;
  color: inherit;
  text-decoration: none;
  background: none;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  cursor: pointer;
}

a.line:hover,
button.line:hover {
  background: rgba(0, 0, 0, 0.02);
}

.kv {
  display: grid;
  grid-template-columns: minmax(96px, max-content) 1fr;
  gap: 8px 16px;
  font-size: 14px;
}

.kv > dt {
  color: var(--text-2);
}

.kv > dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

dl.kv {
  margin: 0;
}

.empty {
  padding: 28px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
}

.empty-title {
  font: 600 19px var(--serif);
  color: var(--text);
}

.empty p {
  max-width: 44ch;
  font-size: 14px;
}

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}

.loading {
  display: flex;
  justify-content: center;
  padding: 32px;
}

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: var(--accent-dark);
  color: var(--on-accent);
}

.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--button-border);
  font-weight: 600;
}

.btn.secondary:hover {
  background: var(--neutral);
}

.btn.danger {
  background: transparent;
  color: var(--negative);
  border: 1px solid var(--button-border);
  font-weight: 600;
}

.btn.danger:hover {
  background: var(--negative-bg);
}

.btn.large {
  min-height: 52px;
  font-size: 16px;
}

.btn.block {
  width: 100%;
}

.btn[disabled] {
  background: var(--neutral);
  color: var(--text-2);
  border-color: transparent;
  cursor: not-allowed;
  font-weight: 600;
  font-size: 14px;
}

.btn.small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 9px;
}

.link-btn {
  border: 0;
  background: none;
  padding: 8px 4px;
  min-height: 36px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.link-btn:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.link-btn.danger {
  color: var(--negative);
}

.icon-btn {
  border: 0;
  background: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--neutral);
}

@media (min-width: 900px) {
  .btn {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 14px;
  }

  .btn.large {
    min-height: 48px;
  }
}

/* ------------------------------------------------------------------ filters and tabs */

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -16px;
  padding: 2px 16px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1px solid var(--field-border);
  background: var(--card);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.chip .chip-count {
  color: var(--text-2);
  font-weight: 500;
}

.chip[aria-pressed="true"],
.chip[aria-current="page"],
.chip[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

.chip[aria-pressed="true"] .chip-count,
.chip[aria-current="page"] .chip-count,
.chip[aria-selected="true"] .chip-count {
  color: var(--on-accent-2);
}

.tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  margin: 0 -16px;
  padding: 0 16px;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: none;
  padding: 10px 0;
  min-height: 44px;
  border: 0;
  border-bottom: 2.5px solid transparent;
  background: none;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.tab[aria-current="page"],
.tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

@media (min-width: 900px) {
  .chips,
  .tabs {
    margin: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .chips {
    flex-wrap: wrap;
  }
}

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

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label,
.field-label {
  font-size: 13px;
  font-weight: 600;
}

.field-hint {
  font-size: 12px;
  color: var(--text-2);
}

.field-error {
  font-size: 13px;
  font-weight: 600;
  color: var(--negative);
}

.field-row {
  display: flex;
  gap: 10px;
}

.field-row > * {
  flex: 1;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--field-border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.textarea {
  min-height: 84px;
  padding: 12px;
  line-height: 1.4;
  resize: vertical;
}

.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: none;
  border: 1.5px solid var(--accent);
}

.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--negative);
}

.counter {
  font-size: 12px;
  color: var(--text-2);
  text-align: right;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.segmented.three {
  grid-template-columns: repeat(3, 1fr);
}

.segmented.one {
  grid-template-columns: 1fr;
}

.segment {
  min-height: 46px;
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid var(--field-border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}

.segment[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 15px;
  cursor: pointer;
}

.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex: none;
}

.lang-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--field-border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.lang-switch button {
  border: 0;
  background: none;
  padding: 6px 12px;
  border-radius: 16px;
  color: var(--text-2);
  cursor: pointer;
  font-weight: 600;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

@media (min-width: 900px) {
  .input,
  .select {
    min-height: 42px;
    border-radius: 10px;
    font-size: 15px;
    background: #fff;
  }

  .textarea {
    font-size: 15px;
    border-radius: 10px;
    background: #fff;
  }
}

/* ------------------------------------------------------------------ dialogs and notices */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(20, 24, 22, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.dialog {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  background: var(--ground);
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
}

.dialog-head {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 10px;
}

.dialog-title {
  font: 600 22px/1.2 var(--serif);
}

.dialog-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 20px 18px;
}

.dialog-foot {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 12px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
}

.dialog-foot .btn {
  flex: 1;
}

@media (min-width: 700px) {
  .overlay {
    align-items: center;
    padding: 24px;
  }

  .dialog {
    border-radius: 18px;
  }

  .dialog-foot {
    justify-content: flex-end;
    padding-bottom: 18px;
  }

  .dialog-foot .btn {
    flex: none;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(92vw, 480px);
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--text);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.toast.error {
  background: var(--negative);
}

@media (min-width: 900px) {
  .toast {
    bottom: 28px;
  }
}

/* ------------------------------------------------------------------ tables (desktop lists) */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}

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

.table .num,
.table th.num {
  text-align: right;
}

.table tr.clickable {
  cursor: pointer;
}

.table tr.clickable:hover td {
  background: rgba(0, 0, 0, 0.02);
}

.table tr[aria-selected="true"] td {
  background: var(--positive-bg);
}

.table tr[aria-selected="true"] td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.table-scroll {
  /* Positioned, so that screen-reader-only labels inside the table scroll with it
     instead of widening the page. */
  position: relative;
  overflow-x: auto;
}

/* ------------------------------------------------------------------ grids used by several screens */

.split {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 86px;
  color: var(--text);
  text-decoration: none;
}

a.tile:hover {
  color: var(--text);
  border-color: var(--button-border);
}

.tile-label {
  font-size: 13px;
  line-height: 1.3;
  color: var(--text-2);
}

.tile-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.tile-sub {
  font-size: 12px;
  color: var(--text-2);
}

.tile.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.tile.accent .tile-label,
.tile.accent .tile-sub {
  color: var(--on-accent-2);
}

.tile.attention {
  background: var(--attention-bg);
  border-color: var(--attention-bg);
  color: var(--attention-strong);
}

.tile.attention .tile-label,
.tile.attention .tile-sub {
  color: var(--attention);
}

.tile.negative {
  background: var(--negative-bg);
  border-color: var(--negative-bg);
  color: var(--negative);
}

.tile.negative .tile-label,
.tile.negative .tile-sub {
  color: var(--negative);
}

@media (min-width: 900px) {
  .split {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }

  .split.even {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .split.narrow-first {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.3fr);
  }

  .split.wide-first {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  }

  .tiles {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
  }

  .tiles.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tile {
    padding: 14px 16px;
    min-height: 92px;
    gap: 6px;
  }

  .tile-value {
    font-size: 28px;
  }
}

.only-wide {
  display: none;
}

@media (min-width: 900px) {
  .only-wide {
    display: revert;
  }

  .only-narrow {
    display: none !important;
  }
}

/* ------------------------------------------------------------------ daily sheet (mockups 1c, 1d) */

.today-count {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}

.today-count span {
  color: var(--text-2);
  font-weight: 500;
  font-size: 15px;
}

.card.care {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.care-what {
  font-size: 15px;
}

.strong {
  font-weight: 600;
}

.care-note {
  font-size: 13px;
  color: var(--attention);
}

.plain-link {
  color: inherit;
  text-decoration: none;
}

.plain-link:hover {
  color: var(--accent);
}

.care .btn.secondary {
  min-width: 104px;
}

/* ------------------------------------------------------------------ horses (mockups 1e, 1f, 1g) */

.pair {
  display: flex;
  gap: 8px;
}

.pair > * {
  flex: 1;
  min-width: 0;
}

.pair .tile {
  min-height: 0;
  padding: 12px;
  gap: 2px;
}

.tile-value.small-value {
  font-size: 18px;
}

.tile-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.tile.plain {
  background: var(--ground);
  border-color: transparent;
  min-height: 0;
  border-radius: 12px;
}

.tile.plain.negative {
  background: var(--negative-bg);
}

.tiles.flat {
  gap: 10px;
}

.tiles.flat .tile-value.small-value {
  font-size: 22px;
}

.horse-card {
  display: flex;
  flex-direction: column;
  border-radius: 18px;
}

.horse-card .photo.banner {
  height: 150px;
}

.horse-card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-2);
}

.card.day-item {
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.care-changed {
  color: var(--attention-strong);
  line-height: 1.4;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.photo-grid figure {
  margin: 0;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.photo-grid figcaption {
  padding: 4px 10px;
  min-height: 44px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0 12px;
  max-height: 240px;
  overflow-y: auto;
}

.feed-row {
  background: var(--card);
}

.decision-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.decision-row .input {
  flex: 1 1 220px;
}

.small-lines > * {
  padding: 10px 0;
  font-size: 14px;
}

.lines.top-line > *:first-child {
  border-top: 1px solid var(--divider);
  margin-top: 8px;
}

.narrow {
  max-width: 640px;
  width: 100%;
}

/* ------------------------------------------------------------------ calendar */

.event-line {
  gap: 14px;
}

.event-date {
  flex: none;
  width: 44px;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.event-dow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-2);
}

.event-day {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.1;
}

.event-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.event-sub {
  display: block;
}

.event-kind {
  color: var(--text-3);
  white-space: nowrap;
}

.when {
  width: 84px;
  text-align: right;
  flex: none;
}

/* ------------------------------------------------------------------ announcements (1i, 1n) */

.page.reading {
  gap: 16px;
  padding-left: 22px;
  padding-right: 22px;
}

.reading-body {
  font-size: 16px;
  line-height: 1.6;
  text-wrap: pretty;
  max-width: 68ch;
}

.reading-foot {
  margin-top: auto;
  text-align: center;
}

.card-title.large {
  font-size: 22px;
}

.quote {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-3);
  background: var(--ground);
  border-radius: 12px;
  padding: 12px 14px;
  max-height: 180px;
  overflow-y: auto;
}

.totals {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.total-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}

/* ------------------------------------------------------------------ messages (1j, 1o) */

.page-title.small-title {
  font-size: 24px;
}

.page.chat-page {
  padding: 0;
  gap: 0;
  height: calc(100dvh - var(--tabbar) - env(safe-area-inset-bottom, 0px));
}

.chat-head {
  flex: none;
  padding: 10px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.thread {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.thread-messages > :first-child {
  margin-top: auto;
}

.thread-empty {
  text-align: center;
  padding: 24px;
}

.day-separator {
  text-align: center;
  font-size: 12px;
  color: var(--text-2);
}

.bubble-row {
  align-self: flex-start;
  max-width: 78%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bubble-row.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.4;
}

.bubble-row.mine .bubble {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  border-radius: 16px 16px 4px 16px;
}

.bubble-sender {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  padding: 0 4px;
}

.bubble-meta {
  font-size: 12px;
  color: var(--text-2);
  padding: 0 4px;
}

.composer {
  flex: none;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 16px;
  background: var(--ground);
}

.composer-input {
  flex: 1;
  min-height: 46px;
  max-height: 140px;
  padding: 12px 16px;
  border: 1px solid var(--field-border);
  border-radius: 23px;
  background: var(--card);
  font: inherit;
  font-size: 15px;
  resize: none;
}

.composer-input:focus-visible {
  outline: none;
  border: 1.5px solid var(--accent);
}

.composer-send {
  min-height: 46px;
  border-radius: 23px;
  font-size: 14px;
}

.inbox {
  flex: 1;
  display: flex;
  min-height: 0;
  height: calc(100dvh - var(--tabbar) - env(safe-area-inset-bottom, 0px));
}

.inbox-list {
  flex: 1;
  overflow-y: auto;
  background: var(--card);
}

.inbox-head {
  padding: 16px 20px 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.inbox-item {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--divider);
  color: inherit;
  text-decoration: none;
}

.inbox-item[aria-current="page"] {
  background: var(--positive-bg);
}

.inbox-item:hover {
  color: inherit;
}

.inbox-item .avatar {
  width: 38px;
  height: 38px;
}

.unread {
  flex: none;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.inbox-thread {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

@media (min-width: 900px) {
  .page.chat-page,
  .inbox {
    height: 100dvh;
  }

  .page.chat-page {
    max-width: 760px;
  }

  .inbox-list {
    flex: none;
    width: 330px;
    border-right: 1px solid var(--border);
  }

  .inbox-head {
    padding-top: 28px;
  }

  .chat-head {
    padding: 24px 28px 14px;
  }

  .thread-messages {
    padding: 20px 28px;
    gap: 14px;
  }

  .bubble-row {
    max-width: 60%;
  }

  .composer {
    padding: 14px 28px 22px;
    gap: 10px;
  }

  .composer-input {
    min-height: 52px;
    border-radius: 12px;
    padding: 14px;
  }

  .composer-send {
    min-height: 52px;
    border-radius: 12px;
    padding: 0 20px;
    font-size: 15px;
  }

  .inbox-thread.only-wide,
  .inbox-list.only-wide {
    display: flex;
    flex-direction: column;
  }

  .inbox-list.only-wide {
    display: block;
  }
}

/* ------------------------------------------------------------------ payments and finance (1h, 1m) */

.balance-card {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.balance-label {
  font-size: 13px;
  color: var(--on-accent-2);
}

.balance-value {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.small-strong {
  font-size: 14px;
}

.charge-amount {
  align-items: flex-end;
  flex: none;
}

.split.accounts {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
}

/* ------------------------------------------------------------------ boxes and settings */

.box-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.box-card {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  color: inherit;
  text-decoration: none;
  width: 100%;
}

button.box-card {
  cursor: pointer;
  font: inherit;
}

button.box-card:hover,
a.box-card:hover {
  border-color: var(--button-border);
  color: inherit;
}

.color-input {
  width: 56px;
  height: 44px;
  padding: 2px;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
}

.logo-preview {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
}

/* ------------------------------------------------------------------ corrections found in the browser */

.photo {
  display: block;
}

.tile .negative,
.card .negative {
  color: var(--negative);
}

.tile .positive,
.card .positive {
  color: var(--positive);
}

/* In a row, a full-width button takes the space its neighbours leave. */
.row > .btn.block {
  flex: 1;
  width: auto;
}

/* List cards in the announcements screen breathe a little more (mockup 1n). */
.split.narrow-first .card.stack.tight {
  gap: 8px;
}

/* What stands at the end of a list line: stacked on a phone, side by side on a wide screen. */
.line-meta {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.line-meta .when {
  width: auto;
}

@media (min-width: 900px) {
  .line-meta {
    flex-direction: row;
    align-items: center;
    gap: 14px;
  }

  .line-meta .when {
    width: 84px;
  }
}
