.animate-jiggle {
  animation: jiggle 0.15s 20;
}

@keyframes jiggle {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(2deg); }
  50% { transform: rotate(0deg); }
  75% { transform: rotate(-2deg); }
  100% { transform: rotate(0deg); }
}
@tailwind base;
@tailwind components;
@tailwind utilities;

/*

@layer components {
  .btn-primary {
    @apply py-2 px-4 bg-blue-200;
  }
}

*/
:root {
    --red-50:#fef2f2;
    --red-100:#ffe2e2;
    --red-200:#ffcaca;
    --red-300:#ffa3a3;
    --red-400:#ff6568;
    --red-500:#fb2c36;
    --red-600:#e40014;
    --red-700:#bf000f;
    --red-800:#9f0712;
    --red-900:#82181a;
    --red-950:#460809;
    --orange-50:#fff7ed;
    --orange-100:#ffedd5;
    --orange-200:#ffd7a8;
    --orange-300:#ffb96d;
    --orange-400:#ff8b1a;
    --orange-500:#fe6e00;
    --orange-600:#f05100;
    --orange-700:#c53c00;
    --orange-800:#9f2d00;
    --orange-900:#7e2a0c;
    --orange-950:#441306;
    --amber-50:#fffbeb;
    --amber-100:#fef3c6;
    --amber-200:#fee685;
    --amber-300:#ffd236;
    --amber-400:#fcbb00;
    --amber-500:#f99c00;
    --amber-600:#dd7400;
    --amber-700:#b75000;
    --amber-800:#953d00;
    --amber-900:#7b3306;
    --amber-950:#461901;
    --yellow-50:#fefce8;
    --yellow-100:#fef9c2;
    --yellow-200:#fff085;
    --yellow-300:#ffe02a;
    --yellow-400:#fac800;
    --yellow-500:#edb200;
    --yellow-600:#cd8900;
    --yellow-700:#a36100;
    --yellow-800:#874b00;
    --yellow-900:#733e0a;
    --yellow-950:#432004;
    --lime-50:#f7fee7;
    --lime-100:#ecfcca;
    --lime-200:#d8f999;
    --lime-300:#bbf451;
    --lime-400:#9de500;
    --lime-500:#80cd00;
    --lime-600:#62a400;
    --lime-700:#4b7d00;
    --lime-800:#3d6300;
    --lime-900:#35530e;
    --lime-950:#192e03;
    --green-50:#f0fdf4;
    --green-100:#dcfce7;
    --green-200:#b9f8cf;
    --green-300:#7bf1a8;
    --green-400:#05df72;
    --green-500:#00c758;
    --green-600:#00a544;
    --green-700:#008138;
    --green-800:#016630;
    --green-900:#0d542b;
    --green-950:#032e15;
    --emerald-50:#ecfdf5;
    --emerald-100:#d0fae5;
    --emerald-200:#a4f4cf;
    --emerald-300:#5ee9b5;
    --emerald-400:#00d294;
    --emerald-500:#00bb7f;
    --emerald-600:#009767;
    --emerald-700:#007956;
    --emerald-800:#005f46;
    --emerald-900:#004e3b;
    --emerald-950:#002c22;
    --teal-50:#f0fdfa;
    --teal-100:#cbfbf1;
    --teal-200:#96f7e4;
    --teal-300:#46ecd5;
    --teal-400:#00d3bd;
    --teal-500:#00baa7;
    --teal-600:#009588;
    --teal-700:#00776e;
    --teal-800:#005f5a;
    --teal-900:#0b4f4a;
    --teal-950:#022f2e;
    --cyan-50:#ecfeff;
    --cyan-100:#cefafe;
    --cyan-200:#a2f4fd;
    --cyan-300:#53eafd;
    --cyan-400:#00d2ef;
    --cyan-500:#00b7d7;
    --cyan-600:#0092b5;
    --cyan-700:#007492;
    --cyan-800:#005f78;
    --cyan-900:#104e64;
    --cyan-950:#053345;
    --sky-50:#f0f9ff;
    --sky-100:#dff2fe;
    --sky-200:#b8e6fe;
    --sky-300:#77d4ff;
    --sky-400:#00bcfe;
    --sky-500:#00a5ef;
    --sky-600:#0084cc;
    --sky-700:#0069a4;
    --sky-800:#005986;
    --sky-900:#024a70;
    --sky-950:#052f4a;
    --blue-50:#eff6ff;
    --blue-100:#dbeafe;
    --blue-200:#bedbff;
    --blue-300:#90c5ff;
    --blue-400:#54a2ff;
    --blue-500:#3080ff;
    --blue-600:#155dfc;
    --blue-700:#1447e6;
    --blue-800:#193cb8;
    --blue-900:#1c398e;
    --blue-950:#162456;
    --indigo-50:#eef2ff;
    --indigo-100:#e0e7ff;
    --indigo-200:#c7d2ff;
    --indigo-300:#a4b3ff;
    --indigo-400:#7d87ff;
    --indigo-500:#625fff;
    --indigo-600:#4f39f6;
    --indigo-700:#432dd7;
    --indigo-800:#372aac;
    --indigo-900:#312c85;
    --indigo-950:#1e1a4d;
    --violet-50:#f5f3ff;
    --violet-100:#ede9fe;
    --violet-200:#ddd6ff;
    --violet-300:#c4b4ff;
    --violet-400:#a685ff;
    --violet-500:#8d54ff;
    --violet-600:#7f22fe;
    --violet-700:#7008e7;
    --violet-800:#5d0ec0;
    --violet-900:#4d179a;
    --violet-950:#2f0d68;
    --purple-50:#faf5ff;
    --purple-100:#f3e8ff;
    --purple-200:#e9d5ff;
    --purple-300:#d9b3ff;
    --purple-400:#c07eff;
    --purple-500:#ac4bff;
    --purple-600:#9810fa;
    --purple-700:#8200da;
    --purple-800:#6e11b0;
    --purple-900:#59168b;
    --purple-950:#3c0366;
    --fuchsia-50:#fdf4ff;
    --fuchsia-100:#fae8ff;
    --fuchsia-200:#f6cfff;
    --fuchsia-300:#f2a9ff;
    --fuchsia-400:#ec6cff;
    --fuchsia-500:#e12afb;
    --fuchsia-600:#c600db;
    --fuchsia-700:#a600b5;
    --fuchsia-800:#8a0194;
    --fuchsia-900:#721378;
    --fuchsia-950:#4b004f;
    --pink-50:#fdf2f8;
    --pink-100:#fce7f3;
    --pink-200:#fccee8;
    --pink-300:#fda5d5;
    --pink-400:#fb64b6;
    --pink-500:#f6339a;
    --pink-600:#e30076;
    --pink-700:#c4005c;
    --pink-800:#a2004c;
    --pink-900:#861043;
    --pink-950:#510424;
    --rose-50:#fff1f2;
    --rose-100:#ffe4e6;
    --rose-200:#ffccd3;
    --rose-300:#ffa2ae;
    --rose-400:#ff667f;
    --rose-500:#ff2357;
    --rose-600:#e70044;
    --rose-700:#c20039;
    --rose-800:#a30037;
    --rose-900:#8b0836;
    --rose-950:#4d0218;
    --slate-50:#f8fafc;
    --slate-100:#f1f5f9;
    --slate-200:#e2e8f0;
    --slate-300:#cad5e2;
    --slate-400:#90a1b9;
    --slate-500:#62748e;
    --slate-600:#45556c;
    --slate-700:#314158;
    --slate-800:#1d293d;
    --slate-900:#0f172b;
    --slate-950:#020618;
    --gray-50:#f9fafb;
    --gray-100:#f3f4f6;
    --gray-200:#e5e7eb;
    --gray-300:#d1d5dc;
    --gray-400:#99a1af;
    --gray-500:#6a7282;
    --gray-600:#4a5565;
    --gray-700:#364153;
    --gray-800:#1e2939;
    --gray-900:#101828;
    --gray-950:#030712;
    --zinc-50:#fafafa;
    --zinc-100:#f4f4f5;
    --zinc-200:#e4e4e7;
    --zinc-300:#d4d4d8;
    --zinc-400:#9f9fa9;
    --zinc-500:#71717b;
    --zinc-600:#52525c;
    --zinc-700:#3f3f46;
    --zinc-800:#27272a;
    --zinc-900:#18181b;
    --zinc-950:#09090b;
    --neutral-50:#fafafa;
    --neutral-100:#f5f5f5;
    --neutral-200:#e5e5e5;
    --neutral-300:#d4d4d4;
    --neutral-400:#a1a1a1;
    --neutral-500:#737373;
    --neutral-600:#525252;
    --neutral-700:#404040;
    --neutral-800:#262626;
    --neutral-900:#171717;
    --neutral-950:#0a0a0a;
    --stone-50:#fafaf9;
    --stone-100:#f5f5f4;
    --stone-200:#e7e5e4;
    --stone-300:#d6d3d1;
    --stone-400:#a6a09b;
    --stone-500:#79716b;
    --stone-600:#57534d;
    --stone-700:#44403b;
    --stone-800:#292524;
    --stone-900:#1c1917;
    --stone-950:#0c0a09;
    --mauve-50:#fafafa;
    --mauve-100:#f3f1f3;
    --mauve-200:#e7e4e7;
    --mauve-300:#d7d0d7;
    --mauve-400:#a89ea9;
    --mauve-500:#79697b;
    --mauve-600:#594c5b;
    --mauve-700:#463947;
    --mauve-800:#2a212c;
    --mauve-900:#1d161e;
    --mauve-950:#0c090c;
    --olive-50:#fbfbf9;
    --olive-100:#f4f4f0;
    --olive-200:#e8e8e3;
    --olive-300:#d8d8d0;
    --olive-400:#abab9c;
    --olive-500:#7c7c67;
    --olive-600:#5b5b4b;
    --olive-700:#474739;
    --olive-800:#2b2b22;
    --olive-900:#1d1d16;
    --olive-950:#0c0c09;
    --mist-50:#f9fbfb;
    --mist-100:#f1f3f3;
    --mist-200:#e3e7e8;
    --mist-300:#d0d6d8;
    --mist-400:#9ca8ab;
    --mist-500:#67787c;
    --mist-600:#4b585b;
    --mist-700:#394447;
    --mist-800:#22292b;
    --mist-900:#161b1d;
    --mist-950:#090b0c;
    --taupe-50:#fbfaf9;
    --taupe-100:#f3f1f1;
    --taupe-200:#e8e4e3;
    --taupe-300:#d8d2d0;
    --taupe-400:#aba09c;
    --taupe-500:#7c6d67;
    --taupe-600:#5b4f4b;
    --taupe-700:#473c39;
    --taupe-800:#2b2422;
    --taupe-900:#1d1816;
    --taupe-950:#0c0a09;
    --black:#000;
    --white:#fff;
}
.bento-box {
  border: 1px solid light-dark(
    var(--gray-200),
    var(--zinc-600)
  );
  border-radius: 0.5rem;
  box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.1) 0px 1px 2px -1px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;

  > .header, > .footer {
    background-color: light-dark(
      var(--gray-50),
      var(--zinc-700)
    );
  }

  > .header {
    border-bottom: 1px solid light-dark(
      var(--gray-200),
      var(--zinc-600)
    );

    display: flex;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 2rem;
    padding: 0.5rem 1rem;
  }

  > .body {
    padding: 1rem;

    .bentos {
      margin: -1rem -1rem 0 -1rem;

      &:has(+ div) {
        border-bottom: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));
        margin-bottom: 1rem;
      }

      .item {
        @media (max-width: 768px) {
          flex-basis: 50% !important;
        }

        .number {
          line-height: 1;
          letter-spacing: -0.025em;
          margin-bottom: 0.25rem;
        }

        .label {
          line-height: 1.5rem;
        }
      }
    }
  }

  > .footer {
    border-top: 1px solid light-dark(
      var(--gray-200),
      var(--zinc-600)
    );
    padding: 1rem;
  }

  > .body dl {
    & > div {
      margin-bottom: 0.5rem;

      &:last-child {
        margin-bottom: 0;
      }
    }

    dt {
      color: var(--gray-400);
      font-size: 0.875rem;
      font-weight: 500;
      line-height: 1.5rem;
    }
  }
}
.blankslate {
  display: flex;
  flex-direction: column;
  padding: 1em;
  align-items: center;
  justify-content: center;
  flex-grow: 1;

  .icon {
    color: var(--gray-500);
    font-size: 3rem;
    margin-bottom: 1rem;
  }

  .heading {
    font-weight: var(--font-semibold);
  }

  .description {
    color: var(--gray-500);
    margin-top: 1rem;
    text-align: center;
  }

  .mutedAction {
    border: 1px solid light-dark(var(--gray-300), var(--zinc-600));
    border-radius: 0.375rem;
    color: light-dark(var(--gray-600), inherit);
    padding: 0.25em 0.5em;

    &:hover {
      background-color: light-dark(var(--gray-100), var(--zinc-600));
    }
  }
}
form.edit_note, form.new_note {
  display: flex;
  width: 100%;
}

