:root {
  --bg: #eef5f2;
  --card: #ffffff;
  --ink: #16251f;
  --muted: #64746d;
  --line: #d9e5df;
  --primary: #0b6b4f;
  --primary-dark: #084b39;
  --blue: #0d5d94;
  --danger: #b42318;
  --warning: #936300;
  --shadow: 0 24px 70px rgba(22, 37, 31, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(19, 126, 93, 0.18), transparent 34rem),
    linear-gradient(135deg, #f8fbf7 0%, var(--bg) 100%);
  font-family: "Aptos", "Segoe UI", sans-serif;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; font-weight: 700; }

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { align-items: center; color: var(--ink); display: inline-flex; gap: 0.8rem; min-width: 0; }
.brand-logo {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(22, 37, 31, 0.1);
  display: block;
  flex: 0 0 auto;
  height: 56px;
  object-fit: contain;
  padding: 0.25rem;
  width: 56px;
}
.brand-text { display: grid; gap: 0.2rem; }
.brand-text span { color: var(--muted); font-size: 0.92rem; }
.top-nav { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }

.page { width: min(1240px, 100%); margin: 0 auto; padding: clamp(1rem, 4vw, 3rem); }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: clamp(1rem, 4vw, 2rem);
  margin-bottom: 1rem;
}

.hero-panel p:last-child { color: var(--muted); max-width: 60ch; }
.eyebrow {
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 0.6rem;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.6rem); line-height: 1.08; }
h2 { font-size: 1.15rem; }

.form-grid, .filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
}
label { display: grid; gap: 0.4rem; color: var(--ink); font-weight: 800; }
.full { grid-column: 1 / -1; }
input, select, textarea, button {
  width: 100%;
  border-radius: 16px;
  font: inherit;
}
input, select, textarea {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fbfdfc;
  min-height: 50px;
  padding: 0.9rem 1rem;
}
textarea { min-height: 120px; resize: vertical; }
input[readonly] {
  color: var(--primary-dark);
  background: #edf7f3;
  font-weight: 900;
}

.primary-button, .secondary-button, .danger-button, .tiny-button {
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-weight: 800;
  min-height: 44px;
  padding: 0.8rem 1rem;
}
.primary-button { background: var(--primary); color: #fff; }
.secondary-button, .tiny-button { background: #edf4f1; color: var(--ink); }
.danger-button { background: var(--danger); color: #fff; }
.tiny-button {
  min-height: 32px;
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  width: auto;
}
.button-row, .action-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.action-row form { margin: 0; }

.checkbox {
  align-items: start;
  display: flex;
  gap: 0.7rem;
  font-weight: 600;
}
.checkbox input {
  width: auto;
  min-height: auto;
  margin-top: 0.2rem;
}

.alert {
  border-radius: 18px;
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
}
.alert-success { background: #e8f5ef; border: 1px solid #bfdfcf; }
.alert-error { background: #fdecec; border: 1px solid #f5c5c5; }

.section-title {
  color: var(--primary-dark);
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
}
.kpi-card {
  background: #f7fbf9;
  border: 1px solid var(--line);
  border-radius: 20px;
  display: grid;
  gap: 0.4rem;
  padding: 1rem;
}
.kpi-card span { color: var(--muted); font-weight: 700; }
.kpi-card strong { font-size: 1.35rem; }

.chart-list { display: grid; gap: 0.7rem; }
.chart-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 180px;
  gap: 0.8rem;
  align-items: center;
}
.chart-bar {
  background: #edf4f1;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}
.chart-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #2fa47c);
  border-radius: 999px;
}

.grid-2, .grid-3, .detail-grid {
  display: grid;
  gap: 1rem;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.mini-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}
.mini-stats div {
  background: #f7fbf9;
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  gap: 0.2rem;
  padding: 0.9rem;
}
.mini-stats span { color: var(--muted); }
.mini-stats strong { font-size: 1.1rem; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; min-width: 920px; width: 100%; }
th, td {
  border-bottom: 1px solid var(--line);
  padding: 0.8rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-size: 0.86rem; text-transform: uppercase; }
.status-chip {
  background: #edf7f3;
  border: 1px solid #cbe0d7;
  border-radius: 999px;
  display: inline-block;
  padding: 0.2rem 0.65rem;
  white-space: nowrap;
}

dl {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 0.55rem 0.8rem;
  margin: 0;
}
dt { color: var(--muted); font-weight: 700; }
dd { margin: 0; }

.history-list { display: grid; gap: 0.75rem; }
.history-card {
  background: #f7fbf9;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.9rem;
}
.history-card span { color: var(--muted); display: block; margin: 0.2rem 0 0.5rem; }

.login-panel { max-width: 460px; margin: 0 auto; }
.compact-form { grid-template-columns: 1fr; }
.muted-note { color: var(--muted); }

@media (max-width: 920px) {
  .form-grid,
  .detail-grid,
  .grid-2,
  .grid-3,
  .chart-row {
    grid-template-columns: 1fr;
  }

  .site-header,
  .card-header {
    align-items: start;
    flex-direction: column;
  }

  table { min-width: 760px; }
}

@media (max-width: 640px) {
  .top-nav { width: 100%; }
  .brand { align-items: start; }
  .brand-text strong { font-size: 0.98rem; }
  .page { padding: 1rem; }
  .panel { border-radius: 22px; padding: 1rem; }
  input, select, textarea { min-height: 46px; padding: 0.8rem 0.9rem; }
  table { min-width: 680px; }
}
