body {
  background: #f6f7f9;
  color: #172033;
}

.navbar .container-fluid {
  flex-wrap: wrap;
  gap: 12px;
}

.app-navbar {
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.app-brand {
  align-items: center;
  display: inline-flex;
  font-weight: 700;
  gap: 10px;
}

.brand-mark {
  align-items: center;
  background: #172033;
  border-radius: 6px;
  color: #ffffff;
  display: inline-flex;
  font-size: 0.8rem;
  height: 30px;
  justify-content: center;
  letter-spacing: 0;
  width: 34px;
}

.app-nav-links {
  background: #f3f6f8;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  padding: 3px;
}

.app-nav-links .nav-link {
  border-radius: 6px;
  color: #42526a;
  font-size: 0.94rem;
  padding: 0.42rem 0.75rem;
}

.app-nav-menu {
  background: transparent;
  border: 0;
}

.app-nav-links .nav-link.active,
.app-nav-links .nav-link:hover {
  background: #ffffff;
  color: #172033;
}

.app-nav-dropdown {
  border-color: #dfe5ec;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  min-width: 180px;
}

.app-nav-dropdown .dropdown-item.active {
  background: #eef4ff;
  color: #172033;
}

.page-toolbar {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.account-menu {
  position: relative;
}

.account-menu-button {
  border: 0;
  padding: 0;
}

.account-avatar {
  align-items: center;
  background: #172033;
  border-radius: 50%;
  color: #ffffff;
  display: inline-flex;
  font-weight: 700;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.account-dropdown {
  left: auto;
  max-width: calc(100vw - 24px);
  min-width: 230px;
  overflow: hidden;
  right: 0;
}

.account-menu-name,
.account-menu-email {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-dropdown .dropdown-item {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (hover: hover) {
  .account-menu:hover .dropdown-menu {
    display: block;
    left: auto;
    margin-top: 0;
    right: 0;
  }
}

.login-shell {
  align-items: center;
  display: flex;
  min-height: calc(100vh - 65px);
  justify-content: center;
  padding: 32px 18px;
}

.login-panel {
  background: #ffffff;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.login-panel input {
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  display: block;
  padding: 0.5rem 0.75rem;
  width: 100%;
}

.social-login-divider {
  align-items: center;
  color: #607086;
  display: flex;
  font-size: 0.85rem;
  gap: 12px;
  margin: 22px 0;
}

.social-login-divider::before,
.social-login-divider::after {
  background: #dfe5ec;
  content: "";
  flex: 1;
  height: 1px;
}

.google-login-button {
  align-items: center;
  border: 1px solid #cfd8e3;
  display: inline-flex;
  gap: 10px;
  justify-content: center;
}

.google-login-button:hover {
  border-color: #9fb0c4;
  background: #f8fafc;
}

.google-mark {
  align-items: center;
  border: 1px solid #dfe5ec;
  border-radius: 50%;
  color: #1a73e8;
  display: inline-flex;
  font-weight: 700;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.metric-panel,
.section-block {
  background: #ffffff;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  padding: 20px;
}

.label {
  color: #607086;
  font-size: 0.82rem;
}

.value {
  font-size: 1.35rem;
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 18px;
}

.progress {
  height: 10px;
  background: #e8edf2;
}

.chart-shell {
  height: 420px;
}

.detail-table {
  max-height: 640px;
}

.filterable-table tfoot input {
  min-width: 120px;
}

.compact-table {
  font-size: 0.92rem;
}

.mini-metric {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px 14px;
}

.dt-container .dt-search input,
.dt-container .dt-length select {
  border-color: #cfd8e3;
}

.alert-error {
  --bs-alert-color: #842029;
  --bs-alert-bg: #f8d7da;
  --bs-alert-border-color: #f5c2c7;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.25fr) minmax(180px, 0.75fr);
  gap: 20px;
  align-items: start;
}

.upload-grid .form-label {
  min-height: 24px;
  margin-bottom: 8px;
}

.upload-action {
  padding-top: 32px;
}

.portal-budget-table {
  max-height: 720px;
}

.portal-budget-table th,
.portal-budget-table td {
  min-width: 130px;
}

.portal-budget-table th:nth-child(2),
.portal-budget-table td:nth-child(2) {
  min-width: 220px;
}

.portal-budget-table th:last-child,
.portal-budget-table td:last-child {
  min-width: 72px;
}

.budget-list .category-row {
  cursor: pointer;
}

.budget-list .category-row:hover {
  background: #f3f6f8;
}

.toggle-cell {
  width: 36px;
}

.toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e8edf2;
  color: #42526a;
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

.category-row[aria-expanded="true"] .toggle-icon {
  transform: rotate(90deg);
}

.detail-collapse > td {
  background: #f8fafc;
}

.detail-list {
  padding: 10px 12px 16px 46px;
}

.detail-list .table {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.improvement-form {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(260px, 1.7fr) minmax(140px, 0.8fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr);
}

.inline-edit {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: inherit;
  min-height: 34px;
  padding: 5px 8px;
  width: 100%;
}

.inline-edit:hover {
  background: #f8fafc;
  border-color: #dfe5ec;
}

.inline-edit:focus {
  background: #ffffff;
  border-color: #7aa7e8;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

textarea.inline-edit {
  resize: vertical;
}

.title-edit {
  line-height: 1.35;
  min-height: 56px;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: normal;
}

.improvement-table tr.saving {
  opacity: 0.72;
}

.improvement-table tr.save-error .inline-edit {
  border-color: #dc3545;
}

.improvement-notes {
  grid-column: span 3;
}

.improvement-action {
  align-self: end;
}

.improvement-table th:first-child,
.improvement-table td:first-child {
  width: 58px;
}

.improvement-table {
  table-layout: fixed;
}

.improvement-table th:nth-child(2),
.improvement-table td:nth-child(2) {
  min-width: 380px;
  width: 34%;
}

.improvement-table th:nth-child(3),
.improvement-table td:nth-child(3) {
  text-align: center;
  width: 74px;
}

.improvement-table th:nth-child(4),
.improvement-table td:nth-child(4),
.improvement-table th:nth-child(5),
.improvement-table td:nth-child(5),
.improvement-table th:nth-child(6),
.improvement-table td:nth-child(6) {
  width: 150px;
}

.improvement-table th:nth-child(7),
.improvement-table td:nth-child(7) {
  width: 220px;
}

.improvement-table th:last-child,
.improvement-table td:last-child {
  width: 104px;
}

.owner-avatar {
  align-items: center;
  background: #eef4ff;
  border: 1px solid #cfe0ff;
  border-radius: 50%;
  color: #1d4ed8;
  cursor: help;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 700;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.wishlist-summary {
  display: flex;
  gap: 10px;
}

.summary-pill {
  background: #f8fafc;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  min-width: 150px;
  padding: 8px 12px;
  text-align: right;
}

.done-summary {
  background: #ecfdf3;
  border-color: #bbf7d0;
}

.improvement-table tr.is-done td {
  background: #ecfdf3;
}

.improvement-table tr.is-done .inline-edit {
  color: #166534;
}

.drag-handle {
  background: #f8fafc;
  border: 1px solid #dfe5ec;
  border-radius: 6px;
  color: #607086;
  cursor: grab;
  font-weight: 700;
  height: 34px;
  letter-spacing: 0;
  line-height: 1;
  padding: 0;
  width: 34px;
}

.drag-handle:active {
  cursor: grabbing;
}

.improvement-table tr.dragging {
  opacity: 0.55;
}

.improvement-note-cell {
  max-width: 240px;
  min-width: 160px;
  white-space: normal;
}

@media (max-width: 900px) {
  .page-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .upload-grid {
    grid-template-columns: 1fr;
  }

  .upload-action {
    padding-top: 0;
  }

  .improvement-form {
    grid-template-columns: 1fr;
  }

  .improvement-notes {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}