.note {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  flex-grow: 1;
  width: 100%;

  .content {
    flex-grow: 1;

    textarea {
      border: 1px solid light-dark(var(--gray-300), var(--zinc-600));
      border-radius: 0.375rem;
      height: calc(100% - 1rem);
      width: 100%;
      height: 100%;
      resize: none;
      background-color: light-dark(var(--white), var(--zinc-700));
    }
  }

  .toolbar {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;

    .mutedAction {
      border: 1px solid light-dark(var(--gray-300), var(--zinc-600));
      border-radius: 0.375rem;
      color: light-dark(var(--gray-600), inherit);
      padding: 0.25em 0.5em;

      &:hover {
        background-color: light-dark(var(--gray-100), var(--zinc-600));
      }
    }

    .dangerAction {
      border: 1px solid light-dark(var(--red-500), var(--red-700));
      border-radius: 0.375rem;
      color: var(--red-500);
      padding: 0.25em 0.5em;
      align-self: flex-end;

      &:hover {
        color: light-dark(var(--red-500), var(--red-900));
        background-color: light-dark(var(--red-100), var(--red-800));
      }
    }

    .primaryAction {
      background: linear-gradient(
        var(--lime-500),
        var(--lime-600)
      );

      align-self: flex-start;
      border: 1px solid var(--lime-500);
      border-radius: 0.375rem;
      color: var(--white);
      padding: 0.25em 0.5em;

      &:hover {
        background-color: light-dark(var(--gray-100), var(--zinc-600));
      }
    }
  }
}
div.timeline {
  --highlight-color: rgb(254 243 199);
  --page-bg-color: var(--white); /* FIXME: Replace this w/ global page BG eventually. */
  --pill-color: var(--gray-100);
  @media (prefers-color-scheme: dark) {
    --highlight-color: rgb(69, 26, 3);
    --page-bg-color: var(--zinc-800); /* FIXME: Replace this w/ global page BG eventually. */
    --pill-color: var(--zinc-900);
  }

  display: flow-root;

  li {
    position: relative;
    padding-bottom: 2rem;

    &:last-child {
      padding-bottom: 0;
    }

    span.line {
      background-color: var(--pill-color);
      position: absolute;
      top: 1rem;
      left: 1rem;
      margin-left: -1px;
      width: 0.125rem;
      height: 100%;
    }

    div.timeline-item {
      position: relative;
      display: flex;
      gap: 0.75rem;
      align-items: center;

      div.icon {
        background-color: var(--pill-color);
        box-shadow: 0 0 0 8px var(--page-bg-color);
        border-radius: 999rem;
        color: var(--gray-500);
        display: flex;
        width: 2rem;
        height: 2rem;
        align-items: center;
        justify-content: center;
      }

      div.content {
        display: flex;
        flex: 1 1 0%;
        font-size: .875rem;
        justify-content: space-between;
        line-height: 1.25rem;
        padding: 0.375rem 0;
        gap: 0.75rem;

        span.action {
          font-weight: 600;
        }

        div.timestamp {
          color: var(--gray-500);
          align-content: center;
          text-align: right;
          white-space: nowrap;
        }
      }
    }

    &.highlighted {
      div.icon {
        box-shadow: 0 0 0 4px var(--highlight-color) !important;
      }

      div.timeline-item {
        background: linear-gradient(
          to right,
          var(--highlight-color),
          transparent
        );
        border-top-left-radius: 2rem;
        border-bottom-left-radius: 2rem;
      }
    }
  }
}
:root {
  color-scheme: light dark;

  --md: 0.375rem;

  /* --p0\.5: 0.125rem; */
  --p1: 0.25rem;
  --p2: 0.5rem;
  --p3: 0.75rem;

  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  --r-x-small: 640px;
  --r-small: 768px;
  --r-desktop: 1024px;
}

