/* ==========================================================
   Settings Hub — New design
   Scoped under .sh-root so nothing leaks to the rest of the app
========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@400;500;600;700;800&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;1,9..144,300;1,9..144,400&display=swap');

.sh-root{
  /* paper palette */
  --bg:          #efeadf;
  --bg-2:        #e6e1d4;
  --surface:     #fefcf7;
  --surface-2:   #faf7ef;

  /* ink */
  --ink:         #0a0a0a;
  --ink-2:       #26221d;
  --ink-3:       #4d463d;
  --muted:       #78716a;
  --muted-2:     #a39d92;

  /* lines */
  --line:        #c9c3b4;
  --line-soft:   #d6d0c0;
  --line-softer: #e2dcca;
  --hair:        rgba(10,10,10,.10);
  --hair-soft:   rgba(10,10,10,.06);

  /* category identity hues */
  --c-sys:       #3a424d;
  --c-sec:       #8a2e2e;
  --c-cli:       #8a5a1a;
  --c-ops:       #2e5a42;

  /* state accents */
  --amber:       #b45309;
  --amber-bg:    #fbe8cd;
  --amber-soft:  rgba(180,83,9,.10);
  --crimson:     #991b1b;
  --crimson-bg:  #f6d9d4;
  --crimson-soft:rgba(153,27,27,.09);
  --forest:      #1e6b4f;
  --forest-bg:   #d7e7dd;

  --f-he:  'Assistant', sans-serif;
  --f-en:  'Fraunces', serif;

  /* Overlay positioning */
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  font-family: var(--f-he);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
  overflow: hidden;
}

.sh-root *{box-sizing: border-box}

/* ==========================================================
   HUB layout — fills viewport, no scroll
========================================================== */
.sh-root .hub{
  position: relative;
  height: 100vh;
  min-height: 700px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 32px 52px 22px;
  gap: 22px;
  background:
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(138,90,26,.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 10% 90%, rgba(46,90,66,.04) 0%, transparent 60%),
    var(--bg);
  overflow: hidden;
}
.sh-root .hub::before{
  content:"";
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(to bottom, transparent 0, transparent 31px, rgba(10,10,10,.012) 32px);
  background-size: 100% 32px;
  opacity: 0.8;
}

/* Brand bar */
.sh-root .brand-bar{
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto);
  align-items: end;
  gap: 40px;
  padding-bottom: 20px;
  border-bottom: 1.5px solid var(--ink);
  position: relative;
  z-index: 1;
  min-width: 0;
}
.sh-root .brand-bar::before, .sh-root .brand-bar::after{
  content:""; position: absolute; bottom: -1px;
  width: 10px; height: 10px;
  border: 1.5px solid var(--ink);
}
.sh-root .brand-bar::before{right: 0; border-top: none; border-left: none}
.sh-root .brand-bar::after{left: 0; border-top: none; border-right: none}

.sh-root .mark{display: flex; align-items: center; gap: 14px; min-width: 0}
.sh-root .mark-glyph{
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  font-family: var(--f-en);
  font-style: italic;
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -.02em;
  font-variation-settings: "opsz" 144;
}
.sh-root .mark-txt{display: flex; flex-direction: column; gap: 2px; padding-top: 2px; min-width: 0}
.sh-root .mark-en{
  font-family: var(--f-en);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  font-variation-settings: "opsz" 14;
  overflow-wrap: anywhere;
}
.sh-root .mark-he{
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  line-height: 1;
}

.sh-root .brand-title{text-align: center; padding-bottom: 2px; min-width: 0}
.sh-root .brand-title h1{
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--ink);
}
.sh-root .brand-title .en{
  font-family: var(--f-en);
  font-weight: 300;
  font-style: italic;
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--muted);
  margin-top: 7px;
  font-variation-settings: "opsz" 36;
}

.sh-root .brand-meta{
  display: flex; align-items: center; gap: 14px;
  font-family: var(--f-he);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-2);
  padding-bottom: 3px;
  min-width: 0;
  white-space: nowrap;
}
.sh-root .brand-meta .alert{color: var(--crimson); font-weight: 800}
.sh-root .brand-meta .sep{width: 1px; height: 14px; background: var(--line)}

