.money-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.money-grid > .card {
  width: 100%;
  min-width: 0;
}

.directory-layout {
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
}

.directory-content {
  min-width: 0;
}

.directory-nav-card {
  align-self: start;
}

.directory-nav-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.directory-nav-list .money-btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.money-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.money-kpi {
  border: 1px solid rgba(91, 216, 243, 0.3);
  border-radius: 14px;
  background: rgba(8, 20, 54, 0.5);
  padding: 12px 14px;
}

.money-kpi-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}

.money-kpi-value {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
}

.money-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.money-select,
.money-input,
.money-textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(91, 216, 243, 0.35);
  background: rgba(4, 13, 39, 0.8);
  color: #ebf2ff;
  padding: 10px 12px;
  font: inherit;
}

.money-textarea {
  min-height: 88px;
  resize: vertical;
}

.money-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.money-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.money-btn {
  border: 1px solid rgba(91, 216, 243, 0.45);
  background: linear-gradient(130deg, rgba(0, 160, 255, 0.24), rgba(5, 104, 179, 0.18));
  color: #e8f7ff;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 600;
  cursor: pointer;
}

.money-btn.small {
  padding: 6px 9px;
  font-size: 12px;
}

.money-btn:hover {
  border-color: rgba(91, 216, 243, 0.9);
}

.money-btn.danger {
  border-color: rgba(255, 128, 142, 0.45);
  background: linear-gradient(130deg, rgba(155, 13, 39, 0.24), rgba(94, 9, 43, 0.2));
}

.money-btn-accent {
  border-color: rgba(123, 255, 182, 0.5);
  background: linear-gradient(130deg, rgba(20, 160, 104, 0.35), rgba(12, 110, 76, 0.3));
}

#dataSourceBadge {
  border: 1px solid rgba(126, 255, 190, 0.55);
  color: #dbffe8;
  background: linear-gradient(130deg, rgba(16, 134, 88, 0.35), rgba(10, 90, 64, 0.32));
  box-shadow:
    0 0 0 1px rgba(126, 255, 190, 0.18),
    0 0 22px rgba(30, 190, 130, 0.25);
}

.money-table-wrap {
  position: relative;
  z-index: 1;
  overflow: auto;
  border: 1px solid rgba(91, 216, 243, 0.25);
  border-radius: 12px;
}

.money-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.money-table th,
.money-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(91, 216, 243, 0.18);
  text-align: left;
  font-size: 14px;
}

.money-table th {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}

.money-status {
  margin-top: 10px;
  font-size: 14px;
}

.money-status.error {
  color: #ff8b9d;
}

.money-status.success {
  color: #75f7c5;
}

.money-note {
  margin-top: 6px;
  opacity: 0.75;
  font-size: 13px;
}
.capital-layout {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.capital-hero-card {
  grid-column: 1 / -1;
}

.capital-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.capital-invest-form {
  align-items: end;
}

.capital-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.capital-status-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(91, 216, 243, 0.25);
  background: rgba(8, 20, 54, 0.45);
}

.capital-status-card.ok {
  border-color: rgba(123, 255, 182, 0.35);
  background: linear-gradient(180deg, rgba(12, 67, 47, 0.36), rgba(8, 20, 54, 0.45));
}

.capital-status-card.warn {
  border-color: rgba(255, 196, 99, 0.45);
  background: linear-gradient(180deg, rgba(92, 57, 9, 0.34), rgba(8, 20, 54, 0.45));
}

.capital-status-card.danger {
  border-color: rgba(255, 128, 142, 0.45);
  background: linear-gradient(180deg, rgba(105, 15, 34, 0.34), rgba(8, 20, 54, 0.45));
}

.capital-status-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.8;
}

.wallet-chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.wallet-chip-label {
  font-size: 13px;
  opacity: 0.84;
}

.wallet-chip {
  border: 1px solid rgba(123, 255, 182, 0.5);
  border-radius: 999px;
  padding: 5px 12px;
  background: rgba(12, 67, 47, 0.4);
  color: #d8fff0;
  font-size: 13px;
}

.wallet-chip-active {
  border-color: rgba(154, 255, 206, 0.95);
  background: linear-gradient(135deg, rgba(21, 129, 88, 0.84), rgba(13, 93, 64, 0.9));
  box-shadow:
    0 0 0 1px rgba(154, 255, 206, 0.32),
    0 0 24px rgba(62, 215, 146, 0.5);
  animation: walletPulseRoyal 3.6s ease-in-out infinite;
}