.container {
  margin-left: auto;
  margin-right: auto;

  width: 100%;

  padding: 0 1rem;

  @media (min-width: 640px) {
    max-width: 640px;
  }

  @media (min-width: 768px) {
    max-width: 768px;
  }

  @media (min-width: 1024px) {
    max-width: 1024px;
    padding: 0 2rem;
  }

  @media (min-width: 1280px) {
    max-width: 1280px;
    padding: 0 2rem;
  }

  @media (min-width: 1536px) {
    max-width: 1536px;
    padding: 0 2rem;
  }
}

body > nav {
  --background-color: rgb(31, 41, 55);
  --button-hover-color: rgb(55 65 81);
  --active-button-color: rgb(17, 24, 39);

  --font-size: 0.875rem;

  --font-color: rgb(209 213 219);

  background-color: var(--background-color);
  font-size: var(--font-size);
  line-height: 1.25rem;

  .container {
    display: flex;
    align-items: center;
    justify-content: space-between;

    height: 4rem;

    &.center {
      justify-content: center;
    }
  }

  .logo {
    flex-shrink: 0;
  }

  .big-logo img {
    height: 32px;
  }

  .big-menu, .small-menu {
    width: 100%;
  }

  .big-menu {
    /* Invisible by default, made visible in media queries: */
    display: none;
  }

  @media (min-width: 640px) {
    .small-menu {
      display: none;
    }

    .big-menu {
      display: flex;
    }
  }

  .menu {
    display: flex;
    flex-grow: 1;
    margin-left: 0.5rem;
  }

  .menu, .right-menu {
    a {
      &:first-child {
        margin-left: 0.5rem;
      }

      &:last-child {
        margin-right: 0;
      }

      &:hover {
        background-color: var(--button-hover-color);
      }

      &.active, &.active:hover {
        background-color: var(--active-button-color);
        color: white;
      }

      align-content: center;
      border-radius: 0.375rem; /* FIXME: Extract! */
      color: var(--font-color);
      font-weight: var(--font-medium);
      margin-right: 0.5rem;
      padding: var(--p2) var(--p3);
    }
  }

  summary {
    &::marker {
      display: none;
      visibility: hidden;
    }

    &::before {
      content: '';
      backdrop-filter: none;
      background: transparent;
    }
  }

  .search {
    form {
      display: flex;
    }

    input {
      border-radius: var(--md);
      border: none;
      font-size: var(--font-size);
      line-height: 1.5rem;
      padding: 0.25rem 0.5rem;
    }

    input[type="text"] {
      background-color: var(--button-hover-color);
      color: white;
    }

    input[type="submit"] {
      background-color: var(--active-button-color); /* FIXME */
      color: white;
      margin-left: 0.25rem;
      font-size: 1.25rem;
    }
  }
}
html[data-hotwire-native] {
  .hidden-on-native, .n-hidden {
    display: none !important;
  }

  .n-mt-0 {
    margin-top: 0 !important;
  }
}

