:root {
  color-scheme: dark;
  --bg: #111214;
  --surface: #191b1f;
  --surface-subtle: #202329;
  --surface-raised: #242832;
  --text: #f4f1ea;
  --muted: #a7adb8;
  --line: #30343c;
  --line-strong: #444a55;
  --accent: #2dd4bf;
  --accent-dark: #5eead4;
  --accent-ink: #062f2b;
  --success: #86efac;
  --success-bg: #123524;
  --warning: #facc15;
  --warning-bg: #3a2d0a;
  --danger: #fb7185;
  --danger-bg: #3a161d;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-dark);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  appearance: none;
}

.app-frame {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #0b0c0f;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-block {
  align-items: center;
  display: flex;
  gap: 12px;
  min-height: 44px;
}

.brand-mark {
  align-items: center;
  background: #f59e0b;
  border-radius: 8px;
  color: #111214;
  display: inline-flex;
  font-weight: 800;
  height: 40px;
  justify-content: center;
  letter-spacing: 0;
  width: 40px;
}

.brand {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.side-nav {
  display: grid;
  gap: 4px;
}

.side-nav a {
  border-radius: 7px;
  color: #d8dde7;
  display: block;
  font-weight: 650;
  padding: 10px 12px;
}

.side-nav a:hover,
.side-nav a.active {
  background: #222833;
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
}

.workspace {
  min-width: 0;
}

.workspace-bar {
  align-items: center;
  background: rgba(17, 18, 20, 0.88);
  border-bottom: 1px solid var(--line);
  display: flex;
  min-height: 64px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(10px);
}

.workspace-bar strong {
  display: block;
  font-size: 16px;
  margin-top: 2px;
}

.page {
  margin: 0 auto;
  max-width: 1320px;
  padding: 28px;
}

.page-header {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.panel-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 16px 18px;
}

.form-panel {
  padding: 18px;
}

.form-panel .panel-header {
  border-bottom: 0;
  padding: 0 0 16px;
}

.help-panel .panel-header,
.setup-panel .panel-header {
  align-items: flex-start;
}

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

.help-grid > div {
  background: var(--surface);
  padding: 18px;
}

.help-grid strong {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
}

.help-grid p,
.panel-note,
.setup-body p,
.field-hint {
  color: var(--muted);
  margin: 0;
}

.help-grid p,
.setup-body p {
  line-height: 1.55;
}

.setup-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.command-block {
  background: #101215;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #d8dde7;
  margin: 0;
  overflow-x: auto;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.command-block code {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: inherit;
  display: block;
  padding: 0;
  white-space: inherit;
}

.command-details {
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.command-details summary {
  background: var(--surface-subtle);
  cursor: pointer;
  font-weight: 750;
  padding: 12px 14px;
}

.command-details .command-block {
  border: 0;
  border-radius: 0;
}

.metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  margin-bottom: 20px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
  display: grid;
  gap: 12px;
  min-height: 108px;
  padding: 16px;
}

.metric span {
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  font-size: 32px;
  line-height: 1;
}

.metric.attention {
  border-left-color: var(--warning);
}

.metric.danger-soft {
  border-left-color: var(--danger);
}

.table-wrap {
  overflow-x: auto;
  width: 100%;
}

.data-table {
  border-collapse: collapse;
  min-width: 840px;
  width: 100%;
}

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

.data-table th {
  background: var(--surface-subtle);
  color: #c9d0dc;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

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

.data-table tbody tr:hover td {
  background: #1e2229;
}

.empty-row {
  color: var(--muted);
  padding: 28px 14px !important;
  text-align: center !important;
}

.badge,
.count-pill {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  min-height: 26px;
  padding: 6px 10px;
  white-space: nowrap;
}

.count-pill,
.badge.neutral {
  background: #29303a;
  color: #d8dde7;
}

.badge.success,
.status-paid,
.status-provisioned {
  background: var(--success-bg);
  color: var(--success);
}

.status-awaiting-payment,
.status-awaiting-manual-review {
  background: var(--warning-bg);
  color: var(--warning);
}

.status-provision-failed,
.badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.muted-badge {
  background: #29303a;
  color: var(--muted);
}

.button,
button {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 750;
  gap: 8px;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  text-align: center;
  white-space: nowrap;
}

.button:hover,
button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.button.secondary,
button.secondary {
  background: #242832;
  border-color: var(--line-strong);
  color: var(--text);
}

.button.secondary:hover,
button.secondary:hover {
  background: #2b303a;
}

.button.danger,
button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

.button.small,
button.small {
  min-height: 32px;
  padding: 6px 10px;
}

.button.full,
button.full {
  width: 100%;
}

form {
  margin: 0;
}

.stack,
.grid-form {
  display: grid;
  gap: 14px;
}

.grid-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wide {
  grid-column: 1 / -1;
}

.field {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 7px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.field.compact span {
  display: none;
}

.field-hint {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

input,
select,
textarea {
  background: #111317;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  min-height: 38px;
  outline: none;
  padding: 8px 10px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.12);
}

textarea {
  min-height: 118px;
  resize: vertical;
}

.form-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.toggle-field {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  font-weight: 750;
  gap: 8px;
  min-height: 38px;
}

.toggle-field input {
  min-height: 0;
  width: auto;
}

.actions {
  display: grid;
  gap: 8px;
  min-width: 170px;
}

.actions-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 130px;
}

.reject-form,
.quota-form {
  display: grid;
  gap: 8px;
}

.quota-form {
  grid-template-columns: 76px minmax(110px, 1fr);
}

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

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

.nowrap {
  white-space: nowrap;
}

.url-cell {
  direction: ltr;
  max-width: 360px;
}

.url-cell a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

code,
.file-id {
  background: #101215;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #d8dde7;
  direction: ltr;
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  padding: 3px 6px;
  text-align: left;
}

.receipt-note {
  background: #101215;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #d8dde7;
  margin: 8px 0 0;
  max-height: 180px;
  max-width: 380px;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
}

.plan-list {
  display: grid;
}

.plan-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1.4fr) minmax(120px, 0.7fr) minmax(160px, 1fr) minmax(110px, 0.6fr) auto;
  padding: 14px 16px;
}

.plan-row:last-child {
  border-bottom: 0;
}

.plan-head {
  background: var(--surface-subtle);
  color: #c9d0dc;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding-bottom: 10px;
  padding-top: 10px;
  text-transform: uppercase;
}

.login-page {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.login-brand {
  align-items: center;
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
}

.login-brand h1 {
  font-size: 24px;
}

.login-brand p {
  color: var(--muted);
  margin: 4px 0 0;
}

@media (max-width: 1100px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    position: static;
  }

  .side-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-bar {
    display: none;
  }

  .page {
    padding: 18px;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

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

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .plan-head {
    display: none;
  }

  .plan-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .field.compact span {
    display: inline;
  }

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