:root {
  --bg: #020202;
  --sidebar: #030303;
  --panel: #202020;
  --panel-hover: #282828;
  --panel-soft: #151515;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(0, 138, 255, 0.55);
  --text: #f5f7fa;
  --muted: rgba(245, 247, 250, 0.7);
  --faint: rgba(245, 247, 250, 0.46);
  --blue: #008aff;
  --blue-bright: #2aa2ff;
  --danger: #ff6b6b;
  --font-body: "Roboto", Arial, sans-serif;
  --font-display: "Roboto Condensed", "Roboto", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-body);
  line-height: 1.45;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.portal-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 124px;
  padding: 20px 28px;
  color: var(--blue-bright);
  font-family: var(--font-display);
  font-size: clamp(1.95rem, 2.4vw, 2.45rem);
  font-weight: 500;
  letter-spacing: 0.06em;
}

.portal-brand img {
  width: 64px;
  height: 64px;
  display: block;
}

.portal-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 6px 12px 24px;
}

.nav-item,
.nav-group-trigger,
.logout-link {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border: 0;
  color: var(--text);
  font-family: var(--font-display);
  background: transparent;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.nav-item:hover,
.logout-link:hover,
.nav-subitem:hover {
  color: var(--blue-bright);
}

.nav-icon {
  position: relative;
  width: 24px;
  height: 24px;
  display: inline-block;
  color: var(--blue);
}

.grid-icon {
  background:
    linear-gradient(var(--blue), var(--blue)) 0 0 / 10px 10px no-repeat,
    linear-gradient(var(--blue), var(--blue)) 14px 0 / 10px 10px no-repeat,
    linear-gradient(var(--blue), var(--blue)) 0 14px / 10px 10px no-repeat,
    linear-gradient(var(--blue), var(--blue)) 14px 14px / 10px 10px no-repeat;
}

.user-icon::before {
  position: absolute;
  top: 2px;
  left: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  content: "";
}

.user-icon::after {
  position: absolute;
  right: 0;
  bottom: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, transparent 3px, var(--blue) 4px 6px, transparent 7px),
    linear-gradient(var(--blue), var(--blue)) center / 3px 13px no-repeat,
    linear-gradient(var(--blue), var(--blue)) center / 13px 3px no-repeat;
  content: "";
}

.settings-icon::before,
.logout-icon::before {
  position: absolute;
  inset: 5px;
  border: 3px solid var(--blue);
  border-radius: 4px;
  content: "";
}

.settings-icon::after {
  position: absolute;
  inset: 10px 2px auto auto;
  width: 10px;
  height: 3px;
  background: var(--blue);
  content: "";
}

.logout-icon::after {
  position: absolute;
  top: 10px;
  right: 0;
  width: 15px;
  height: 3px;
  background: var(--blue);
  box-shadow: 5px -5px 0 -2px var(--blue), 5px 5px 0 -2px var(--blue);
  content: "";
}

.chevron {
  width: 12px;
  height: 12px;
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
  transform: rotate(-45deg) translateY(3px);
}

.nav-group {
  margin: 0;
}

.nav-subitem {
  display: block;
  min-height: 48px;
  margin-left: 8px;
  padding: 13px 16px 13px 78px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.98rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-subitem.active {
  color: var(--text);
  background: var(--panel-soft);
}

.logout-link {
  margin: 0 12px 24px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  width: auto;
}

.portal-main {
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(0, 138, 255, 0.05), transparent 28rem),
    var(--bg);
}

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 124px;
  padding: 28px clamp(28px, 5vw, 64px);
}

.portal-eyebrow {
  margin: 0 0 8px;
  color: var(--blue-bright);
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--blue);
  font-size: clamp(1.45rem, 2.3vw, 2rem);
  font-weight: 700;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 0;
  color: var(--blue);
  font-size: clamp(2rem, 3.2vw, 3rem);
  font-weight: 500;
}

