:root {
  --accent: hsl(199, 88%, 37%);
  --ink: #1b3037;
  --muted: #607178;
  --line: #dce6e4;
  --soft: #edf5f2;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font:
    16px/1.5 system-ui,
    Arial,
    sans-serif;
  background: #f3f6f5;
  color: var(--ink);
}
header {
  padding: 20px 32px;
  background: #142f35;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
header h1 {
  font-size: 23px;
  margin: 0;
}
header small {
  color: #bdcece;
}
.badge {
  font-size: 12px;
  color: #cde0dd;
}
main {
  max-width: 1320px;
  margin: auto;
  padding: 0 28px 48px;
}
nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 18px;
  min-height: 48px;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  margin-top: 16px;
}
button:hover {
  filter: brightness(0.94);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid #ca962c;
  outline-offset: 2px;
}
.secondary,
nav button,
.subnav button {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}
nav button.active,
.subnav button.active {
  background: var(--accent);
  color: white;
  box-shadow: inset 0 -3px #0003;
}
nav button.active:before {
  content: "● ";
  font-size: 12px;
}
header button {
  background: #ffffff10;
  border-color: #ffffff35;
  margin: 0;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 26px 0 20px;
}
h2 {
  font-size: 26px;
  margin: 4px 0 12px;
}
h3 {
  font-size: 19px;
  margin: 0 0 18px;
}
p {
  margin: 12px 0;
}
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.panel {
  padding: 26px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 4px 16px #19382c05;
  margin-bottom: 24px;
}
.narrow {
  max-width: 760px;
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
label {
  display: block;
  font-weight: 650;
  font-size: 14px;
  margin: 18px 0 8px;
}
input,
select {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px;
  border-radius: 9px;
  border: 1px solid #b8cac5;
  background: #fff;
  color: var(--ink);
  margin-top: 8px;
}
select {
  margin-bottom: 12px;
}
input[type="color"] {
  padding: 4px;
}
nav button,
.subnav button,
.pager button {
  margin: 0;
}
.hint,
small {
  font-size: 13px;
  color: var(--muted);
}
.notice {
  padding: 14px 18px;
  border-left: 4px solid #b9821d;
  background: #fff8e8;
  font-size: 14px;
}
.wide {
  width: 100%;
}
.total-line,
.item-row {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.total-line strong {
  font-size: 24px;
}
.item-row button {
  margin: 0;
  min-width: 48px;
}
.money-line {
  display: flex;
  align-items: center;
  border: 1px solid #b8cac5;
  border-radius: 9px;
  overflow: hidden;
  background: var(--soft);
}
.money-line span {
  padding: 0 12px;
  font-weight: 650;
}
.money-line input {
  border: 0;
  border-radius: 0;
  margin: 0;
  min-width: 0;
}
.money-field select {
  font-size: 12px;
  min-height: 36px;
  padding: 6px;
  margin: 6px 0;
}
.money-preview {
  display: block;
  margin-top: 6px;
  color: var(--accent);
}
.subnav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.toolbar {
  display: flex;
  align-items: end;
  gap: 16px;
  margin-bottom: 20px;
}
.toolbar label {
  margin: 0;
}
.toolbar button {
  margin: 0;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.metric {
  padding: 18px;
  background: var(--soft);
  border-radius: 12px;
}
.metric strong {
  display: block;
  font-size: 22px;
  margin-top: 8px;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 12px;
  color: var(--muted);
  background: #f7faf9;
}
td {
  font-size: 14px;
}
td button {
  margin: 0;
  white-space: nowrap;
}
.pager {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
}
.debt-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 16px 0;
  overflow: hidden;
}
.debt-card summary {
  padding: 20px;
  cursor: pointer;
  background: #f6faf8;
}
.debt-card summary strong {
  float: right;
  font-size: 21px;
  color: var(--accent);
}
.debt-content {
  padding: 18px;
}
.payment-history {
  color: var(--accent);
  font-size: 13px;
}
.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: #f8faf9;
  border-radius: 12px;
}
.scroll-list {
  max-height: 420px;
  overflow: auto;
}
.popover {
  position: absolute;
  right: 30px;
  top: 86px;
  z-index: 4;
  background: white;
  padding: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 8px 30px #0002;
  border-radius: 12px;
}
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: #11282fec;
  padding: 20px;
}
.login {
  width: min(440px, 100%);
}
.login button {
  width: 100%;
}
.hidden {
  display: none !important;
}
dialog {
  width: min(620px, 94vw);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  color: var(--ink);
}
dialog::backdrop {
  background: #122b38a6;
}
.actions {
  display: flex;
  gap: 12px;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #173b35;
  color: #fff;
  padding: 16px 22px;
  border-radius: 10px;
  z-index: 50;
  display: none;
  max-width: 90vw;
}
#receipt {
  max-width: 360px;
  margin: 20px auto;
  font-family: monospace;
  color: #111;
  background: #fff;
  padding: 16px;
  border: 1px dashed #bbb;
}
#receipt h3,
#receipt p {
  text-align: center;
}
#receipt table {
  table-layout: fixed;
}
#receipt th,
#receipt td {
  padding: 8px 3px;
  overflow-wrap: anywhere;
  font-size: 12px;
}
#receipt th:first-child {
  width: 43%;
}
#receipt td:nth-child(3) {
  text-align: right;
}
#receipt .total-line {
  font-size: 12px;
}
#receipt .total-line strong {
  font-size: 14px;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 26px 0;
}
@media (max-width: 760px) {
  header {
    padding: 16px;
  }
  header h1 {
    font-size: 18px;
  }
  .badge {
    display: none;
  }
  main {
    padding: 0 14px 30px;
  }
  .columns {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .panel {
    padding: 20px;
  }
  .two {
    grid-template-columns: 1fr;
  }
  .page-heading small {
    display: none;
  }
  nav {
    gap: 6px;
  }
  nav button {
    font-size: 14px;
    padding: 10px;
  }
  .subnav button {
    font-size: 14px;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
  }
  .metric strong {
    font-size: 18px;
  }
  .debt-card summary strong {
    float: none;
    display: block;
  }
}

:root {
  --accent: hsl(199, 88%, 37%);
  --ink: hsl(199, 45%, 18%);
  --muted: hsl(199, 18%, 42%);
  --line: hsl(199, 30%, 87%);
  --soft: hsl(199, 65%, 96%);
  --field-border: hsl(199, 28%, 76%);
}

body {
  background: hsl(199, 45%, 98%);
}

header {
  background: var(--accent);
}

header small,
.badge {
  color: hsl(199, 100%, 94%);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid hsl(199, 88%, 28%);
  outline-offset: 2px;
}

header button:focus-visible {
  outline-color: #fff;
}

.panel {
  box-shadow: 0 4px 16px hsl(199, 65%, 25%, 0.05);
}

input,
select,
.money-line {
  border-color: var(--field-border);
}

.notice {
  border-left-color: var(--accent);
  background: var(--soft);
}

th,
.debt-card summary,
.empty {
  background: var(--soft);
}

.popover {
  box-shadow: 0 8px 30px hsl(199, 65%, 20%, 0.14);
}

.overlay {
  background: hsl(199, 65%, 15%, 0.93);
}

dialog {
  background: #fff;
}

dialog::backdrop {
  background: hsl(199, 65%, 15%, 0.65);
}

#toast {
  background: var(--accent);
}
