/* tenants.css — B5 «فضاءات المدارس» (simulation). 09-kufi: paper / ink / red, radius 0. */
.appbar-title .sim, .tn-sim{ color:var(--action, #1739A8); }
.tn-head h1{ max-width:18ch; }
.tn-head p{ max-width:56ch; }

/* controls */
.tn-bar{ display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; padding-bottom:20px; }
.tn-ctx{ font-size:var(--t-note); color:var(--ink-3); margin-inline-start:auto; }
.tn-toggle{ display:inline-flex; align-items:center; gap:14px; min-height:60px; padding:0 22px 0 18px; border:0; background:var(--paper-2); color:var(--ink); font:700 19px/1.3 var(--f-text); cursor:pointer; transition:background-color .2s var(--ease), color .2s var(--ease); }
.tn-toggle i{ position:relative; width:46px; height:26px; background:var(--paper-3); flex:none; transition:background-color .2s var(--ease); }
.tn-toggle i::after{ content:""; position:absolute; top:3px; inset-inline-start:3px; width:20px; height:20px; background:var(--selected, #E0E2DD); transition:transform .25s var(--ease), background-color .2s var(--ease); }
.tn-toggle[aria-pressed="true"]{ background:var(--selected, #E0E2DD); color:var(--ink, #0B0B0B); }
.tn-toggle[aria-pressed="true"] i{ background: #E4EDFF; }
.tn-toggle[aria-pressed="true"] i::after{ transform:translateX(-20px); background:#fff; }
[dir="ltr"] .tn-toggle[aria-pressed="true"] i::after{ transform:translateX(20px); }
.tn-toggle:active{ transform:translateY(2px); }
@media (max-width:640px){ .tn-ctx{ margin-inline-start:0; width:100%; } .tn-bar .btn{ flex:1; } .tn-toggle{ width:100%; } }

/* legend: four tone steps, ink */
.tn-legend{ list-style:none; margin:0 0 24px; padding:0; display:flex; flex-wrap:wrap; gap:8px 20px; font-size:16px; color:var(--ink-2); }
.tn-legend li{ display:inline-flex; align-items:center; gap:8px; }
.tn-legend i, .tn-dots i, .tn-bars i{ display:block; }
.lv0{ background:var(--paper-3); box-shadow:inset 0 0 0 1px rgba(11,11,11,.18); }
.lv1{ background:var(--paper-2, #F1F0EC); }
.lv2{ background:var(--paper-2, #F1F0EC); }
.lv3{ background:var(--selected, #E0E2DD); }
.tn-legend i{ width:14px; height:14px; }
.tn-legend bdi{ font-family:var(--f-text); color:var(--ink-3); direction:ltr; }

/* the five spaces */
.tn-stage{ position:relative; padding-bottom:var(--gap-section); }
.tn-spaces{ display:grid; grid-template-columns:repeat(5, minmax(0,1fr)); gap:12px; }
@media (max-width:1180px){ .tn-spaces{ grid-template-columns:repeat(3, minmax(0,1fr)); } }
@media (max-width:760px){ .tn-spaces{ grid-template-columns:1fr; } }

.tn-space{ position:relative; display:flex; flex-direction:column; min-width:0; }
.tn-box{ position:relative; background:var(--paper-2); padding:18px 18px 16px; display:flex; flex-direction:column; gap:14px; flex:1; box-shadow:inset 0 0 0 2px var(--ink); transition:box-shadow .3s var(--ease); }
.tn-space.small .tn-box{ box-shadow:inset 0 0 0 2px var(--ink), inset 0 0 0 5px var(--paper-2), inset 0 0 0 6px var(--ink); }
.tn-top{ display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:2px 10px; }
.tn-top h3{ font:800 22px/1.3 var(--f-display); }
.tn-top span{ font-size:15px; color:var(--ink-2); }
.tn-key{ display:flex; align-items:center; gap:8px; font:500 14px/1.4 var(--f-text); color:var(--ink); background:var(--paper); padding:8px 10px; }
.tn-key svg{ width:20px; height:20px; flex:none; }
.tn-inner{ display:flex; flex-direction:column; gap:12px; transition:opacity .35s var(--ease), filter .35s var(--ease); }
.tn-cap{ font-size:14px; color:var(--ink-3); line-height:1.5; }
.tn-dots{ display:grid; grid-template-columns:repeat(auto-fill, 12px); gap:4px; }
.tn-dots i{ width:12px; height:12px; }

.tn-tbl{ width:100%; border-collapse:collapse; font-size:15px; }
.tn-tbl th{ font:500 13px/1.3 var(--f-text); color:var(--ink-3); padding:0 0 6px; text-align:center; direction:ltr; }
.tn-tbl th:first-child{ text-align:start; }
.tn-tbl td{ padding:5px 0; text-align:center; font:800 17px/1.2 var(--f-display); font-feature-settings:"tnum" 1; box-shadow:inset 0 -1px 0 rgba(11,11,11,.08); }
.tn-tbl td:first-child{ text-align:start; font:700 15px/1.2 var(--f-text); }
.tn-sum{ font-size:15px; line-height:1.5; color:var(--ink-2); }
.tn-sum b{ color:var(--ink); font-family:var(--f-display); font-weight:800; }
.tn-pool{ font:500 15px/1.5 var(--f-text); background:var(--paper); padding:8px 10px; box-shadow:inset 3px 0 0 var(--action, #1739A8); }
[dir="rtl"] .tn-pool{ box-shadow:inset -3px 0 0 var(--action, #1739A8); }

.tn-foot{ margin-top:auto; display:grid; gap:8px; }
.tn-foot .btn{ min-height:56px; font-size:17px; padding:10px 14px; width:100%; }
.tn-state{ display:flex; align-items:center; gap:8px; min-height:56px; font:700 16px/1.4 var(--f-text); color:var(--ink); }
.tn-state svg{ width:20px; height:20px; flex:none; }

/* the wire out of each space: carries totals only */
.tn-wire{ position:relative; height:64px; margin-inline:auto; width:2px; background:repeating-linear-gradient(to bottom, rgba(11,11,11,.28) 0 4px, transparent 4px 9px); transition:background .3s var(--ease); }
.tn-space.sent .tn-wire{ background: #E4EDFF; }
.tn-packet{ position:absolute; top:0; left:50%; transform:translate(-50%, -8px); opacity:0; white-space:nowrap; background:var(--selected, #E0E2DD); color:var(--ink, #0B0B0B); font:500 13px/1 var(--f-text); padding:7px 9px; pointer-events:none; }
.tn-space.sending .tn-packet{ animation:tn-down 1.1s var(--ease) forwards; }
@keyframes tn-down{ 0%{ opacity:0; transform:translate(-50%, -6px); } 15%{ opacity:1; } 80%{ opacity:1; } 100%{ opacity:0; transform:translate(-50%, 44px); } }

/* the bus joining the wires into the délégation */
.tn-bus{ height:2px; margin-bottom:0; }
.tn-bus i{ display:block; height:2px; background:repeating-linear-gradient(to left, rgba(11,11,11,.28) 0 4px, transparent 4px 9px); margin-inline:10%; }
.tn-stage.any-sent .tn-bus i{ background: #E4EDFF; }
.tn-bus::after{ content:""; display:block; width:2px; height:40px; margin-inline:auto; background:rgba(11,11,11,.28); }
.tn-stage.any-sent .tn-bus::after{ background: #E4EDFF; }
@media (max-width:760px){ .tn-wire{ height:40px; } .tn-bus i{ display:none; } }

/* the délégation */
.tn-central{ background:var(--band); color:var(--ink, #0B0B0B); padding:clamp(20px,3vw,40px); display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.3fr); gap:24px 48px; }
.tn-central h2{ font:800 var(--t-mid)/1.35 var(--f-display); grid-column:1/-1; display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 16px; }
.tn-central h2 small{ font:500 16px/1.4 var(--f-text); color:var(--on-ink-2); }
.tn-central .tn-sim{ font:700 15px/1 var(--f-text); padding:6px 10px; background:#fff; color:#0B0B0B; }
.tn-arr{ list-style:none; margin:0; padding:0; display:grid; gap:4px; align-content:start; }
.tn-arr li{ display:flex; justify-content:space-between; gap:12px; background:var(--band-2); padding:12px 14px; font-size:16px; animation:tn-in .5s var(--ease) both; }
.tn-arr li b{ font-family:var(--f-display); font-weight:800; }
.tn-arr li.pool{ box-shadow:inset -3px 0 0 var(--action, #1739A8); }
.tn-arr li.wait{ color:var(--on-ink-2); background:transparent; box-shadow:inset 0 0 0 1px #333; animation:none; }
@keyframes tn-in{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:none; } }
.tn-tot{ display:grid; gap:14px; align-content:start; }
.tn-row{ display:grid; grid-template-columns:52px minmax(0,1fr) 64px; gap:12px; align-items:center; }
.tn-row b{ font:700 16px var(--f-text); }
.tn-row .pct{ font:900 26px/1 var(--f-display); text-align:end; direction:ltr; }
.tn-bars{ display:flex; height:22px; background:var(--paper-2, #F1F0EC); }
.tn-bars i{ height:100%; transition:width .6s var(--ease); }
.tn-bars .lv0{ background:var(--paper-2, #F1F0EC); box-shadow:none; } .tn-bars .lv1{ background:var(--paper-2, #F1F0EC); } .tn-bars .lv2{ background:#BDBDBD; } .tn-bars .lv3{ background:#FFFFFF; }
.tn-tot .note{ color:var(--on-ink-2); }
@media (max-width:760px){ .tn-central{ grid-template-columns:1fr; } .tn-row{ grid-template-columns:44px minmax(0,1fr) 56px; } }

/* «أظهر ما يعبر»: only aggregates are visible; everything inside the spaces dims */
.tn-log{ display:none; margin-top:12px; background:var(--paper-2); padding:clamp(18px,2.4vw,32px); }
.tn-log h2{ font:800 var(--t-mid)/1.3 var(--f-display); margin-bottom:6px; }
.tn-log ol{ list-style:none; margin:16px 0 0; padding:0; display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:4px; }
.tn-log pre{ margin:0; font:inherit; white-space:pre; overflow-x:auto; }
.tn-log bdi{ unicode-bidi:isolate; }
.tn-log li{ background:var(--paper); padding:12px 14px; font:400 14px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; direction:ltr; text-align:left; overflow-wrap:anywhere; animation:tn-in .4s var(--ease) both; }
.tn-log li.empty{ font-family:var(--f-text); direction:rtl; text-align:start; color:var(--ink-3); }
.show-cross .tn-log{ display:block; }
.show-cross .tn-inner, .show-cross .tn-key, .show-cross .tn-foot .btn{ opacity:.12; filter:grayscale(1); }
.show-cross .tn-box{ box-shadow:inset 0 0 0 2px rgba(11,11,11,.18); }
.show-cross .tn-space.sent .tn-wire{ box-shadow:0 0 0 3px rgba(23,57,168,.15); }
.show-cross .tn-arr li:not(.wait){ box-shadow:inset 0 0 0 2px var(--action, #1739A8); }
@media (prefers-reduced-motion:reduce){ .tn-space.sending .tn-packet{ animation:none; } }

.tn-rules{ padding-bottom:var(--gap-section); }
.tn-rules ul{ margin:16px 0; padding-inline-start:1.2em; display:grid; gap:8px; }
.tn-rules h2{ font:800 var(--t-mid)/1.3 var(--f-display); }