[data-bridge-components~="button"]
[data-controller~="bridge--button"] {
  display: none !important;
}

.hidden {
  display: none;
}
.calendar-page {
  display: grid;
  gap: 1rem;

  @media (min-width: 768px) {
    grid-template-columns: 3fr 1fr;
  }

  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  span.day-subtitle {
    color: var(--gray-500);
    font-size: .875rem;
    line-height: 1.25rem;

    @media (max-width: 768px) {
      display: block;
    }
  }
}

.day-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  justify-content: space-between;
  margin-bottom: 1.5rem;

  h1 {
    font-size: 1.875rem;
    line-height: 2.25rem;

    @media (max-width: 768px) {
      font-size: 1.5rem;
    }
  }

  .current-glucose {
    display: flex;
    align-items: center;

    p {
      &.giant {
        font-size: 6rem;
        font-weight: 700;
        line-height: 1;
      }

      &.arrow {
        font-size: 3.75rem;
        line-height: 1;
      }
    }
  }

  nav {
    text-align: right;
  }
}

.day-page {
  display: grid;
  gap: 1.5rem;

  @media (min-width: 768px) {
    grid-template-columns: 1fr 3fr;
  }
}

div.actions {
  margin-bottom: 1rem;

  a {
    display: flex;
    color: light-dark(rgba(0, 0, 0, 0.65), rgb(156, 163, 175));

    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));
    border-radius: 2rem;
    font-weight: 600;
    text-align: center;

    .material-symbols-outlined {
      margin-right: 0.5rem;
      font-weight: 100;
    }

    &:hover {
      background-color: light-dark(var(--gray-100), var(--zinc-900));
    }
  }

  &.centered {
    a {
      justify-content: center;
    }
  }
}

