:root {
  --navy: #0A1628;
  --blue: #2563EB;
  --blue-hover: #1D4ED8;
  --blue-bg: #EFF6FF;
  --blue-border: #BFDBFE;
  --muted: #6B7280;
  --muted-light: #9CA3AF;
  --border: rgba(13, 17, 23, 0.08);
  --border-strong: rgba(13, 17, 23, 0.12);
  --page-bg: #F7F8FA;
  --card-bg: #FFFFFF;
  --danger: #E11D48;
  --row-alt: #FAFBFC;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--navy);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 800;
}
.topbar .brand .logo-img {
  height: 34px;
  width: auto;
  object-fit: contain;
  display: block;
}
.topbar .icons {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
}

/* ── Page shell ─────────────────────────────────────────────────────────── */
.page {
  max-width: 780px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}
.page-header .icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--blue-bg);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.page-header h1 {
  font-size: 22px;
  margin: 0;
}
.page-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 18px;
}

/* ── Search + submit row ────────────────────────────────────────────────── */
.search-row {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}
.search-box {
  flex: 1;
  position: relative;
}
.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-light);
}
.search-box input {
  width: 100%;
  height: 46px;
  padding: 0 16px 0 42px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 14px;
  color: var(--navy);
  outline: none;
}
.search-box input:focus { border-color: var(--blue); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border-radius: 12px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:disabled { background: #C7D2FE; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ── Project cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 14px;
  overflow: hidden;
}
.card-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
}
.thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(135deg, #DBEAFE, #93C5FD);
  color: #1D4ED8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-body { flex: 1; min-width: 0; }
.card-body .name { font-size: 15px; font-weight: 700; }
.card-body .location {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.card-stats {
  display: flex;
  gap: 28px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.stat .label { font-size: 10.5px; color: var(--muted-light); font-weight: 600; }
.stat .value { font-size: 14px; font-weight: 700; margin-top: 1px; }
.stat .value .unit { font-size: 11px; font-weight: 500; color: var(--muted); }
.card-chevron { color: var(--muted-light); flex-shrink: 0; transition: transform 0.15s; }
.card.expanded .card-chevron { transform: rotate(180deg); }

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 14px;
  margin-top: -6px;
}
.card-meta-row .reports { font-size: 12px; color: var(--muted); font-weight: 600; }
.toggle-details { font-size: 12px; color: var(--blue); font-weight: 700; }

.reports-table-wrap {
  border-top: 1px solid var(--border);
  padding: 14px 18px 18px;
  background: var(--row-alt);
}
.reports-table-wrap h4 {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 700;
}
table.reports-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.reports-table thead th {
  text-align: left;
  font-size: 11px;
  color: var(--muted-light);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--border);
}
table.reports-table tbody td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.reports-table tbody tr:last-child td { border-bottom: none; }
table.reports-table td.notes { color: var(--muted); }
table.reports-table td.price { font-weight: 700; }

.empty-state, .error-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 14px;
}
.error-state { color: var(--danger); }

/* ── Loading skeleton ───────────────────────────────────────────────────── */
.skeleton-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.skeleton-thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  flex-shrink: 0;
}
.skeleton-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skeleton-line { height: 12px; border-radius: 6px; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-90 { width: 90%; }
.skeleton-thumb, .skeleton-line {
  background: linear-gradient(90deg, #EEF0F3 25%, #F7F8FA 37%, #EEF0F3 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
}
@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ── Pagination ─────────────────────────────────────────────────────────── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 16px 4px 4px;
  margin-top: 4px;
}
.page-size-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.page-size-control select {
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  outline: none;
}
.pagination-info {
  font-size: 12.5px;
  color: var(--muted);
  order: 3;
  flex-basis: 100%;
  text-align: center;
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.page-btn:hover:not(:disabled):not(.active) { background: var(--blue-bg); }
.page-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.page-btn:disabled { color: var(--muted-light); cursor: not-allowed; opacity: 0.5; }
.page-btn.ellipsis { border: none; cursor: default; }

@media (min-width: 641px) {
  .pagination-info { order: 0; flex-basis: auto; text-align: left; }
}

.note-bar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 18px;
  color: var(--navy);
  font-size: 12.5px;
  line-height: 1.5;
}
.note-bar svg { color: var(--blue); flex-shrink: 0; margin-top: 1px; }

/* ── Form (Submit Price) ────────────────────────────────────────────────── */
.form-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px;
}
.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}
.field label .req { color: var(--danger); margin-left: 2px; }
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 0 14px;
  height: 46px;
  font-size: 14px;
  color: var(--navy);
  outline: none;
  background: #fff;
}
.field textarea {
  height: auto;
  padding: 12px 14px;
  min-height: 90px;
  resize: vertical;
}
.field input:focus, .field textarea:focus { border-color: var(--blue); }
.field .hint {
  text-align: right;
  font-size: 11px;
  color: var(--muted-light);
  margin-top: 6px;
}
.field-row {
  display: flex;
  gap: 16px;
}
.field-row .field { flex: 1; }

.autocomplete { position: relative; }
.autocomplete-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(13, 17, 23, 0.08);
  max-height: 220px;
  overflow-y: auto;
  z-index: 10;
}
.autocomplete-list .option {
  padding: 10px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}
.autocomplete-list .option:last-child { border-bottom: none; }
.autocomplete-list .option:hover { background: var(--blue-bg); }
.autocomplete-list .option .opt-location { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.autocomplete-list .option.new-entry { color: var(--blue); font-weight: 600; }
.autocomplete-list .empty { padding: 12px 14px; font-size: 13px; color: var(--muted); }

/* ── Submission overlay ─────────────────────────────────────────────────── */
.submit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.submit-overlay-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  max-width: 300px;
  text-align: center;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--blue-bg);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.submit-overlay-message {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}
.submit-overlay-submessage {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: -8px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  z-index: 100;
}
.toast.error { background: var(--danger); }

@media (max-width: 640px) {
  .card-stats { gap: 18px; }
  .field-row { flex-direction: column; gap: 0; }
  .page { padding: 20px 16px 50px; }
}
