:root {
  --bg: #edf1ea;
  --surface: #ffffff;
  --surface-soft: #f7f9f6;
  --ink: #1b2a27;
  --muted: #5a6c67;
  --brand: #0f766e;
  --brand-dark: #0a5b55;
  --accent: #c05621;
  --line: #d8e1dd;
  --ok: #1f7a3d;
  --warn: #b45309;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 0%, #f6efe4 0%, var(--bg) 35%);
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #143f3b, #1b5650);
  color: #e8f7f3;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.brand strong {
  display: block;
  font-size: 1.3rem;
}

.brand small {
  opacity: 0.75;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.menu a,
.menu-logout {
  text-decoration: none;
  border: 0;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  color: #e8f7f3;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
}

.menu a:hover,
.menu-logout:hover,
.menu a.active {
  background: rgba(255, 255, 255, 0.16);
}

.content-wrap {
  padding: 1rem 1.4rem 1.4rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.topbar h1 {
  margin: 0;
}

.topbar p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.session-chip {
  background: #d6ece9;
  color: #124640;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.9rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 30px rgba(14, 28, 24, 0.06);
}

.card h2 {
  margin: 0 0 0.6rem;
}

.muted {
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 0.8rem;
}

.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.four-cols {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input,
select,
textarea,
button {
  width: 100%;
  border: 1px solid #c8d7d1;
  border-radius: 9px;
  padding: 0.58rem 0.65rem;
  font: inherit;
}

button {
  width: auto;
  background: var(--brand);
  color: #fff;
  border: none;
  cursor: pointer;
  min-width: 120px;
}

button:hover {
  background: var(--brand-dark);
}

button.secondary {
  background: var(--accent);
}

button.ghost {
  background: #d9e4df;
  color: #1b2a27;
}

.actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

.align-end {
  align-items: end;
}

.summary-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.kpi-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.kpi-card {
  background: linear-gradient(180deg, #f7faf9 0%, #edf3f1 100%);
  border: 1px solid #d6e1dc;
  border-radius: 12px;
  padding: 0.85rem;
}

.kpi-card span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.kpi-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.25rem;
  color: #0f3d37;
}

.dashboard-grid-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.status-chart {
  display: grid;
  gap: 0.65rem;
}

.status-row {
  border: 1px solid #e3ece8;
  border-radius: 10px;
  padding: 0.6rem;
  background: #f9fcfb;
}

.status-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
}

.status-bar-track {
  height: 8px;
  border-radius: 999px;
  background: #dce8e3;
  overflow: hidden;
}

.status-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #1c8a7f, #3fa89e);
}

.project-volume-chart {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

.project-volume-row {
  background: #f8fbfa;
  border: 1px solid #e3ece8;
  border-radius: 10px;
  padding: 0.5rem;
}

.project-volume-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.project-volume-head span {
  font-size: 0.85rem;
  color: var(--muted);
}

.project-volume-head strong {
  font-size: 0.92rem;
}

.project-volume-track {
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: #dce8e3;
}

.project-volume-fill {
  height: 100%;
  background: linear-gradient(90deg, #c05621, #e28a5a);
}

.period-picker {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid #dfe8e4;
}

.period-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.period-groups {
  display: grid;
  gap: 0.65rem;
}

.period-group {
  border: 1px solid #dbe6e1;
  border-radius: 12px;
  background: #f8fbfa;
  padding: 0.6rem;
}

.period-months {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.55rem;
}

.period-button {
  min-width: 0;
  border: 1px solid #b8cbc5;
  background: #ffffff;
  color: #1b2a27;
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}

.period-button.year {
  font-weight: 600;
  background: #e9f4f1;
}

.period-button.month {
  font-size: 0.88rem;
}

.period-button.active {
  background: #0f766e;
  color: #ffffff;
  border-color: #0f766e;
}

.metric {
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 0.8rem;
}

.metric span {
  font-size: 0.82rem;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.1rem;
}

.table-wrap {
  overflow-x: auto;
}

.table-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.table-actions button,
.table-actions a {
  min-width: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.45rem;
  border-bottom: 1px solid #e4ebe8;
}

.status-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
  font-size: 0.75rem;
  background: #dbe4df;
}

.status-DRAFT { background: #e5ece8; color: #1b2a27; }
.status-SUBMITTED { background: #dbeafe; color: #1e40af; }
.status-IN_REVIEW { background: #fef3c7; color: #92400e; }
.status-APPROVED { background: #dcfce7; color: #166534; }
.status-REJECTED { background: #fee2e2; color: #991b1b; }
.status-PAID { background: #d1fae5; color: #065f46; }

.empty-state {
  padding: 1rem;
  border: 1px dashed #c9d8d3;
  border-radius: 10px;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.audit-list {
  display: grid;
  gap: 0.5rem;
}

.audit-item {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e4ebe8;
}

.audit-entry {
  border: 1px solid #dce8e3;
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.7rem;
  background: #fbfdfc;
}

.audit-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.audit-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.8rem;
  margin-bottom: 0.55rem;
}

.status-hint {
  border-radius: 10px;
  padding: 0.8rem;
  background: #f7f9f6;
}

.inline-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.danger-text {
  color: var(--danger);
}

.button-loading {
  opacity: 0.75;
  cursor: wait;
}

.dialog-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  width: min(480px, 92vw);
}

.dialog-card::backdrop {
  background: rgba(8, 19, 16, 0.42);
}

.receipt-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 0.8rem;
  margin-bottom: 0.8rem;
}

.receipt-preview {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  margin-bottom: 0.6rem;
}

.receipt-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: #1f453f;
  color: #fff;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  max-width: 320px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.toast.error {
  background: #8a1f1f;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .menu {
    flex-direction: row;
    overflow-x: auto;
  }

  .two-cols,
  .three-cols,
  .four-cols,
  .dashboard-grid-2col,
  .receipt-grid,
  .detail-grid,
  .audit-entry-grid {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }
}
