/* Panorama Exec — shared shell. Same tokens as admin.html / setup.html. */

:root{
  --ink:#071527; --field:#0b1e38; --surface:#0d2440; --surface2:#102b4d;
  --line:rgba(255,255,255,.10);
  --navy:#002147; --gold:#D59F0F; --gold-hi:#f0bd3a;
  --text:#e8edf3; --muted:#93a6bd;
  --danger:#ff6b6b; --ok:#3ecf8e; --r:14px;
  --accent:#D59F0F;                 /* per-dashboard brand, overwritten at runtime */
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  min-height:100vh; direction:rtl;
  font-family:Rubik,system-ui,-apple-system,"Segoe UI",Arial,sans-serif;
  background:var(--ink); color:var(--text);
  -webkit-font-smoothing:antialiased;
}
body::before{
  content:""; position:fixed; inset:0; pointer-events:none; z-index:0; opacity:.5;
  background:
    linear-gradient(rgba(255,255,255,.022) 1px,transparent 1px) 0 0/34px 34px,
    linear-gradient(90deg,rgba(255,255,255,.022) 1px,transparent 1px) 0 0/34px 34px,
    radial-gradient(1100px 560px at 50% -12%, rgba(213,159,15,.09), transparent 70%);
}
button,input,select,textarea{font:inherit; color:inherit}
button{cursor:pointer}
:focus-visible{outline:2px solid var(--gold-hi); outline-offset:2px; border-radius:6px}
@media (prefers-reduced-motion:reduce){*{animation:none!important; transition:none!important}}

/* ------------------------------------------------------------------ topbar */
.top{
  position:sticky; top:0; z-index:30;
  display:flex; align-items:center; gap:10px;
  padding:11px 16px; background:rgba(7,21,39,.9);
  backdrop-filter:blur(10px); border-bottom:1px solid var(--line);
}
.brand{display:flex; align-items:center; gap:9px; min-width:0}
.mark{width:26px; height:26px; flex:none}
.brand b{font-size:16px; font-weight:700; white-space:nowrap}
.tag{
  font-size:9.5px; font-weight:700; letter-spacing:1.5px; color:var(--gold);
  border:1px solid rgba(213,159,15,.35); border-radius:5px; padding:2px 6px; flex:none;
}
.dash-name{
  background:transparent; border:1px solid transparent; border-radius:8px;
  padding:6px 9px; font-size:15px; font-weight:600; min-width:60px; max-width:34vw;
  transition:border-color .15s, background .15s;
}
.dash-name:hover{border-color:var(--line)}
.dash-name:focus{outline:none; border-color:var(--gold); background:var(--field)}
.spacer{flex:1}

.save{
  font-size:12px; color:var(--muted); white-space:nowrap;
  display:flex; align-items:center; gap:6px;
}
.save i{width:7px; height:7px; border-radius:50%; background:var(--muted); flex:none}
.save[data-s="dirty"] i{background:var(--gold)}
.save[data-s="saving"] i{background:var(--gold); animation:pulse 1s infinite}
.save[data-s="saved"] i{background:var(--ok)}
.save[data-s="error"] i{background:var(--danger)}
@keyframes pulse{50%{opacity:.25}}

.ghost{
  background:transparent; border:1px solid var(--line); border-radius:8px;
  padding:7px 12px; font-size:13px; font-weight:500; white-space:nowrap;
  transition:border-color .15s, background .15s;
}
.ghost:hover{border-color:var(--gold); background:rgba(213,159,15,.08)}
.gold{
  background:var(--gold); color:#241800; border:0; border-radius:8px;
  padding:8px 14px; font-size:13.5px; font-weight:600; white-space:nowrap;
}
.gold:hover{background:var(--gold-hi)}
.gold:disabled{opacity:.5; cursor:not-allowed}

/* -------------------------------------------------------------- filter bar */
.filters{
  display:flex; gap:8px; align-items:center; flex-wrap:wrap;
  padding:8px 16px; border-bottom:1px solid var(--line);
  background:rgba(13,36,64,.5); position:relative; z-index:2;
}
.filters:empty{display:none}
.chip{
  display:inline-flex; align-items:center; gap:7px;
  background:rgba(213,159,15,.14); border:1px solid rgba(213,159,15,.4);
  color:var(--gold-hi); border-radius:999px; padding:4px 11px; font-size:12.5px;
}
.chip b{font-weight:600; color:var(--text)}
.chip button{background:none; border:0; color:inherit; font-size:15px; line-height:1; padding:0}