h3 {
  margin-bottom: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.account-status {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 18px rgba(0, 138, 255, 0.8);
}

.portal-content {
  padding: 32px clamp(28px, 5vw, 64px) 64px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 42px;
  color: var(--blue-bright);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.back-link::before {
  width: 12px;
  height: 12px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
  content: "";
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 24px;
  border: 1px solid var(--blue);
  border-radius: 26px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 16px 42px rgba(0, 138, 255, 0.28);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.create-client-page {
  min-height: 100vh;
  background: #000;
}

.create-client-content {
  width: 100%;
  padding: 32px clamp(28px, 5vw, 64px) 64px;
}

.create-client-content h2 {
  margin-bottom: 46px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(1.02rem, 1.35vw, 1.28rem);
  font-weight: 400;
  line-height: 1.35;
  text-transform: none;
}

.create-client-content h2 span {
  display: inline-block;
  margin-left: 12px;
  overflow-wrap: anywhere;
  font-weight: 500;
}

.app-client-form {
  display: grid;
  gap: 34px;
}

.form-field {
  display: grid;
  gap: 9px;
}

.form-field label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.form-field input,
.form-field textarea {
  width: 100%;
  border: 1px solid rgba(245, 247, 250, 0.24);
  border-radius: 5px;
  color: var(--text);
  background: #000;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.form-field input {
  height: 66px;
  padding: 0 18px;
  font-size: clamp(0.98rem, 1.15vw, 1.08rem);
}

.form-field textarea {
  min-height: 190px;
  resize: vertical;
  padding: 18px;
  font-size: clamp(0.98rem, 1.15vw, 1.08rem);
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 138, 255, 0.18);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: transparent;
}

.form-field input:placeholder-shown + p,
.form-field textarea:placeholder-shown + p {
  color: var(--faint);
}

.form-field p {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.form-field input:empty {
  color: var(--text);
}

.form-field input,
.form-field textarea {
  caret-color: var(--blue-bright);
}

.form-field {
  position: relative;
}

.form-field::before {
  position: absolute;
  top: 20px;
  left: 18px;
  z-index: 0;
  color: var(--faint);
  font-size: clamp(0.98rem, 1.15vw, 1.08rem);
  pointer-events: none;
  content: attr(data-placeholder);
}

.form-field:focus-within::before,
.form-field:has(input:not(:placeholder-shown))::before,
.form-field:has(textarea:not(:placeholder-shown))::before {
  display: none;
}

.permission-fieldset {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px 30px;
  margin: 0;
  padding: 0;
  border: 0;
}

.permission-fieldset legend {
  flex-basis: 100%;
  margin-bottom: 4px;
  color: var(--text);
  font-size: clamp(1rem, 1.2vw, 1.12rem);
}

.permission-fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
  font-size: clamp(0.98rem, 1.15vw, 1.08rem);
}

.permission-fieldset input {
  width: 22px;
  height: 22px;
  margin: 0;
  appearance: none;
  border: 2px solid var(--muted);
  border-radius: 3px;
  background: transparent;
}

.permission-fieldset input:checked {
  border-color: var(--blue);
  background:
    linear-gradient(45deg, transparent 45%, #fff 46% 54%, transparent 55%) center / 16px 16px no-repeat,
    var(--blue);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  padding-top: 2px;
}

.form-status {
  margin: -12px 0 0;
  color: var(--blue-bright);
  font-size: 0.92rem;
}

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

.form-actions .primary-action {
  min-height: 52px;
  padding-inline: 24px;
  border-radius: 26px;
  font-size: 0.9rem;
}

.secondary-link {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
}

.secondary-link:hover {
  color: var(--blue-bright);
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  color: var(--blue-bright);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.secondary-action:hover {
  border-color: var(--blue-bright);
}

.credential-result {
  display: grid;
  gap: 22px;
  margin-top: 42px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
}

.success-note {
  max-width: 760px;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 1rem;
}

.credential-result[hidden] {
  display: none;
}

.credential-result-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.credential-result-heading h3 {
  font-family: "Roboto", Arial, sans-serif;
  font-size: 1.08rem;
  font-weight: 500;
}

.credential-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

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

.credential-grid div {
  min-width: 0;
}

.credential-grid dd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.credential-tutorial {
  display: grid;
  gap: 18px;
}

.tutorial-step {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
}

.tutorial-step-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.tutorial-step-heading span {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--blue-bright);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.tutorial-step-heading h4 {
  margin: 0 0 7px;
  color: var(--text);
  font-family: "Roboto", Arial, sans-serif;
  font-size: 1rem;
  font-weight: 600;
}

.tutorial-step-heading p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.credential-curl {
  overflow-x: auto;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #dce7f5;
  background: #06080b;
  font-size: 0.78rem;
  line-height: 1.6;
  white-space: pre;
}

.copy-curl-action {
  justify-self: start;
}

.account-summary {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, minmax(140px, 0.7fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.account-summary div {
  min-width: 0;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.035);
}

.account-summary span,
dt {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.account-summary strong,
dd {
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
}

.account-summary strong {
  display: block;
  overflow-wrap: anywhere;
}

.transaction-range-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
  align-items: end;
  gap: 18px;
  margin-bottom: 26px;
}

.transaction-date-field {
  display: grid;
  gap: 8px;
}

.transaction-date-field label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.transaction-date-field input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 14px;
  color: var(--text);
  color-scheme: dark;
  background: rgba(255, 255, 255, 0.045);
  outline: none;
}

.transaction-date-field input:focus {
  border-color: var(--line-strong);
}

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

.transaction-records {
  margin-top: 34px;
}

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

.transaction-records-heading h3 {
  font-size: 1.45rem;
}

.transaction-records-heading span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
}

.transaction-record-list {
  display: grid;
  gap: 14px;
}

.transaction-record {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
}

.transaction-record h4 {
  margin: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.transaction-record pre {
  overflow-x: auto;
  margin: 0;
  padding: 16px 18px;
  color: #dce7f5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
}

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

.client-load-status {
  min-height: 22px;
  margin: -8px 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.search-shell {
  position: relative;
  width: min(100%, 420px);
}

.search-shell span {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 13px;
  height: 13px;
  border: 2px solid var(--faint);
  border-radius: 50%;
  transform: translateY(-50%);
}

.search-shell span::after {
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  background: var(--faint);
  transform: rotate(45deg);
  content: "";
}

.search-shell input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 16px 0 42px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  outline: none;
}

.search-shell input:focus {
  border-color: var(--line-strong);
}

.view-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, 50px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.view-toggle button {
  display: grid;
  place-items: center;
  height: 42px;
  border: 0;
  color: var(--text);
  background: transparent;
}

.view-toggle button.active {
  background: rgba(255, 255, 255, 0.18);
}

.view-toggle .grid-icon,
.view-toggle .list-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.list-icon {
  background:
    linear-gradient(var(--text), var(--text)) left 2px top 3px / 22px 3px no-repeat,
    linear-gradient(var(--text), var(--text)) left 2px top 9px / 22px 3px no-repeat,
    linear-gradient(var(--text), var(--text)) left 2px top 15px / 22px 3px no-repeat;
}

.client-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 28px;
}

.client-card {
  min-height: 260px;
  padding: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--panel);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.client-card:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
  transform: translateY(-1px);
}

.client-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 44px;
}

.card-actions {
  display: flex;
  gap: 14px;
}

.card-actions button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 4px;
  background: transparent;
}

