:root {
  --bg-top: #f7f4ec;
  --bg-bottom: #e6f0ea;
  --surface: #ffffff;
  --surface-soft: #f8faf8;
  --ink: #1c2a24;
  --muted: #5f7066;
  --brand: #136f63;
  --brand-strong: #0f5a50;
  --accent: #d9893d;
  --line: #d6e0da;
  --radius: 16px;
  --shadow: 0 8px 28px rgba(20, 42, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Montserrat", "Segoe UI", Tahoma, sans-serif;
  background: linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
  min-height: 100vh;
}

.app-shell {
  max-width: 1180px;
  margin: 20px auto;
  padding: 0 12px 28px;
}

.hero {
  background: linear-gradient(120deg, #12433e, #1f7a6f 68%, #2f9b8f);
  color: #f3faf7;
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
}

.hero h1 {
  margin: 0 0 6px;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: clamp(1.2rem, 2.8vw, 1.9rem);
}

.hero p {
  margin: 0;
  color: rgba(243, 250, 247, 0.9);
  font-size: 0.95rem;
}

.hero-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.hero-nav a {
  text-decoration: none;
  color: #eff9f5;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.hero-nav a:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.panel {
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.panel-muted {
  background: var(--surface-soft);
}

.panel-title {
  margin: 0 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  font-size: 0.78rem;
  font-weight: 700;
}

.kpi {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-strong);
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.btn-outline-accent {
  color: var(--accent);
  border-color: var(--accent);
}

.btn-outline-accent:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  background: #ecf4ef;
  color: #2f4b3e;
  border-bottom: 1px solid #cfddd5;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.table td {
  vertical-align: middle;
}

.summary-box p {
  margin-bottom: 8px;
  font-weight: 600;
}

.summary-box p:last-child {
  margin-bottom: 0;
}

.declared-pill {
  display: inline-block;
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #c8d9d1;
  background: #f0f7f3;
  color: #2f5f4f;
  font-weight: 700;
  font-size: 0.86rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.summary-card {
  border: 1px solid #d1ded7;
  border-radius: 12px;
  padding: 11px 12px;
  background: linear-gradient(160deg, #fbfdfc, #f1f7f4);
}

.summary-card.is-positive {
  border-color: #9ac9b8;
}

.summary-card.is-negative {
  border-color: #d8a9a9;
  background: linear-gradient(160deg, #fff8f8, #fff0f0);
}

.summary-label {
  color: #658176;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
}

.summary-value {
  margin-top: 3px;
  font-size: 1.12rem;
  font-weight: 800;
  color: #1f4034;
  line-height: 1.1;
}

.summary-value.small {
  font-size: 1rem;
}

.summary-value span {
  font-size: 0.74rem;
  color: #648073;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-sub {
  margin-top: 4px;
  color: #4c665b;
  font-size: 0.82rem;
  font-weight: 600;
}

.summary-expense {
  margin-top: 10px;
  border: 1px dashed #d2ddd7;
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fbf9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mobile-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mobile-stack > * {
  flex: 1 1 230px;
}

.form-control,
.form-select,
input[type="number"],
input[type="date"],
input[type="text"] {
  border-radius: 10px;
  border-color: #cfdad4;
}

.form-control:focus,
.form-select:focus,
input:focus {
  border-color: #5ea497;
  box-shadow: 0 0 0 0.2rem rgba(19, 111, 99, 0.15);
}

.fade-in {
  animation: fadeInUp 0.35s ease;
}

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

@media (max-width: 991px) {
  .panel {
    padding: 12px;
  }

  .table thead th,
  .table td {
    font-size: 0.86rem;
  }
}

@media (max-width: 767px) {
  .app-shell {
    margin: 10px auto;
    padding: 0 8px 18px;
  }

  .hero {
    border-radius: 14px;
    padding: 14px 12px;
  }

  .hero-nav a {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .panel {
    margin-top: 10px;
    border-radius: 12px;
    padding: 10px;
  }

  .panel-title {
    font-size: 0.74rem;
  }

  .table thead th,
  .table td {
    font-size: 0.8rem;
    padding: 0.45rem;
  }

  .col-desktop {
    display: none;
  }

  .btn,
  .form-control,
  .form-select,
  input {
    min-height: 42px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .summary-expense {
    flex-direction: column;
    align-items: flex-start;
  }
}
