/* Layout and color */
:root {
  color-scheme: light;
  font:
    100%/1.5 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  --canvas: #f5f6fa;
  --surface: #fff;
  --ink: #151b30;
  --muted: #535e75;
  --line: #e1e5ef;
  --accent: #2649c7;
  --accent-dark: #1c369d;
  --accent-soft: #edf1ff;
  --danger: #a32e42;
  --nav-width: 15rem;
  --radius: 1rem;
  background: var(--canvas);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-height: 100dvh;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(1.95rem, 3vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.055em;
  font-weight: 720;
}
h2 {
  font-size: 1.15rem;
  line-height: 1.25;
  letter-spacing: -0.023em;
}
h3 {
  font-size: 1rem;
  line-height: 1.3;
}
a {
  color: var(--accent);
}
button,
a,
summary {
  touch-action: manipulation;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0.58rem 0.85rem;
  border-radius: 0.65rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition:
    background-color 0.12s,
    transform 0.12s ease-out;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
button.danger {
  color: var(--danger);
}
button:disabled {
  cursor: wait;
  opacity: 0.65;
}
button:active:not(:disabled) {
  transform: scale(0.98);
  background-color: #e1e8fa;
}
button.primary:active:not(:disabled) {
  background-color: var(--accent-dark);
}
:focus-visible {
  outline: 3px solid #526ddd;
  outline-offset: 3px;
}
.icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  display: inline-block;
  vertical-align: middle;
}
.icon-button {
  width: 2.75rem;
  padding: 0;
}
.muted {
  color: var(--muted);
}
.actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.notice {
  padding: 0.7rem 0.9rem;
  color: #284287;
  background: var(--accent-soft);
  border: 1px solid #d9e3ff;
  border-radius: 0.65rem;
  overflow-wrap: anywhere;
  font-size: 0.875rem;
}
.notice.is-error {
  background: #fff0f2;
  color: var(--danger);
  border-color: #f4d7de;
}
#notice {
  margin-bottom: 1rem;
}

/* App chrome */
#app {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: white;
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-weight: 760;
  font-size: 1.27rem;
  letter-spacing: -0.05em;
  line-height: 1;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--accent);
  color: white;
  border-radius: 0.7rem;
}
.brand-mark .icon {
  width: 1.3rem;
  height: 1.3rem;
}
.sidebar > .brand {
  padding: 1.36rem 1.2rem 1.2rem;
}
.nav {
  padding: 0.3rem 0.8rem 1rem;
  overflow: auto;
  overscroll-behavior: contain;
}
.sidebar > .nav {
  flex: 1;
}
.nav-group + .nav-group {
  margin-top: 0.85rem;
}
.nav-label {
  font-weight: 680;
  font-size: 0.69rem;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.3rem 0.65rem;
}
.nav button {
  border: 0;
  display: flex;
  justify-content: flex-start;
  width: 100%;
  min-height: 2.38rem;
  padding: 0.42rem 0.65rem;
  color: var(--muted);
  font-weight: 550;
  text-align: left;
}
.nav button[aria-current="page"],
.tabbar button[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
}
.profile {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 650;
}
.profile-name {
  overflow-wrap: anywhere;
}
.sidebar > .profile {
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--line);
}
.avatar {
  background: #e9eeff;
  color: #2947a7;
  border-radius: 50%;
  display: grid;
  place-items: center;
  width: 2.05rem;
  height: 2.05rem;
  font-size: 0.77rem;
  font-weight: 740;
  flex: none;
}
.topbar {
  min-height: 4.25rem;
  padding: 0.6rem clamp(1.4rem, 3vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f5f6faec;
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.breadcrumb {
  color: var(--muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.875rem;
}
.breadcrumb strong {
  color: var(--ink);
}
.account {
  background: transparent;
  border-color: transparent;
  padding: 0.2rem 0.35rem;
  min-width: 2.75rem;
}
.mobile-brand,
.tabbar {
  display: none;
}
#main {
  max-width: 94rem;
  margin-inline: auto;
  padding: clamp(1.3rem, 3vw, 2.75rem) clamp(1.4rem, 3vw, 3rem) 3rem;
}
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.9rem 1.2rem;
  margin-bottom: 1.5rem;
}
#subtitle {
  margin-top: 0.48rem;
  font-size: 0.925rem;
  color: var(--muted);
}

