.expense-status-select .custom-select-trigger {
  min-height: 34px;
}


.expenses-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.expense-toolbar {
  display: grid;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  box-shadow: 0 10px 26px rgba(31, 45, 68, 0.05);
}

.expense-toolbar {
  grid-template-columns: minmax(220px, 1fr) 150px 150px 150px;
}

.expense-toolbar label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.expense-toolbar label span {
  color: var(--faint);
  font-size: 12px;
  font-weight: 850;
}

.expense-add-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding-inline: 22px;
}

.expense-header-actions {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 10px;
}

.expense-balance-card {
  display: grid;
  align-content: center;
  min-width: 180px;
  min-height: 56px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  background: #f0fdfa;
  padding: 8px 14px;
}

.expense-balance-card.negative {
  border-color: rgba(239, 68, 68, 0.18);
  background: #fff5f5;
}

.expense-balance-card.negative span,
.expense-balance-card.negative strong {
  color: #b91c1c;
}

.expense-balance-card.positive strong {
  color: #047857;
}

.expense-balance-card span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 850;
}

.expense-balance-card strong {
  color: #0f172a;
  font-size: 20px;
  font-weight: 950;
}

.expense-budget-list {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

.expense-budget-chip {
  display: inline-grid;
  grid-template-columns: auto auto auto 24px;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid rgba(21, 149, 107, 0.18);
  border-radius: 999px;
  background: #f3fbf7;
  color: #166b50;
  padding: 0 7px 0 12px;
  font-size: 12px;
  font-weight: 850;
}

.expense-budget-chip span {
  color: var(--muted);
}

.expense-budget-chip b {
  color: #0f766e;
  font-weight: 950;
}

.expense-budget-chip button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(21, 149, 107, 0.1);
  color: #166b50;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.expense-create-dialog {
  width: min(680px, 100%);
}

.expense-create-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.expense-create-form label {
  display: grid;
  gap: 6px;
}

.expense-create-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.expense-entry-type {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #eef3f9;
  padding: 4px;
}

.expense-entry-type button {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.expense-entry-type button.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 6px 16px rgba(31, 45, 68, 0.1);
}

.expense-create-wide,
.expense-create-form .dialog-actions {
  grid-column: 1 / -1;
}

.expense-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(31, 45, 68, 0.05);
}

.expense-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.expense-table th,
.expense-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: middle;
}

.expense-table th {
  color: var(--faint);
  font-size: 12px;
  font-weight: 900;
}

.expense-table td {
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.expense-table tbody tr:last-child td {
  border-bottom: 0;
}

.expense-table strong,
.expense-table small {
  display: block;
}

.expense-table strong {
  font-weight: 900;
}

.expense-detail-link {
  display: inline;
  max-width: 260px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  font: inherit;
  font-weight: 900;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.expense-detail-link:hover {
  color: var(--blue);
  text-decoration-color: rgba(37, 99, 235, 0.4);
}

.expense-table small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.expense-amount {
  font-weight: 950;
  white-space: nowrap;
}

.expense-amount.positive,
.expense-amount-value.positive {
  color: #047857;
}

.expense-amount.negative,
.expense-amount-value.negative {
  color: #b91c1c;
}

.expense-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: #eef4fb;
  color: #42526d;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.expense-status-badge.status-submitted,
.expense-status-badge.status-approved {
  background: #ecfdf5;
  color: #047857;
}

.expense-status-badge.status-paid {
  background: #e0f2fe;
  color: #0369a1;
}

.expense-status-badge.status-scheduled {
  background: #fff7ed;
  color: #c2410c;
}

.expense-status-badge.status-received {
  background: #ecfdf5;
  color: #047857;
}

.expense-status-badge.status-rejected {
  background: #fef2f2;
  color: #b91c1c;
}

.expense-status-select {
  min-height: 34px;
  min-width: 112px;
}

.expense-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.expense-detail-popover {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 45;
  display: grid;
  gap: 0;
  width: min(520px, calc(100vw - 48px));
  max-height: min(720px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 0;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22);
}

.expense-detail-popover > header,
.expense-attachment-panel header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.expense-detail-popover > header {
  position: sticky;
  top: 0;
  z-index: 2;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 14px 16px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
}

.expense-detail-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.expense-detail-popover h2 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 950;
}

.expense-detail-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 16px 0;
}

.expense-detail-form label {
  display: grid;
  gap: 6px;
}

.expense-detail-form label span,
.expense-detail-read dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.expense-detail-form input,
.expense-detail-form select,
.expense-detail-form textarea {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 0 10px;
  font-size: 13px;
}

.expense-detail-form textarea {
  height: 72px;
  min-height: 72px;
  padding: 10px;
  resize: none;
}

.expense-detail-wide,
.expense-detail-actions {
  grid-column: 1 / -1;
}

.expense-detail-read {
  display: grid;
  gap: 10px;
  margin: 14px 16px 0;
}

.expense-detail-readform {
  align-items: start;
}

.expense-detail-value {
  display: flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--text);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 850;
}

.expense-detail-value.note {
  min-height: 56px;
  align-items: flex-start;
  padding: 10px;
  line-height: 1.6;
}

.expense-detail-read dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.expense-detail-read dl div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid rgba(220, 228, 239, 0.8);
  border-radius: 0;
  background: transparent;
  padding: 5px 0;
}

.expense-detail-read dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.expense-detail-note {
  margin: 0;
  border-left: 3px solid #bfdbfe;
  color: #42506a;
  padding: 4px 0 4px 10px;
  font-size: 13px;
  font-weight: 700;
}

.expense-detail-popover.is-editing .expense-detail-actions {
  position: static;
  margin: 0;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 12px 16px;
}

.expense-detail-audit {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 12px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px 12px;
}

.expense-detail-audit span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.expense-attachment-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 12px;
  margin: 14px 16px 0;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.expense-detail-form .expense-attachment-panel,
.expense-detail-form .expense-detail-audit {
  margin: 0;
}

.expense-attachment-panel.is-dragging {
  border-color: rgba(37, 99, 235, 0.45);
  background: #eff6ff;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.expense-attachment-panel h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.file-upload-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 999px;
  background: #ffffff;
  color: var(--blue);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.file-upload-trigger svg,
.expense-attachment-panel a svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.expense-attachment-panel ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.expense-attachment-panel li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
}

.expense-attachment-panel a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #26354f;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.expense-attachment-panel a span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-attachment-panel small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.expense-attachment-panel li button {
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  background: var(--red-soft);
  color: var(--red);
  padding: 0 9px;
  font-size: 11px;
  font-weight: 850;
}

.expense-detail-audit {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px 10px;
  margin: 14px 16px 16px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.expense-detail-audit span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

@media (max-width: 1180px) {
  .expense-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
