:root {
  color-scheme: dark;
  --bg: #070b0f;
  --bg-elev: #0a1016;
  --panel: #0d141b;
  --panel-2: #101922;
  --border: rgba(148, 196, 184, 0.14);
  --border-strong: rgba(148, 196, 184, 0.24);
  --text: #e6efe9;
  --text-dim: #9db1a9;
  --text-faint: #6e817a;
  --green: #41e0a3;
  --green-strong: #19c98a;
  --cyan: #5bd3e6;
  --amber: #f0b95b;
  --red: #ff6b6b;
  --violet: #b197ff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 620px at 12% -8%, rgba(65, 224, 163, 0.1), transparent 62%),
    radial-gradient(820px 540px at 102% 0%, rgba(91, 211, 230, 0.07), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--cyan);
}

code {
  font-family: var(--mono);
}

::selection {
  background: rgba(65, 224, 163, 0.28);
  color: #f4fffa;
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 196, 184, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 196, 184, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 55%, transparent 92%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 55%, transparent 92%);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 50;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--green);
  color: #04130d;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 10px;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(148, 196, 184, 0.4);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

.btn-primary {
  border-color: rgba(65, 224, 163, 0.55);
  background: linear-gradient(180deg, #4ce7ad, #22c98e);
  color: #03140d;
  font-weight: 650;
  box-shadow: 0 7px 20px rgba(34, 201, 142, 0.15);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #63f0b9, #2ed79a);
  border-color: rgba(65, 224, 163, 0.75);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-dim);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text);
}

.btn-danger-ghost {
  border-color: rgba(255, 107, 107, 0.26);
  background: transparent;
  color: #ffa8a8;
}

.btn-danger-ghost:hover:not(:disabled) {
  background: rgba(255, 107, 107, 0.09);
  border-color: rgba(255, 107, 107, 0.45);
  color: #ffcccc;
}

.btn-danger {
  border-color: rgba(255, 107, 107, 0.48);
  background: rgba(255, 107, 107, 0.16);
  color: #ffd0d0;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(255, 107, 107, 0.24);
  border-color: rgba(255, 107, 107, 0.65);
}

.btn-sm {
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 11.5px;
}

.btn-block {
  width: 100%;
  min-height: 42px;
}

[aria-busy="true"] {
  cursor: progress;
}

/* Fields and forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #080d12;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder {
  color: #586a63;
}

input:hover,
select:hover {
  border-color: var(--border-strong);
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(65, 224, 163, 0.62);
  box-shadow: 0 0 0 3px rgba(65, 224, 163, 0.1);
  background: #070c10;
}

input[type="number"] {
  font-family: var(--mono);
}

.field-action {
  justify-content: flex-end;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.form-grid-init {
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto;
}

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

.form-grid-create .field-action {
  grid-column: 1 / -1;
  align-items: flex-start;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.input-compact {
  width: 66px;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 11.5px;
}

/* Alerts and loading */

.alert {
  margin: 10px 0 0;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.alert-error {
  border-color: rgba(255, 107, 107, 0.32);
  background: rgba(255, 107, 107, 0.08);
  color: #ffc0c0;
}

.alert-ok {
  border-color: rgba(65, 224, 163, 0.3);
  background: rgba(65, 224, 163, 0.07);
  color: #a9f4d6;
}

.alert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}

.alert-row > span {
  min-width: 0;
}

.loading-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 2px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11.5px;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid rgba(65, 224, 163, 0.18);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 12px;
  height: 12px;
  border-width: 1.5px;
}

/* Brand and header */

.app-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 11px clamp(12px, 3vw, 28px);
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 15, 0.86);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 1px solid rgba(65, 224, 163, 0.3);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(65, 224, 163, 0.16), rgba(65, 224, 163, 0.03));
  color: var(--green);
  box-shadow: inset 0 0 18px rgba(65, 224, 163, 0.08);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.1;
}

.brand-name {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(5, 9, 12, 0.55);
}

.tab {
  appearance: none;
  border: 0;
  border-radius: 7px;
  padding: 6px 14px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  background: rgba(65, 224, 163, 0.12);
  color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(65, 224, 163, 0.2);
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.refresh-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(65, 224, 163, 0.12);
  animation: pulse 2.4s ease-in-out infinite;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 3px 8px 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}

.user-name {
  max-width: 160px;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  line-height: 1.6;
  text-transform: uppercase;
  white-space: nowrap;
}

.role-badge.role-admin {
  border-color: rgba(177, 151, 255, 0.35);
  background: rgba(177, 151, 255, 0.08);
  color: #cdbcff;
}

