@font-face {
  font-family: 'Google Sans Flex';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/google-sans-flex-latin.c28f7eaefb89.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Google Sans Flex';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/google-sans-flex-latin-ext.bf8dcbb5c65e.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Google Sans Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overscroll-behavior-y: none;
}

/* Money and quantities line up column to column without monospacing the UI. */
.tbl, .field, .num, input[type='number'] {
  font-variant-numeric: tabular-nums;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #3B82F640;
  border-radius: 9999px;
}

.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

input[type='number'] {
  -moz-appearance: textfield;
}

.label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #525252;
}

.dark .label { color: #a3a3a3; }

.label .req { color: #3B82F6; }

.field {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid #e5e5e5;
  border-radius: 0.75rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  background: #fff;
  color: inherit;
  font-family: inherit;
}

.field:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px #3B82F633;
}

.dark .field { background: #171717; border-color: #333; }

/* Chrome paints autofilled inputs its own colour; hold the theme instead. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: #171717;
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  caret-color: #171717;
  transition: background-color 100000s ease-in-out 0s;
}

.dark input:-webkit-autofill,
.dark input:-webkit-autofill:hover,
.dark input:-webkit-autofill:focus,
.dark input:-webkit-autofill:active {
  -webkit-text-fill-color: #f5f5f5;
  -webkit-box-shadow: 0 0 0 1000px #171717 inset;
  caret-color: #f5f5f5;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 0.75rem;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
}

.btn-primary { background: #3B82F6; color: #fff; }
.btn-ghost { border-color: #e5e5e5; color: inherit; background: transparent; }
.dark .btn-ghost { border-color: #333; }
.btn-danger { color: #dc2626; border-color: #fecaca; background: transparent; }
.dark .btn-danger { border-color: #7f1d1d; }

.btn-field {
  display: grid;
  place-items: center;
  width: 2.75rem;
  /* Explicit, so it is square whether it sits beside a field that stretches it
     or stands alone in a row with nothing to take its height from. */
  height: 2.75rem;
  flex-shrink: 0;
  border-radius: 0.75rem;
  border: 1px solid #e5e5e5;
  background: transparent;
  color: #525252;
  cursor: pointer;
}

.btn-field svg { width: 1.05rem; height: 1.05rem; }
.dark .btn-field { border-color: #333; color: #a3a3a3; }
.btn-field-brand { background: #3B82F6; border-color: #3B82F6; color: #fff; }
.dark .btn-field-brand { background: #3B82F6; border-color: #3B82F6; color: #fff; }
.btn-field-on { color: #3B82F6; border-color: #3B82F6; }

.btn-text {
  border: 0;
  background: none;
  padding: 0.15rem 0;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: #525252;
}

.btn-text-danger { color: #dc2626; }
.dark .btn-text-danger { color: #f87171; }

.btn-icon {
  display: inline-grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.65rem;
  border: 1px solid #e5e5e5;
  background: transparent;
  color: #525252;
  cursor: pointer;
}

.btn-icon svg { width: 1.05rem; height: 1.05rem; }
.btn-icon:hover { color: #3B82F6; border-color: #3B82F6; }
.dark .btn-icon { border-color: #333; color: #a3a3a3; }

.btn-icon-active { color: #3B82F6; border-color: #3B82F6; }

.btn-icon-danger { color: #dc2626; border-color: #fecaca; }
.btn-icon-danger:hover { color: #dc2626; border-color: #dc2626; }
.dark .btn-icon-danger { border-color: #7f1d1d; color: #f87171; }

.card {
  border: 1px solid #e5e5e5;
  border-radius: 1rem;
  background: #fff;
}

.dark .card { background: #0f0f0f; border-color: #262626; }

.tbl { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.tbl th {
  text-align: left;
  font-weight: 600;
  color: #737373;
  padding: 0.6rem 0.75rem;
  white-space: nowrap;
  border-bottom: 1px solid #e5e5e5;
}
.tbl td { padding: 0.65rem 0.75rem; border-bottom: 1px solid #f5f5f5; white-space: nowrap; }
.dark .tbl th { border-color: #262626; }
.dark .tbl td { border-color: #1c1c1c; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Small screens read lists as cards; tables only appear from lg up. */
.rowcard {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
  border: 1px solid #e5e5e5;
  border-radius: 0.9rem;
  padding: 0.7rem 0.85rem;
  background: #fff;
}

.dark .rowcard { background: #0f0f0f; border-color: #262626; }

/* The text side may shrink to nothing, the amount never does, and neither is
   allowed to run away with the row. */
.rowcard-main {
  min-width: 0;
  flex: 1 1 auto;
}

.rowcard-side {
  flex: 0 0 auto;
  max-width: 45%;
  text-align: right;
}

.rowcard-title {
  font-size: 0.84rem;
  font-weight: 600;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rowcard-meta {
  margin-top: 0.1rem;
  font-size: 0.71rem;
  color: #8a8a8a;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rowcard-foot {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.3rem;
  font-size: 0.71rem;
  color: #3B82F6;
  min-width: 0;
}

.rowcard-foot span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rowcard-foot svg { width: 0.75rem; height: 0.75rem; flex-shrink: 0; }
.tabular-nums { font-variant-numeric: tabular-nums; }

.rowcard-amount {
  /* Scales down on a narrow screen rather than shoving the title aside. */
  font-size: clamp(0.74rem, 3.2vw, 0.88rem);
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.rowcard-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

/* A chip is a label, never a flex item that stretches to its neighbour. */
.rowcard-actions .chip { align-self: center; }

.rowcard-empty {
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: #8a8a8a;
}

.centre-pick {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid #e5e5e5;
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  background: #fff;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}

.centre-pick:hover {
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px #3B82F61a;
}

.centre-pick:active { transform: scale(0.99); }
.centre-pick-on { border-color: #3B82F6; }
.dark .centre-pick { background: #0f0f0f; border-color: #262626; }

.chip {
  display: inline-block;
  border-radius: 9999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  background: #3B82F61a;
  color: #3B82F6;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chip-off { background: #73737320; color: #737373; }
.chip-me { background: #3B82F620; color: #3B82F6; }

.chip-bad { background: #dc262620; color: #dc2626; }
.chip-part { background: #3B82F620; color: #3B82F6; }
.chip-tight { font-size: 0.62rem; padding: 0.05rem 0.4rem; }
.rowcard-bad { border-color: #fecaca; }
.dark .rowcard-bad { border-color: #7f1d1d; }

.sheet-enter {
  animation: sheet-in 0.16s ease-out;
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fade 0.14s ease-out;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

#pdf-frame {
  position: fixed;
  width: 0;
  height: 0;
  border: 0;
  visibility: hidden;
}
