:root {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #1f2933;
  background-color: #f7f9fb;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 3vw;
  background: #0f172a;
  color: #fff;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  opacity: 0.8;
}

#active-user {
  font-weight: 600;
}

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

.header-actions .nav-link {
  text-align: center;
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  padding: 0.45rem 0.9rem;
}

.header-actions .nav-link.secondary {
  color: #fff;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 0.5rem;
  padding: 0.65rem 1rem;
  font-weight: 600;
  background-color: #2563eb;
  color: #fff;
  appearance: none;
}

button.link {
  background: transparent;
  color: #2563eb;
  padding: 0;
}

.auth-provider-button {
  width: 100%;
  margin-top: 0.75rem;
}

.icon-button {
  background: transparent !important;
  color: #0f172a;
  padding: 0.15rem;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  border: none;
  box-shadow: none;
}

.icon-button img {
  width: 1.5rem;
  height: 1.5rem;
  pointer-events: none;
  display: block;
}

.icon-button img[data-icon="trash"] {
  width: 2rem;
  height: 1.7rem;
}

button.secondary {
  background: #e2e8f0;
  color: #0f172a;
}

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

main {
  padding: 2rem 3vw 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

section {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.card {
  background: #fff;
  border-radius: 1rem;
  padding: 1.5rem;
  flex: 1 1 320px;
  box-shadow: 0 10px 35px rgba(15, 23, 42, 0.1);
}

.card h2 {
  margin-top: 0;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
}

input,
select,
textarea {
  border-radius: 0.5rem;
  border: 1px solid #cbd5e1;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
}

textarea {
  resize: vertical;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.grid-form .wide {
  grid-column: 1 / -1;
}

.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.checkbox input {
  width: auto;
}
.account-defaults {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.error {
  color: #b91c1c;
  min-height: 1.2rem;
}

.hint {
  font-size: 0.85rem;
  margin: 0;
  color: #64748b;
}

.hidden {
  display: none !important;
}

.summary {
  flex: 1 1 100%;
}

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

.summary-label {
  margin: 0;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

.summary-value {
  margin: 0.2rem 0 0;
  font-size: 1.4rem;
  font-weight: 700;
}

.summary-value.positive {
  color: #15803d;
}

.summary-value.negative {
  color: #b91c1c;
}

.balance-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  background: #e2e8f0;
  color: #0f172a;
}

.balance-status.balanced {
  background: #dcfce7;
  color: #166534;
}

.balance-status.unbalanced {
  background: #fee2e2;
  color: #b91c1c;
}

.app-shell {
  display: flex;
  gap: 2rem;
  min-height: 70vh;
  width: 100%;
}

.nav-panel {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  background: #0f172a;
  color: #fff;
  border-radius: 1rem;
  box-shadow: 0 15px 40px rgba(15, 23, 42, 0.35);
}

.nav-brand h2 {
  margin: 0;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1 1 auto;
}

.nav-link {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid transparent;
  color: #fff;
  text-align: left;
}

.nav-link.secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #cbd5f5;
}

.nav-link.active {
  background: #2563eb;
}

.nav-link[data-view='entities'].active {
  background: #22c55e;
}

.nav-link:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.nav-footer {
  margin-top: auto;
}

.content-panel {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0 1rem;
}

.content-panel-inner {
  width: 100%;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.content-panel-inner > * {
  width: 100%;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.list-card {
  padding: 0;
}

.ledger-card {
  padding: 1.5rem;
}

.ledger-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.ledger-filter {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-weight: 600;
  color: #475569;
}

.ledger-filter button {
  align-self: flex-start;
}

.filter-menu {
  position: absolute;
  top: 110%;
  left: 0;
  z-index: 5;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  min-width: 240px;
  box-shadow: 0 15px 40px rgba(15, 23, 42, 0.15);
}

.filter-menu .tag-filter-section {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-menu .tag-filter-section input {
  width: 100%;
}
.filter-menu.hidden {
  display: none;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
}

.filter-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.filter-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.filter-list label {
  font-weight: 400;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.4rem;
}

.tag-input input {
  border: none;
  flex: 1;
  min-width: 120px;
}

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

.tag-chip {
  background: #e0edff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.tag-chip button {
  background: transparent;
  border: none;
  color: inherit;
  padding: 0;
  cursor: pointer;
  font-size: 0.9em;
}

.tag-suggestions {
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  max-height: 150px;
  overflow-y: auto;
}

.tag-suggestions li {
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}

.tag-suggestions li:hover {
  background: #e0edff;
}

.tag-suggestions.hidden {
  display: none;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.account-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.account-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  align-items: center;
}

.account-list li:last-child {
  border-bottom: none;
}

.account-list li.empty {
  color: #94a3b8;
  justify-content: center;
  padding: 2rem;
}

.account-info {
  flex: 1;
}

.account-name {
  margin: 0;
  font-weight: 600;
  font-size: 1.1rem;
}

.account-description {
  margin: 0.25rem 0 0;
  color: #64748b;
}

.account-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.account-meta .badge {
  margin: 0;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: #475569;
}

.badge-list {
  display: flex;
  gap: 0.3rem;
}

.badge.cash {
  background: #2563eb;
}

.badge.entity {
  background: #10b981;
}

.account-balance {
  margin: 0;
  font-weight: 700;
  color: #0f172a;
}

.account-meta .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 0;
}

.account-opening {
  margin: 0;
  font-size: 0.85rem;
  color: #94a3b8;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 4vh 1rem;
  overflow-y: auto;
  z-index: 10;
}

.modal.hidden {
  display: none;
}

.modal-content {
  max-width: 540px;
  width: 100%;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-header h3 {
  margin: 0;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.pricing-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pricing-tabs-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.pricing-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pricing-tabs button {
  border: 1px solid #cbd5f5;
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pricing-tabs button.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  box-shadow: 0 0.25rem 0.6rem rgba(37, 99, 235, 0.2);
}

.pricing-panels {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pricing-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

th,
td {
  border-bottom: 1px solid #e2e8f0;
  padding: 0.75rem;
  text-align: left;
}

th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
}

.ledger-table tr.txn-stripe-a td,
.ledger-table tr.txn-stripe-b td {
  transition: background-color 0.2s ease;
}

.ledger-table tr.txn-stripe-a td {
  background-color: #35415c !important;
  color: #fff;
}

.ledger-table tr.txn-stripe-b td {
  background-color: #e2e8f0 !important;
  color: #1f2937;
}


.ledger-entity-row td {
  font-style: italic;
  color: #475569;
}

.table-tags {
  margin-top: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.table-tag {
  background: #e2e8f0;
  color: #334155;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
}

.return-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #fef3c7;
  color: #92400e;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: 0.4rem;
}

.client-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 0.4rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  margin-left: 0.4rem;
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .nav-panel {
    flex: 1 1 auto;
  }
}
.modal#error {
  display: flex;
}
