.buchungen-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.buchungen-summary-card {
  background: #ffffff;
  border: 1px solid rgba(17, 24, 39, 0.06);
  border-radius: 24px;
  padding: 16px 20px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.buchungen-summary-card p {
  font-size: 13px;
  color: rgba(17, 24, 39, 0.58);
  margin: 0 0 6px;
}

.buchungen-summary-card strong {
  display: block;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.buchungen-filter-card {
  background: #ffffff;
  padding: 14px 16px;
  border: 1px solid rgba(17, 24, 39, 0.06);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.buchungen-filter-form {
  display: grid;
  grid-template-columns: 105px 105px 115px 130px 130px 150px 150px minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.buchungen-filter-form .form-control > span,
.buchungen-edit-form .form-control > span {
  font-size: 12px;
  font-weight: 800;
  color: rgba(17, 24, 39, 0.62);
  margin-bottom: 4px;
}

.buchungen-filter-form .select,
.buchungen-filter-form .input,
.buchungen-edit-form .select,
.buchungen-edit-form .input {
  height: 36px;
  min-height: 36px;
  border-radius: 14px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  background-color: #f8fafc;
  color: #111827;
  font-size: 13px;
  outline: none;
}

.buchungen-filter-form .select:focus,
.buchungen-filter-form .input:focus,
.buchungen-edit-form .select:focus,
.buchungen-edit-form .input:focus {
  border-color: rgba(79, 70, 229, 0.55);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.buchungen-table-card {
  background: #ffffff;
  border: 1px solid rgba(17, 24, 39, 0.06);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.08);
}

.buchungen-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.buchungen-table thead {
  background: #f8fafc;
}

.buchungen-table th {
  padding: 13px 16px;
  font-size: 12px;
  font-weight: 900;
  color: rgba(17, 24, 39, 0.62);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.buchungen-table td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(17, 24, 39, 0.06);
}

.buchungen-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.buchungen-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.buchungen-table tbody tr:hover {
  background: rgba(79, 70, 229, 0.055);
}

.buchungen-type-icon {
  width: 32px;
  height: 32px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.buchungen-type-icon svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
}

.buchungen-type-icon.is-income {
  background: rgba(34, 197, 94, 0.14);
  color: #16a34a;
}

.buchungen-type-icon.is-expense {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
}

.buchungen-type-icon.is-transfer {
  background: rgba(79, 70, 229, 0.14);
  color: #4f46e5;
}

.buchungen-main-text {
  font-size: 13px;
  font-weight: 850;
  line-height: 1.15;
  color: #111827;
}

.buchungen-normal-text {
  font-size: 13px;
  line-height: 1.15;
  color: #111827;
}

.buchungen-sub-text {
  margin-top: 3px;
  font-size: 11px;
  color: rgba(17, 24, 39, 0.52);
  line-height: 1.12;
}

.buchungen-amount {
  font-size: 15px;
  font-weight: 950;
  white-space: nowrap;
}

.buchungen-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.buchungen-icon-btn {
  width: 31px;
  height: 31px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: 0.15s ease;
}

.buchungen-icon-btn:hover {
  background: #f1f5f9;
}

.buchungen-icon-btn svg {
  width: 16px;
  height: 16px;
}

.empty-state {
  padding: 48px 16px !important;
  text-align: center;
}

.empty-state p {
  font-weight: 900;
}

.empty-state span {
  font-size: 13px;
  color: rgba(17, 24, 39, 0.5);
}

.buchungen-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

@media (min-width: 1024px) {
  .buchungen-modal {
    left: 96px;
  }
}

.buchungen-modal-box {
  width: min(760px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: #ffffff;
  color: #111827;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 24px;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.32);
}

.buchungen-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.buchungen-modal-head h3 {
  font-size: 18px;
  font-weight: 900;
  margin: 0;
}

.buchungen-modal-head p {
  margin-top: 4px;
  font-size: 13px;
  color: rgba(17, 24, 39, 0.55);
}

.buchungen-edit-form {
  padding: 20px;
}

.buchungen-modal-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(17, 24, 39, 0.08);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

[data-theme="financeDark"] .buchungen-summary-card,
[data-theme="financeDark"] .buchungen-filter-card,
[data-theme="financeDark"] .buchungen-table-card,
[data-theme="financeDark"] .buchungen-modal-box {
  background: #111827;
  color: #f9fafb;
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="financeDark"] .buchungen-table thead,
[data-theme="financeDark"] .buchungen-table tbody tr:nth-child(even) {
  background: rgba(31, 41, 55, 0.72);
}

[data-theme="financeDark"] .buchungen-table tbody tr:nth-child(odd) {
  background: #111827;
}

[data-theme="financeDark"] .buchungen-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.14);
}

[data-theme="financeDark"] .buchungen-table th,
[data-theme="financeDark"] .buchungen-table td,
[data-theme="financeDark"] .buchungen-modal-head,
[data-theme="financeDark"] .buchungen-modal-actions {
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="financeDark"] .buchungen-main-text,
[data-theme="financeDark"] .buchungen-normal-text {
  color: #f9fafb;
}

[data-theme="financeDark"] .buchungen-sub-text,
[data-theme="financeDark"] .buchungen-summary-card p,
[data-theme="financeDark"] .buchungen-modal-head p,
[data-theme="financeDark"] .buchungen-filter-form .form-control > span,
[data-theme="financeDark"] .buchungen-edit-form .form-control > span {
  color: rgba(249, 250, 251, 0.56);
}

[data-theme="financeDark"] .buchungen-filter-form .select,
[data-theme="financeDark"] .buchungen-filter-form .input,
[data-theme="financeDark"] .buchungen-edit-form .select,
[data-theme="financeDark"] .buchungen-edit-form .input {
  background-color: #1f2937;
  border-color: rgba(255, 255, 255, 0.12);
  color: #f9fafb;
}

[data-theme="financeDark"] .buchungen-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 1280px) {
  .buchungen-filter-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .filter-actions {
    grid-column: span 4;
  }
}

/* Mobile layout fix */
@media (max-width: 768px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  main {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-bottom: 120px !important;
  }

  .buchungen-summary-grid,
  .buchungen-filter-card,
  .buchungen-table-card {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .buchungen-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .buchungen-summary-card {
    border-radius: 20px;
    padding: 14px;
    min-width: 0;
  }

  .buchungen-summary-card strong {
    font-size: 20px;
    word-break: break-word;
  }

  .buchungen-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .buchungen-filter-form .form-control,
  .buchungen-filter-form .search-field,
  .filter-actions {
    width: 100%;
    min-width: 0;
  }

  .buchungen-filter-form .search-field,
  .filter-actions {
    grid-column: span 2;
  }

  .buchungen-filter-form .select,
  .buchungen-filter-form .input {
    width: 100%;
    min-width: 0;
  }

  .filter-actions {
    justify-content: space-between;
  }

  .buchungen-table-card {
    border-radius: 22px;
    margin-bottom: 110px;
  }

  .buchungen-table-card .overflow-x-auto,
  .buchungen-table-scroll {
    overflow-x: hidden !important;
    width: 100%;
    max-width: 100%;
  }

  .buchungen-table {
    display: block;
    width: 100% !important;
    max-width: 100%;
    min-width: 0 !important;
  }

  .buchungen-table thead {
    display: none;
  }

  .buchungen-table tbody {
    display: block;
    width: 100%;
  }

  .buchungen-table tr {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    column-gap: 10px;
    width: calc(100% - 24px);
    max-width: calc(100% - 24px);
    margin: 12px;
    padding: 14px;
    border-radius: 20px;
    border: 1px solid rgba(17, 24, 39, 0.08);
    background: #ffffff;
    overflow: hidden;
  }

  .buchungen-table tbody tr:nth-child(even) {
    background: #f9fafb;
  }

  .buchungen-table td {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 2px 0;
    border-bottom: 0;
  }

  .buchungen-table td:first-child {
    grid-column: 1;
    grid-row: 1 / span 8;
    width: 38px;
    margin: 0;
    float: none;
  }

  .buchungen-table td:not(:first-child) {
    grid-column: 2;
    margin-left: 0 !important;
    max-width: 100% !important;
  }

  .buchungen-table td:nth-child(7) {
    margin-top: 8px;
    text-align: left !important;
  }

  .buchungen-table td:nth-child(8) {
    margin-top: 8px;
  }

  .buchungen-actions {
    justify-content: flex-start;
  }

  .buchungen-main-text,
  .buchungen-normal-text,
  .buchungen-sub-text {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .buchungen-amount {
    white-space: nowrap;
  }

  .mobile-bottom-nav {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: calc(100vw - 24px);
  }
}

/* Filter Buttons */
.filter-actions .btn {
  border-radius: 16px;
  height: 38px;
  min-height: 38px;
  padding-left: 18px;
  padding-right: 18px;
  font-size: 13px;
  font-weight: 700;
}

.filter-actions .btn-primary {
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.20);
}

.filter-actions .btn-ghost:hover {
  background-color: rgba(17, 24, 39, 0.06);
}