.sidebar {
  &.mobile-bottom {
    @media (max-width: 768px) {
      order: 1;
    }
  }

  div.calendar {
    padding: 0.5rem;

    p.title {
      font-weight: 700;
      margin-bottom: 1rem;
      text-align: center;
    }
  }

  .actions {
    @media (max-width: 768px) {
      display: none;
    }
  }
}

ol.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;

  li {
    display: grid;
    place-content: center;
    font-weight: 700;

    &.day {
      aspect-ratio: 1 / 1;
      border-radius: 4px;
      border: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));

      &.muted {
        color: rgb(107 114 128);
        border: none;
      }

      &.future {
        border: none;
      }
    }
  }
}

.bentos {
  display: flex;
  flex-wrap: nowrap;

  @media (max-width: 768px) {
    flex-wrap: wrap;
  }

  .item {
    align-content: center;
    flex: 0 1 50%;
    padding: 1rem;

    &:not(:last-child) {
      border-right: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));
    }

    @media (max-width: 768px) {
      flex-basis: 33%;

      &:nth-child(3n) {
        border-right: none;
      }

      &:nth-child(n+4) {
        border-top: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));
        flex-grow: 1;
      }
    }

    .number {
      font-size: 2.25rem;
      font-weight: 600;
      display: block;
      font-variant-numeric: slashed-zero tabular-nums;

      &.big {
        font-size: 3rem;
        font-variant-numeric: normal;
      }
    }

    .label {
      font-weight: 500;
      font-size: 0.9rem;
      color: light-dark(rgba(0, 0, 0, 0.65), rgb(156, 163, 175));
      line-height: 1.3;
    }

    .high, .low {
      font-size: 1.2rem;
      font-variant-numeric: tabular-nums;
    }
  }
}

