:root {
  color-scheme: light;
  font: 16px / 1.45 system-ui, sans-serif;
  color: #19243a;
  background: #f3f5fa;
}

* { box-sizing: border-box; }
body { margin: 0; }
aside {
  position: fixed;
  inset: 0 auto 0 0;
  width: 235px;
  padding: 25px;
  overflow: auto;
  background: #17243e;
  color: white;
}
.brand { font-size: 1.18rem; font-weight: 700; }
nav { display: grid; gap: 5px; margin: 28px 0 18px; }
nav button { background: transparent; color: #d5def0; text-align: left; }
nav button:hover, nav [aria-current] { background: #344a70; color: white; }
.demo-label { margin: 0; color: #c0cce2; font-size: .83rem; }

main { max-width: 1500px; margin-left: 235px; padding: 32px; }
h1 { margin: 0; font-size: clamp(1.65rem, 4vw, 2.25rem); }
h2 { margin: 0 0 6px; font-size: 1.21rem; }
p { margin: .65em 0; }
small { color: #5b6981; }
.top, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.top { justify-content: space-between; }
.tag, .paid, .pending { display: inline-block; border-radius: 20px; padding: 5px 10px; }
.tag { background: #e5eaff; color: #354b93; font-size: .875rem; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin: 22px 0; }
.card, section {
  padding: 20px;
  border: 1px solid #e2e7f0;
  border-radius: 14px;
  background: white;
}
.card strong { display: block; margin-top: 8px; font-size: clamp(1.25rem, 3.1vw, 1.9rem); overflow-wrap: anywhere; }
section { margin: 18px 0; }

button, input, select { min-height: 44px; border-radius: 8px; font: inherit; }
button { padding: 9px 12px; border: 0; background: #eef1f7; color: inherit; cursor: pointer; }
button:hover { background: #e0e6f0; }
button:disabled { opacity: .65; cursor: default; }
.primary { background: #385bd5; color: white; }
.primary:hover { background: #2847b3; }
:focus-visible { outline: 3px solid #5873df; outline-offset: 2px; }
nav :focus-visible { outline-color: #adc1ff; }
input, select { max-width: 100%; padding: 9px 11px; border: 1px solid #aebbd2; background: white; color: inherit; }
input[readonly] { background: #f3f5fa; }
label { display: grid; gap: 4px; }

table { width: 100%; border-collapse: collapse; margin-top: 8px; }
td, th { padding: 12px 8px; border-bottom: 1px solid #e6ebf3; text-align: left; vertical-align: middle; }
th { color: #5b6981; font-size: .78rem; }
.cell-label { display: none; }
.paid { background: #dff5e9; color: #145f40; }
.pending { background: #fff0d8; color: #784900; }
progress { display: block; width: 100%; height: 14px; accent-color: #385bd5; }
.message { min-height: 3rem; padding: 12px; background: #f3f5fa; border-radius: 8px; }
#simulation-status { color: #145f40; }

dialog {
  width: min(460px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100% - 24px);
  max-height: calc(100dvh - 24px);
  padding: 20px;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 15px 65px #0004;
  color: inherit;
}
dialog::backdrop { background: #17243e88; }
dialog form { display: grid; gap: 9px; }
dialog p { margin: 0 0 4px; }

@media (max-width: 900px) {
  aside { position: static; width: auto; padding: 14px 16px; }
  nav { display: flex; flex-wrap: wrap; margin: 10px 0; }
  main { margin: 0; padding: 18px 16px; }
}

@media (max-width: 620px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card, section { padding: 14px; }
  .records, .records tbody { display: block; }
  .records thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .records tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 0; border-bottom: 1px solid #e6ebf3; }
  .records td { min-width: 0; padding: 0; border: 0; overflow-wrap: anywhere; }
  .records td:first-child, .records .row-action, .records .empty-row td { grid-column: 1 / -1; }
  .records .row-action button { width: 100%; }
  .cell-label { display: block; color: #5b6981; font-size: .78rem; }
}