.sh-root .brand-close{
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--f-en);
  font-weight: 300;
  font-size: 22px;
  line-height: 1;
  transition: all .15s;
  margin-right: 8px;
}
.sh-root .brand-close:hover{background: var(--ink); color: var(--bg)}

/* Category stack */
.sh-root .stack{
  display: grid;
  grid-auto-rows: 1fr;
  gap: 18px;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.sh-root .cat{
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow:
    0 1px 0 rgba(255,255,255,.6) inset,
    0 1px 2px rgba(10,10,10,.04),
    0 14px 32px rgba(10,10,10,.06);
  overflow: hidden;
  min-height: 0;
}
.sh-root .cat::before{
  content: "";
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--cat-color, var(--ink));
}

.sh-root .cat-sys{--cat-color: var(--c-sys)}
.sh-root .cat-sec{--cat-color: var(--c-sec)}
.sh-root .cat-cli{--cat-color: var(--c-cli)}
.sh-root .cat-ops{--cat-color: var(--c-ops)}

.sh-root .cat-id{
  padding: 22px 30px 22px 24px;
  border-left: 1.5px solid var(--line);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 0;
  text-align: right;
}
.sh-root .cat-id h2{
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 32px;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -.02em;
}
.sh-root .cat-id .caption{
  font-family: var(--f-en);
  font-weight: 300;
  font-style: italic;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .04em;
  font-variation-settings: "opsz" 18;
  margin-top: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-softer);
}
.sh-root .cat-id .hint{
  font-family: var(--f-he);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  padding-top: 12px;
}
.sh-root .cat-id .count{
  align-self: start;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-softer);
  font-family: var(--f-he);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--muted);
}
.sh-root .cat-id .count b{
  font-weight: 800;
  color: var(--cat-color);
  font-size: 14px;
}

.sh-root .cat-grid{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: 0;
}

.sh-root .mod{
  position: relative;
  padding: 20px 24px 20px 20px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-right: 1.5px solid var(--line-softer);
  transition: background .18s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  text-align: right;
  min-width: 0;
  background: transparent;
  border-top: none;
  border-bottom: none;
  border-left: none;
  font-family: inherit;
}
.sh-root .mod:first-child{border-right: none}
.sh-root .mod.vacant{cursor: default; pointer-events: none}
.sh-root .mod.vacant > *{visibility: hidden}
.sh-root .mod:hover:not(.vacant){background: var(--surface-2)}

