:root {
  --ink: #15231f;
  --muted: #5d6f68;
  --line: #d7e2dc;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --panel: #f3f7f4;
  --brand: #0f5c4c;
  --brand-deep: #0a3d34;
  --accent: #d97706;
  --accent-soft: #fff4e5;
  --danger: #b42318;
  --success: #0f7a45;
  --warning: #9a6700;
  --shadow: 0 18px 40px rgba(15, 40, 32, 0.08);
  --radius: 16px;
  --font-display: "Sora", "Trebuchet MS", sans-serif;
  --font-body: "Figtree", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 12% 10%, rgba(217, 119, 6, 0.14), transparent 28%),
    radial-gradient(circle at 88% 0%, rgba(15, 92, 76, 0.16), transparent 32%),
    linear-gradient(160deg, #eef5f1 0%, #f7faf8 42%, #e8f0eb 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 92, 76, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 92, 76, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.55), transparent 85%);
  z-index: 0;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: linear-gradient(180deg, #0b3f36 0%, #0f5c4c 58%, #134e45 100%);
  color: #f4fffb;
  overflow: auto;
  animation: rise 420ms ease both;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  padding: 8px 10px 18px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: 16px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.12);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-text {
  display: grid;
  gap: 2px;
}

.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand-text small {
  color: rgba(244, 255, 251, 0.72);
  font-size: 0.78rem;
}

.nav-label {
  margin: 16px 10px 6px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 255, 251, 0.55);
}

.side-nav {
  display: grid;
  gap: 4px;
}

.side-nav a {
  color: rgba(244, 255, 251, 0.88);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 160ms ease, transform 160ms ease;
}

.side-nav a:hover,
.side-nav a.active {
  background: rgba(255,255,255,.12);
  transform: translateX(2px);
}

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 28px 8px;
  animation: rise 480ms ease both;
}

.topbar-copy {
  flex: 1;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.nav-toggle {
  display: none;
}

main {
  padding: 12px 28px 36px;
  max-width: 1480px;
  width: 100%;
  animation: rise 560ms ease both;
}

.hero,
.panel {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(215, 226, 220, 0.9);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(15, 92, 76, 0.94), rgba(10, 61, 52, 0.88)),
    radial-gradient(circle at 80% 20%, rgba(217, 119, 6, 0.28), transparent 40%);
  color: #f7fffb;
  border: none;
}

.hero h2,
.page-title h2,
main > h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  letter-spacing: -0.03em;
}

.hero p,
.page-title p,
.map-hint {
  margin: 0;
  color: inherit;
  opacity: 0.9;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 180ms ease, border-color 180ms ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: #b8d0c6;
}

.card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--brand);
  letter-spacing: -0.03em;
}

.card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0;
}

.sticky {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(243, 247, 244, 0.92);
  backdrop-filter: blur(8px);
  padding: 8px 0;
}

button,
.button-link {
  border: 1px solid #c5d5cd;
  background: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

button:hover,
.button-link:hover {
  transform: translateY(-1px);
  border-color: #9fbfb2;
}

button.primary,
.primary,
.primary-link {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

button.danger {
  background: #fff1f0;
  color: var(--danger);
  border-color: #eab1ac;
}

.actions {
  display: flex;
  gap: 5px;
  align-items: flex-start;
}

.actions form { margin: 0; }

.table-wrap {
  overflow: auto;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 12px;
}

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

th, td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf2ef;
  text-align: left;
  vertical-align: top;
  font-size: 0.86rem;
}

th {
  background: #eef5f1;
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 14px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.form-grid label,
.location-field,
.map-search-controls > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.86rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: 2fr repeat(5, 1fr) auto;
  gap: 8px;
}

input, textarea, select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #c6d6ce;
  border-radius: 10px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(15, 92, 76, 0.22);
  border-color: var(--brand);
}

.full { grid-column: 1 / -1; }

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.provider-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease;
}

.provider-card:hover {
  border-color: #a9c7ba;
  transform: translateY(-1px);
}

.provider-card span {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.flash {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-weight: 600;
}

.flash.success { background: #e4f7ec; color: var(--success); }
.flash.error { background: #ffe2df; color: #8a1c12; }
.flash.warning { background: #fff1c9; color: var(--warning); }

.status {
  padding: 3px 8px;
  border-radius: 8px;
  background: #e6eee9;
  font-size: 0.78rem;
}

.status.pending,
.status.captured { background: #fff0c2; }
.status.approved,
.status.transferred { background: #d9f5df; }
.status.rejected { background: #ffe0dc; }

.empty {
  text-align: center;
  padding: 28px;
  color: var(--muted);
}

.mini-form {
  display: grid;
  gap: 6px;
  min-width: 330px;
}

.map-search-panel {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 14px;
  margin: 18px 0 8px;
}

.map-search-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.location-row,
.radius-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.location-row input { flex: 1; }
.radius-row input[type=range] { flex: 1; }
.radius-row input[type=number] { width: 88px; }

#search-map {
  min-height: 360px;
  height: 440px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #d9e8e1;
}

.map-hint {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  font-weight: 500;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.search-submit-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.hero-btn-light {
  background: #fff !important;
  color: #0a3d34 !important;
  border-color: #fff !important;
}

.hero-btn-ghost {
  background: transparent !important;
  color: #fff !important;
  border-color: rgba(255,255,255,.35) !important;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    z-index: 20;
    transform: translateX(-105%);
    transition: transform 200ms ease;
  }
  .sidebar.open { transform: translateX(0); }
  .nav-toggle { display: inline-flex; }
  .topbar, main { padding-left: 18px; padding-right: 18px; }
  .form-grid,
  .form-grid.two,
  .filter-grid,
  .map-search-panel {
    grid-template-columns: 1fr;
  }
  .page-title {
    align-items: stretch;
    flex-direction: column;
  }
  #search-map { height: 320px; }
}