.monthly-stats {
  margin: 1rem 0;

  dl.pad-x {
    dt, dd {
      padding-left: 1rem;
      padding-right: 1rem;
    }
  }

  dt {
    font-weight: 500;
    font-size: 0.9rem;
    color: light-dark(rgba(0, 0, 0, 0.65), rgb(156, 163, 175));
    line-height: 1.3;
  }

  dd {
    border-bottom: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;

    &:last-child {
      border-bottom: none;
      padding-bottom: 0;
    }

    .small {
      font-size: 0.85rem;
      font-variant-numeric: normal;
    }
  }
}
.details-page {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;

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

  @media (max-width: 768px) {
    grid-template-columns: none !important;
  }
}
.form-page {
  border: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));
  border-radius: var(--md);
  box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.1) 0px 1px 2px -1px;
  background-color: light-dark(var(--box-background-color), var(--dark-box-background-color));

  width: 50%;
  margin: 0 auto 1.5rem auto;
  padding: 1rem;

  &.narrow {
    @media (min-width: 1024px) {
      width: 33%;
      min-width: 400px;
    }
  }

  @media (max-width: 1024px) {
    width: 100%;
  }

  .title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0.75rem;
    color: light-dark(var(--gray-900), var(--gray-300));

    --icon-mr: 0.5rem;
    .icon {
      margin-right: var(--icon-mr);
      font-size: 1.75rem;
      font-weight: bold;
    }
    img.logo {
      margin-right: 0.75rem;
      height: 3rem;
    }

    &.centered {
      justify-content: center;
    }

    &.big {
      margin-top: 1rem;
      margin-bottom: 2rem;
    }

    p.subtitle {
      flex-basis: 100%;
    }
  }

  p {
    margin-top: 0.5rem;
  }

  h1 {
    font-size: 1.75rem;
    font-weight: var(--font-semibold);
    vertical-align: middle;
  }

  form {
    margin-top: 1.5rem;

    div.row {
      label {
        display: block;
        margin-bottom: 0.5rem;
        &.inline { display: inline; }
      }

      p.inline {
        display: flex;
        gap: 1rem;
        justify-content: space-between;

        font-size: var(--text-small);
        font-weight: var(--font-medium);
        line-height: 1.5rem;
      }

      margin-bottom: 1.5rem;
    }

    label {
      font-size: var(--text-small);
      font-weight: var(--font-medium);
      line-height: 1.5rem;
    }

    select, textarea, input:not([type="checkbox"],[type="radio"]) {
      background-color: light-dark(
        white,
        color-mix(black 20%, var(--dark-box-background-color))
      );
      border: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));
      border-radius: var(--md);

      display: block;
      width: 100%;

      &.error {
        border-color: var(--red-600);
        box-shadow: 0 0 0.25rem var(--red-600);
      }
    }

    input[type="checkbox"] {
      background-color: light-dark(
        white,
        color-mix(black 20%, var(--dark-box-background-color))
      );
      border: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));
      border-radius: 0.275rem;
    }

    input[type="submit"] {
      background-image: linear-gradient(#78BA55, #8BC26D);
      border-color: #78BA55;
      color: #FFF;
      padding: 0.5rem 1rem;

      font-weight: var(--font-semibold);

      @media (prefers-color-scheme: dark) {
        --darken-amount: 35%;
        background-image: linear-gradient(
          color-mix(black var(--darken-amount), #78BA55),
          color-mix(black var(--darken-amount), #8BC26D)
          );
        border-color: color-mix(black var(--darken-amount), #78BA55);
      }
    }

    .pretty-radio {
      display: flex;
      gap: 1rem;

      label {
        background-color: light-dark(
          white,
          color-mix(black 20%, var(--dark-box-background-color))
        );
        border-radius: 0.33rem;
        border: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));
        gap: 0.5rem;
        padding: 0.5rem 1rem;
        place-content: center;
        width: fit-content;

        input[type="radio"] {
          margin-right: 0.5rem;
        }

        &:has(input[type="radio"]:checked) {
          background-color: light-dark(
            #ECF4FE,
            var(--slate-800)
          );

          border-color: light-dark(
            color-mix(black 5%, #ECF4FE),
            var(--slate-500)
          );
        }

        &:focus-within {
          border-color: #3a6fb0 !important;
        }
      }
    }
  }

  hr {
    margin: 1rem 0;
    border: 1px solid var(--gray-300);
    height: 1px;
  }

  ul {
    margin: 1rem 0;

    li {
      list-style-type: circle;
      list-style-position: outside;
      margin-bottom: 0.25rem;
      margin-left: 1rem;
    }
  }

  .errors {
    background-color: light-dark(var(--red-100), var(--red-900));
    border: 1px solid light-dark(var(--red-400), var(--red-600));
    border-radius: var(--md);

    padding: 0.75rem;
    margin-bottom: 1rem;

    h2 {
      font-weight: var(--font-medium);
      margin-bottom: 0.25rem;
    }
  }

  .error-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
  }
}

