/* v1 — стиль как в sample/pools.html */
:root {
  --bg: #fff;
  --bg-card: #fff;
  --border: #e5e7eb;
  --text: #1f1f1f;
  --text-muted: #6b7280;
  --primary: #16a34a;
  --primary-hover: #15803d;
  --secondary: #f3f4f6;
  --secondary-hover: #e5e7eb;
  --ring: rgba(22, 163, 74, 0.5);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
}

.site-header .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

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

/* Page nav (Баланс / Профиль) */
.page-nav {
  display: flex;
  gap: 1.5rem;
  font-weight: 500;
}

.page-nav a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.page-nav a:hover {
  color: var(--text);
}

.page-nav a.active {
  color: var(--text);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

main {
  padding: 2rem 0;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  line-height: 1.5;
  min-height: 1.5rem;
}

/* Form */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--secondary-hover);
}

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

.btn-ghost:hover {
  background: var(--secondary);
  color: var(--text);
}

/* Wallet block */
.wallet-block {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  background: var(--secondary);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.wallet-block .wallet-info {
  flex: 1;
  min-width: 0;
}

.wallet-block .wallet-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.wallet-block .wallet-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.icon-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--bg-card);
  color: var(--text);
}

.icon-btn svg {
  width: 1rem;
  height: 1rem;
}

/* Add wallet placeholder */
.add-wallet-btn {
  width: 100%;
  padding: 1.25rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.add-wallet-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Wallet form (add/edit) */
.wallet-form {
  padding: 1rem;
  background: var(--secondary);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.wallet-form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.hidden {
  display: none !important;
}

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

/* Section titles */
.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
}

.wallets-section + .wallets-section {
  margin-top: 2rem;
}

/* Balance page */
.balance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
  align-items: start;
}

@media (max-width: 768px) {
  .balance-grid {
    grid-template-columns: 1fr;
  }
}

.balance-block {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.balance-header {
  margin-bottom: 1rem;
  min-height: 5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.balance-amount {
  font-size: 2rem;
  font-weight: 700;
  margin: 0.5rem 0;
  line-height: 1.2;
}

.balance-stats {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.balance-stats-item {
  display: flex;
  justify-content: space-between;
}

.balance-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-shrink: 0;
  min-height: 2.5rem;
  align-items: flex-start;
}

.balance-actions .btn {
  flex: 1;
}

/* Transaction table */
.transactions-table-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.transactions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.transactions-table th {
  text-align: left;
  padding: 0.75rem 0.5rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.transactions-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.transactions-table tr:last-child td {
  border-bottom: none;
}

.transaction-date {
  color: var(--text-muted);
  white-space: nowrap;
}

.transaction-amount {
  font-weight: 600;
  white-space: nowrap;
}

.transaction-amount.positive {
  color: #10b981;
}

.transaction-amount.negative {
  color: #f87171;
}

.transaction-comment {
  color: var(--text);
  word-break: break-word;
}

.transaction-tx {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-muted);
  font-family: monospace;
  font-size: 0.8125rem;
}

.copy-btn {
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.copy-btn:hover {
  background: var(--secondary);
  color: var(--text);
}

.copy-btn svg {
  width: 0.875rem;
  height: 0.875rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.pagination-btn {
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--secondary);
  border-color: var(--primary);
}

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

.pagination-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pagination-info {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0 0.5rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
  background: var(--secondary);
  color: var(--text);
}

.modal-close svg {
  width: 1.25rem;
  height: 1.25rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-text {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.modal-actions .btn {
  flex: 1;
}