/* Dashboard */
.metrics {
  display: grid;
  grid-template-columns: minmax(15rem, 1.4fr) minmax(0, 2fr);
  gap: 1rem;
}
.summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}
.metric,
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.metric {
  padding: 1.12rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 9.6rem;
  gap: 0.45rem;
}
.metric-icon,
.empty-icon {
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  border-radius: 0.7rem;
  color: var(--accent);
  background: var(--accent-soft);
}
.metric-label {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 590;
}
.metric-value {
  font-size: clamp(1.4rem, 2.3vw, 2.05rem);
  font-weight: 740;
  letter-spacing: -0.055em;
  line-height: 1.12;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.metric.revenue {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 10.4rem;
  color: white;
  background: linear-gradient(112deg, #132256, #244dc1);
  border-color: transparent;
  padding: 1.25rem 1.35rem;
}
.metric.revenue .metric-label {
  color: #e2e9ff;
}
.metric.revenue .metric-icon {
  color: white;
  background: #ffffff20;
}
.metric.revenue .metric-value {
  font-size: clamp(1.8rem, 3vw, 2.9rem);
}
.revenue::before,
.signin-art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: repeating-radial-gradient(
    ellipse at 103% 122%,
    transparent 0 16px,
    #aac5ff22 17px 18px,
    transparent 19px 34px
  );
  pointer-events: none;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(14rem, 1fr);
  gap: 1rem;
  margin-top: 1.1rem;
  align-items: start;
}
.dashboard-grid > :only-child {
  grid-column: 1 / -1;
}
.panel {
  overflow: clip;
}
.panel-head {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
}
.panel-head p {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}
.panel-head button {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  padding-inline: 0.35rem;
  white-space: nowrap;
}
.operations {
  padding: 0.25rem 1.15rem;
}
.operation {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.85rem 0;
}
.operation + .operation {
  border-top: 1px solid var(--line);
}
.operation span {
  color: var(--muted);
  font-size: 0.81rem;
}
.operation span.pill {
  color: var(--pill-ink);
}
.operation strong {
  display: block;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
  margin-bottom: 0.1rem;
}

/* Records and states */
.databar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.databar > p {
  margin-right: auto;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 580;
}
.scroll {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: 0.86rem;
}
thead {
  background: #f8f9fc;
}
th,
td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
th {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 680;
  white-space: nowrap;
}
tbody tr:last-child td {
  border-bottom: 0;
}
td:first-child {
  font-weight: 680;
  min-width: 6.5rem;
}
td:last-child {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}
td:last-child button {
  border-color: transparent;
  color: var(--accent);
  background: transparent;
  padding-inline: 0.45rem;
}
.pill {
  --pill-ink: #4c5871;
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  font-size: 0.74rem;
  font-weight: 670;
  white-space: nowrap;
  padding: 0.24rem 0.53rem;
  border-radius: 2rem;
  color: var(--pill-ink);
  background: #eef0f5;
}
.pill::before {
  content: "";
  background: currentColor;
  height: 0.37rem;
  width: 0.37rem;
  border-radius: 50%;
  flex: none;
}
.pill.good {
  --pill-ink: #13694e;
  background: #e7f6ee;
}
.pill.wait {
  --pill-ink: #865409;
  background: #fff3d9;
}
.pill.bad {
  --pill-ink: #a32e42;
  background: #feebee;
}
.empty {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 2.65rem 1.1rem;
  gap: 0.6rem;
  color: var(--muted);
}
.empty-icon {
  width: 2.9rem;
  height: 2.9rem;
}
.empty h3 {
  color: var(--ink);
}
.empty p {
  font-size: 0.86rem;
  max-width: 33ch;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 0.8rem 1.05rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}

/* Forms and dialogs */
label {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
  font-size: 0.86rem;
  font-weight: 620;
}
label:last-child {
  margin-bottom: 0;
}
input,
select,
textarea {
  color: var(--ink);
  padding: 0.65rem 0.72rem;
  width: 100%;
  min-height: 2.75rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 450;
  border: 1px solid #ccd4e4;
  background: white;
  border-radius: 0.65rem;
  min-width: 0;
}
textarea {
  min-height: 6rem;
  resize: vertical;
}
label small {
  color: var(--muted);
  font-weight: 450;
  overflow-wrap: anywhere;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.7rem 0.85rem;
  margin: 0 0 0.9rem;
  min-width: 0;
}
legend {
  padding: 0 0.3rem;
  font-size: 0.86rem;
  font-weight: 650;
}
.checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.1rem 0.7rem;
}
.checks label {
  display: flex;
  align-items: center;
  margin: 0;
  min-height: 2.75rem;
  gap: 0.45rem;
}
.checks input {
  width: 1rem;
  height: 1rem;
  min-height: 0;
  accent-color: var(--accent);
}
dialog {
  padding: 0;
  width: min(34rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  color: var(--ink);
  box-shadow: 0 22px 70px #18234e35;
  overscroll-behavior: contain;
}
dialog::backdrop {
  background: #11192c60;
  backdrop-filter: blur(3px);
}
.dialog-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.2rem;
  border-bottom: 1px solid var(--line);
}
.dialog-body {
  padding: 1.1rem 1.2rem;
}
.dialog-error {
  margin: 0 1.2rem 0.8rem;
}
#dialog-actions {
  position: sticky;
  bottom: 0;
  justify-content: flex-end;
  padding: 0.8rem 1.2rem;
  border-top: 1px solid var(--line);
  background: #fff;
}
.menu {
  max-width: 23rem;
}
.menu .profile,
.menu-actions {
  padding: 0.85rem 1.2rem;
}
.menu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  border-top: 1px solid var(--line);
}
.advanced {
  border-top: 1px solid var(--line);
  margin-top: 0.4rem;
}
.advanced summary {
  cursor: pointer;
  min-height: 2.75rem;
  padding-block: 0.7rem;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--accent-dark);
}
.advanced[open] {
  padding-bottom: 0.1rem;
}
.detail-list {
  margin: 0;
}
.detail-row {
  display: grid;
  grid-template-columns: minmax(7rem, 0.75fr) minmax(0, 1fr);
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
}
.detail-row dt {
  color: var(--muted);
}
.detail-row dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--canvas);
  padding: 0.8rem;
  border-radius: 0.65rem;
}
.qr-preview {
  display: block;
  max-width: 100%;
  width: 17rem;
  margin: auto;
}
.qr-amount {
  text-align: center;
  margin-top: 0.65rem;
  font-size: 1.25rem;
  font-weight: 720;
}