/* -------------------------------------------------------------------- grid */
.canvas{position:relative; z-index:1; padding:14px 10px 90px}
.grid-stack{min-height:60vh}
.grid-stack-item-content{
  inset:5px !important;
  background:var(--surface); border:1px solid var(--line); border-radius:12px;
  display:flex; flex-direction:column; overflow:hidden;
  box-shadow:0 18px 40px -28px rgba(0,0,0,.8);
}
.w-head{
  display:flex; align-items:center; gap:8px; padding:10px 13px 6px; flex:none;
}
.w-title{
  font-size:13px; font-weight:600; letter-spacing:.2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex:1; min-width:0;
}
.w-move{cursor:move; color:var(--muted); flex:none; opacity:.55; padding:2px}
.w-move:hover{opacity:1; color:var(--gold)}
.w-act{display:flex; gap:2px; flex:none; opacity:0; transition:opacity .15s}
.grid-stack-item-content:hover .w-act,
.w-act:focus-within{opacity:1}
.w-act button{
  background:none; border:0; color:var(--muted); padding:3px 5px; border-radius:6px; font-size:13px;
}
.w-act button:hover{color:var(--gold-hi); background:rgba(213,159,15,.1)}
.w-act button.del:hover{color:var(--danger); background:rgba(255,107,107,.1)}
.w-body{flex:1; min-height:0; position:relative; padding:2px 13px 12px}
.w-body canvas{max-width:100%}

/* value-type widgets */
.v-wrap{height:100%; display:flex; flex-direction:column; justify-content:center; gap:5px}
.v-num{font-size:clamp(24px,4.6vw,40px); font-weight:700; line-height:1.05; letter-spacing:-.5px}
.v-sub{font-size:12px; color:var(--muted)}
.v-delta{font-size:13px; font-weight:600; display:flex; align-items:center; gap:4px}
.v-delta.up{color:var(--ok)} .v-delta.down{color:var(--danger)}
.bar-track{height:9px; border-radius:99px; background:var(--field); overflow:hidden; margin-top:4px}
.bar-fill{height:100%; border-radius:99px; background:var(--accent); transition:width .5s ease}

/* table widget */
.w-table{height:100%; overflow:auto}
.w-table table{width:100%; border-collapse:collapse; font-size:12.5px}
.w-table th{
  position:sticky; top:0; background:var(--surface2); color:var(--muted);
  font-weight:600; text-align:start; padding:7px 9px; white-space:nowrap;
  border-bottom:1px solid var(--line);
}
.w-table td{padding:6px 9px; border-bottom:1px solid rgba(255,255,255,.05); white-space:nowrap}
.w-table tbody tr:hover{background:rgba(213,159,15,.06)}
.w-table td.num{font-variant-numeric:tabular-nums; text-align:end}

/* heatmap widget */
.hm{display:grid; gap:2px; height:100%; align-content:center}
.hm-cell{
  border-radius:4px; min-height:16px; display:grid; place-items:center;
  font-size:10px; color:#fff; cursor:pointer;
}
.hm-lab{font-size:10.5px; color:var(--muted); display:grid; place-items:center; padding:0 4px}

/* note widget */
.w-note{height:100%; overflow:auto; font-size:13.5px; line-height:1.65; color:var(--text); white-space:pre-wrap}

.w-empty{
  height:100%; display:grid; place-items:center; text-align:center;
  color:var(--muted); font-size:12.5px; padding:10px; line-height:1.6;
}

/* ------------------------------------------------------------------ dialog */
dialog{
  border:1px solid var(--line); border-radius:var(--r);
  background:var(--surface); color:var(--text);
  padding:24px; width:min(520px,92vw); max-height:86vh; overflow:auto;
  box-shadow:0 40px 90px -30px rgba(0,0,0,.85);
}
dialog::backdrop{background:rgba(3,9,17,.72); backdrop-filter:blur(3px)}
dialog h2{margin:0 0 6px; font-size:17px; font-weight:600}
dialog p.hint{margin:0 0 18px; font-size:13px; color:var(--muted); line-height:1.6}
label{display:block; font-size:12.5px; font-weight:500; color:var(--muted); margin:14px 0 6px}
label:first-of-type{margin-top:0}
input,select,textarea{
  width:100%; background:var(--field); border:1px solid var(--line); border-radius:9px;
  padding:10px 12px; font-size:14px; transition:border-color .15s, box-shadow .15s;
}
textarea{resize:vertical; min-height:88px; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:12.5px}
input:focus,select:focus,textarea:focus{
  outline:none; border-color:var(--gold); box-shadow:0 0 0 3px rgba(213,159,15,.16);
}
select{appearance:none; background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);
  background-position:left 14px top 18px, left 9px top 18px; background-size:5px 5px; background-repeat:no-repeat}
