@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #f4f7f3;
  --ink: #16201d;
  --muted: #5f6e66;
  --surface: #ffffff;
  --brand: #0d7a5f;
  --brand-2: #d7831f;
  --line: #d8e3db;
  --alert-bg: #ffe9ec;
  --alert-fg: #9c1f2f;
  --shadow-soft: 0 14px 34px rgba(18, 45, 35, 0.09);
  --shadow-float: 0 22px 45px rgba(18, 45, 35, 0.15);
}

body.module-theme-dashboard {
  --brand: #0d7a5f;
  --brand-2: #d7831f;
}

body.module-theme-users {
  --brand: #3757b4;
  --brand-2: #5f7de0;
}

body.module-theme-penjualan-kompos {
  --brand: #9f4f0d;
  --brand-2: #d7831f;
}

body.module-theme-sampah-anorganik {
  --brand: #1e6474;
  --brand-2: #2b8ea5;
}

body.module-theme-limbah-kantin {
  --brand: #8c5f1f;
  --brand-2: #cf9239;
}

body.module-theme-sampah-daun,
body.module-theme-agripam,
body.module-theme-bibit,
body.module-theme-pohon,
body.module-theme-hewan {
  --brand: #0d7a5f;
  --brand-2: #4da979;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 95% 5%, #d8f0e5 0%, transparent 38%),
    radial-gradient(circle at 15% 100%, #f4efd6 0%, transparent 46%),
    linear-gradient(145deg, #f6faf7 0%, #edf4ef 55%, #f8f4e8 100%),
    var(--bg);
}

.auth-body { min-height: 100vh; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 30px;
  border-radius: 24px;
  border: 1px solid #e4ede7;
  background: linear-gradient(170deg, #ffffff 0%, #f7fbf8 100%);
  box-shadow: var(--shadow-float);
  animation: slideUp .45s ease;
}

.chip {
  display: inline-block;
  padding: 6px 12px;
  background: #e3f5ee;
  border-radius: 999px;
  color: #0c7e60;
  font-weight: 700;
  margin: 0;
}

.muted { color: var(--muted); }

.stack { display: grid; gap: 10px; margin-top: 18px; }

input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 14px;
  background: #fcfefd;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(13, 122, 95, .14);
  outline: none;
  transform: translateY(-1px);
}

select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fcfefd;
  color: var(--ink);
}

select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(13, 122, 95, .14);
  outline: none;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #138267 0%, #0d6f58 100%);
  color: #fff;
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(13, 111, 88, 0.22);
  filter: saturate(1.05);
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.alert {
  background: var(--alert-bg);
  color: var(--alert-fg);
  border: 1px solid #ffc4ce;
  padding: 10px 12px;
  border-radius: 10px;
  margin-top: 12px;
}

.alert-success {
  background: #e7f8ee;
  color: #1f7048;
  border-color: #bde7cc;
}

.alert-error {
  background: var(--alert-bg);
  color: var(--alert-fg);
  border-color: #ffc4ce;
}

.shell {
  display: grid;
  grid-template-columns: 296px 1fr;
  min-height: 100vh;
}

.sidebar {
  background:
    radial-gradient(circle at 20% 10%, rgba(117, 202, 171, 0.2) 0%, transparent 40%),
    linear-gradient(165deg, #082c24 0%, #0e4033 100%);
  color: #dff3ea;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand p {
  margin: 0;
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: .3px;
}

.brand span { color: #9ed8be; font-size: 13px; }

.sidebar nav {
  display: grid;
  gap: 6px;
}

.sidebar nav a {
  color: #d9efe5;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}

.nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.nav-icon svg {
  width: 15px;
  height: 15px;
}

.nav-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateX(2px);
}

.sidebar nav a.active {
  background: linear-gradient(130deg, rgba(29, 139, 108, 0.38), rgba(13, 111, 88, 0.55));
  border-color: rgba(158, 216, 190, 0.38);
  color: #f7fffb;
}

.sidebar nav a.active .nav-icon {
  background: rgba(255, 255, 255, 0.16);
}

.logout-form { margin-top: auto; }

.content {
  padding: 22px;
  animation: fadeIn .35s ease;
}

.content-topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.content-topbar div {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #ffffffd9;
  border: 1px solid #e3ebe6;
  box-shadow: var(--shadow-soft);
}

.content-topbar strong {
  font-size: 13px;
}

.content-topbar span {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.page-head h1 {
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  margin: 0;
}

.page-head .muted {
  margin-top: 4px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.card {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid #e3ece6;
  box-shadow: var(--shadow-soft);
}

.card h3 { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.card strong { font-size: 24px; }

.dashboard-head {
  margin-bottom: 18px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-stack {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

.kpi-card {
  border-radius: 18px;
  padding: 16px;
  color: #fff;
  box-shadow: 0 18px 30px rgba(23, 38, 31, 0.16);
  min-height: 140px;
}

.kpi-card h3 {
  margin: 0;
  font-size: 13px;
  opacity: 0.9;
}

.kpi-card strong {
  display: block;
  font-size: 28px;
  margin: 8px 0;
}

.kpi-card small {
  opacity: 0.95;
}

.tone-sales { background: linear-gradient(140deg, #0b7f62, #22a883); }
.tone-daun { background: linear-gradient(140deg, #608b2d, #8abf3f); }
.tone-anorganik { background: linear-gradient(140deg, #245b64, #2d8790); }
.tone-limbah { background: linear-gradient(140deg, #a15c1a, #d8932f); }

.panel {
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  border: 1px solid #e3ece6;
  box-shadow: var(--shadow-soft);
}

.detail-panel {
  min-height: 270px;
  display: flex;
  flex-direction: column;
}

.panel header h2 {
  margin: 0;
  font-size: 18px;
}

.panel header p {
  margin: 6px 0 0;
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
  align-items: stretch;
  flex: 1;
}

.split-grid div {
  border: 1px solid #e1e9e4;
  border-radius: 12px;
  padding: 12px;
  background: #fbfdfc;
  min-width: 0;
}

.split-grid h4 {
  margin: 0 0 8px;
}

.split-grid p {
  margin: 6px 0;
}

.mini-chart {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 250px;
  flex: 1;
}

.bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  gap: 4px;
  height: 100%;
  min-width: 0;
}

.bar {
  width: 100%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #2f8f61 0%, #1f6f54 100%);
  min-height: 6px;
}

.bar-label {
  font-size: 11px;
  color: var(--muted);
}

.bar-item small {
  font-size: 10px;
  color: #55615c;
  white-space: normal;
  text-align: center;
  line-height: 1.2;
}

.revenue-chart .bar {
  background: linear-gradient(180deg, #d7831f 0%, #9f4f0d 100%);
}

.management-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.management-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.management-latest-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.compact-table table {
  min-width: 480px;
}

.management-stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.recent-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.recent-list li {
  border: 1px solid #e2ebe6;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfdfc;
  display: grid;
  gap: 2px;
}

.recent-list span {
  color: var(--muted);
  font-size: 12px;
}

.recent-list strong {
  font-size: 14px;
}

.recent-list em {
  font-size: 12px;
  color: #3b4d45;
  font-style: normal;
}

@media (min-width: 1440px) {
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.table-wrap {
  width: 100%;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e4ebe6;
  box-shadow: var(--shadow-soft);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th, td {
  text-align: left;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
}

th {
  position: sticky;
  top: 0;
  background: #eef6f1;
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  font-size: 12px;
  letter-spacing: .35px;
  text-transform: uppercase;
}

tbody tr {
  transition: background-color .2s ease;
}

tbody tr:hover {
  background: #f7fbf9;
}

.empty-state {
  background: #fff;
  border-radius: 12px;
  border: 1px dashed var(--line);
  padding: 18px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.search-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search-form input,
.search-form select {
  min-height: 38px;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #345f4d 0%, #214c3b 100%);
  border-radius: 12px;
  padding: 0 14px;
}

.btn-link,
button,
.pagination a.active {
  background: linear-gradient(135deg, var(--brand-2) 0%, var(--brand) 100%);
}

.form-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid #e4ebe6;
  box-shadow: var(--shadow-soft);
}

.form-card-head {
  margin-bottom: 12px;
}

.form-card-head h3 {
  margin: 0;
}

.form-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.grid-form label,
.stack-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.stack-form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #e2ebe6;
  border-radius: 12px;
  background: #fcfefd;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.edit-box {
  margin-bottom: 8px;
}

details summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 600;
}

.danger {
  background: #b93f4a;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.pagination a {
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 32px;
  text-align: center;
  padding: 6px 8px;
}

.pagination a.nav-link {
  min-width: 52px;
  font-weight: 600;
}

.pagination a.active {
  color: #fff;
  border-color: var(--brand);
}

.pagination a.disabled {
  opacity: .45;
  pointer-events: none;
}

@keyframes slideUp {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 14px 12px;
    gap: 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }
  .brand p { font-size: 20px; }
  .sidebar nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }
  .sidebar nav a {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    white-space: nowrap;
  }
  .logout-form { margin-top: 6px; }
  .logout-form button { width: 100%; }
  .content { padding: 12px; }
  .content-topbar { justify-content: flex-start; }
  .content-topbar div {
    width: 100%;
    justify-content: center;
    border-radius: 12px;
    padding: 10px 12px;
  }
  .toolbar { gap: 8px; }
  .search-form {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .search-form input,
  .search-form select,
  .search-form button {
    width: 100%;
    min-height: 42px;
  }
  .grid-form {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .form-card,
  .table-wrap,
  .panel,
  .card {
    border-radius: 14px;
  }
  .management-kpi-grid,
  .management-grid-2,
  .management-latest-grid,
  .management-stats-grid {
    grid-template-columns: 1fr;
  }
  th, td { padding: 11px 10px; }
  .split-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .content-topbar strong { font-size: 12px; }
  .content-topbar span { font-size: 11px; }
  .search-form { grid-template-columns: 1fr; }
  .btn-link {
    width: 100%;
    min-height: 42px;
  }
  .pagination {
    justify-content: center;
    gap: 8px;
  }
}
