:root {
  --primary: #1B4332;
  --primary-light: #2D6A4F;
  --accent: #40916C;
  --accent-light: #D8F3DC;
  --bg: #F8F9FA;
  --card: #FFFFFF;
  --text: #212529;
  --text-muted: #6C757D;
  --border: #DEE2E6;
  --success: #198754;
  --warning: #FFC107;
  --danger: #DC3545;
  --purple: #5C4B7A;
  --blue: #1D3557;
  --shadow: 0 4px 12px rgba(27,67,50,0.08);
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ========== NAV ========== */
.navbar {
  background: var(--primary);
  color: white;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: white;
}

.navbar-brand .logo {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,0.15);
  color: white;
}

/* ========== LAYOUT ========== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.75rem;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.page-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ========== CARDS & KPI ========== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.2s;
}

.kpi-card:hover { transform: translateY(-2px); }

.kpi-card .label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.kpi-card .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}

.kpi-card .target {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.kpi-card .status {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-ok { background: #D1E7DD; color: #0F5132; }
.status-warn { background: #FFF3CD; color: #664D03; }
.status-danger { background: #F8D7DA; color: #842029; }

/* ========== SECTIONS ========== */
.section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========== TABLES ========== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  background: var(--primary);
  color: white;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

tr:hover td { background: #F1F8F4; }

/* ========== FORMS ========== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(64,145,108,0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover { background: var(--primary-light); }

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover { background: var(--accent-light); }

/* ========== ARCHITECTURE ========== */
.arch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.arch-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem;
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow);
}

.arch-card h3 {
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.arch-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.arch-card .modules {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.arch-card .modules span {
  background: var(--accent-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ========== FLOW ========== */
.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
}

.flow-step {
  background: var(--primary);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  min-width: 110px;
}

.flow-arrow {
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: bold;
}

/* ========== TRACE ========== */
.trace-box {
  background: #F1F8F4;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}

.qr-placeholder {
  width: 120px;
  height: 120px;
  background: white;
  border: 2px solid var(--primary);
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-radius: 8px;
}

/* ========== FOOTER ========== */
.footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .flow { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); }
}

/* ========== CHART CONTAINER ========== */
.chart-container {
  position: relative;
  height: 260px;
  margin-top: 1rem;
}

/* ========== BADGE ========== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green { background: #D1E7DD; color: #0F5132; }
.badge-blue { background: #CFE2FF; color: #084298; }
.badge-purple { background: #E2D9F3; color: #432874; }
