.account-overview {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: 54px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
}

.account-scope {
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 5px 10px;
  border-right: 1px solid var(--line);
}

.account-scope label,
.account-summary dt {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.account-select-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.account-select-row select {
  width: 132px;
  min-width: 0;
  max-width: 132px;
  height: 26px;
  padding: 0 22px 0 7px;
  color: var(--ink);
  color-scheme: dark;
  background: #0d0d0d;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.account-select-row select:hover,
.account-select-row select:focus {
  background: #171717;
  border-color: #4a4a4a;
  outline: 0;
}

.account-select-row select option {
  color: #f5f5f5;
  color-scheme: dark;
  background-color: #121212;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

.account-select-row select option:checked {
  color: #ffffff;
  background-color: #2a2a2a;
}

.account-select-row select:disabled {
  color: var(--ink);
  opacity: 1;
}

.account-select-row span {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

.account-select-row button,
.account-manager button {
  color: var(--ink);
  background: #171717;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.account-select-row button {
  height: 26px;
  margin-left: auto;
  padding: 0 9px;
}

.account-select-row button:hover,
.account-manager button:hover {
  background: #242424;
  border-color: #4a4a4a;
}

.account-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  min-width: 0;
  margin: 0;
}

.account-summary > div {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  padding: 5px 10px;
  border-right: 1px solid var(--line);
}

.account-summary dd {
  margin: 0;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-summary dd.is-positive {
  color: var(--price-up);
}

.account-summary dd.is-negative {
  color: var(--price-down);
}

.account-health {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 132px;
  padding: 0 11px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

.account-health i {
  width: 6px;
  height: 6px;
  background: var(--line-strong);
  border-radius: 50%;
}

.account-health.is-connected i {
  background: var(--green);
}

.account-health.is-error i {
  background: var(--red);
}

.account-manager {
  width: min(1080px, calc(100vw - 28px));
  max-width: none;
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: #080808;
  border: 1px solid #353535;
  border-radius: 5px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.72);
}

.account-manager::backdrop {
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(2px);
}

.account-manager-shell {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  max-height: calc(100vh - 30px);
}

.account-manager-header {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: #0d0d0d;
  border-bottom: 1px solid var(--line);
}

.account-manager-header > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.account-manager-header span,
.account-form header span,
.account-roster header span {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
}

.account-manager h2,
.account-manager h3,
.account-manager p {
  margin: 0;
}

.account-manager h2 {
  font-size: 18px;
  letter-spacing: 0.03em;
}

.account-manager h3 {
  font-size: 14px;
}

.account-manager-header button,
.account-token-strip button,
.account-roster > header button,
.account-form footer button {
  min-height: 30px;
  padding: 0 11px;
}

.account-token-strip {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: #0a0a0a;
  border-bottom: 1px solid var(--line);
}

.account-token-strip label,
.account-field span {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
}

.account-token-strip small,
.account-credential-note {
  color: #777777;
  font-size: 12px;
}

.account-manager input[type="text"],
.account-manager input[type="password"] {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  color: var(--ink);
  background: #111111;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  outline: 0;
  font-family: var(--font-mono);
  font-size: 12px;
}

.account-manager input:focus {
  border-color: #666666;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
}

.account-manager-message {
  min-height: 30px;
  padding: 6px 12px;
  color: var(--ink-soft);
  background: #0d0d0d;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
}

.account-manager-message.is-success {
  color: var(--green);
}

.account-manager-message.is-error {
  color: var(--red);
}

.account-manager-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  min-height: 420px;
  overflow: hidden;
}

.account-roster {
  min-width: 0;
  padding: 10px 12px;
  overflow: auto;
  border-right: 1px solid var(--line);
}

.account-roster > header,
.account-form > header,
.account-form > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.account-roster > header > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.account-manager-list {
  display: grid;
  gap: 6px;
  margin-top: 9px;
}

.account-manager-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 8px 9px;
  background: #0e0e0e;
  border: 1px solid var(--line);
  border-left: 2px solid #3a3a3a;
}

.account-manager-row:hover {
  background: #121212;
  border-left-color: var(--green);
}

.account-row-identity {
  min-width: 0;
}

.account-row-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.account-row-title strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-row-identity > small {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
}

.account-env-badge,
.account-state-badge {
  padding: 2px 5px;
  color: #a8a8a8;
  background: #1b1b1b;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

.account-state-badge.is-connected {
  color: var(--green);
  background: var(--green-soft);
}

.account-state-badge.is-error {
  color: var(--red);
  background: var(--red-soft);
}

.account-state-badge.is-disabled {
  color: #777777;
}

.account-row-error {
  margin-top: 3px !important;
  overflow: hidden;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-row-actions {
  display: flex;
  gap: 4px;
}

.account-row-actions button {
  min-height: 28px;
  padding: 0 8px;
}

.account-row-actions button.is-danger {
  color: var(--red);
}

.account-manager button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.account-manager.is-busy button,
.account-manager.is-busy input {
  pointer-events: none;
  opacity: 0.58;
}

.account-manager-empty {
  margin-top: 9px !important;
  padding: 22px 12px;
  color: var(--ink-soft);
  background: #0d0d0d;
  border: 1px dashed var(--line-strong);
  font-size: 13px;
  text-align: center;
}

.account-form {
  display: grid;
  align-content: start;
  gap: 9px;
  padding: 10px 12px;
  overflow: auto;
  background: #0a0a0a;
}

.account-form > header {
  min-height: 30px;
  border-bottom: 1px solid var(--line);
}

.account-field {
  display: grid;
  gap: 4px;
}

.account-form-flags {
  display: flex;
  gap: 18px;
  padding: 4px 0;
}

.account-form-flags label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.account-form-flags input {
  width: 15px;
  height: 15px;
  accent-color: var(--green);
}

.account-form > footer {
  justify-content: flex-end;
  padding-top: 4px;
}

.account-manager button.is-primary {
  color: #050505;
  background: var(--green);
  border-color: var(--green);
  font-weight: 700;
}

.account-manager button.is-primary:hover {
  background: #00d495;
}

@media (max-width: 1080px) {
  .account-overview {
    grid-template-columns: 218px minmax(0, 1fr);
  }

  .account-health {
    display: none;
  }

  .account-token-strip {
    grid-template-columns: auto minmax(180px, 1fr) auto;
  }

  .account-token-strip small {
    display: none;
  }
}

@media (max-width: 800px) {
  .account-overview {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .account-summary {
    grid-template-columns: repeat(4, minmax(76px, 1fr));
  }

  .account-summary > div:nth-child(5) {
    display: none;
  }

  .account-manager-workspace {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .account-roster {
    max-height: 280px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .account-form {
    overflow: visible;
  }
}

@media (max-width: 560px) {
  .account-overview {
    grid-template-columns: 180px minmax(0, 1fr);
    min-height: 52px;
  }

  .account-scope,
  .account-summary > div {
    padding-inline: 8px;
  }

  .account-select-row {
    gap: 4px;
  }

  .account-select-row select {
    width: 76px;
    max-width: 76px;
    padding-right: 10px;
  }

  .account-select-row button {
    padding-inline: 7px;
  }

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

  .account-summary > div:nth-child(n+3) {
    display: none;
  }

  .account-token-strip {
    grid-template-columns: 1fr auto;
  }

  .account-token-strip label {
    grid-column: 1 / -1;
  }

  .account-manager-header > div,
  .account-row-title {
    flex-wrap: wrap;
  }

  .account-manager-row {
    grid-template-columns: 1fr;
  }

  .account-row-actions {
    justify-content: flex-end;
  }
}
