/* =====================================================================
   EcoCoin Admin Analytics — self-contained professional theme
   (no external CSS frameworks / CDNs required)
   ===================================================================== */
:root {
  --eco: #18b07b;
  --eco-dark: #128a60;
  --eco-light: #e8f8f1;
  --ink: #1f2a25;
  --muted: #6b7a72;
  --line: #e7ebe8;
  --bg: #f1f5f3;
  --card: #ffffff;
  --sidebar-from: #103b2c;
  --sidebar-to: #0a261b;
  --blue: #4e73df;
  --amber: #e0a818;
  --teal: #2fb6c9;
  --red: #e25563;
  --shadow: 0 1px 3px rgba(16, 40, 30, 0.06), 0 8px 24px rgba(16, 40, 30, 0.06);
  --radius: 14px;
  --sidebar-w: 244px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica,
    Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

/* ---------------- Buttons / inputs ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--eco);
  color: #fff;
}
.btn-primary:hover {
  background: var(--eco-dark);
}
.btn-block {
  width: 100%;
  padding: 12px;
}
.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--eco);
  color: var(--eco-dark);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-ic,
.nav-ic,
.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.select {
  appearance: none;
  background: #fff
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%236b7a72'><path d='M7 10l5 5 5-5z'/></svg>")
    no-repeat right 10px center;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 32px 9px 12px;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
}
.select:focus,
.field input:focus {
  outline: none;
  border-color: var(--eco);
  box-shadow: 0 0 0 3px rgba(24, 176, 123, 0.15);
}

/* ---------------- Login ---------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(
      1200px 600px at 20% -10%,
      rgba(24, 176, 123, 0.35),
      transparent
    ),
    linear-gradient(135deg, #0f3d2e 0%, #0a261b 100%);
}
.login-card {
  width: 100%;
  max-width: 390px;
  background: #fff;
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
.login-head {
  text-align: center;
  margin-bottom: 22px;
}
.login-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 20px;
  background: var(--eco-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}
.login-head h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
}
.login-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.field {
  display: block;
  margin-bottom: 16px;
}
.field span {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 0.95rem;
  color: var(--ink);
}
.form-error {
  color: var(--red);
  font-size: 0.82rem;
  text-align: center;
  min-height: 1.1em;
  margin-top: 12px;
}

/* ---------------- Layout ---------------- */
.layout {
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(180deg, var(--sidebar-from), var(--sidebar-to));
  color: #cfe6db;
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform 0.25s ease;
}
.sidebar-brand {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand-leaf {
  font-size: 1.45rem;
}
.sidebar-nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: #b6d3c6;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}
.nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}
.nav-link.active {
  background: rgba(24, 176, 123, 0.22);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--eco);
}
.nav-ic {
  width: 18px;
  height: 18px;
  fill: currentColor;
  opacity: 0.9;
}
.sidebar-foot {
  padding: 16px 22px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 35;
}

.content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 64px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
}
.topbar-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.icon-btn {
  display: none;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--ink);
}
.icon-btn svg {
  width: 22px;
  height: 22px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--eco);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}
.user-name {
  font-weight: 600;
  font-size: 0.85rem;
}

/* ---------------- Page ---------------- */
.page {
  padding: 24px;
  flex: 1;
  max-width: 1440px;
  width: 100%;
}
section {
  margin-bottom: 22px;
  scroll-margin-top: 80px;
}

/* ---------------- KPI cards ---------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}
.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--eco);
}
.kpi-card.accent-blue::before {
  background: var(--blue);
}
.kpi-card.accent-amber::before {
  background: var(--amber);
}
.kpi-card.accent-teal::before {
  background: var(--teal);
}
.kpi-card.accent-green::before {
  background: var(--eco);
}
.kpi-icon {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 14px;
  background: var(--eco-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.kpi-card.accent-blue .kpi-icon {
  background: #eaf0fd;
}
.kpi-card.accent-amber .kpi-icon {
  background: #fdf4e0;
}
.kpi-card.accent-teal .kpi-icon {
  background: #e4f7fa;
}
.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.1;
  margin-top: 3px;
}
.kpi-sub {
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 3px;
}

/* ---------------- Cards & charts ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--eco-dark);
}
.card-body {
  padding: 18px 20px;
}
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.charts-row-2 {
  grid-template-columns: 1fr 1fr;
}
.chart-wrap {
  position: relative;
  height: 300px;
}
.chart-wrap-pie {
  height: 280px;
}

/* ---------------- Tables ---------------- */
.table-wrap {
  overflow-x: auto;
  padding: 0;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  padding: 12px 18px;
  text-align: left;
  white-space: nowrap;
}
.table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #f8faf9;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
}
.table td {
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
}
.table tbody tr:hover {
  background: #f6fbf8;
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table .ar {
  text-align: right;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--muted);
  font-size: 0.82rem;
}
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--eco-light);
  color: var(--eco-dark);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: capitalize;
}
.empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 32px;
}

.page-foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 18px 0 4px;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 1024px) {
  .charts-row {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar.open ~ .sidebar-backdrop {
    display: block;
  }
  .content {
    margin-left: 0;
  }
  .icon-btn {
    display: inline-flex;
  }
  .topbar-title {
    display: none;
  }
  .user-name {
    display: none;
  }
  .charts-row-2 {
    grid-template-columns: 1fr;
  }
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.checkbox-field {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--ink);
}
.checkbox-field input {
  width: auto;
}
.form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
}
.form-hint {
  font-size: 0.82rem;
  color: var(--muted);
}
.btn-sm {
  padding: 6px 10px;
  font-size: 0.78rem;
}
.table-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.pill-ok {
  background: var(--eco-light);
  color: var(--eco-dark);
}
.pill-off {
  background: #f3e8e8;
  color: var(--red);
}
.row-inactive td {
  opacity: 0.72;
}
@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}