.role-badge.role-user {
  border-color: var(--border);
  color: var(--text-faint);
}

/* Layout */

.main {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px clamp(12px, 3vw, 28px) 36px;
  flex: 1 0 auto;
}

.tab-panel {
  animation: fade-in 0.2s ease;
}

.tab-panel:focus {
  outline: none;
}

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

.quota-card {
  grid-column: span 7;
}

.status-card {
  grid-column: span 5;
}

.instance-card {
  grid-column: span 7;
}

.forwards-card {
  grid-column: span 5;
}

.usage-card {
  grid-column: span 7;
}

.quickstart-card {
  grid-column: span 5;
}

/* Cards */

.card {
  position: relative;
  min-width: 0;
  padding: clamp(14px, 2vw, 18px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17, 26, 34, 0.88), rgba(10, 16, 22, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025), 0 10px 30px rgba(0, 0, 0, 0.12);
}

.card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(65, 224, 163, 0.3), transparent);
  pointer-events: none;
}

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

.card-head > div {
  min-width: 0;
}

.card-kicker {
  margin: 0 0 3px;
  color: rgba(65, 224, 163, 0.82);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.card h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.hint {
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.4;
}

/* Quota and live status */

.quota-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0 12px;
}

.metric {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.metric-value {
  color: var(--text);
  font-family: var(--mono);
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}

.metric-unit {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid rgba(65, 224, 163, 0.25);
  border-radius: 999px;
  background: rgba(65, 224, 163, 0.08);
  color: var(--green);
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
}

.meter {
  height: 9px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #070c10;
}

.meter-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1fbf86, #41e0a3, #5bd3e6);
  box-shadow: 0 0 14px rgba(65, 224, 163, 0.3);
  transition: width 0.45s ease, background 0.3s ease;
}

.meter.is-warn .meter-fill {
  background: linear-gradient(90deg, #d79a39, var(--amber));
  box-shadow: 0 0 14px rgba(240, 185, 91, 0.25);
}

.meter.is-danger .meter-fill {
  background: linear-gradient(90deg, #d94b4b, var(--red));
  box-shadow: 0 0 14px rgba(255, 107, 107, 0.25);
}

.quota-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
}

.status-light {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(65, 224, 163, 0.1), 0 0 12px rgba(65, 224, 163, 0.4);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin: 4px 0 0;
}

.stat {
  min-width: 0;
}

.stat dt {
  margin-bottom: 3px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat dd {
  display: flex;
  align-items: center;
  min-height: 20px;
  margin: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
}

/* Instance */

.kv-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 2px 0 12px;
}

.kv {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.015);
}

.kv-label {
  display: block;
  margin-bottom: 2px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.kv-value {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}

.flag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.6;
  white-space: nowrap;
}

.chip-warn {
  border-color: rgba(240, 185, 91, 0.3);
  background: rgba(240, 185, 91, 0.08);
  color: #f5cb85;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
}

.actions.is-busy {
  opacity: 0.65;
  pointer-events: none;
}

/* Data tables */

.table-wrap {
  width: 100%;
  margin-top: 10px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(4, 8, 11, 0.35);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  padding: 8px 11px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 9px 11px;
  border-top: 1px solid rgba(148, 196, 184, 0.07);
  color: var(--text-dim);
  vertical-align: top;
}

.data-table tbody tr:first-child td {
  border-top: 0;
}

.data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

.data-table .num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.cell-strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 550;
}

.cell-sub {
  display: block;
  margin-top: 1px;
  overflow-wrap: anywhere;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
}

.text-danger {
  color: #ffb3b3;
}

.path-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.path-chip {
  display: inline-block;
  max-width: 230px;
  overflow-wrap: anywhere;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
}

/* Badges and tones */

.state-badge,
.mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  line-height: 1.6;
  text-transform: uppercase;
  white-space: nowrap;
}

.tone-ok {
  border-color: rgba(65, 224, 163, 0.3);
  background: rgba(65, 224, 163, 0.09);
  color: #74f0bf;
}

.tone-idle {
  border-color: rgba(160, 180, 175, 0.18);
  background: rgba(160, 180, 175, 0.06);
  color: #a8b6b0;
}

.tone-busy {
  border-color: rgba(91, 211, 230, 0.3);
  background: rgba(91, 211, 230, 0.08);
  color: #8fd8f4;
}

.tone-warn {
  border-color: rgba(240, 185, 91, 0.32);
  background: rgba(240, 185, 91, 0.08);
  color: #f5cb85;
}

.tone-danger {
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.09);
  color: #ffabab;
}