@keyframes walletPulseRoyal {
  0% {
    box-shadow:
      0 0 0 1px rgba(154, 255, 206, 0.22),
      0 0 18px rgba(62, 215, 146, 0.34),
      0 0 34px rgba(36, 181, 124, 0.2);
    filter: saturate(1.02) brightness(1);
    transform: scale(1);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(175, 255, 217, 0.52),
      0 0 36px rgba(98, 245, 177, 0.72),
      0 0 58px rgba(56, 199, 141, 0.38);
    filter: saturate(1.18) brightness(1.08);
    transform: scale(1.035);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(154, 255, 206, 0.22),
      0 0 18px rgba(62, 215, 146, 0.34),
      0 0 34px rgba(36, 181, 124, 0.2);
    filter: saturate(1.02) brightness(1);
    transform: scale(1);
  }
}

.wallet-gate-form {
  margin-top: 12px;
}

.wallet-gate-divider {
  height: 1px;
  margin: 14px 0;
  background: linear-gradient(90deg, transparent, rgba(91, 216, 243, 0.4), transparent);
}

.inline-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.04em;
  border: 1px solid rgba(123, 255, 182, 0.45);
  color: #c6ffe8;
  background: rgba(12, 87, 59, 0.3);
}

.tx-category-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.tx-datetime-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.category-pill {
  display: inline-block;
  border-radius: 999px;
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid transparent;
}

.category-pill.income {
  background: rgba(33, 168, 108, 0.22);
  border-color: rgba(102, 251, 177, 0.55);
  color: #c4ffe8;
}

.category-pill.expense {
  background: rgba(215, 105, 122, 0.22);
  border-color: rgba(255, 142, 157, 0.45);
  color: #ffdce1;
}

.category-pill.transfer {
  background: rgba(0, 240, 255, 0.16);
  border-color: rgba(0, 240, 255, 0.45);
  color: #bdf8ff;
}

.category-pill.debt {
  background: rgba(255, 193, 7, 0.16);
  border-color: rgba(255, 193, 7, 0.45);
  color: #ffe7a3;
}
.money-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.money-modal.hidden {
  display: none;
}

.money-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 24, 0.68);
  backdrop-filter: blur(3px);
}

.money-modal-dialog {
  position: relative;
  width: min(680px, calc(100% - 24px));
  margin: 7vh auto;
  border: 1px solid rgba(91, 216, 243, 0.5);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(5, 20, 54, 0.95), rgba(3, 10, 31, 0.98));
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
  padding: 14px;
}

.money-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.money-modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(91, 216, 243, 0.4);
  background: rgba(4, 14, 40, 0.85);
  color: #d8efff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.money-modal-body {
  margin-top: 10px;
}

.money-modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.dtp-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.dtp-open {
  border: 1px solid rgba(91, 216, 243, 0.45);
  background: rgba(6, 17, 47, 0.9);
  color: #d8f1ff;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.dtp-open:hover {
  border-color: rgba(91, 216, 243, 0.9);
}

.dtp-hint {
  grid-column: 1 / -1;
  font-size: 12px;
  opacity: 0.78;
  padding-left: 2px;
}

.b24-toggle-btn {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 10001;
  border: 1px solid rgba(91, 216, 243, 0.7);
  border-radius: 999px;
  background: linear-gradient(130deg, rgba(0, 160, 255, 0.78), rgba(5, 104, 179, 0.72));
  color: #e8f7ff;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  box-shadow: 0 8px 24px rgba(3, 18, 42, 0.45);
}