.button {
  border-radius: var(--md);
  border: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));
  color: light-dark(rgba(0, 0, 0, 0.65), rgb(156, 163, 175));
  display: block;
  font-weight: var(--font-semibold);
  margin-bottom: 0.5rem;
  padding: 0.5rem 1rem;
  text-align: center;
  width: 100%;

  &.danger {
    background: inherit;
    border-color: var(--red-600);
    color: var(--red-600);
  }

  &.primary {
    background-image: linear-gradient(#78BA55, #8BC26D);
    border-color: #78BA55;
    color: #FFF;

    @media (prefers-color-scheme: dark) {
      --darken-amount: 35%;
      background-image: linear-gradient(
        color-mix(black var(--darken-amount), #78BA55),
        color-mix(black var(--darken-amount), #8BC26D)
        );
      border-color: color-mix(black var(--darken-amount), #78BA55);
    }
  }
}
.usual_bolus {
  border: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));
  border-radius: var(--md);
  display: flex;
  gap: 0.5em;
  margin-top: 1em;
  width: fit-content;

  .label {
    display: flex;
    align-items: center;
    background-color: light-dark(var(--box-background-color), var(--dark-box-background-color));
  }

  div {
    padding: 0.5em 1em;
    border-right: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));

    &:last-child {
      border-right: none;
    }
  }

  .number {
    font-size: 1.5em;
    font-weight: var(--font-bold);
  }
}

div.meals {
  margin: 1rem 0;

  font-size: 0.875rem;
  line-height: 1.25rem;

  @media (max-width: 768px) {
    /* Bleed to screen edge on mobile: */
    margin: 1rem -1rem;
  }

  display: grid;
  grid-template-columns: minmax(max-content, 1fr) auto 6fr minmax(max-content, 1fr);

  .row {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1/-1;

    align-items: center;
    border-bottom: 1px solid light-dark(var(--gray-200), var(--zinc-700));
    padding: 1rem 0;

    &:hover {
      background-color: light-dark(var(--gray-100), var(--zinc-900));
    }

    .date {
      padding: 0 0.75rem;
      text-align: right;
    }

    .emoji {
      font-size: 1rem;
      padding-right: 0.75rem;
    }

    .description {
      height: 100%;

      a {
        align-content: center;
        display: block;
        height: 100%;
        width: 100%;
      }
    }

    .meta {
      text-align: center;
      padding: 0 0.5rem;

      div.icons {
        align-content: center;
        display: flex;
        flex-direction: row;
        font-size: 1rem;
        gap: 0.5rem;
        justify-content: center;
        margin-top: 0.5rem;

        .material-symbols-outlined {
          font-size: 1rem;
          line-height: normal;
        }

        /* TODO: extract to a shared button utility class */
        a {
          color: light-dark(rgb(75, 85, 99), rgb(209, 213, 219));
          border: 1px solid light-dark(rgb(209, 213, 219), rgb(82, 82, 91));
          border-radius: 0.5rem;
          padding: 0.125rem 0.375rem;
          font-size: 0.875rem;

          &:hover {
            background-color: light-dark(rgb(243, 244, 246), rgb(82, 82, 91));
          }
        }
      }
    }
  }
}