.tone-info {
  border-color: rgba(91, 211, 230, 0.25);
  background: rgba(91, 211, 230, 0.07);
  color: #9ce6f2;
}

/* Empty states */

.empty {
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.012);
  color: var(--text-dim);
  font-size: 12.5px;
}

.empty p {
  margin: 0;
}

.empty p + p {
  margin-top: 4px;
}

.empty-title {
  margin: 0 0 3px !important;
  color: var(--text);
  font-weight: 600;
}

.empty-inline {
  margin-top: 10px;
  padding: 12px;
}

/* Forwards */

.forward-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.forward-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.015);
}

.forward-main {
  flex: 1 1 180px;
  min-width: 0;
}

.forward-url {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  text-decoration: none;
}

.forward-url[href]:hover {
  text-decoration: underline;
}

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

/* Usage and quickstart */

.pricing-note {
  margin: 0 0 2px;
  padding: 8px 10px;
  border-left: 2px solid rgba(65, 224, 163, 0.5);
  border-radius: 0 7px 7px 0;
  background: rgba(65, 224, 163, 0.045);
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.5;
}

.pricing-note strong {
  color: var(--text);
  font-family: var(--mono);
  font-weight: 600;
}

.usage-table {
  min-width: 420px;
}

.code-block {
  margin: 10px 0 0;
  padding: 11px 13px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #05090c;
  color: #cfe9de;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.85;
}

.code-block code {
  display: block;
  min-width: max-content;
}

.code-line {
  display: block;
  white-space: pre;
}

.code-line::before {
  content: "$ ";
  color: rgba(65, 224, 163, 0.75);
}

.quickstart-card .hint {
  margin: 10px 0 0;
}

/* Login and boot */

.boot-view,
.login-view {
  position: relative;
  z-index: 1;
}

.boot-view {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 100vh;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
}

.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(14px, 3vw, 32px);
}

.login-card {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  width: min(940px, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(15, 23, 31, 0.96), rgba(8, 13, 18, 0.98));
  box-shadow: var(--shadow);
}

.login-intro {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  min-width: 0;
  padding: clamp(24px, 4vw, 44px);
  border-right: 1px solid var(--border);
  background:
    radial-gradient(650px 340px at 0% 0%, rgba(65, 224, 163, 0.12), transparent 65%),
    radial-gradient(420px 300px at 100% 100%, rgba(91, 211, 230, 0.08), transparent 70%);
}

.login-intro::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 196, 184, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 196, 184, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 80%);
  mask-image: linear-gradient(to bottom, #000, transparent 80%);
}

.login-intro > * {
  position: relative;
  z-index: 1;
}

.brand-login .brand-mark {
  width: 36px;
  height: 36px;
}

.brand-login .brand-name {
  font-size: 15px;
}

.login-intro h1 {
  margin: 4px 0 0;
  font-size: clamp(25px, 3.2vw, 36px);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.login-lead {
  max-width: 42ch;
  margin: 0;
  color: var(--text-dim);
  font-size: 13.5px;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 2px 0 0;
  padding: 0;
  color: var(--text-dim);
  font-size: 12.5px;
  list-style: none;
}

.feature-list li {
  position: relative;
  padding-left: 18px;
}

.feature-list li::before {
  content: "›";
  position: absolute;
  left: 2px;
  top: -1px;
  color: var(--green);
  font-family: var(--mono);
}

.login-terminal {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin-top: 8px;
  padding: 9px 11px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #05090c;
  color: #9fb8ae;
  font-family: var(--mono);
  font-size: 11px;
}

.terminal-prompt {
  color: var(--green);
}

.terminal-cursor {
  width: 6px;
  height: 13px;
  background: var(--green);
  opacity: 0.8;
  animation: blink 1.1s steps(2, start) infinite;
}

.login-form-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: clamp(24px, 4vw, 42px);
  background: rgba(4, 8, 11, 0.35);
}

.eyebrow {
  margin: 0;
  color: rgba(65, 224, 163, 0.82);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-form-title {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 0 0 10px;
  color: var(--text-dim);
  font-size: 12.5px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.login-form-panel .hint {
  margin: 4px 0 0;
}

/* Admin */

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 16px;
}

.section-title {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}

.total {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(17, 26, 34, 0.8), rgba(10, 16, 22, 0.85));
}

.total-label {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.total-value {
  color: var(--text);
  font-family: var(--mono);
  font-size: 21px;
  letter-spacing: -0.02em;
}

.admin-meta {
  margin: 8px 0 16px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

#panel-admin > .card {
  margin-top: 16px;
}

#panel-admin .admin-grid + .card {
  margin-top: 0;
}