body.b24-widget-hidden iframe[src*="bitrix24"],
body.b24-widget-hidden iframe[src*="site_button"],
body.b24-widget-hidden div[id*="bx-livechat"],
body.b24-widget-hidden div[class*="bx-livechat"],
body.b24-widget-hidden div[id*="b24-widget"],
body.b24-widget-hidden div[class*="b24-widget"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

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

  .directory-layout {
    grid-template-columns: 1fr;
  }

  .money-table {
    min-width: 560px;
  }

  .tx-datetime-row {
    grid-template-columns: 1fr;
  }

  .b24-toggle-btn {
    left: 10px;
    right: auto;
    bottom: 10px;
    font-size: 11px;
    padding: 7px 11px;
  }
}
/* ── Add-item inline form (slide-down reveal) ─────────────────── */
.dir-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: transparent;
  border: 1.5px solid var(--neon-green);
  color: var(--neon-green);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background 0.18s,
    box-shadow 0.18s,
    color 0.18s;
  margin-bottom: 14px;
}
.dir-add-btn:hover {
  background: rgba(0, 255, 159, 0.1);
  box-shadow: 0 0 14px rgba(0, 255, 159, 0.3);
}
.dir-add-btn.is-open {
  border-color: var(--neon-pink);
  color: var(--neon-pink);
}
.dir-add-btn.is-open:hover {
  background: rgba(255, 0, 110, 0.1);
  box-shadow: 0 0 14px rgba(255, 0, 110, 0.3);
}
.dir-add-btn .dir-add-btn-icon {
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.dir-add-btn.is-open .dir-add-btn-icon {
  transform: rotate(45deg);
}

.dir-inline-form-wrap {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 0;
}
.dir-inline-form-wrap.is-open {
  grid-template-rows: 1fr;
  margin-bottom: 16px;
}
.dir-inline-form-wrap > .dir-inline-form-inner {
  overflow: hidden;
}
.dir-inline-form-wrap > .dir-inline-form-inner > .dir-form {
  position: relative;
  z-index: 4;
  padding-top: 4px;
  row-gap: 12px;
  margin-bottom: 14px;
}

.dir-inline-form-wrap > .dir-inline-form-inner > .dir-form > .money-btn[type="submit"] {
  grid-column: 1 / -1;
  min-height: 44px;
}
/* ── Dashboard loader spinner ─────────────────────────────────── */
.dashboard-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  gap: 24px;
}

.hb-spinner {
  position: relative;
  width: 64px;
  height: 64px;
}
.hb-spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  animation: hb-spin linear infinite;
}
.hb-spinner-ring:nth-child(1) {
  border-top-color: var(--neon-green);
  animation-duration: 1.1s;
}
.hb-spinner-ring:nth-child(2) {
  inset: 8px;
  border-top-color: var(--neon-blue);
  border-right-color: var(--neon-blue);
  animation-duration: 0.75s;
  animation-direction: reverse;
}
.hb-spinner-ring:nth-child(3) {
  inset: 18px;
  border-top-color: var(--neon-pink);
  animation-duration: 0.55s;
}
.hb-spinner-dot {
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow:
    0 0 12px var(--neon-green),
    0 0 24px var(--neon-green);
  animation: hb-pulse 1.1s ease-in-out infinite;
}

@keyframes hb-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes hb-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.7);
  }
}

.dashboard-loader-text {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  animation: hb-blink 1.4s ease-in-out infinite;
}
@keyframes hb-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
/* ── Dashboard toolbar ────────────────────────────────────────── */
.dash-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 22px;
}

.dash-period-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dash-period-pill {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.dash-period-pill:hover {
  border-color: var(--neon-green);
  color: var(--neon-green);
  background: rgba(0, 255, 159, 0.07);
}
.dash-period-pill.active {
  border-color: var(--neon-green);
  background: rgba(0, 255, 159, 0.12);
  color: var(--neon-green);
  box-shadow: 0 0 12px rgba(0, 255, 159, 0.25);
}

.dash-refresh-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}
.dash-refresh-btn svg {
  width: 16px;
  height: 16px;
}
.dash-refresh-btn:hover {
  border-color: var(--neon-blue);
  color: var(--neon-blue);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
}
.dash-refresh-btn:active svg {
  animation: dash-spin-once 0.4s ease;
}
@keyframes dash-spin-once {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
/* ── Wallet Summary Table ────────────────────────────────────── */
.wallet-summary-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.wallet-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.wallet-summary-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color-soft);
  white-space: nowrap;
}
.wallet-summary-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-color-soft);
  vertical-align: middle;
}
.wallet-summary-table tbody tr:last-child td {
  border-bottom: none;
}
.wallet-summary-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}
.wallet-summary-table .income {
  color: var(--neon-blue);
}
.wallet-summary-table .expense {
  color: var(--neon-pink);
}
.wallet-summary-table .wallet-summary-row--active td:first-child {
  font-weight: 700;
  color: var(--accent, var(--neon-blue));
}
@media (max-width: 600px) {
  .wallet-summary-table th,
  .wallet-summary-table td {
    padding: 7px 8px;
    font-size: 0.8rem;
  }
}