/* Login */
.signin {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(23rem, 1fr) minmax(23rem, 1fr);
  background: white;
}
.signin-panel {
  display: flex;
  flex-direction: column;
  padding: calc(2rem + env(safe-area-inset-top)) clamp(1.35rem, 4.6vw, 4.5rem)
    calc(2rem + env(safe-area-inset-bottom));
}
.signin-content {
  width: min(100%, 22rem);
  margin: auto;
  padding: 3rem 0;
}
.signin-content > p {
  margin: 0.65rem 0 1.8rem;
}
#login-form {
  display: grid;
}
#login-form .primary {
  margin-top: 0.7rem;
  min-height: 3rem;
}
.signin-art {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 6vw, 6rem);
  gap: 2.1rem;
  background: linear-gradient(143deg, #142455, #284ab1);
  color: white;
  margin: 0.8rem;
  border-radius: 1.35rem;
  overflow: hidden;
}
.login-mark .icon {
  color: #dce6ff;
  width: clamp(5rem, 9vw, 8rem);
  height: clamp(5rem, 9vw, 8rem);
  stroke-width: 1.1;
}
.signin-copy h2 {
  max-width: 13ch;
  font-size: clamp(2rem, 4vw, 3.6rem);
  letter-spacing: -0.05em;
}
.signin-copy p {
  margin-top: 0.7rem;
  color: #e2e9ff;
  max-width: 30ch;
}