.row{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.acts{display:flex; gap:9px; justify-content:flex-start; margin-top:22px}

/* widget-type picker */
.types{display:grid; grid-template-columns:repeat(auto-fill,minmax(96px,1fr)); gap:8px}
.type{
  background:var(--field); border:1px solid var(--line); border-radius:10px;
  padding:12px 6px 9px; display:grid; gap:6px; justify-items:center;
  font-size:11.5px; color:var(--muted); transition:.15s;
}
.type:hover{border-color:var(--gold); color:var(--text); background:rgba(213,159,15,.08)}
.type svg{width:22px; height:22px; stroke:currentColor; fill:none; stroke-width:1.7}
.type:hover svg{stroke:var(--gold-hi)}

/* source list */
.srcs{display:flex; flex-direction:column; gap:8px; margin-bottom:6px}
.src{
  display:flex; align-items:center; gap:10px; background:var(--field);
  border:1px solid var(--line); border-radius:10px; padding:10px 12px;
}
.src-i{
  width:30px; height:30px; border-radius:8px; flex:none; display:grid; place-items:center;
  background:rgba(213,159,15,.14); color:var(--gold-hi); font-size:11px; font-weight:700;
}
.src-m{flex:1; min-width:0}
.src-m b{display:block; font-size:13.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.src-m span{font-size:11.5px; color:var(--muted)}

/* ------------------------------------------------------------------- misc */
.fab{
  position:fixed; inset-inline-start:20px; inset-block-end:20px; z-index:25;
  display:flex; gap:9px;
}
.fab .gold{border-radius:99px; padding:12px 20px; box-shadow:0 14px 34px -10px rgba(213,159,15,.55)}
.toast{
  position:fixed; inset-block-end:24px; inset-inline-end:24px; z-index:60;
  background:var(--gold); color:#241800; padding:11px 20px; border-radius:10px;
  font-size:14px; font-weight:600; box-shadow:0 20px 44px -14px rgba(0,0,0,.6);
  opacity:0; transform:translateY(10px); pointer-events:none; transition:.22s;
}
.toast.on{opacity:1; transform:none}
.toast.bad{background:var(--danger); color:#fff}

.gate{min-height:100vh; display:grid; place-items:center; padding:24px; position:relative; z-index:1}
.gate .card{
  position:relative; width:100%; max-width:380px; background:var(--surface);
  border:1px solid var(--line); border-radius:var(--r); padding:30px 26px 26px;
  box-shadow:0 30px 70px -30px rgba(0,0,0,.75);
}
.gate .card::before{
  content:""; position:absolute; inset-inline:0; top:0; height:2px;
  border-radius:var(--r) var(--r) 0 0;
  background:linear-gradient(90deg,transparent,var(--gold),transparent);
}
.gate h1{font-size:18px; font-weight:600; margin:20px 0 6px}
.gate .msg{color:var(--danger); font-size:12.5px; min-height:17px; margin:8px 0 0}
.ridge{width:100%; height:26px; margin-top:16px; opacity:.5}
.ridge path{stroke:var(--gold); stroke-width:1.2; fill:none}

/* viewer chrome is quieter than the builder's */
body.view .top{background:rgba(7,21,39,.82)}
body.view .canvas{padding-bottom:36px}
.stamp{
  text-align:center; font-size:11.5px; color:var(--muted);
  padding:18px 16px 30px; position:relative; z-index:1;
}
.stamp b{color:var(--gold); font-weight:600}

@media (max-width:640px){
  .top{padding:9px 11px; gap:7px}
  .brand b,.tag{display:none}
  .dash-name{max-width:44vw; font-size:14px}
  .canvas{padding:8px 4px 90px}
  .w-act{opacity:1}
}