.card-actions button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.edit-icon,
.delete-icon {
  position: relative;
  width: 18px;
  height: 18px;
  display: block;
  color: var(--faint);
}

.edit-icon::before {
  position: absolute;
  top: 8px;
  left: 1px;
  width: 18px;
  height: 5px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(-45deg);
  content: "";
}

.delete-icon::before {
  position: absolute;
  top: 5px;
  left: 4px;
  width: 11px;
  height: 12px;
  border-radius: 0 0 2px 2px;
  background: currentColor;
  content: "";
}

.delete-icon::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 3px;
  background: currentColor;
  content: "";
}

dl {
  display: grid;
  gap: 17px;
  margin: 0;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.list-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
}

.list-preview[hidden] {
  display: none;
}

.client-card[hidden],
.list-row[hidden],
.empty-results[hidden] {
  display: none;
}

.list-row {
  display: grid;
  grid-template-columns: 1fr 1.55fr 0.7fr 0.85fr;
  gap: 18px;
  min-height: 54px;
  align-items: center;
  padding: 0 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

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

.list-row strong {
  color: var(--text);
}

.list-head {
  min-height: 44px;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.empty-results {
  margin: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  text-align: center;
}

@media (max-width: 1180px) {
  .portal-shell {
    grid-template-columns: 232px minmax(0, 1fr);
  }

  .portal-brand {
    padding-inline: 20px;
    font-size: 1.8rem;
  }

  .portal-brand img {
    width: 52px;
    height: 52px;
  }

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

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

@media (max-width: 860px) {
  .portal-shell {
    display: block;
  }

  .portal-sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .portal-brand {
    min-height: 88px;
  }

  .portal-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-bottom: 14px;
  }

  .logout-link {
    margin-bottom: 14px;
  }

  .portal-topbar,
  .page-heading,
  .transaction-records-heading,
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-chip {
    white-space: normal;
  }

  .primary-action,
  .search-shell {
    width: 100%;
  }

  .client-grid,
  .credential-grid,
  .account-summary,
  .transaction-range-form,
  .list-row {
    grid-template-columns: 1fr;
  }

  .credential-result-heading {
    flex-direction: column;
  }

  .credential-actions {
    width: 100%;
    justify-content: stretch;
  }

  .credential-actions .primary-action,
  .credential-actions .secondary-action {
    width: 100%;
  }

  .tutorial-step-heading {
    flex-direction: column;
  }

  .list-row {
    gap: 6px;
    padding-block: 14px;
  }
}

@media (max-width: 560px) {
  .portal-nav {
    grid-template-columns: 1fr;
  }

  .portal-content,
  .portal-topbar {
    padding-inline: 20px;
  }

  .client-card {
    padding: 22px;
  }
}
