:root {
  color-scheme: light;
  --ink: #1d2329;
  --muted: #5f6f7a;
  --line: #d9e1e7;
  --surface: #f7f9fb;
  --accent: #176b87;
  --accent-strong: #0f4f64;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: #ffffff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar,
footer {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

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

.topbar-nav {
  margin-left: auto;
}

.user-profile {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  object-fit: cover;
  background: var(--surface);
}

.user-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
  text-align: right;
}

.user-copy strong,
.user-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy strong {
  color: var(--ink);
  font-size: 14px;
}

.user-copy span {
  color: var(--muted);
  font-size: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary {
  color: var(--accent-strong);
  background: #ffffff;
}

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

.button.small {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.button-placeholder {
  display: inline-block;
  width: 82px;
  min-height: 38px;
}

.shell {
  width: min(1040px, calc(100% - 32px));
  margin: 36px auto;
  flex: 1;
}

.welcome-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 240px;
  padding: 32px 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.05;
}

h2 {
  font-size: 22px;
}

.muted {
  color: var(--muted);
}

.workspace {
  padding: 28px 0;
}

.section-copy {
  margin-bottom: 0;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 22px 0 0;
  border-bottom: 1px solid var(--line);
}

.tab {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.tab.active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
}

.balance-card {
  min-width: 160px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: right;
}

.balance-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.topup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.topup-prompt {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

.billing-spacer {
  height: 44px;
}

.topup-cell {
  min-width: 0;
}

.subsection-label {
  margin: 44px 0 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

.billing-figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0 4px;
}

.billing-figure {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.figure-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.figure-title {
  color: var(--ink);
  font-weight: 750;
}

.figure-subtitle,
.figure-empty {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.figure-total {
  color: var(--ink);
  font-size: 18px;
  white-space: nowrap;
}

.figure-bars {
  display: grid;
  grid-template-rows: 64px 156px;
  gap: 14px;
}

.figure-legend {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px 12px;
  height: 64px;
  overflow: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.figure-legend-item {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.figure-swatch {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
}

.figure-plot {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px;
}

.figure-y-axis {
  display: flex;
  height: 120px;
  align-self: start;
  justify-content: space-between;
  flex-direction: column;
  padding-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-align: right;
  white-space: nowrap;
}

.figure-time-series {
  display: grid;
  grid-auto-columns: minmax(34px, 1fr);
  grid-auto-flow: column;
  align-items: end;
  gap: 8px;
  height: 156px;
  overflow-x: auto;
  padding: 4px 2px 0 8px;
  border-left: 1px solid var(--line);
  background-image: linear-gradient(to bottom, var(--line) 0, transparent 1px, transparent calc(50% - 1px), var(--line) 50%, transparent calc(50% + 1px), transparent calc(100% - 1px), var(--line) 100%);
  background-size: 100% 120px;
  background-repeat: no-repeat;
}

.figure-day {
  display: grid;
  min-width: 0;
  grid-template-rows: 120px auto;
  gap: 8px;
}

.figure-day-stack {
  display: flex;
  overflow: hidden;
  align-items: flex-end;
  justify-content: flex-end;
  flex-direction: column;
  border-radius: 6px 6px 3px 3px;
}

.figure-day-segment {
  width: 100%;
}

.figure-day-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.charge-label {
  color: var(--ink);
  font-weight: 650;
}

.charge-category {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.charge-detail {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions .button {
  width: 92px;
}

.section-header,
.dialog-header,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-header.billing-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 24px;
}

.table-wrap {
  overflow-x: auto;
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 0;
}

.pager-status {
  color: var(--muted);
  font-size: 13px;
}

.pager-actions {
  display: flex;
  gap: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

td a {
  color: var(--accent-strong);
  font-weight: 650;
  text-decoration: none;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}

.empty-state {
  padding: 28px 0;
  color: var(--muted);
}

.status-message {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgb(29 35 41 / 42%);
  backdrop-filter: blur(2px);
  z-index: 1000;
}

.modal {
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgb(29 35 41 / 20%);
}

.modal h3 {
  margin: 0 0 12px;
  font-size: 20px;
}

.modal-body {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.modal-body p {
  margin: 0 0 10px;
}

.modal-body p:last-child {
  margin-bottom: 0;
}

.modal-body strong {
  color: var(--ink);
}

.modal-warning {
  padding: 10px 12px;
  border-left: 3px solid #d08a14;
  border-radius: 4px;
  background: #fff4d6;
  color: #8a5a08;
  font-size: 13px;
}

dialog {
  width: min(480px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

dialog::backdrop {
  background: rgb(29 35 41 / 42%);
}

dialog form {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.quote-grid {
  display: grid;
  gap: 12px;
}

.quote-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 150px 110px;
  align-items: center;
  gap: 12px;
}

.quote-static {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.quote-label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.quote-help {
  font-size: 12px;
  font-weight: 500;
}

.quote-fixed {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

.node-name-stack {
  display: grid;
  gap: 3px;
}

.node-version {
  color: var(--muted);
  font-size: 12px;
}

.quote-price {
  justify-self: end;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-strong);
}

.quote-spacer {
  min-height: 40px;
}

.quote-price-group {
  justify-self: end;
  display: grid;
  gap: 3px;
  text-align: right;
}

.quote-spec {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.quote-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.quote-total strong {
  font-size: 18px;
}

.compact-input {
  max-width: 150px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
}

@media (max-width: 640px) {
  .quote-row {
    grid-template-columns: 1fr;
  }

  .quote-price {
    justify-self: start;
  }

  .quote-price-group {
    justify-self: start;
    text-align: left;
  }

  .compact-input {
    max-width: none;
  }
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}

.error {
  margin: 0;
  color: #a73535;
  font-weight: 650;
}

footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 640px) {
  .topbar,
  footer {
    padding: 0 16px;
  }

  .user-copy {
    display: none;
  }

  .balance-card {
    width: 100%;
    text-align: left;
  }

  .billing-figures {
    grid-template-columns: 1fr;
  }

  .section-header.billing-header {
    grid-template-columns: 1fr;
    gap: 12px;
  }

}
