:root {
  color-scheme: light;
  --blue: #0070f0;
  --purple: #7010f0;
  --gold: #c4a766;
  --ink: #111827;
  --muted: #667085;
  --line: #e5e7eb;
  --soft: #f7f8fb;
  --panel: #ffffff;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --warn: #a15c07;
  --warn-bg: #fff7e6;
  --ok: #067647;
  --ok-bg: #ecfdf3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--soft);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

.login-page {
  background:
    linear-gradient(135deg, rgba(0, 112, 240, 0.2), transparent 34%),
    linear-gradient(315deg, rgba(112, 16, 240, 0.2), transparent 40%),
    #080b16;
  color: #ffffff;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 420px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(12, 17, 31, 0.92);
  padding: 32px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.login-panel h1 {
  margin-top: 8px;
  font-size: 28px;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 8px;
  color: inherit;
  font-weight: 650;
}

label span {
  font-size: 12px;
  color: var(--muted);
}

.login-panel label span {
  color: #cbd5e1;
}

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

input:focus,
select:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(0, 112, 240, 0.16);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
}

.button.primary {
  background: var(--blue);
  color: #ffffff;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.button.secondary {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 16px 24px;
  backdrop-filter: blur(10px);
}

.topbar h1 {
  margin-top: 2px;
  font-size: 22px;
}

.page {
  display: grid;
  gap: 20px;
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.page.narrow {
  width: min(720px, calc(100% - 32px));
}

.eyebrow {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.block {
  display: block;
}

.toolbar,
.panel,
.account-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.range-form {
  display: flex;
  align-items: end;
  gap: 10px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
}

.metric span,
.account-total span,
.scope-cost span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.panel {
  overflow: hidden;
}

.panel-heading,
.account-header,
.scope-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading {
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
}

.panel-heading h2,
.account-header h2,
.scope-heading h3 {
  font-size: 18px;
}

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

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

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

th {
  background: #fbfcfe;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

tr:last-child td {
  border-bottom: 0;
}

.compact th,
.compact td {
  padding: 10px 0;
  white-space: normal;
}

.compact table {
  min-width: 620px;
}

.accounts-list {
  display: grid;
  gap: 18px;
}

.account-card {
  padding: 18px;
}

.account-total,
.scope-cost {
  min-width: 132px;
  text-align: right;
}

.account-total strong,
.scope-cost strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.scope-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.scope-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-width: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
}

.pill.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.pill.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.pill.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.pill.team {
  background: rgba(112, 16, 240, 0.1);
  color: var(--purple);
}

.pill.personal {
  background: rgba(0, 112, 240, 0.1);
  color: var(--blue);
}

.notice {
  border-radius: 6px;
  margin-top: 14px;
  padding: 12px;
}

.notice p + p {
  margin-top: 6px;
}

.notice.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.notice.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.notice.neutral {
  background: #f2f4f7;
  color: #344054;
}

.projects {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

.projects h4 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.project-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}

.domain-list {
  display: grid;
  gap: 8px;
  min-width: 260px;
}

.domain-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.domain-row a {
  font-weight: 750;
  text-decoration: none;
}

.empty-state {
  padding: 28px;
}

.empty-state p {
  margin-top: 8px;
  color: var(--muted);
}

.link-button {
  margin-top: 18px;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.resource-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
  min-width: 0;
}

.resource-card.warn {
  border-color: rgba(161, 92, 7, 0.35);
}

.resource-card.danger {
  border-color: rgba(180, 35, 24, 0.35);
}

.resource-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.resource-head h3 {
  font-size: 15px;
}

.usage-bar {
  display: block;
  width: 100%;
  height: 9px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #edf0f5;
  margin-top: 14px;
  appearance: none;
}

.usage-bar::-webkit-progress-bar {
  border-radius: 999px;
  background: #edf0f5;
}

.usage-bar::-webkit-progress-value {
  border-radius: 999px;
  background: var(--blue);
}

.usage-bar::-moz-progress-bar {
  border-radius: 999px;
  background: var(--blue);
}

.resource-card.warn .usage-bar::-webkit-progress-value {
  background: var(--warn);
}

.resource-card.warn .usage-bar::-moz-progress-bar {
  background: var(--warn);
}

.resource-card.danger .usage-bar::-webkit-progress-value {
  background: var(--danger);
}

.resource-card.danger .usage-bar::-moz-progress-bar {
  background: var(--danger);
}

.resource-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 0;
}

.resource-stats div {
  min-width: 0;
}

.resource-stats dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.resource-stats dd {
  margin: 3px 0 0;
  font-size: 18px;
  font-weight: 850;
}

.unit-note {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 10px;
  font-size: 12px;
}

.embedded-panel {
  margin-top: 18px;
}

.worker-panel {
  padding-bottom: 18px;
}

.worker-panel .panel-heading {
  align-items: center;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.worker-notice {
  margin: 16px 18px 0;
}

.worker-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.worker-metrics article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.worker-metrics span,
.subheading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.worker-metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.worker-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  padding: 0 18px;
}

.subheading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.subheading h3 {
  font-size: 15px;
}

.latest-runs {
  padding: 18px 18px 0;
}

.logs-empty {
  margin: 18px;
}

.log-list {
  display: grid;
}

.log-entry {
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
}

.log-entry:last-child {
  border-bottom: 0;
}

.log-entry > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.log-entry time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.log-entry code {
  display: block;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
  color: #344054;
  padding: 8px;
  white-space: pre;
}

@media (max-width: 980px) {
  .metrics-grid,
  .scope-grid,
  .resource-grid,
  .worker-grid,
  .worker-metrics {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .range-form,
  .topbar,
  .action-row {
    align-items: stretch;
    flex-direction: column;
  }

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

  .range-form label {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(100% - 20px, 1500px);
    padding-top: 14px;
  }

  .login-panel {
    padding: 24px;
  }

  .account-header,
  .scope-heading,
  .panel-heading {
    flex-direction: column;
  }

  .account-total,
  .scope-cost {
    min-width: 0;
    text-align: left;
  }
}
