:root {
  --navy: #1e3d67;
  --navy-dark: #153150;
  --orange: #f57c2a;
  --orange-dark: #d86513;
  --success: #177245;
  --danger: #a7362f;
  --gray: #667085;
  --border: #d0d5dd;
  --background: #f5f7fa;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

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

.container {
  max-width: 1440px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 24px;
}

.branded-header {
  padding: 20px;
  background: linear-gradient(135deg, #ffffff, #eff4fa);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: auto;
  height: clamp(120px, 16vw, 150px);
  flex: 0 0 auto;
}

.header-links {
  margin: 8px 0 0;
  font-size: 0.95rem;
}

h1,
h2,
h3 {
  margin-top: 0;
  color: var(--navy);
}

.card {
  padding: 24px;
  margin-bottom: 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(16, 24, 40, 0.05);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0 16px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

select {
  max-width: 560px;
  margin-bottom: 12px;
}

textarea {
  resize: vertical;
}

button {
  font: inherit;
}

.button {
  padding: 10px 16px;
  border: 0;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-weight: 600;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary {
  background: var(--orange);
}

.primary:hover {
  background: var(--orange-dark);
}

.secondary {
  background: var(--navy);
}

.secondary:hover {
  background: var(--navy-dark);
}

.success {
  background: var(--success);
}

.danger {
  background: var(--danger);
}

.summary-grid,
.round-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 16px 0 24px;
}

.summary-card,
.round-card {
  padding: 18px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.summary-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--gray);
  font-size: 0.9rem;
}

.summary-card strong {
  font-size: 1.35rem;
}

.compact-list {
  margin: 10px 0 14px;
  padding-left: 18px;
}

.compact-list li {
  margin-bottom: 4px;
}

.difference-valid {
  color: var(--success);
}

.difference-invalid {
  color: var(--danger);
}

.table-wrapper {
  overflow-x: auto;
  margin-bottom: 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 950px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #eaecf0;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f9fafb;
  font-size: 0.9rem;
}

tr:last-child td {
  border-bottom: 0;
}

.project-row td {
  background: #eaf2ff;
  color: #123b70;
  font-weight: 700;
}

.money {
  text-align: right;
  white-space: nowrap;
}

.amount-input {
  min-width: 130px;
  text-align: right;
}

.form-card {
  max-width: 960px;
}

.form-grid,
.record-grid,
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.checkbox-grid {
  grid-template-columns: repeat(4, minmax(70px, 1fr));
}

.inline-checkbox {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.inline-checkbox input {
  width: auto;
}

.form-card textarea {
  margin-bottom: 16px;
}

.alert {
  padding: 14px 16px;
  margin: 16px 0;
  border-radius: 6px;
}

.alert-success {
  background: #ecfdf3;
  border: 1px solid #abefc6;
  color: #067647;
}

.alert-error {
  background: #fef3f2;
  border: 1px solid #fecdca;
  color: #b42318;
}

.status-callout {
  margin-top: 16px;
  padding: 12px;
  border-left: 4px solid var(--navy);
  background: #eff4fa;
}

.flag {
  display: inline-block;
  margin-right: 6px;
  margin-bottom: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e6edf7;
  color: var(--navy);
  font-size: 0.75rem;
  font-weight: 700;
}

.flag-delete {
  background: #fee4e2;
  color: #a7362f;
}

.flag-new {
  background: #fff1e7;
  color: #b3520f;
}

.changed-row td {
  background: #fffaf2;
}

.modified-indicator {
  color: #b3520f;
  font-weight: 700;
  margin-right: 6px;
}

.sticky-summary {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--background);
  padding-top: 8px;
}

.project-section {
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.project-header {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid #eaecf0;
  background: #f8fbff;
}

.project-content {
  padding: 14px 16px 18px;
}

.activity-card {
  border: 1px solid #eaecf0;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.activity-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.activity-table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
}

.activity-table .col-category { width: 9%; }
.activity-table .col-current { width: 11%; }
.activity-table .col-current-desc { width: 16%; }
.activity-table .col-proposed { width: 20%; }
.activity-table .col-proposed-desc { width: 44%; }

.activity-table .current-cell {
  font-size: 0.85rem;
  color: #5b6770;
  word-break: break-word;
}

.activity-table .amount-input {
  min-width: 0;
  width: 100%;
}

.activity-table textarea {
  width: 100%;
}

.hint {
  font-size: 0.9rem;
  color: #5b6770;
}

.activity-controls {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
  margin-top: 12px;
}

.object-row-warning td {
  background: #fff2f1;
}

.deleted-row td {
  background: #fff2f1;
}

.deleted-row td:not(:last-child) {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.hidden {
  display: none !important;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.8);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 4px solid #d0d5dd;
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.small-button {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.review-buttons {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.status-pending {
  background: #fff4cc;
  color: #7a5c00;
}

.status-approved {
  background: #dcfae6;
  color: #067647;
}

.status-rejected {
  background: #fee4e2;
  color: #b42318;
}

hr {
  margin: 20px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

a {
  color: var(--navy);
}

.hint-text {
  display: block;
  color: var(--gray);
  margin-top: 6px;
}

@media (max-width: 960px) {
  .summary-grid,
  .round-grid,
  .form-grid,
  .record-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  body {
    padding: 12px;
  }

  .brand-lockup,
  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .button-row {
    width: 100%;
  }
}

@media print {
  body {
    background: #ffffff;
    padding: 0;
  }

  .no-print,
  #lookupForm,
  #messageArea,
  .loading-overlay,
  #loadBudgetButton,
  #startModificationButton,
  #cancelModificationButton,
  #addNewLineButton,
  #submitButton,
  #backToRoundsButton,
  #logoutButton,
  #reviewActions,
  #statusFilter,
  #saveRoundSettingsButton {
    display: none !important;
  }

  .container,
  .card,
  .table-wrapper {
    box-shadow: none;
    border: 0;
    max-width: 100%;
  }
}
