:root {
  color-scheme: light;
  --background: #f4f6f2;
  --surface: #ffffff;
  --panel: #fbfcfa;
  --ink: #141f1a;
  --muted: #61706a;
  --line: #d7ded8;
  --accent: #0b6e5f;
  --accent-strong: #084f45;
  --warning: #ba6d1f;
  --danger: #a83a35;
  --blue: #1f5d84;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.app-header {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 86%);
  padding: 0 max(20px, calc((100vw - 1180px) / 2));
}

.brand,
.nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

.nav {
  gap: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.shell {
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 44px 0 80px;
}

.auth-panel,
.dashboard-heading,
.panel,
.metrics {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 0.55fr);
  gap: 48px;
  align-items: center;
  min-height: 420px;
  padding: 44px;
}

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

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.8rem, 6vw, 5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

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

label,
.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

input,
select {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

.inline-form,
.key-form,
.heading-actions,
.panel-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inline-form {
  margin-top: 10px;
}

.button,
.ghost,
.plan-option {
  cursor: pointer;
}

.button,
.ghost {
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
}

.button.primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.button.secondary,
.ghost {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

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

.ghost.danger {
  color: var(--danger);
}

.ghost:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

.form-note {
  min-height: 24px;
  margin: 12px 0 0;
  font-size: 0.92rem;
}

.form-note[data-state='error'] {
  color: var(--danger);
}

.dashboard {
  display: grid;
  gap: 18px;
}

.dashboard-heading,
.panel,
.metrics {
  padding: 24px;
}

.dashboard-heading,
.panel-heading {
  justify-content: space-between;
}

.dashboard-heading h1 {
  margin-bottom: 8px;
  font-size: clamp(2.2rem, 5vw, 4rem);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.plan-option {
  display: grid;
  min-height: 138px;
  gap: 8px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  text-align: left;
}

.plan-option span {
  font-weight: 850;
}

.plan-option strong {
  font-size: 1.55rem;
}

.plan-option small {
  color: var(--muted);
}

.plan-option.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

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

.metrics div {
  min-height: 112px;
  background: var(--surface);
  padding: 20px;
}

.metrics strong {
  display: block;
  margin-top: 12px;
  font-size: 1.8rem;
  line-height: 1;
}

.secret-box {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  border-left: 4px solid var(--warning);
  background: #fff8eb;
  padding: 16px;
}

code {
  overflow-wrap: anywhere;
  border-radius: 6px;
  background: #edf2ee;
  color: #0d332d;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-size: 0.84rem;
  padding: 2px 5px;
}

.table {
  display: grid;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 0.65fr 1fr 0.7fr;
  min-height: 54px;
  align-items: center;
  border-top: 1px solid var(--line);
}

.table-row:first-child {
  border-top: 0;
}

.table-row > * {
  padding: 12px 14px;
}

.table-head {
  background: #edf2ee;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.empty-state {
  margin: 0;
  padding: 20px;
}

@media (max-width: 920px) {
  .app-header,
  .auth-panel,
  .dashboard-heading,
  .panel-heading,
  .inline-form,
  .key-form {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-panel {
    display: flex;
    padding: 28px;
  }

  .plan-grid,
  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .table {
    overflow-x: auto;
  }

  .table-row {
    min-width: 760px;
  }
}

@media (max-width: 620px) {
  .plan-grid,
  .metrics {
    grid-template-columns: 1fr;
  }
}
