:root {
  --evm-blue: #1f4e79;
  --evm-blue-dark: #173a5b;
  --surface: #ffffff;
  --page: #f4f6f8;
  --border: #d7dde3;
  --muted: #5f6b76;
  --danger: #9b1c1c;
}

* { box-sizing: border-box; }

body {
  font-family: Arial, sans-serif;
  background: var(--page);
  color: #1f2933;
  margin: 0;
  padding: 20px;
}

.card {
  background: var(--surface);
  padding: 24px;
  max-width: 1350px;
  margin: auto;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

h1, h2 { margin-top: 0; }
h1 { margin-bottom: 6px; }
h2 { font-size: 20px; margin-bottom: 16px; }

.welcome, .section-note { margin: 0; color: var(--muted); }

.page-heading, .section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.header-actions, .report-actions, .item-actions, .receipt-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-top: 20px;
  background: #fff;
}

.report-panel { background: #f8fafc; }

.report-grid, .expense-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 16px;
}

.field { min-width: 0; }
.field-wide { grid-column: span 2; }

label {
  font-weight: bold;
  display: block;
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #b8c1ca;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: white;
}

textarea { resize: vertical; }
input:disabled, select:disabled, textarea:disabled { background: #eef1f4; color: #606a73; }
small { display: block; margin-top: 5px; color: var(--muted); line-height: 1.35; }

.inline-control {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.status-strip {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 10px 12px;
  background: #eaf0f6;
  border-radius: 6px;
}

.project-description {
  min-height: 18px;
  padding: 5px 7px;
  background: #f3f4f6;
  border-radius: 4px;
}

.receipt-field {
  padding: 14px;
  border: 1px dashed #9aa8b5;
  border-radius: 8px;
  background: #f8fafc;
}

.receipt-preview {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

.receipt-preview img {
  display: block;
  max-width: 320px;
  max-height: 260px;
  object-fit: contain;
  margin-bottom: 10px;
  border-radius: 4px;
}

.hidden { display: none !important; }

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

table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}

th, td {
  border: 1px solid #ddd;
  padding: 9px;
  text-align: left;
  vertical-align: top;
}

th { background: var(--evm-blue); color: white; white-space: nowrap; }
.numeric { text-align: right; white-space: nowrap; }
.description-cell { min-width: 220px; white-space: pre-wrap; }
.empty-state { text-align: center; padding: 28px; color: var(--muted); }
.action-cell { white-space: nowrap; }

.totals {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.total-box {
  background: #eef3f8;
  padding: 12px;
  border-radius: 8px;
  min-width: 190px;
  font-weight: bold;
  text-align: right;
}

.grand-total { background: #dfeaf4; }
.report-actions { justify-content: flex-end; margin-top: 20px; }

button {
  padding: 10px 18px;
  background: var(--evm-blue);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

button:hover:not(:disabled) { background: var(--evm-blue-dark); }
button:disabled { background: #999; cursor: not-allowed; }
button.secondary { background: #555; }
button.danger { background: var(--danger); }
button.compact { padding: 7px 10px; margin-top: 8px; }
button.table-button { padding: 6px 9px; margin: 0 4px 4px 0; font-size: 12px; }

.message {
  margin-top: 20px;
  padding: 12px;
  border-radius: 8px;
  font-weight: bold;
  text-align: center;
  display: none;
}

#messageText { margin-bottom: 12px; }
.acknowledge-message-button { padding: 8px 18px; }
.item-count { font-weight: bold; color: var(--muted); }

@media (max-width: 900px) {
  body { padding: 10px; }
  .card { padding: 16px; }
  .report-grid, .expense-form-grid { grid-template-columns: 1fr 1fr; }
  .field-wide { grid-column: span 2; }
  .load-field { grid-column: span 2; }
}

@media (max-width: 620px) {
  .report-grid, .expense-form-grid { grid-template-columns: 1fr; }
  .field-wide, .load-field { grid-column: span 1; }
  .inline-control { grid-template-columns: 1fr 1fr; }
  .inline-control select { grid-column: span 2; }
  .header-actions, .report-actions { width: 100%; }
  .header-actions button, .report-actions button { flex: 1; }
  .receipt-preview img { max-width: 100%; }
}