div.meals-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;

  h1 {
    font-size: 1.25rem;
    line-height: 1.5rem;
    font-weight: 600;
  }

  nav {
    display: flex;

    @media (max-width: 768px) {
      flex-grow: 1;
    }
  }

  form.search {
    flex-grow: 1;

    input[type="search"] {
      background-color: light-dark(
        white,
        color-mix(black 20%, var(--dark-box-background-color))
      );

      /* Search icon: */
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640' height='20px' fill='%236b7280'%3E%3C!--!Font Awesome Free v7.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--%3E%3Cpath d='M480 272C480 317.9 465.1 360.3 440 394.7L566.6 521.4C579.1 533.9 579.1 554.2 566.6 566.7C554.1 579.2 533.8 579.2 521.3 566.7L394.7 440C360.3 465.1 317.9 480 272 480C157.1 480 64 386.9 64 272C64 157.1 157.1 64 272 64C386.9 64 480 157.1 480 272zM272 416C351.5 416 416 351.5 416 272C416 192.5 351.5 128 272 128C192.5 128 128 192.5 128 272C128 351.5 192.5 416 272 416z'/%3E%3C/svg%3E");
      background-position: 0.50rem;
      background-repeat: no-repeat;

      border: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));
      border-radius: 999rem;
      flex-grow: 1;
      padding-left: 2.25rem;
      width: 100%;
    }
  }
}
&:root {
  --box-border-color: rgb(229 231 235);
  --box-background-color: rgb(249 250 251);
  --dark-box-border-color: rgb(82 82 91);
  --dark-box-background-color: rgb(63 63 70);
}

.box {
  border: 1px solid light-dark(var(--box-border-color), var(--dark-box-border-color));
  border-radius: 1rem;

  &.shadow {
    box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.1) 0px 1px 2px -1px;
  }
}

.search_page {
  background-color: var(--box-background-color);

  @media (prefers-color-scheme: dark) {
    background-color: var(--dark-box-background-color);
  }

  padding: 2rem 1rem;

  width: 50%;
  margin: 0 auto;

  @media (max-width: 1024px) {
    width: 100%;
  }

  .title {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;

    .icon {
      margin-right: 0.5rem;
      font-size: 1.75rem;
      font-weight: bold;
    }
  }

  h1 {
    font-size: 1.75rem;
    font-weight: var(--font-semibold);
    vertical-align: middle;
  }

  form {
    display: flex;
    flex-wrap: wrap;
    row-gap: 0.5rem;
    column-gap: 1rem;

    input {
      border: 1px solid var(--box-border-color);
      border-radius: var(--md);
      padding: 0.5rem 0.75rem;
      flex-grow: 1;
    }

    input[type="search"] {
      flex-grow: 2;

      @media (prefers-color-scheme: dark) {
        --darken-amount: 20%;
        background-color: color-mix(black var(--darken-amount), var(--dark-box-background-color));
        border-color: var(--dark-box-border-color);
        /* border-color: color-mix(black var(--darken-amount), var(--dark-box-border-color)); */
      }
    }

    input[type="submit"] {
      background-image: linear-gradient(#78BA55, #8BC26D);
      border-color: #78BA55;
      color: #FFF;
      padding: 0.5rem 1rem;

      @media (prefers-color-scheme: dark) {
        --darken-amount: 35%;
        background-image: linear-gradient(
          color-mix(black var(--darken-amount), #78BA55),
          color-mix(black var(--darken-amount), #8BC26D)
          );
        border-color: color-mix(black var(--darken-amount), #78BA55);
      }
    }
  }
}
.access-tokens {
  div.token {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--gray-300);
    padding-bottom: 0.5rem;
    gap: 0.5rem;

    &:last-child {
      border-bottom: none;
    }

    span.key {
      font-size: 1.1rem;
      font-family: monospace;
      flex-grow: 1;
    }

    div.last-used {
      margin-top: 0.25rem;
      color: light-dark(var(--gray-600), var(--gray-400));
    }

    clipboard-copy {
      color: light-dark(var(--gray-600), var(--gray-400));
      padding: 0.25rem;
      border-radius: 0.25rem;

      &:hover {
        background-color: light-dark(var(--gray-200), var(--zinc-600));
      }
    }
  }

  .danger {
    color: var(--red-600);
    padding: 0.25rem;
    border-radius: 0.25rem;

    &:hover {
      background-color: light-dark(var(--red-100), var(--red-950));
    }
  }
}
:root {
  --font-color: rgb(0 0 0);
  --dark-font-color: rgb(209 213 219);

  --text-xsmall: 0.75rem;
  --text-small: 0.875rem;
  --text-normal: 1rem;
  --text-large: 1.125rem;
  --text-xlarge: 1.25rem;
  /* ... */

  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;
}

body {
  color: var(--font-color);

  @media (prefers-color-scheme: dark) {
    color: var(--dark-font-color);
  }
}

.text-muted {
  color: light-dark(rgba(0, 0, 0, 0.65), rgb(156, 163, 175));
}
.small-only {
  display: none;

  @media (max-width: 768px) {
    display: block;
  }
}

span.nowrap {
  white-space: pre;
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */
