/* The whole app's look starts here. Change the brand colours below and every
   page follows: the home page, both dashboards, and the assistant. */
:root {
  --color-primary: #2f7d4f;
  --color-primary-dark: #226b46;
  --color-primary-soft: #ecf5ef;
  --color-primary-content: #fff;

  --color-navbar: #1f3a44;
  --color-navbar-ink: #f7f5f1;

  --color-page: #efebe4;
  --color-surface: #fff;
  --color-raised: #f6f3ee;
  --color-sunken: #e8e2d8;

  --color-ink: #15302e;
  --color-text: #3d4a49;
  --color-muted: #8a938f;
  --color-border: #e6e0d6;
  --color-border-strong: #d8d1c4;
  --color-hairline: #efeae1;

  --color-red: #b91c1c;
  --color-red-dot: #dc2626;
  --color-red-wash: #fee2e2;
  --color-amber: #b45309;
  --color-amber-dot: #f59e0b;
  --color-amber-wash: #fef3c7;
  --color-grey-wash: #f1f3f2;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --navbar-height: 4rem;
  --radius: 0.75rem;
  --shadow-card: 0 1px 3px rgb(20 40 38 / 0.06), 0 1px 2px rgb(20 40 38 / 0.04);
  --shadow-pop: 0 0.5rem 1.25rem rgb(20 40 38 / 0.14);
}

/* A small reset, so every browser starts in the same place. */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { max-width: 100%; overflow-x: clip; }
img, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3 { line-height: 1.2; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--color-page);
  color: var(--color-ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding: 2rem 1rem 3rem;
}
.page--narrow { max-width: 32rem; }

/* Buttons. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 0.5rem;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;

  &:hover { background: var(--color-raised); }
  &:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
  & svg { width: 1rem; height: 1rem; }
}
.btn--primary {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-primary-content);

  &:hover { border-color: var(--color-primary-dark); background: var(--color-primary-dark); }
}
.btn--small { min-height: 2rem; padding: 0 0.75rem; font-size: 0.875rem; }
.btn--large { min-height: 3rem; padding: 0 1.5rem; font-size: 1rem; }
.btn--wide { width: 100%; }

.link {
  color: var(--color-primary);
  font-weight: 600;

  &:hover { text-decoration: underline; }
}

/* Forms. */
.form { display: flex; flex-direction: column; gap: 1.25rem; }
.field { display: flex; flex-direction: column; gap: 0.375rem; }
.field__label { font-size: 0.9375rem; font-weight: 600; color: var(--color-text); }
.field__hint { font-size: 0.875rem; color: var(--color-muted); }
.field__input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 0.5rem;
  background: var(--color-surface);
  font-size: 1rem;

  &:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; border-color: transparent; }
}
textarea.field__input { min-height: 18rem; resize: vertical; line-height: 1.6; }
.field--check {
  flex-direction: row;
  align-items: center;
  gap: 0.625rem;

  & input { width: 1.25rem; height: 1.25rem; accent-color: var(--color-primary); }
}
.form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; }
.form__errors {
  padding: 0.875rem 1rem;
  border-radius: 0.625rem;
  background: var(--color-red-wash);
  color: var(--color-red);

  & li { list-style: disc; margin-left: 1.25rem; }
}

/* The bar across the top of every page. */
.navbar {
  position: sticky;
  top: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--navbar-height);
  padding: 0 1rem;
  background: var(--color-navbar);
  color: var(--color-navbar-ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);

  @media (min-width: 768px) { padding: 0 1.5rem; }
}
.navbar__brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.125rem;
  font-weight: 600;

  @media (min-width: 768px) { font-size: 1.25rem; }
}
.navbar__mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: var(--color-primary);
  color: var(--color-primary-content);
  font-size: 1rem;
  font-weight: 700;
}
.navbar__end { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.navbar__menu-button {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-left: -0.5rem;
  border-radius: 0.5rem;
  cursor: pointer;

  &:hover { background: rgb(255 255 255 / 0.1); }
  & svg { width: 1.5rem; height: 1.5rem; }
  @media (min-width: 1024px) { display: none; }
}

/* The menu under a person's name. */
.user-menu { position: relative; }
.user-menu__toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  border-radius: 999px;
  cursor: pointer;
  list-style: none;

  &::-webkit-details-marker { display: none; }
  &:hover { background: rgb(255 255 255 / 0.1); }
}
.user-menu__name { font-size: 0.9375rem; font-weight: 500; @media (max-width: 639px) { display: none; } }
.user-menu__list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 13rem;
  padding: 0.375rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-pop);
}
.user-menu__item {
  display: block;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: left;

  &:hover { background: var(--color-raised); }
}
.user-menu__who {
  padding: 0.5rem 0.75rem 0.625rem;
  border-bottom: 1px solid var(--color-hairline);
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: var(--color-muted);
}

/* Initials until there's a photo. */
.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  font-size: 0.8125rem;
  font-weight: 700;
}
.avatar--large { width: 4rem; height: 4rem; border: 2px solid var(--color-primary); font-size: 1.375rem; }
.avatar--medium { width: 2.75rem; height: 2.75rem; font-size: 0.9375rem; }

/* Messages at the top of the page after something happens. */
.flash {
  position: fixed;
  top: calc(var(--navbar-height) + 0.75rem);
  left: 50%;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(100% - 2rem, 36rem);
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  font-weight: 500;
  transform: translateX(-50%);
  animation: flash-in 200ms ease-out;
}
.flash--notice { background: var(--color-primary-soft); color: var(--color-primary-dark); border: 1px solid color-mix(in oklab, var(--color-primary) 30%, transparent); }
.flash--alert { background: var(--color-red-wash); color: var(--color-red); border: 1px solid color-mix(in oklab, var(--color-red) 25%, transparent); }
.flash__text { flex: 1; }
.flash__close { font-size: 1.25rem; line-height: 1; opacity: 0.6; &:hover { opacity: 1; } }
@keyframes flash-in { from { opacity: 0; transform: translate(-50%, -0.5rem); } }

.empty { color: var(--color-muted); }
.phone-only { display: none; }
@media (max-width: 640px) {
  .phone-only { display: inline; }
  .desktop-only { display: none; }
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
