:host {
  display: block;
  width: min(900px, 86vw);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--mat-divider-color, #e0e0e0);

  h2[mat-dialog-title] {
    margin: 0;
    padding: 0;
    line-height: 1.25;
  }
}

.dialog-subtitle {
  margin: 4px 0 0;
  color: rgba(0, 0, 0, 0.6);
}

.close-button {
  flex: 0 0 auto;
  margin: -8px -8px 0 0;
}

mat-dialog-content {
  display: flex;
  height: min(70vh, 620px);
  max-height: none;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 24px 24px !important;
}

.dialog-state {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: rgba(0, 0, 0, 0.6);
  text-align: center;
}

.error-state {
  mat-icon {
    width: 44px;
    height: 44px;
    color: #ba1a1a;
    font-size: 44px;
  }

}

.table-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;

  mat-form-field {
    flex: 1 1 360px;
    max-width: 520px;
  }
}

.note-toggle {
  flex: 0 0 auto;

  &.active {
    color: var(--mat-sys-primary, #343dff);
    background: #eef3ff;
  }
}

.table-shell {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--mat-divider-color, #e0e0e0);
  border-radius: 12px;
  background: #fff;
}

.table-scroll {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 690px;
}

th.mat-mdc-header-cell {
  color: rgba(0, 0, 0, 0.68);
  font-weight: 600;
  white-space: nowrap;
}

td.mat-mdc-cell {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.amount-cell {
  font-weight: 600;
}

.note-cell {
  min-width: 180px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions-cell {
  width: 48px;
  padding-right: 8px;
  text-align: right;
}

.empty-row td {
  height: 128px;
  color: rgba(0, 0, 0, 0.6);
  text-align: center;
}

mat-paginator {
  flex: 0 0 auto;
  border-top: 1px solid var(--mat-divider-color, #e0e0e0);
}

@media (max-width: 700px) {
  :host {
    width: 92vw;
  }

  .dialog-header {
    padding: 20px 16px 14px;
  }

  mat-dialog-content {
    height: min(72vh, 620px);
    padding: 16px !important;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;

    mat-form-field {
      flex-basis: auto;
      max-width: none;
    }
  }

  .note-toggle {
    align-self: flex-start;
  }
}
