.balance-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.balance-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 0.9rem;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: 0 10px 30px rgba(8, 47, 73, 0.35);
}

.balance-card .label {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.balance-card .value {
  font-family: "Fira Code", "Source Code Pro", monospace;
  font-size: 1.5rem;
  color: var(--highlight);
}

:root {
  color-scheme: dark;
  font-family: "Inter", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --info: #22d3ee;
  --success: #4ade80;
  --warning: #facc15;
  --error: #f87171;
  --highlight: #60a5fa;
  --command: #cbd5f5;
  --response: #f472b6;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at top, #1e293b, #0f172a 65%);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: rgba(30, 41, 59, 0.85);
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

.app-header h1 {
  font-size: 1.5rem;
  color: var(--highlight);
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
  margin-right: calc(clamp(260px, 32vw, 600px) + 2rem);
  width: calc(100% - clamp(260px, 32vw, 600px) - 2rem);
}

.panel {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--panel-border);
  border-radius: 1rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.45);
}

.panel-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.page-info {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.transactions-panel {
  grid-column: 1 / -1;
  width: 100%;
}

.transactions-list {
  max-height: 260px;
  overflow-y: auto;
  gap: 0.75rem;
}

.transaction-item {
  border: 1px solid rgba(96, 165, 250, 0.15);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.transaction-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.transaction-description {
  font-weight: 600;
  color: var(--text);
}

.transaction-value {
  font-family: "Fira Code", "Source Code Pro", monospace;
}

.transaction-value.positive {
  color: var(--success);
}

.transaction-value.negative {
  color: var(--error);
}

.transaction-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.transaction-tag {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(96, 165, 250, 0.15);
  color: var(--highlight);
  border: 1px solid rgba(96, 165, 250, 0.35);
}

.transaction-tag.negative {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
  border-color: rgba(248, 113, 113, 0.35);
}

.transaction-tag.positive {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
  border-color: rgba(74, 222, 128, 0.35);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.panel h2 {
  color: var(--highlight);
  font-size: 1.1rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sub-panel {
  padding: 1rem;
  border: 1px dashed var(--panel-border);
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.6);
}

.list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 220px;
  overflow-y: auto;
}

.credential-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--panel-border);
  background: rgba(15, 23, 42, 0.7);
}

.credential-item.active {
  border-color: var(--highlight);
  box-shadow: 0 0 0 1px var(--highlight);
}

.credential-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.credential-name {
  font-size: 1rem;
  color: var(--text);
}

.credential-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.credential-status.success {
  color: var(--success);
}

.credential-status.warning {
  color: var(--warning);
}

.credential-actions {
  display: flex;
  gap: 0.5rem;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 0.6rem;
  padding: 0.6rem 1rem;
  background: var(--highlight);
  color: #0f172a;
  font-weight: 600;
  transition: transform 0.1s ease, background 0.2s ease;
}

button.secondary {
  background: rgba(148, 163, 184, 0.2);
  color: var(--muted);
}

button.danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input, textarea {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--panel-border);
  border-radius: 0.6rem;
  padding: 0.6rem 0.75rem;
  color: var(--text);
}

input:focus, textarea:focus {
  outline: 2px solid var(--highlight);
  border-color: var(--highlight);
}

.log-panel {
  position: fixed;
  top: calc(1.5rem + 96px);
  right: 1.5rem;
  width: clamp(260px, 32vw, 600px);
  bottom: 1.5rem;
  grid-column: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
}

.log-output {
  flex: 1;
  background: rgba(3, 7, 18, 0.8);
  border-radius: 0.75rem;
  border: 1px solid rgba(96, 165, 250, 0.2);
  padding: 1rem;
  overflow-y: auto;
  font-family: "Fira Code", "Source Code Pro", monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.log-entry {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.log-entry .label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(203, 213, 225, 0.6);
}

.log-entry.info {
  color: var(--info);
}

.log-entry.success {
  color: var(--success);
}

.log-entry.warning {
  color: var(--warning);
}

.log-entry.error {
  color: var(--error);
}

.log-entry.highlight {
  color: var(--highlight);
}

.log-entry.request {
  color: var(--command);
}

.log-entry.response {
  color: var(--response);
}

.log-entry.response .status {
  color: var(--highlight);
}

.log-entry .line {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
}

.hidden {
  display: none !important;
}

#confirm-dialog {
  border: none;
  border-radius: 1rem;
  padding: 0;
  background: rgba(15, 23, 42, 0.95);
  color: var(--text);
  box-shadow: 0 25px 70px rgba(2, 6, 23, 0.6);
  max-width: min(480px, 90vw);
  width: 100%;
  margin: auto;
}

#confirm-dialog::backdrop {
  background: rgba(2, 6, 23, 0.65);
}

.dialog-form {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.notification-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 9999;
}

.notification {
  min-width: 260px;
  max-width: 340px;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(96, 165, 250, 0.35);
  box-shadow: 0 14px 35px rgba(8, 47, 73, 0.35);
  color: var(--text);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: slide-in 0.25s ease, fade-out 0.25s ease forwards;
  animation-delay: 0s, 4.75s;
}

.notification::before {
  content: "";
  width: 6px;
  border-radius: 999px;
  background: var(--highlight);
  align-self: stretch;
}

.notification.info::before {
  background: var(--info);
}

.notification.success::before {
  background: var(--success);
}

.notification.warning::before {
  background: var(--warning);
}

.notification.error::before {
  background: var(--error);
}

.notification:hover {
  animation-play-state: paused;
}

.notification strong {
  display: block;
  color: var(--highlight);
  margin-bottom: 0.25rem;
}

.notification p {
  margin: 0;
  color: var(--muted);
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
    transform: translateX(24px);
  }
}

#confirm-dialog::backdrop,
#pause-dialog::backdrop {
  background: rgba(2, 6, 23, 0.65);
}

#unlock-panel {
  align-self: start;
}

.qr-dialog {
  max-width: min(520px, 90vw);
}

.qr-preview {
  width: 100%;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(96, 165, 250, 0.2);
}

.qr-copy-label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

#qr-copy-value {
  min-height: 120px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 0.75rem;
  padding: 0.75rem;
  color: var(--text);
  resize: vertical;
  font-family: "Fira Code", "Source Code Pro", monospace;
}

#qr-copy-btn {
  margin-right: auto;
}

.keys-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.key-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(96, 165, 250, 0.15);
  background: rgba(15, 23, 42, 0.7);
  gap: 1rem;
}

.key-info {
  display: flex;
  flex-direction: column;
}

.key-value {
  font-size: 1rem;
  color: var(--text);
  word-break: break-word;
}

.key-type {
  font-size: 0.85rem;
}

#cashout-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#cashout-panel input {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--panel-border);
  border-radius: 0.6rem;
  padding: 0.6rem 0.75rem;
  color: var(--text);
}

#cashout-panel input:focus {
  outline: 2px solid var(--highlight);
  border-color: var(--highlight);
}

#pix-transaction-panel input {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--panel-border);
  border-radius: 0.6rem;
  padding: 0.6rem 0.75rem;
  color: var(--text);
}

#pix-transaction-panel input:focus {
  outline: 2px solid var(--highlight);
  border-color: var(--highlight);
}

#pix-transaction-result {
  padding: 1rem;
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.7);
  color: var(--muted);
  min-height: 100px;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 1.5rem;
    width: 100%;
    margin-right: 0;
  }

  .log-panel {
    position: static;
    width: 100%;
    bottom: auto;
    right: auto;
    top: auto;
  }
}