/* Responsive */
@media (max-width: 1100px) {
  .metrics {
    grid-template-columns: 1fr;
  }
  .summary-metrics .metric {
    min-height: 7.55rem;
  }
}
@media (max-width: 1000px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  #app {
    display: block;
  }
  .sidebar,
  .breadcrumb {
    display: none;
  }
  .mobile-brand {
    display: flex;
  }
  .topbar {
    min-height: calc(3.75rem + env(safe-area-inset-top));
    padding: calc(0.5rem + env(safe-area-inset-top))
      max(1rem, env(safe-area-inset-right)) 0.5rem
      max(1rem, env(safe-area-inset-left));
  }
  #main {
    padding: 1.35rem max(1rem, env(safe-area-inset-right))
      calc(5.4rem + env(safe-area-inset-bottom))
      max(1rem, env(safe-area-inset-left));
  }
  .page-heading {
    margin-bottom: 1.1rem;
  }
  #subtitle {
    font-size: 0.875rem;
  }
  .tabbar {
    display: flex;
    position: fixed;
    z-index: 4;
    inset: auto 0 0;
    justify-content: space-around;
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
    background: #fffffff5;
    padding: 0.35rem max(0.35rem, env(safe-area-inset-right))
      calc(0.35rem + env(safe-area-inset-bottom))
      max(0.35rem, env(safe-area-inset-left));
  }
  .tabbar button {
    flex: 1;
    max-width: 8rem;
    gap: 0.12rem;
    flex-direction: column;
    border: 0;
    background: transparent;
    font-size: 0.69rem;
    color: var(--muted);
    min-height: 3rem;
    padding: 0.3rem;
  }
  .menu {
    margin: auto auto 0;
    width: 100%;
    max-width: none;
    max-height: 86dvh;
    border-radius: 1.2rem 1.2rem 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .menu .nav button {
    min-height: 2.75rem;
  }
  .account-menu {
    max-width: 26rem;
  }
  .signin {
    display: block;
  }
  .signin-art {
    display: none;
  }
  .signin-panel {
    min-height: 100dvh;
  }
}
@media (max-width: 590px) {
  .metrics,
  .dashboard-grid {
    gap: 0.7rem;
  }
  .dashboard-grid {
    margin-top: 0.7rem;
  }
  .summary-metrics {
    gap: 0.45rem;
  }
  .metric.revenue {
    min-height: 9rem;
    padding: 1rem;
  }
  .summary-metrics .metric {
    padding: 0.65rem 0.52rem;
    min-height: 7.15rem;
  }
  .metric-label {
    font-size: 0.73rem;
    line-height: 1.2;
  }
  .summary-metrics .metric-icon {
    width: 1.8rem;
    height: 1.8rem;
  }
  .panel-head,
  .databar {
    padding: 0.7rem 0.85rem;
  }
  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr {
    display: block;
  }
  .responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .responsive-table tr {
    position: relative;
    border-bottom: 1px solid var(--line);
    padding: 0.75rem 0.85rem;
  }
  .responsive-table tr:last-child {
    border-bottom: 0;
  }
  .responsive-table td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.55rem;
    border: 0;
    padding: 0.18rem 0;
  }
  .responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.75rem;
    flex: none;
  }
  .responsive-table td:first-child {
    padding: 0.17rem 5.15rem 0.4rem 0;
    font-size: 0.96rem;
  }
  .responsive-table td:first-child::before,
  .responsive-table td:last-child::before {
    display: none;
  }
  .responsive-table td:last-child {
    position: absolute;
    top: 0.42rem;
    right: 0.65rem;
    width: auto;
    padding: 0;
  }
  .quick-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 0.5rem;
  }
  .quick-table td:nth-child(2)::before,
  .quick-table td:nth-child(3)::before {
    display: none;
  }
  .quick-table td:first-child {
    grid-column: 1 / -1;
  }
  .quick-table td:nth-child(3) {
    justify-content: flex-end;
  }
}
@media (hover: hover) and (pointer: fine) {
  button:hover {
    background: #f1f4fc;
  }
  button.primary:hover {
    background: var(--accent-dark);
  }
  .nav button:hover {
    background: #f0f3fa;
    color: var(--accent-dark);
  }
  td:last-child button:hover,
  .panel-head button:hover {
    background: var(--accent-soft);
  }
}
@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
  button:active:not(:disabled) {
    transform: none;
  }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar,
  .tabbar {
    backdrop-filter: none;
    background: white;
  }
  dialog::backdrop {
    backdrop-filter: none;
  }
}