.machine-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 10px;
  margin-top: 2px;
}

.machine {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.015);
}

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

.machine-title {
  min-width: 0;
}

.machine-head .cell-strong {
  font-size: 12.5px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5b6a65;
}

.status-pill.is-online {
  color: #74f0bf;
}

.status-pill.is-online .dot {
  background: var(--green);
  box-shadow: 0 0 8px rgba(65, 224, 163, 0.6);
}

.status-pill.is-offline {
  color: #ffabab;
}

.status-pill.is-offline .dot {
  background: var(--red);
}

.machine-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin: 10px 0 8px;
}

.machine-stats dt {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.machine-stats dd {
  margin: 1px 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
}

.mini-meter {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #070c10;
}

.mini-meter-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #1fbf86, var(--cyan));
  transition: width 0.3s ease;
}

.machine > .mini-meter {
  margin-top: 4px;
}

.machine-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 9.5px;
}

.admin-users-table {
  min-width: 760px;
}

.admin-instances-table {
  min-width: 700px;
}

.admin-forwards-table {
  min-width: 640px;
}

.admin-users-table .row-actions {
  flex-wrap: nowrap;
}

/* Footer */

.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(12px, 3vw, 28px) 28px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10px;
}

.footer-meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* Modal and toast */

.modal {
  width: min(430px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(3, 6, 9, 0.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}

.modal-form h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.modal-form p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.toast-region {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(420px, calc(100vw - 24px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  max-width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(12, 20, 27, 0.96);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-size: 12px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  overflow-wrap: anywhere;
}

.toast.is-visible {
  opacity: 1;
  transform: none;
}

.toast-ok {
  border-color: rgba(65, 224, 163, 0.35);
}

.toast-error {
  border-color: rgba(255, 107, 107, 0.4);
  color: #ffc9c9;
}

.noscript {
  position: fixed;
  right: 12px;
  bottom: 12px;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-dim);
  font-size: 12px;
}

/* Animation */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 3px rgba(65, 224, 163, 0.12);
  }
  50% {
    opacity: 0.55;
    box-shadow: 0 0 0 4px rgba(65, 224, 163, 0.06);
  }
}

@keyframes blink {
  0%,
  49% {
    opacity: 0.8;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Responsive */

@media (max-width: 1120px) {
  .user-name {
    max-width: 120px;
  }
}

@media (max-width: 980px) {
  .quota-card,
  .status-card,
  .instance-card,
  .forwards-card,
  .usage-card,
  .quickstart-card {
    grid-column: span 12;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .tabs {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
  }

  .tab {
    flex: 1;
  }

  .login-card {
    grid-template-columns: 1fr;
  }

  .login-intro {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
  }

  .login-intro h1 {
    font-size: 26px;
  }

  .feature-list {
    display: none;
  }

  .login-terminal {
    display: none;
  }
}

@media (max-width: 700px) {
  .brand-sub {
    display: none;
  }

  .refresh-note {
    display: none;
  }

  .main {
    padding-top: 14px;
  }

  .form-grid,
  .form-grid-init,
  .form-grid-create,
  .form-row {
    grid-template-columns: 1fr;
  }

  .field-action .btn,
  .form-grid-create .field-action .btn {
    width: 100%;
  }

  .kv-grid {
    grid-template-columns: 1fr;
  }

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

  .user-name {
    max-width: 100px;
  }

  .section-title {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .app-header {
    gap: 9px 12px;
    padding: 9px 12px;
  }

  .header-meta {
    gap: 7px;
  }

  .user-chip {
    padding: 2px 6px 2px 8px;
  }

  .role-badge {
    display: none;
  }

  .user-name {
    max-width: 92px;
    font-size: 12px;
  }

  .btn-sm {
    padding: 4px 8px;
  }

  .quota-line {
    align-items: flex-start;
    flex-direction: column;
  }

  .stat-grid {
    gap: 10px 12px;
  }

  .card-head {
    gap: 8px;
  }

  .card-head .hint {
    display: none;
  }

  .admin-meta {
    font-size: 10px;
  }

  .total {
    padding: 10px 11px;
  }

  .total-value {
    font-size: 18px;
  }

  .login-view {
    padding: 0;
  }

  .login-card {
    min-height: 100vh;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .login-intro {
    padding: 22px 20px 18px;
  }

  .login-lead {
    font-size: 12.5px;
  }

  .login-form-panel {
    padding: 22px 20px 28px;
  }

  .app-footer {
    padding-bottom: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
