/* =====================================================
   VARIAVEIS E CONFIGURACAO BASE
   ===================================================== */
:root {
  --ink: #17352b;
  --leaf: #2f6b4f;
  --deep-leaf: #173d2d;
  --cream: #dee3df;
  --paper: #fffef9;
  --line: #dce4d5;
  --muted: #617865;
  --terracotta: #ba4738;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  background-color: var(--cream);
  background-image: radial-gradient(rgba(44, 83, 62, .08) .75px, transparent .75px);
  background-size: 12px 12px;
}

h1,
h2,
h3 {
  font-family: "Roboto", serif;
}

/* =====================================================
   ESTRUTURA PRINCIPAL
   ===================================================== */
.app-shell {
  min-height: 100vh;
}

.sidebar {
  background: var(--deep-leaf);
}

/* =====================================================
   NAVEGACAO
   ===================================================== */
.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .8rem;
  border-radius: .8rem;
  color: #c4d7c8;
  font-size: .88rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  transition: .2s;
}

.nav-button:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.nav-button.active {
  background: #e4f0df;
  color: #214b38;
}

/* =====================================================
   CAMPOS E PAINEIS
   ===================================================== */
.field {
  width: 100%;
  border: 1px solid #cdd9ca;
  border-radius: .72rem;
  padding: .7rem .8rem;
  color: var(--ink);
  background: #fffef9;
  outline: none;
}

.field:focus {
  border-color: #477f5d;
  box-shadow: 0 0 0 3px rgba(71, 127, 93, .15);
}

.panel {
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 10px 30px rgba(30, 67, 47, .055);
}

/* =====================================================
   BOTOES E STATUS
   ===================================================== */
.btn {
  border: 0;
  cursor: pointer;
}

.btn-primary {
  color: #fff;
  background: #2f6b4f;
}

.btn-soft {
  color: #24583d;
  background: #e1efdf;
}

.btn-danger {
  color: #9a4d32;
  background: #f7e5dd;
}

.btn-muted {
  color: #415a4a;
  background: #e7eee3;
}

.status-pending {
  color: #895900;
  background: #fff3cf;
}

.status-done {
  color: #21653b;
  background: #dff3df;
}

.status-cancelled {
  color: #6b6870;
  background: #ecebef;
}

/* =====================================================
   DASHBOARD E METRICAS
   ===================================================== */
.metric {
  position: relative;
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -34px;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .15);
}

/* =====================================================
   MENSAGENS, TOASTS E DIALOGOS
   ===================================================== */
.message {
  border-radius: .5rem;
  padding: .65rem .8rem;
  font-size: .875rem;
}

.message.success {
  color: #22633a;
  background: #e1f1e3;
}

.message.error {
  color: #8c3d28;
  background: #f8dfd7;
}

.toast {
  opacity: 0;
  transform: translateY(140%);
  transition: .3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.dialog {
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.dialog.show {
  opacity: 1;
  pointer-events: auto;
}

/* =====================================================
   TABELAS
   ===================================================== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: #edf4e9;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

td,
th {
  padding: 1rem;
  text-align: left;
}

tbody tr {
  border-top: 1px solid #e7eee3;
}

.installment-details > td {
  padding: 0;
  background: #f7faf4;
}

.installments-panel {
  padding: 1rem;
  border-top: 1px solid #dce4d5;
  border-bottom: 1px solid #dce4d5;
}

.installments-grid {
  display: grid;
  gap: .6rem;
}

.installment-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem;
  border: 1px solid #dce4d5;
  border-radius: .7rem;
  background: #fffef9;
}

@media (max-width: 767px) {
  .installment-card {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* =====================================================
   RESPONSIVIDADE
   ===================================================== */
@media (max-width: 767px) {
  .sidebar {
    position: relative;
  }

  .nav-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .main {
    padding: 1rem;
  }

  .sidebar-footer {
    display: none;
  }
}