@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 650;
  font-display: swap;
  src: url('assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('assets/fonts/inter-latin-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f7f9fc;
  --surface: #fbfcff;
  --line: #e7ecf3;
  --line-strong: #d8dee8;
  --text: #020407;
  --muted: #5a6472;
  --charcoal: #20242b;
  --blue: #2255c6;
  --blue-soft: #eef4ff;
  --focus: rgba(34, 85, 198, 0.12);
  --success: #067647;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

/* Login screen */

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

.login-card {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 32px;
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.06);
}

.login-card img {
  width: 132px;
  height: auto;
  margin-bottom: 4px;
}

.login-card h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.login-card p.login-hint {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-card label {
  display: grid;
  gap: 7px;
}

.login-card label span {
  color: #344054;
  font-size: 12px;
  font-weight: 650;
}

.login-card input {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  padding: 0 12px;
  font: 14px Inter, Arial, sans-serif;
  color: var(--text);
}

.login-card input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--focus);
  outline: 0;
}

.login-card button {
  min-height: 46px;
  border: 1px solid var(--charcoal);
  border-radius: 6px;
  background: var(--charcoal);
  color: #f8fafc;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.login-card p.login-status {
  min-height: 18px;
  margin: 0;
  color: #b00000;
  font-size: 13px;
  font-weight: 650;
}

/* App shell */

.panel-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.panel-header {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: start;
  width: 264px;
  border-right: 1px solid var(--line);
  background: rgba(251, 252, 255, 0.96);
  padding: 24px 18px 18px;
  box-shadow: 8px 0 22px rgba(17, 24, 39, 0.035);
}

.panel-brand {
  display: inline-flex;
  align-items: center;
  margin-bottom: 28px;
}

.panel-brand img {
  display: block;
  width: 124px;
  height: auto;
}

.panel-nav {
  display: grid;
  min-width: 0;
  align-items: start;
  gap: 2px;
}

.panel-nav-section {
  display: block;
  margin: 24px 0 9px;
  border-top: 1px solid var(--line);
  color: #344054;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.1;
  padding: 15px 11px 0;
  text-transform: uppercase;
}

