/* ==========================================================
   ERP ECHO — Hybrid CEO Dashboard (ENTERPRISE)
   FILE: /assets/css/ceo_dashboard.css
   ========================================================== */

:root{
  --bg:#f4f6fb;
  --panel:#ffffff;
  --panel-soft:#fbfcff;
  --text:#0f172a;
  --muted:#64748b;
  --line:#e6eaf2;

  --brand:#2563eb;
  --brand-dark:#1e40af;

  --good:#16a34a;
  --warn:#f59e0b;
  --bad:#dc2626;

  --radius:14px;
  --radius-sm:10px;
  --shadow:0 10px 28px rgba(15,23,42,.08);
}

/* ================= RESET ================= */
*{box-sizing:border-box}
body{
  background:var(--bg);
  color:var(--text);
  font-family: 'Cairo', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ================= WRAPPER ================= */
.ceo-wrap{
  direction:rtl;
  max-width:1400px;
  margin:0 auto;
  padding:18px 18px 28px;
}

/* ================= HEADER ================= */
.ceo-top{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  margin-bottom:14px;
}

.ceo-title h2{
  margin:0;
  font-size:22px;
  font-weight:800;
}
.ceo-sub{
  margin-top:4px;
  font-size:12px;
  color:var(--muted);
}

/* ================= PERIOD SEGMENT ================= */
.period-filters{
  display:flex;
  gap:6px;
  background:#eef2ff;
  padding:6px;
  border-radius:999px;
  border:1px solid #e0e7ff;
}
.period-filters button{
  border:0;
  background:transparent;
  padding:7px 14px;
  border-radius:999px;
  font-size:12px;
  cursor:pointer;
  color:#334155;
}
.period-filters button.active{
  background:linear-gradient(180deg,var(--brand),var(--brand-dark));
  color:#fff;
  box-shadow:0 6px 14px rgba(37,99,235,.25);
}

/* ================= WAREHOUSE CONTROLS ================= */
.wh-controls{
  display:flex;
  gap:10px;
  align-items:center;
  margin:10px 0 14px;
}

#warehouseSelect{
  padding:8px 12px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
  font-size:12px;
}

/* Tabs */
#warehouseTabs{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}
.wh-tab{
  border:1px solid var(--line);
  background:#fff;
  padding:6px 12px;
  font-size:12px;
  border-radius:999px;
  cursor:pointer;
  color:#334155;
}
.wh-tab.active{
  background:var(--brand);
  border-color:var(--brand);
  color:#fff;
}

/* ================= KPI STRIP ================= */
.kpi-strip{
  display:grid;
  grid-template-columns:repeat(6,1fr);
  gap:12px;
  margin-bottom:14px;
}

.kpi{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:12px 14px;
  box-shadow:0 1px 0 rgba(15,23,42,.03);
}
.kpi-label{
  font-size:12px;
  color:var(--muted);
}
.kpi-value{
  margin-top:6px;
  font-size:22px;
  font-weight:800;
}

/* ================= MAIN GRID ================= */
.ceo-grid{
  display:grid;
  grid-template-columns:1.4fr .9fr;
  gap:14px;
}

/* ================= PANELS ================= */
.panel{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
}

.panel-head{
  padding:12px 14px;
  border-bottom:1px solid var(--line);
  display:flex;
  justify-content:space-between;
  align-items:center;
}
.panel-head h3{
  margin:0;
  font-size:13px;
  font-weight:800;
}
.panel-head .hint{
  font-size:11px;
  color:var(--muted);
}
.panel-body{
  padding:12px 14px;
}

/* ================= TABLE ================= */
.tbl{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}
.tbl thead th{
  background:var(--panel-soft);
  color:#475569;
  font-weight:700;
  text-align:right;
  padding:10px;
  border-bottom:1px solid var(--line);
}
.tbl tbody td{
  padding:10px;
  border-bottom:1px solid #eef2f7;
}
.tbl tbody tr:hover{
  background:#fafbff;
}

/* ================= RIGHT STACK ================= */
.stack{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.chart-box{
  min-height:260px;
}
.chart-box canvas{
  width:100% !important;
  height:220px !important;
}

/* ================= INVENTORY MINI ================= */
.mini-kpis{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
.mini{
  background:var(--panel-soft);
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px;
}
.mini .kpi-value{
  font-size:20px;
}

/* ================= LOWER ================= */
.lower{
  margin-top:14px;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}

/* ================= STATUS DOT ================= */
.dot{
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.dot i{
  width:9px;
  height:9px;
  border-radius:50%;
  background:#94a3b8;
}
.dot.good i{background:var(--good)}
.dot.warn i{background:var(--warn)}
.dot.bad i{background:var(--bad)}

/* ================= LOADING STATE ================= */
body.dash-loading{
  cursor:progress;
}
body.dash-loading .panel{
  opacity:.7;
}

/* ================= RESPONSIVE ================= */
@media(max-width:1200px){
  .kpi-strip{grid-template-columns:repeat(3,1fr)}
}
@media(max-width:980px){
  .ceo-grid{grid-template-columns:1fr}
  .lower{grid-template-columns:1fr}
}
@media(max-width:520px){
  .kpi-strip{grid-template-columns:repeat(2,1fr)}
  .ceo-top{flex-direction:column;align-items:flex-start}
  .period-filters{width:100%;justify-content:space-between}
}
