* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: Inter, Segoe UI, Arial, sans-serif;
  color: #f5f8ff;
  min-height: 100vh;
  background: linear-gradient(rgba(9,14,28,.78), rgba(9,14,28,.88)), url('/analytics-crm/assets/blue-flower-pattern-medium-dark-background.jpg') center/cover no-repeat fixed;
}
.hidden { display: none !important; }
.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card, .panel, .card, .modal-card {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(10px);
  border-radius: 12px;
}
.auth-card { width: min(460px, 94%); padding: 22px; }
.auth-card h1 { margin-bottom: 10px; }
.auth-card p { color: #d2dcff; margin-bottom: 12px; }
.app-shell { width: min(1250px, 95%); margin: 24px auto; }
.topbar { margin-bottom: 12px; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.topbar h1 { font-size: 2rem; margin-bottom: 6px; }
.topbar p { color: #d2dcff; }
.toolbar { margin-bottom: 12px; }
.actions-right { display: flex; gap: 8px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.card { padding: 14px; }
.card h3 { font-size: .95rem; color: #cad5ff; }
.card p { font-size: 1.7rem; font-weight: 700; margin-top: 8px; }
.charts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.chart-panel { padding: 14px; min-height: 300px; height: 340px; max-height: 340px; overflow: hidden; }
.chart-panel h3 { margin-bottom: 8px; }
.chart-panel canvas { width: 100% !important; height: 280px !important; max-height: 280px !important; display: block; }
.panel { padding: 14px; margin-bottom: 16px; }
.entity-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { background: rgba(80,110,200,.4); }
.tab.active { background: #4c7dff; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; border-bottom: 1px solid rgba(255,255,255,.15); text-align: left; }
button {
  padding: 10px 12px; border: 0; border-radius: 8px; cursor: pointer;
  background: #4c7dff; color: #fff; font-weight: 600;
}
button:hover { background: #3f6ef0; }
.danger { background: #c63552; }
.danger:hover { background: #aa2e47; }
.secondary { background: #6f7ca4; }
.secondary:hover { background: #5f6c92; }
.actions { display: flex; gap: 6px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; z-index: 1000; }
.modal-card { width: min(720px, 96%); padding: 16px; }
.modal-card h3 { margin-bottom: 10px; }
#entity-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#entity-form label { display: grid; gap: 6px; font-size: .9rem; color: #d2dcff; }
#entity-form input, #entity-form textarea {
  width: 100%; padding: 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(8,17,42,.52); color: #fff;
}
#entity-form textarea { min-height: 90px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
@media (max-width: 980px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  #entity-form { grid-template-columns: 1fr; }
}
@media (max-width: 640px) { .kpis { grid-template-columns: 1fr; } }