.panel-nav-section:first-child {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

.panel-nav-link {
  position: relative;
  display: inline-flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4f5b6b;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.panel-nav-link:hover,
.panel-nav-link.active {
  background: #f0f4fa;
  color: var(--text);
}

.panel-user {
  display: grid;
  min-width: 0;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.panel-user span {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-logout,
.section-action {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--charcoal);
  border-radius: 6px;
  background: var(--charcoal);
  color: #f8fafc;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.section-action.secondary-action {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--text);
}

.panel-main {
  width: 100%;
  margin: 0;
  padding: 26px 28px 54px;
  grid-column: 2;
}

/* Stat tiles */

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

.metric,
.panel-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric {
  display: grid;
  gap: 10px;
  min-height: 104px;
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.metric strong {
  color: var(--text);
  font-size: 25px;
  font-weight: 650;
}

.panel-section {
  padding: 20px;
  margin-bottom: 14px;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.panel-section h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.25;
}

.panel-section p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* Generic tables (tunnels / tickets / abuse / ledger) */

.data-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.data-row {
  display: grid;
  gap: 14px;
  align-items: center;
  min-height: 54px;
  border-top: 1px solid var(--line);
  padding: 0 14px;
}

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

.data-head {
  min-height: 42px;
  background: #f3f6fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.data-row strong,
.data-row span,
.data-row time {
  min-width: 0;
  overflow: hidden;
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-row strong {
  color: var(--text);
  font-weight: 650;
}

.data-row span,
.data-row time {
  color: var(--muted);
}

.data-row.clickable {
  width: 100%;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.data-row.clickable:hover {
  background: #f8fafc;
}

.tunnels-row { grid-template-columns: 90px minmax(160px, 1.2fr) 120px minmax(140px, 1fr) 130px; }
.tickets-row { grid-template-columns: minmax(180px, 1.2fr) 130px 130px 130px; }
.abuse-row { grid-template-columns: 150px 140px minmax(220px, 1fr) 120px; }
.ledger-row { grid-template-columns: 140px 110px 140px 130px; }

.status-pill {
  justify-self: start;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #344054 !important;
  padding: 5px 9px;
  font-size: 11px !important;
  font-weight: 750;
}

.status-pill.good {
  border-color: #abefc6;
  background: #ecfdf3;
  color: #067647 !important;
}

.status-pill.warn {
  border-color: #fedf89;
  background: #fffaeb;
  color: #b54708 !important;
}

.empty-row {
  padding: 24px 14px;
  color: var(--muted);
  font-size: 13px;
}

/* Ticket detail thread */

.ticket-thread {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.ticket-message {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.ticket-message.staff-message {
  border-left: 3px solid var(--blue);
  background: #fff;
}

.ticket-message div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ticket-message strong {
  font-size: 12px;
  font-weight: 750;
}

.ticket-message time {
  color: var(--muted);
  font-size: 11px;
}

.ticket-message p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Forms */

.order-input {
  display: grid;
  gap: 7px;
}

.order-input span {
  color: #344054;
  font-size: 12px;
  font-weight: 650;
}

.order-input input,
.order-input select,
.order-input textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
}

.order-input textarea {
  min-height: 120px;
  padding-top: 10px;
  line-height: 1.45;
  resize: vertical;
}

.order-input input:focus,
.order-input select:focus,
.order-input textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--focus);
  outline: 0;
}

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

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.checkout-btn {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--blue);
  border-radius: 6px;
  background: var(--blue);
  color: #f8fafc;
  padding: 0 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.checkout-btn:hover {
  filter: brightness(0.92);
}

.checkout-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.checkout-status.is-error {
  color: #b00000;
  font-weight: 750;
}

/* Developer API keys */

.developer-key-form {
  display: grid;
  gap: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 18px;
}

.developer-key-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.developer-key-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 2fr) 130px auto;
  gap: 14px;
  align-items: center;
  min-height: 58px;
  border-top: 1px solid var(--line);
  padding: 10px 14px;
}

.developer-key-row:first-child { border-top: 0; }
.developer-key-row strong { color: var(--text); font-size: 13px; }
.developer-key-row span { color: var(--muted); font-size: 12px; }
.developer-key-empty { padding: 24px 14px; color: var(--muted); font-size: 13px; }

.developer-secret {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  padding: 12px;
  color: var(--text);
  font-size: 13px;
}

.developer-secret input {
  min-width: 0;
  border: 1px solid #bfdbfe;
  border-radius: 5px;
  background: #fff;
  padding: 8px 10px;
  font: 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.developer-secret button {
  min-height: 32px;
  border: 1px solid var(--charcoal);
  border-radius: 6px;
  background: var(--charcoal);
  color: #fff;
  padding: 0 12px;
  font-weight: 650;
  font-size: 12px;
  cursor: pointer;
}

/* Wallet embedded checkout */

.wallet-embedded-checkout {
  min-height: 620px;
  margin-top: 14px;
}

/* Tunnel detail */

.service-detail-layout {
  display: grid;
  gap: 16px;
}

.service-overview-grid {
  display: grid;
  grid-template-columns: minmax(210px, 1.15fr) minmax(210px, 1.15fr) minmax(150px, 0.7fr) minmax(230px, 1.2fr);
  gap: 12px;
}

.service-info-card {
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.service-info-card span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.service-info-card strong {
  display: block;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.service-traffic-card {
  min-height: 126px;
}

.traffic-meter {
  overflow: hidden;
  width: 100%;
  height: 9px;
  margin-top: 14px;
  border-radius: 999px;
  background: #e8edf5;
}

.traffic-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 180ms ease;
}

.service-info-card p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.service-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 16px;
  align-items: start;
}

.service-ip-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.service-panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.service-panel-heading h3 {
  margin: 0 0 5px;
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
}

.service-panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.service-panel-heading > span {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: #344054;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.assigned-ip-list {
  display: grid;
  max-height: 430px;
  overflow: auto;
}

.assigned-ip-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  padding: 8px 16px;
}

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

.assigned-ip-head {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 38px;
  background: #f3f6fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.assigned-ip-row code {
  color: var(--text);
  font: 13px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.assigned-ip-row input {
  width: 100%;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  outline: 0;
}

.assigned-ip-row input:focus {
  border-color: var(--blue);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--focus);
}

.assigned-ip-empty,
.inline-save-status {
  color: var(--muted);
  font-size: 13px;
}

.assigned-ip-empty {
  padding: 18px 16px;
}

.inline-save-status {
  min-height: 20px;
  margin: 0;
  padding: 12px 16px 0;
}

.service-detail-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 16px;
}

.service-detail-summary dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

.service-detail-summary div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.service-detail-summary div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.service-detail-summary dt,
.service-detail-summary dd {
  margin: 0;
  font-size: 13px;
}

.service-detail-summary dt {
  color: var(--muted);
}

.service-detail-summary dd {
  color: var(--text);
  font-weight: 650;
  text-align: right;
}

.service-cancel-btn {
  width: 100%;
  margin-top: 10px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff;
  color: #b91c1c;
  cursor: pointer;
  font: 800 13px/1 Inter, sans-serif;
  padding: 12px 14px;
}

.service-cancel-btn:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #fca5a5;
}

.service-cancel-btn:disabled {
  cursor: default;
  opacity: 0.65;
}

.service-cancel-status {
  margin: 8px 0 0;
  min-height: 18px;
}

.service-code-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.service-code-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.service-code-panel h3 {
  margin: 0 0 5px;
  color: var(--text);
  font-size: 15px;
}

.service-code-panel textarea {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  border: 1px solid #18243a;
  border-radius: 8px;
  background: #0f172a;
  color: #e5eefc;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  padding: 14px;
  outline: none;
}

@media (max-width: 900px) {
  .service-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .service-workspace-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

@media (max-width: 900px) {
  .panel-shell {
    grid-template-columns: 1fr;
  }

  .panel-header {
    position: static;
    width: 100%;
    box-shadow: none;
  }

  .panel-main {
    grid-column: 1;
  }
}

@media (max-width: 760px) {
  .developer-key-row { grid-template-columns: 1fr; gap: 6px; }
  .developer-secret { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .tunnels-row,
  .tickets-row,
  .abuse-row,
  .ledger-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px;
  }
  .data-head {
    display: none;
  }
}

/* API documentation */

.docs-content h3 {
  margin: 28px 0 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
}

.docs-content h3:first-of-type {
  margin-top: 4px;
}

.docs-content p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.docs-content code {
  border-radius: 4px;
  background: #eef1f6;
  padding: 2px 5px;
  color: var(--text);
  font: 12px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.docs-content pre {
  overflow-x: auto;
  margin: 0 0 12px;
  border: 1px solid #18243a;
  border-radius: 8px;
  background: #0f172a;
  padding: 14px;
  color: #e5eefc;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.docs-content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
}

.docs-method {
  display: inline-block;
  margin-right: 4px;
  border-radius: 4px;
  background: var(--blue);
  padding: 2px 7px;
  color: #fff;
  font-size: 11px;
  font-weight: 750;
}

.docs-scope-row {
  grid-template-columns: 160px minmax(0, 1fr);
}

.docs-scope-row code {
  align-self: center;
}

.docs-param-table {
  width: 100%;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-collapse: collapse;
  font-size: 13px;
}

.docs-param-table th,
.docs-param-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
}

.docs-param-table th {
  background: #f3f6fb;
  color: var(--muted);
  font-size: 12px;
}

.docs-param-table td:first-child {
  white-space: nowrap;
}
