:root{
  --bg:#0b1220;
  --panel:#111a2b;
  --panel2:#0f1828;
  --text:#e8eefc;
  --muted:#9fb0d6;
  --line:rgba(255,255,255,.10);
  --accent:#4f7cff;
  --accent2:#7dd3fc;
  --danger:#ff5a6b;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:radial-gradient(1200px 800px at 20% -10%, rgba(79,124,255,.18), transparent 50%),
             radial-gradient(1200px 800px at 90% 0%, rgba(125,211,252,.14), transparent 45%),
             var(--bg);
  color:var(--text);
}
a{color:inherit}
.topbar{
  position:sticky; top:0; z-index:5;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px;
  border-bottom:1px solid var(--line);
  background:rgba(11,18,32,.85);
  backdrop-filter: blur(10px);
}
.brand{display:flex; gap:12px; align-items:center}
.avatar{
  width:40px;height:40px;border-radius:12px;
  border:1px solid var(--line); object-fit:cover;
}
.brandTitle{font-weight:800; letter-spacing:.2px}
.brandSub{color:var(--muted); font-size:12px; margin-top:2px}

.layout{
  display:grid;
  grid-template-columns: 420px 1fr;
  gap:14px;
  padding:14px;
}
@media (max-width: 1100px){
  .layout{grid-template-columns:1fr}
}
.left,.right{display:flex; flex-direction:column; gap:14px}
.card{
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
}
.card h2{margin:0 0 10px 0; font-size:14px; letter-spacing:.3px; text-transform:uppercase; color:var(--muted)}
.field{display:flex; flex-direction:column; gap:6px; margin-bottom:10px}
.field label{font-size:12px; color:var(--muted)}
.field input, .field select, textarea{
  background:rgba(0,0,0,.18);
  border:1px solid var(--line);
  color:var(--text);
  padding:10px 10px;
  border-radius:12px;
  outline:none;
}
textarea{width:100%}
.field input:focus, .field select:focus, textarea:focus{border-color:rgba(79,124,255,.7)}
.row{display:flex; gap:10px; align-items:center}
.row.spread{justify-content:space-between}
.sep{border:none; border-top:1px solid var(--line); margin:10px 0}
.grid2{display:grid; grid-template-columns:1fr 1fr; gap:10px}
.grid3{display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px}
@media (max-width: 600px){
  .grid2,.grid3{grid-template-columns:1fr}
}
.chk{display:flex; gap:8px; align-items:center; color:var(--muted); font-size:12px}
.miniRow{display:flex; gap:12px; flex-wrap:wrap; margin-top:8px}
.small{font-size:12px; color:var(--muted)}
.muted{color:var(--muted)}
.btn{
  border:1px solid var(--line);
  background:rgba(255,255,255,.06);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
}
.btn:hover{border-color:rgba(255,255,255,.22)}
.btn.primary{
  background:linear-gradient(135deg, rgba(79,124,255,.95), rgba(125,211,252,.75));
  border-color:rgba(79,124,255,.7);
  color:#051022;
  font-weight:700;
}
.btn.danger{background:rgba(255,90,107,.12); border-color:rgba(255,90,107,.45)}
.datasetsList{display:flex; flex-direction:column; gap:8px; margin-top:8px}
.dsItem{display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px; border:1px dashed var(--line); border-radius:14px}
.dsName{font-weight:700}
.dsSmall{color:var(--muted); font-size:12px; margin-top:2px}
.progressWrap{gap:10px; align-items:center; margin-top:8px}
.progressBar{flex:1; height:10px; border-radius:999px; border:1px solid var(--line); overflow:hidden; background:rgba(255,255,255,.04)}
.progressFill{height:100%; width:0%; background:linear-gradient(90deg, rgba(79,124,255,.95), rgba(125,211,252,.75)); transition:width .2s ease}
.progressFill.indeterminate{animation: indet 1.2s infinite ease-in-out}
@keyframes indet{
  0%{transform:translateX(-60%)}
  100%{transform:translateX(260%)}
}
.progressText{min-width:190px; color:var(--muted); font-size:12px}

.kpis{display:grid; grid-template-columns: repeat(7,1fr); gap:10px}
@media (max-width: 1100px){
  .kpis{grid-template-columns: repeat(2,1fr)}
}
.kpi{border:1px solid var(--line); border-radius:14px; padding:10px; background:rgba(0,0,0,.14)}
.kpi .k{color:var(--muted); font-size:12px}
.kpi .v{font-size:18px; font-weight:800; margin-top:4px}

.map{height:420px; border-radius:14px; overflow:hidden; border:1px solid var(--line)}
.chartWrap{height:260px}
.tableWrap{overflow:auto; max-height:520px; border-radius:14px; border:1px solid var(--line)}
table.sales{width:100%; border-collapse:collapse; font-size:12px}
table.sales th, table.sales td{padding:8px 10px; border-bottom:1px solid rgba(255,255,255,.06); vertical-align:top}
table.sales th{position:sticky; top:0; background:rgba(11,18,32,.92); backdrop-filter:blur(10px); text-align:left; color:var(--muted)}
table.sales td{color:var(--text)}
.reportHost{position:absolute; left:-99999px; top:-99999px; width:820px}
.debug{margin-top:10px}
.diagBox{
  margin:8px 0 0 0;
  padding:10px;
  border-radius:12px;
  background:rgba(0,0,0,.22);
  border:1px solid var(--line);
  max-height:200px;
  overflow:auto;
  font-size:11px;
  color:var(--muted);
}

/* Report styles (used by HTML export -> canvas) */
.reportPage{
  width:794px; /* approx A4 width at 96dpi */
  min-height:1123px;
  padding:26px 26px 22px;
  background:#fff;
  color:#111827;
  font-family:Calibri, Arial, sans-serif;
}
.reportMeta{font-size:12px;color:#374151;line-height:1.4}
.reportHr{border-top:1px solid #e5e7eb;margin:10px 0}
.reportKpis{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.reportKpi{border:1px solid #e5e7eb;border-radius:10px;padding:10px}
.reportKpi .k{font-size:11px;color:#6b7280}
.reportKpi .v{font-size:16px;font-weight:700}
.reportImg{border:1px solid #e5e7eb;border-radius:12px;overflow:hidden}
.reportImg img{width:100%;height:auto;display:block}
.reportNote{font-size:12px;color:#6b7280}
.salesHeader,.saleRow{display:grid;grid-template-columns:78px 70px 52px 58px 66px 86px 1fr 64px;gap:8px}
.salesHeader{font-weight:700;background:#f3f4f6;border:1px solid #e5e7eb;padding:6px;margin-top:6px}
.salesList{border-left:1px solid #e5e7eb;border-right:1px solid #e5e7eb;border-bottom:1px solid #e5e7eb}
.saleRow{padding:6px;border-top:1px solid #e5e7eb;font-size:12px}
.saleRow .addr{overflow-wrap:anywhere;word-break:break-word}