.sh-root .mod-title{
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.sh-root .mod-title-text{
  min-width: 0;
  overflow-wrap: anywhere;
}
.sh-root .mod-glyph{
  width: 20px; height: 20px;
  color: var(--muted);
  flex-shrink: 0;
}
.sh-root .mod-glyph svg{
  width: 100%; height: 100%;
  stroke-width: 1.5;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sh-root .status-dot{
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}
.sh-root .mod.urgent .status-dot{
  background: var(--crimson);
  box-shadow: 0 0 0 3px var(--crimson-soft);
  animation: sh-pulse 1.8s ease-in-out infinite;
}
@keyframes sh-pulse{
  0%,100%{opacity: 1; transform: scale(1)}
  50%{opacity: .55; transform: scale(1.15)}
}

.sh-root .mod-attn{
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 14px;
  color: var(--amber);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sh-root .mod.urgent .mod-attn{color: var(--crimson)}
.sh-root .mod.zero .mod-attn{color: var(--muted)}
.sh-root .mod.zero .status-dot{background: var(--muted-2); box-shadow: none; animation: none; opacity: .55}
.sh-root .mod-attn .n{
  font-family: var(--f-en);
  font-weight: 500;
  font-style: italic;
  font-size: 22px;
  letter-spacing: -.02em;
  font-variation-settings: "opsz" 36;
  line-height: 1;
}
.sh-root .mod-attn .sep-bar{
  width: 1px;
  height: 18px;
  background: currentColor;
  opacity: .4;
  flex: 0 0 auto;
}

.sh-root .mod-state{
  font-family: var(--f-he);
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.sh-root .mod-state b{font-weight: 800; color: var(--ink-2)}
.sh-root .mod-state .sep{
  display: inline-block;
  width: 3px; height: 3px;
  background: var(--muted-2);
  border-radius: 50%;
  vertical-align: middle;
  margin: 0 7px;
}

/* Foot */
.sh-root .foot{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 40px;
  padding-top: 14px;
  border-top: 1.5px solid var(--ink);
  position: relative;
  z-index: 1;
}
.sh-root .foot::before, .sh-root .foot::after{
  content: ""; position: absolute; top: -1px;
  width: 10px; height: 10px;
  border: 1.5px solid var(--ink);
}
.sh-root .foot::before{right: 0; border-bottom: none; border-left: none}
.sh-root .foot::after{left: 0; border-bottom: none; border-right: none}

.sh-root .foot-left, .sh-root .foot-right{
  display: flex; align-items: center; gap: 14px;
  font-family: var(--f-en);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  font-variation-settings: "opsz" 14;
  min-width: 0;
  flex-wrap: wrap;
}
.sh-root .foot-right{justify-content: flex-end}
.sh-root .foot-left b, .sh-root .foot-right b{
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
.sh-root .foot-mid{
  font-family: var(--f-en);
  font-weight: 400;
  font-style: italic;
  font-size: 12px;
  color: var(--muted);
  font-variation-settings: "opsz" 18;
}
.sh-root .foot .dotsep{width: 3px; height: 3px; background: var(--muted-2); border-radius: 50%}

/* ==========================================================
   MODAL — panel that opens over the hub
========================================================== */
.sh-root .modal-back{
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,.38);
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 40px;
  animation: sh-fade-in .18s ease-out;
}
@keyframes sh-fade-in{
  from{opacity: 0}
  to{opacity: 1}
}

.sh-root .panel{
  position: relative;
  width: 100%;
  max-width: 1020px;
  max-height: calc(100vh - 80px);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow:
    0 1px 0 rgba(10,10,10,.02),
    0 16px 48px rgba(10,10,10,.18);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  animation: sh-panel-in .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes sh-panel-in{
  from{opacity: 0; transform: translateY(8px) scale(.98)}
  to{opacity: 1; transform: translateY(0) scale(1)}
}
.sh-root .panel::before{
  content: "";
  position: absolute; top: 0; right: 0; left: 0; height: 3px;
  z-index: 1;
  background: var(--cat-color, var(--ink));
}
.sh-root .panel.sys{--cat-color: var(--c-sys)}
.sh-root .panel.sec{--cat-color: var(--c-sec)}
.sh-root .panel.cli{--cat-color: var(--c-cli)}
.sh-root .panel.ops{--cat-color: var(--c-ops)}

.sh-root .panel-head{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 22px 32px 20px;
  border-bottom: 1px solid var(--hair);
  background: var(--surface-2);
}
.sh-root .panel-breadcrumb{
  font-family: var(--f-he);
  font-weight: 700;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.sh-root .panel-breadcrumb .cat-dot{
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--cat-color, var(--ink));
  margin-left: 8px;
  vertical-align: middle;
}
.sh-root .panel-title{
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 24px;
  color: var(--ink);
  letter-spacing: -.015em;
  line-height: 1.1;
  margin-bottom: 6px;
}
.sh-root .panel-sub{
  font-family: var(--f-he);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.5;
  max-width: 720px;
}
.sh-root .panel-close{
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-3);
  cursor: pointer;
  font-family: var(--f-en);
  font-weight: 300;
  font-size: 22px;
  line-height: 1;
  transition: all .15s;
}
.sh-root .panel-close:hover{background: var(--ink); color: var(--bg); border-color: var(--ink)}

.sh-root .panel-body{
  padding: 24px 32px;
  overflow-y: auto;
  min-height: 0;
}
.sh-root .panel-body::-webkit-scrollbar{width: 6px}
.sh-root .panel-body::-webkit-scrollbar-track{background: transparent}
.sh-root .panel-body::-webkit-scrollbar-thumb{background: var(--line); border-radius: 3px}

.sh-root .panel-foot{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  border-top: 1px solid var(--hair);
  background: var(--surface-2);
}
.sh-root .panel-foot .note{
  margin-right: auto;
  font-family: var(--f-he);
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Panel primitives ---------- */
.sh-root .section{margin-bottom: 26px}
.sh-root .section:last-child{margin-bottom: 0}
.sh-root .sec-hd{
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hair);
}
.sh-root .sec-t{
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  letter-spacing: -.005em;
  margin: 0;
}
.sh-root .sec-rule{flex: 1; height: 1px; background: var(--hair-soft)}
.sh-root .sec-aside{
  font-family: var(--f-he);
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
}

.sh-root .field{margin-bottom: 12px}
.sh-root .field-l{
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.sh-root .field-l-t{
  font-family: var(--f-he);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-2);
}
.sh-root .field-l-hint{
  margin-right: auto;
  font-family: var(--f-en);
  font-weight: 300;
  font-style: italic;
  font-size: 11.5px;
  color: var(--muted);
  font-variation-settings: "opsz" 14;
}
.sh-root .field-i{
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--ink-3);
  font-family: var(--f-he);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
  letter-spacing: normal;
  text-align: right;
}
.sh-root input[type="password"].field-i{
  letter-spacing: 2px;
  text-align: center;
}
.sh-root .field-i:focus{
  border-color: var(--ink);
  background: #fff;
}
.sh-root .field-n{
  font-family: var(--f-he);
  font-weight: 600;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.5;
}

/* Password row: label + input + save button, all right-flow */
.sh-root .pw-row{
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hair-soft);
}
.sh-root .pw-row:last-child{border-bottom: none}
.sh-root .pw-row-lbl{
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 13px;
  color: var(--ink);
}
.sh-root .pw-row-hint{
  font-family: var(--f-en);
  font-weight: 300;
  font-style: italic;
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
  font-variation-settings: "opsz" 14;
}

/* Buttons */
.sh-root .btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--ink-3);
  cursor: pointer;
  transition: all .15s;
  letter-spacing: -.005em;
}
.sh-root .btn:hover{background: var(--ink); color: var(--bg); border-color: var(--ink)}
.sh-root .btn-primary{
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.sh-root .btn-primary:hover{background: #000; border-color: #000}
.sh-root .btn-ghost{
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.sh-root .btn-ghost:hover{
  background: var(--surface-2);
  color: var(--ink);
  border-color: transparent;
}
.sh-root .btn-sm{padding: 7px 13px; font-size: 12px}

/* Label size preset grid */
.sh-root .sh-sz-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.sh-root .sz{
  padding: 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  text-align: center;
  position: relative;
  transition: all .15s;
  font-family: inherit;
  color: inherit;
}
.sh-root .sz:hover{border-color: var(--ink-3)}
.sh-root .sz.active{
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.sh-root .sz-dim{
  font-family: var(--f-en);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: -.02em;
  line-height: 1;
  font-variation-settings: "opsz" 48;
}
.sh-root .sz-unit{
  font-family: var(--f-en);
  font-weight: 300;
  font-style: italic;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  font-variation-settings: "opsz" 14;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.sh-root .sz.active .sz-unit{color: rgba(239,234,223,.6)}
.sh-root .sz-desc{
  font-family: var(--f-he);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 8px;
}
.sh-root .sz.active .sz-desc{color: rgba(239,234,223,.8)}
.sh-root .sz-mark{
  position: absolute;
  top: 10px; left: 12px;
  width: 6px; height: 6px;
  background: transparent;
}
.sh-root .sz.active .sz-mark{background: var(--amber)}

/* Status strip inside panels */
.sh-root .status{
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 18px;
  background: var(--forest-bg);
  border-right: 3px solid var(--forest);
}
.sh-root .status-led{
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--forest);
  box-shadow: 0 0 0 3px rgba(30,107,79,.12);
  flex-shrink: 0;
}
.sh-root .status-t{
  font-family: var(--f-he);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}
.sh-root .status-t b{color: var(--forest); font-weight: 800}
.sh-root .status.warn{
  background: var(--amber-bg);
  border-right-color: var(--amber);
}
.sh-root .status.warn .status-led{
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(180,83,9,.12);
}
.sh-root .status.warn .status-t b{color: var(--amber)}

/* User row (impersonate list) */
.sh-root .dev{
  display: grid;
  gap: 14px;
  align-items: center;
  padding: 13px 15px;
  margin-bottom: 6px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
}
.sh-root .dev-b{min-width: 0}
.sh-root .dev-n{
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
}
.sh-root .dev-m{
  font-family: var(--f-he);
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.sh-root .ava{
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 14px;
  color: var(--ink-2);
  flex-shrink: 0;
}

/* ── Role tabs (permissions module) ─────────────── */
.sh-root .sh-tabs{
  display: flex; gap: 0;
  border-bottom: 1px solid var(--line);
}
.sh-root .sh-tab{
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
  margin-bottom: -1px;
}
.sh-root .sh-tab:hover{color: var(--ink-2)}
.sh-root .sh-tab.active{
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ── Permission row ─────────────────────────────── */
.sh-root .sh-perm-row{
  padding: 10px 0;
  border-bottom: 1px solid var(--hair-soft);
}
.sh-root .sh-perm-row:last-child{border-bottom: none}
.sh-root .sh-perm-head{display: flex}
.sh-root .sh-perm-toggle{
  padding: 8px 16px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  min-width: 120px;
  text-align: right;
  transition: all .15s;
}
.sh-root .sh-perm-toggle.on{
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.sh-root .sh-perm-subs{
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 0 2px 0;
  margin-top: 6px;
}
.sh-root .sh-perm-sub{
  padding: 5px 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--f-he);
  font-weight: 700;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all .12s;
}
.sh-root .sh-perm-sub.on{
  background: var(--forest-bg);
  color: var(--forest);
  border-color: var(--forest);
}

/* ── Toggle row (client 360) ────────────────────── */
.sh-root .sh-toggle-row{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  margin-bottom: 6px;
}
.sh-root .sh-toggle-b{min-width: 0}
.sh-root .sh-toggle-t{
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 2px;
}
.sh-root .sh-toggle-d{
  font-family: var(--f-he);
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Industrial switch ──────────────────────────── */
.sh-root .sh-sw{
  position: relative;
  width: 44px; height: 24px;
  background: var(--line);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .18s;
  border-radius: 2px;
}
.sh-root .sh-sw::after{
  content: "";
  position: absolute;
  top: 2px; right: 2px;
  width: 20px; height: 20px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(10,10,10,.18);
  transition: right .18s;
  border-radius: 1px;
}
.sh-root .sh-sw.on{background: var(--ink)}
.sh-root .sh-sw.on::after{right: 22px; background: var(--amber)}

/* ── 3-column grid (segment thresholds) ─────────── */
.sh-root .sh-grid-3{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* ── Deleted client row ─────────────────────────── */
.sh-root .sh-del-row{
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-right: 3px solid var(--crimson);
}
.sh-root .sh-del-row .dev-n b.urgent{color: var(--crimson); font-weight: 800}

/* Placeholder body for modules not yet implemented */
.sh-root .placeholder{
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}
.sh-root .placeholder .big{
  font-family: var(--f-en);
  font-weight: 400;
  font-style: italic;
  font-size: 64px;
  color: var(--line);
  line-height: 1;
  margin-bottom: 20px;
  font-variation-settings: "opsz" 144;
}
.sh-root .placeholder .msg{
  font-family: var(--f-he);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.sh-root .placeholder .sub{
  font-family: var(--f-he);
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
}

/* Responsive */
@media (max-height: 820px){
  .sh-root{
    overflow-y: auto;
    overflow-x: hidden;
  }
  .sh-root .hub{
    height: auto;
    min-height: 100vh;
    padding: 22px 40px 18px;
    gap: 16px;
    overflow: visible;
  }
  .sh-root .stack{
    grid-auto-rows: minmax(156px, auto);
    gap: 14px;
  }
  .sh-root .cat{
    min-height: 156px;
  }
  .sh-root .cat-id{padding: 18px 24px 18px 18px}
  .sh-root .cat-id h2{font-size: 27px}
  .sh-root .mod{padding: 14px 20px}
  .sh-root .mod-title{font-size: 16px}
  .sh-root .brand-title h1{font-size: 26px}
}
@media (max-height: 720px){
  .sh-root .cat-id h2{font-size: 23px}
  .sh-root .cat-id .hint{display: none}
  .sh-root .mod{padding: 12px 18px}
  .sh-root .mod-title{font-size: 15px}
}
@media (max-width: 1100px){
  .sh-root .hub{padding: 20px 28px}
  .sh-root .cat{grid-template-columns: minmax(0, 180px) minmax(0, 1fr)}
  .sh-root .cat-grid{grid-template-columns: repeat(2, minmax(0, 1fr))}
}
@media (max-width: 700px){
  .sh-root{
    overflow-y: auto;
    overflow-x: hidden;
  }
  .sh-root .hub{
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto auto;
    padding: 16px 20px 18px;
    gap: 16px;
    overflow: visible;
  }
  .sh-root .brand-bar{
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding-bottom: 14px;
  }
  .sh-root .mark{gap: 10px}
  .sh-root .mark-glyph,
  .sh-root .brand-close{
    width: 32px;
    height: 32px;
  }
  .sh-root .mark-glyph{font-size: 16px}
  .sh-root .mark-en{font-size: 9.5px; letter-spacing: .12em}
  .sh-root .mark-he{font-size: 13px}
  .sh-root .brand-title h1{font-size: 22px; line-height: 1.08}
  .sh-root .brand-title .en{font-size: 11px; margin-top: 4px}
  .sh-root .brand-meta{
    gap: 8px;
    font-size: 11px;
  }
  .sh-root .brand-meta span:not(:first-child),
  .sh-root .brand-meta .sep{
    display: none;
  }
  .sh-root .stack{
    grid-auto-rows: auto;
    gap: 12px;
  }
  .sh-root .cat{
    grid-template-columns: minmax(0, 1fr);
    min-height: auto;
  }
  .sh-root .cat-id{
    grid-template-rows: auto auto auto;
    gap: 0;
    padding: 16px 20px 14px;
    border-left: none;
    border-bottom: 1.5px solid var(--line);
  }
  .sh-root .cat-id h2{font-size: 28px}
  .sh-root .cat-id .caption{
    margin-top: 5px;
    padding-bottom: 10px;
  }
  .sh-root .cat-id .hint{
    padding-top: 10px;
    font-size: 12px;
  }
  .sh-root .cat-id .count{display: none}
  .sh-root .cat-grid{
    grid-template-columns: minmax(0, 1fr);
  }
  .sh-root .mod{
    min-height: 72px;
    padding: 14px 20px;
    border-right: none;
    border-bottom: 1px solid var(--line-softer);
  }
  .sh-root .mod:last-child{border-bottom: none}
  .sh-root .mod.vacant{display: none}
  .sh-root .mod-title{
    font-size: 16px;
    line-height: 1.25;
  }
  .sh-root .mod-state,
  .sh-root .mod-attn{
    font-size: 12.5px;
  }
  .sh-root .foot{
    grid-template-columns: 1fr;
    gap: 6px;
    padding-top: 12px;
    text-align: center;
  }
  .sh-root .foot-left,
  .sh-root .foot-right{
    justify-content: center;
    font-size: 9.5px;
    letter-spacing: .08em;
    gap: 8px;
  }
  .sh-root .foot-mid{font-size: 11px}
}

/* ── Devices module: status tags (was missing — relied on mockup vars) ── */
.sh-root .tag{
  display: inline-block;
  padding: 3px 9px;
  border-radius: 3px;
  font-family: var(--f-he);
  font-size: 11px;
  font-weight: 800;
  border: 1px solid;
  white-space: nowrap;
}
.sh-root .tag-ok    { background: var(--forest-bg);  color: var(--forest);  border-color: rgba(30,107,79,.22); }
.sh-root .tag-amber { background: var(--amber-bg);   color: var(--amber);   border-color: rgba(180,83,9,.22); }
.sh-root .tag-red   { background: var(--crimson-bg); color: var(--crimson); border-color: rgba(153,27,27,.22); }

/* ── Devices module: scope/role/group mini-tags on the device card ── */
.sh-root .dev-tags{
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.sh-root .dev-tag{
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 3px;
  font-family: var(--f-he);
  font-size: 10.5px;
  font-weight: 800;
  border: 1px solid;
  letter-spacing: .01em;
}
.sh-root .dev-tag-scope {
  background: rgba(58,66,77,.06);
  color: var(--c-sys);
  border-color: rgba(58,66,77,.22);
}
.sh-root .dev-tag-role {
  background: rgba(138,90,26,.07);
  color: var(--c-cli);
  border-color: rgba(138,90,26,.22);
}
.sh-root .dev-tag-group {
  background: rgba(138,46,46,.06);
  color: var(--c-sec);
  border-color: rgba(138,46,46,.20);
  margin-right: 6px;
  font-size: 10.5px;
}

/* ── Devices module: edit button look (small, ghost) ── */
.sh-root .btn[data-sh-dev-edit]{
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.sh-root .btn[data-sh-dev-edit]:hover{
  background: var(--surface-2);
  border-color: var(--ink-3);
}

/* ── Devices module: filter chip strip ── */
.sh-root .sh-dev-chips{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 14px 0;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--hair-soft);
}
.sh-root .sh-dev-chip{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.sh-root .sh-dev-chip:hover{
  border-color: var(--ink-3);
  color: var(--ink-2);
}
.sh-root .sh-dev-chip.is-active,
.sh-root .sh-dev-chip.is-active .lbl{
  background: var(--ink);
  border-color: var(--ink);
  color: #fefcf7;
}
.sh-root .sh-dev-chip .lbl{
  font-family: var(--f-he);
  font-weight: 800;
  color: inherit;
}
.sh-root .sh-dev-chip .cnt{
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  background: rgba(0,0,0,.06);
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 700;
  color: var(--muted);
}
.sh-root .sh-dev-chip.is-active .cnt{
  background: rgba(255,255,255,.18);
  color: #fefcf7;
}

/* ── Device groups module: row layout ── */
.sh-root .sh-grp-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 6px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
}
.sh-root .sh-grp-name{
  font-family: var(--f-he);
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
}

/* ════════════════════════════════════════════════════════════════════
   Device Approve / Edit popup — Atelier-style modal
   Lives at body level (NOT inside .sh-root) so styles are unscoped,
   namespaced via #dev-approve-popup + .dap-* class prefix.
═══════════════════════════════════════════════════════════════════ */
#dev-approve-popup.dap-overlay{
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(15, 12, 8, .56);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Assistant', sans-serif;
  direction: rtl;
  padding: 20px;
}
#dev-approve-popup .dap-card{
  background: #fefcf7;
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  overflow: hidden;
  border: 1px solid #c9c3b4;
  box-shadow:
    0 1px 0 rgba(0,0,0,.05) inset,
    0 22px 60px -18px rgba(28, 18, 8, .35);
  display: flex; flex-direction: column;
}
#dev-approve-popup .dap-head{
  position: relative;
  padding: 22px 28px 18px;
  text-align: center;
  background:
    linear-gradient(180deg, #faf7ef 0%, #fefcf7 100%);
  border-bottom: 1px solid #d6d0c0;
}
#dev-approve-popup .dap-rule{
  position: absolute; top: 10px; right: 28px; left: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, #8a2e2e 50%, transparent 100%);
  opacity: .55;
}
#dev-approve-popup .dap-eyebrow{
  font-family: 'Fraunces', 'Frank Ruhl Libre', serif;
  font-style: italic;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .14em;
  color: #8a2e2e;
  text-transform: uppercase;
  margin-bottom: 4px;
}
#dev-approve-popup .dap-title{
  font-family: 'Frank Ruhl Libre', 'Heebo', serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -.005em;
  color: #0a0a0a;
  margin: 0;
  line-height: 1.2;
}
#dev-approve-popup .dap-en{
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: .15em;
  color: #78716a;
  text-transform: uppercase;
  margin-top: 4px;
}
#dev-approve-popup .dap-body{
  padding: 18px 28px 8px;
  overflow-y: auto;
  flex: 1;
}
#dev-approve-popup .dap-section{
  margin-bottom: 18px;
}
#dev-approve-popup .dap-label{
  font-family: 'Assistant', sans-serif;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .02em;
  color: #4d463d;
  margin-bottom: 8px;
  text-align: right;
}
#dev-approve-popup .dap-hint{
  font-weight: 600;
  font-size: 11px;
  color: #a39d92;
  margin-right: 4px;
}
#dev-approve-popup .dap-checks{
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#dev-approve-popup .dap-check{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  background: #faf7ef;
  transition: border-color .12s, background .12s;
}
#dev-approve-popup .dap-check:hover{
  background: #f4ead5;
  border-color: rgba(140, 105, 18, .18);
}
#dev-approve-popup .dap-check input[type="checkbox"]{
  /* visually hide native checkbox; .dap-box is the real UI */
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px; height: 1px;
}
#dev-approve-popup .dap-box{
  width: 18px; height: 18px;
  border: 1.5px solid #8a857a;
  background: #fefcf7;
  position: relative;
  flex-shrink: 0;
  transition: all .12s;
}
#dev-approve-popup .dap-check input[type="checkbox"]:checked + .dap-box{
  background: #8a2e2e;
  border-color: #8a2e2e;
}
#dev-approve-popup .dap-check input[type="checkbox"]:checked + .dap-box::after{
  content: '';
  position: absolute;
  top: 1px; left: 5px;
  width: 5px; height: 10px;
  border-right: 2px solid #fefcf7;
  border-bottom: 2px solid #fefcf7;
  transform: rotate(45deg);
}
#dev-approve-popup .dap-check input[type="checkbox"]:focus-visible + .dap-box{
  outline: 2px solid #8a2e2e;
  outline-offset: 2px;
}
#dev-approve-popup .dap-lbl{
  flex: 1;
  font-family: 'Assistant', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #0a0a0a;
  text-align: right;
}
#dev-approve-popup .dap-input{
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid #c9c3b4;
  background: #fefcf7;
  font-family: 'Assistant', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #0a0a0a;
  text-align: right;
  direction: rtl;
  box-sizing: border-box;
}
#dev-approve-popup .dap-input:focus{
  outline: none;
  border-color: #8a2e2e;
}
#dev-approve-popup .dap-input::placeholder{
  color: #a39d92;
  font-weight: 600;
}
#dev-approve-popup .dap-select{
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid #c9c3b4;
  background: #fefcf7
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%234d463d' stroke-width='1.5' d='M1 1.5l5 5 5-5'/></svg>")
    no-repeat left 14px center;
  background-size: 12px 8px;
  font-family: 'Assistant', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #0a0a0a;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-align: right;
  direction: rtl;
  padding-left: 36px;
}
#dev-approve-popup .dap-select:focus{
  outline: none;
  border-color: #8a2e2e;
}
#dev-approve-popup .dap-err{
  min-height: 18px;
  color: #991b1b;
  font-family: 'Assistant', sans-serif;
  font-weight: 700;
  font-size: 12.5px;
  text-align: right;
  margin-bottom: 4px;
}
#dev-approve-popup .dap-foot{
  display: flex;
  gap: 10px;
  padding: 16px 28px 22px;
  background: #faf7ef;
  border-top: 1px solid #d6d0c0;
}
#dev-approve-popup .dap-btn{
  flex: 1;
  padding: 12px 16px;
  font-family: 'Assistant', sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .01em;
  cursor: pointer;
  border: 1.5px solid;
  background: transparent;
  transition: all .15s;
}
#dev-approve-popup .dap-btn-ghost{
  border-color: #c9c3b4;
  color: #4d463d;
  background: #fefcf7;
  flex: 0 0 110px;
}
#dev-approve-popup .dap-btn-ghost:hover{
  border-color: #4d463d;
  color: #0a0a0a;
}
#dev-approve-popup .dap-btn-primary{
  border-color: #0a0a0a;
  background: #0a0a0a;
  color: #fefcf7;
  position: relative;
}
#dev-approve-popup .dap-btn-primary:hover{
  background: #8a2e2e;
  border-color: #8a2e2e;
}
#dev-approve-popup .dap-btn-primary:active{
  transform: translateY(1px);
}
