:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  color: #172033;
  background: #f6f7f9;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
}

body.login-page {
  background: #0f6fbf url("/images/login-background.png") center / cover no-repeat fixed;
  min-height: 100vh;
}

body.login-page .topbar {
  background: rgb(255 255 255 / 88%);
  backdrop-filter: blur(8px);
}

body.login-page main {
  align-items: center;
  display: flex;
  justify-content: flex-end;
  min-height: calc(100vh - 69px);
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #dfe3ea;
  display: flex;
  justify-content: space-between;
  padding: 14px 24px;
}

.brand {
  color: #172033;
  display: block;
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
}

.subtitle {
  color: #6b7280;
  font-size: 13px;
}

nav {
  align-items: center;
  display: flex;
  gap: 8px;
}

.nav-menu {
  position: relative;
}

.menu-toggle {
  align-items: center;
  background: #ffffff;
  border-color: #cfd6e0;
  color: #172033;
  flex-direction: column;
  gap: 4px;
  height: 40px;
  justify-content: center;
  padding: 0;
  width: 44px;
}

.menu-toggle span {
  background: currentColor;
  border-radius: 999px;
  display: block;
  height: 2.5px;
  width: 20px;
}

.menu-toggle:hover {
  background: #eef5ff;
  border-color: #9ec5fe;
  color: #0b5ed7;
}

.nav-menu nav {
  background: #ffffff;
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgb(15 34 58 / 16%);
  display: none;
  min-width: 220px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
}

.nav-menu.open nav {
  display: grid;
}

.nav-menu nav a,
.nav-menu .logout-form,
.nav-menu .logout-form button {
  width: 100%;
}

.nav-menu nav a,
.nav-menu .logout-form button {
  justify-content: center;
  text-align: center;
}

.logout-form {
  margin: 0;
}

.logout-form button {
  background: #ffffff;
  border-color: #cfd6e0;
  color: #172033;
}

nav a,
.button,
button,
.icon-button {
  border: 1px solid #cfd6e0;
  border-radius: 6px;
  color: #172033;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font: inherit;
  gap: 6px;
  justify-content: center;
  line-height: 1;
  padding: 10px 12px;
  text-decoration: none;
}

nav a,
.button.secondary {
  background: #ffffff;
}

.button.secondary {
  color: #0b5ed7;
  font-weight: 700;
}

nav a.active,
button,
.button {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #ffffff;
}

button.danger {
  background: #c92a2a;
  border-color: #c92a2a;
}

.icon-button {
  align-items: center;
  height: 38px;
  justify-content: center;
  padding: 0;
  width: 38px;
}

.icon-button.edit {
  background: #eef5ff;
  border-color: #9ec5fe;
  color: #0b5ed7;
  font-size: 18px;
  transform: scaleX(-1);
}

.icon-button.edit:hover {
  background: #dbeafe;
}

main {
  margin: 0 auto;
  max-width: 1600px;
  padding: 24px;
  width: 100%;
}

.section-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1 {
  font-size: 28px;
  margin: 0 0 6px;
}

p {
  color: #596275;
  margin: 0;
}

code {
  background: #eef1f5;
  border-radius: 4px;
  padding: 2px 5px;
}

.alert {
  background: #fff3cd;
  border: 1px solid #ffec99;
  border-radius: 6px;
  margin-bottom: 16px;
  padding: 12px;
}

.auth-panel {
  background: #ffffff;
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  margin: 40px auto;
  max-width: 420px;
  padding: 22px;
}

.login-panel {
  box-shadow: 0 18px 50px rgb(15 34 58 / 22%);
  margin-left: auto;
  margin-right: 7vw;
}

.auth-panel h1 {
  margin-bottom: 18px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form button {
  justify-self: center;
  min-width: 150px;
}

.entry-form {
  align-items: end;
  background: #ffffff;
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  margin-bottom: 20px;
  padding: 16px;
}

.filter-form {
  align-items: end;
  background: #ffffff;
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  padding: 16px;
}

.filter-form label {
  min-width: 220px;
}

.table-meta {
  color: #596275;
  margin-bottom: 10px;
}

.field-wide,
.form-actions {
  grid-column: 1 / -1;
}

.form-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.save-button {
  min-width: 140px;
}

.back-button svg {
  height: 18px;
  width: 18px;
}

.back-button.button.secondary {
  background: #ffffff;
  border-color: #9ec5fe;
  color: #0b5ed7;
  height: 38px;
  min-width: 0;
  padding: 0;
  width: 38px;
}

.back-button.button.secondary:hover {
  background: #eef5ff;
  border-color: #0b5ed7;
}

.back-button path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

label {
  color: #3c4659;
  display: grid;
  font-size: 13px;
  gap: 6px;
}

input,
textarea {
  border: 1px solid #cfd6e0;
  border-radius: 6px;
  font: inherit;
  padding: 9px 10px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.check-row {
  align-items: center;
  display: flex;
  min-height: 38px;
}

.check-row input {
  width: auto;
}

.table-wrap {
  background: #ffffff;
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid #edf0f4;
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f9fafb;
  color: #4b5563;
  font-size: 13px;
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.actions form {
  margin: 0;
}

.empty {
  color: #6b7280;
  text-align: center;
}

.amount-cell {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.pager {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.page-size-form {
  margin: 0;
}

.inline-category-form {
  align-items: center;
  display: flex;
  gap: 6px;
  margin: 0;
}

.inline-category-form select {
  min-width: 160px;
}

.category-display {
  background: transparent;
  border-color: transparent;
  color: #172033;
  font-weight: 400;
  justify-content: flex-start;
  min-height: 34px;
  padding: 6px 0;
  text-align: left;
}

.category-display:hover {
  color: #0b5ed7;
  text-decoration: underline;
}

.confirm-button {
  background: #ffffff;
  border-color: #9ec5fe;
  color: #0b5ed7;
  font-size: 18px;
  font-weight: 700;
  height: 38px;
  padding: 0;
  width: 38px;
}

.confirm-button:hover {
  background: #eef5ff;
}

.page-size-form label {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
}

select {
  border: 1px solid #cfd6e0;
  border-radius: 6px;
  font: inherit;
  padding: 9px 10px;
}

.button.disabled {
  opacity: 0.45;
  pointer-events: none;
}

@media (max-width: 760px) {
  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-menu nav {
    left: 0;
    min-width: 100%;
    right: auto;
  }

  main {
    padding: 16px;
  }

  .entry-form {
    grid-template-columns: 1fr;
  }

  .filter-form,
  .pager {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-form label {
    min-width: 0;
  }

  body.login-page {
    background-position: 24% center;
  }

  body.login-page main {
    justify-content: center;
    min-height: auto;
  }

  .login-panel {
    margin: 32px auto;
  }
}
