/* ==========================================================================
   EIM Theme — Full Circle family visual identity
   Derived from CRM base.html, adapted for EIM structure.
   ========================================================================== */

:root {
  color-scheme: light;
  /* Brand — Full Circle: dark blue to green gradient */
  --brand-dark: #0d2137;
  --brand-mid: #134a6e;
  --brand-green: #1cb938;
  --brand-gradient: linear-gradient(135deg, #0d2137 0%, #134a6e 40%, #1a7a3a 80%, #1cb938 100%);
  --brand-gradient-btn: linear-gradient(135deg, #134a6e 0%, #1a7a3a 60%, #1cb938 100%);

  /* Surfaces */
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #dfe1e6;
  --border-light: #ebecf0;

  /* Text */
  --text: #172b4d;
  --text-secondary: #5e6c84;
  --text-dim: #8993a4;

  /* Accent */
  --accent: #1cb938;
  --accent-hover: #169c2e;
  --accent-light: #e8f8ec;

  /* Status */
  --green: #22a868;
  --green-hover: #1a8553;
  --green-light: #e3fcef;
  --red: #de350b;
  --red-light: #ffebe6;
  --yellow: #856404;
  --yellow-light: #fff3cd;

  /* Structure */
  --radius: 6px;
  --shadow-sm: 0 1px 1px rgba(9,30,66,0.15);
}

/* ── Reset & Base ────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh;
}
a { color: var(--brand-mid); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar / Navbar ─────────────────────────────────────────── */
.topbar {
  background: var(--brand-gradient);
  padding: 0 16px;
  display: flex;
  align-items: center;
  height: 44px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.topbar-brand {
  font-size: 1rem; font-weight: 700; color: #fff; text-decoration: none;
  display: flex; align-items: center; gap: 8px;
}
.topbar-brand:hover { text-decoration: none; color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-right a { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.8rem; font-weight: 500; }
.topbar-right a:hover { color: #fff; text-decoration: none; }
.topbar-right a.active { color: #fff; }

/* ── Container ────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border: 1px solid transparent; border-radius: var(--radius);
  font-size: 0.85rem; font-weight: 500; cursor: pointer; text-decoration: none;
  transition: all 0.15s; background: transparent; color: var(--text);
}
.btn-primary, .btn-green {
  background: var(--brand-gradient-btn); color: #fff; border: none;
}
.btn-primary:hover, .btn-green:hover { filter: brightness(1.1); color: #fff; text-decoration: none; }
.btn-success { background: var(--green); color: #fff; border: none; }
.btn-success:hover { background: var(--green-hover); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-danger { background: var(--surface); border-color: var(--border); color: var(--red); }
.btn-danger:hover { background: var(--red-light); border-color: var(--red); }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-icon { padding: 5px 10px; font-size: 1rem; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.card h2 { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: 12px; }

/* ── Stat Cards (Dashboard) ───────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat-card .value { font-size: 32px; font-weight: 700; color: var(--brand-mid); }
.stat-card .label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.stat-card.month { background: #2E7D32; }
.stat-card.month .value { color: #fff; }
.stat-card.month .label { color: rgba(255,255,255,0.8); }

/* ── Tables ───────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th {
  background: var(--surface); padding: 8px 12px; text-align: left;
  font-weight: 600; color: var(--text-secondary); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 2px solid var(--border);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--accent-light); }

/* ── Forms ─────────────────────────────────────────────────────── */
input[type="text"], input[type="search"], input[type="date"], input[type="number"],
input[type="email"], input[type="password"], select, textarea {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.85rem; background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light);
}
.search-box { display: flex; gap: 8px; margin-bottom: 16px; }
.search-box input { flex: 1; min-width: 200px; }
.search-box select { min-width: 120px; }

/* ── Badges ────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 600; }
.badge-pass { background: #E2F0D9; color: var(--green); }
.badge-fail { background: #FCE4EC; color: var(--red); }
.badge-missing { background: #FFF3E0; color: #E65100; }
.badge-call { background: #e9f2ff; color: #0c66e4; }
.badge-email { background: #f3f0ff; color: #6e55d1; }
.badge-vm { background: #fff7e6; color: #c77a1a; }
.badge-visit { background: #e3fcef; color: #22a868; }
.badge-pickup { background: #e3fcef; color: #1a8553; }
.badge-other { background: var(--bg); color: var(--text-secondary); }

/* Service level badges — consistent with CRM */
.badge-sl-clear { background: #d4edda; color: #155724; }
.badge-sl-red, .badge-sl-red-nist, .badge-sl-red-r2, .badge-sl-red-nist-r2 { background: #f8d7da; color: #721c24; }
.badge-sl-nist { background: #e2d5f1; color: #4a1a8a; }
.badge-sl-r2 { background: #fff3cd; color: #856404; }
.badge-sl-cor { background: #cce5ff; color: #004085; }

/* ── Pagination ────────────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--brand-mid); font-size: 13px;
}
.pagination a:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination .disabled { color: #ccc; border-color: #eee; cursor: default; }

/* ── Flash Messages ───────────────────────────────────────────── */
.flash { padding: 10px 16px; border-radius: var(--radius); margin-bottom: 12px; font-size: 0.9rem; }
.flash-success { background: var(--green-light); color: #1a8553; border: 1px solid #b2dfdb; }
.flash-error { background: var(--red-light); color: #c22828; border: 1px solid #f5c6c6; }
.flash-info { background: var(--accent-light); color: var(--accent); border: 1px solid #b3d4f7; }

/* ── Empty State ───────────────────────────────────────────────── */
.empty { text-align: center; padding: 40px; color: var(--text-secondary); }

/* ── Dropdown (EIM Import) ─────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-btn {
  color: rgba(255,255,255,0.8); text-decoration: none; font-size: 14px; font-weight: 500;
  cursor: pointer; background: none; border: none; font-family: inherit; font-size: 14px; padding: 0;
}
.dropdown-btn:hover, .dropdown-btn.active { color: #fff; }
.dropdown-menu {
  display: none; position: absolute; background: var(--brand-mid); min-width: 180px;
  top: 100%; left: 0; box-shadow: 0 4px 12px rgba(0,0,0,0.2); border-radius: 4px; z-index: 100;
}
.dropdown-menu a { display: block; padding: 10px 16px; color: #fff; text-decoration: none; font-size: 13px; }
.dropdown-menu a:hover { background: rgba(255,255,255,0.1); }
.dropdown:hover .dropdown-menu { display: block; }


/* ── Detail Grid (2x2 tiles) ───────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-grid .card { margin-bottom: 0; }
@media (max-width: 768px) { .detail-grid { grid-template-columns: 1fr; } }
/* ── Print ─────────────────────────────────────────────────────── */
@media print {
  .topbar, .no-print { display: none !important; }
  .container { padding: 0; max-width: 100%; }
  body { background: #fff; }
}
