/* Execution Technology brand — dashboard styles */
:root {
  --bg: #1c1e1b; --panel: #252825; --panel-2: #333333; --line: #3d403c;
  --text: #efefef; --dim: #9aa09a; --brand: #00a651; --brand-soft: rgba(0, 166, 81, .14);
  --danger: #e5484d; --danger-soft: rgba(229, 72, 77, .14); --info: #84a1d2; --olive: #a6a300;
  --radius: 10px;
  --circuit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cg fill='none' stroke='%2300a651' stroke-opacity='.13' stroke-width='1.3'%3E%3Cpath d='M24 0v54l22 22v104'/%3E%3Ccircle cx='46' cy='76' r='4'/%3E%3Cpath d='M112 0v34l-22 22v44'/%3E%3Ccircle cx='90' cy='104' r='4'/%3E%3Cpath d='M150 180v-56l16-16V64'/%3E%3Ccircle cx='166' cy='60' r='4'/%3E%3C/g%3E%3C/svg%3E");
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
body { font-family: 'Almarai', system-ui, sans-serif; background: var(--bg); color: var(--text);
       font-size: 14.5px; line-height: 1.65; min-height: 100vh; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.pattern { background-image: var(--circuit); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px;
          padding: 12px 24px; background: #171916; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 800; }
.brand:hover { text-decoration: none; }
.brand img { height: 38px; width: auto; }
.brand span { border-inline-start: 1px solid var(--line); padding-inline-start: 12px; font-size: 15px; }
.topbar nav { display: flex; gap: 4px; margin-inline-start: auto; flex-wrap: wrap; }
.topbar nav a { color: var(--dim); padding: 8px 12px; border-radius: 8px; font-weight: 700; font-size: 13.5px; }
.topbar nav a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.topbar nav a.on { color: var(--text); background: var(--panel); box-shadow: inset 0 -2px 0 var(--brand); }

.wrap { max-width: 1320px; margin: 0 auto; padding: 24px 16px 96px; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 22px; font-weight: 800; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.page-head .plogo { width: 56px; height: 56px; border-radius: 12px; object-fit: contain; background: var(--panel-2); padding: 6px; }

/* [ Bracket ] headings from the brand guideline */
.bracket { display: inline-block; font-size: 13px; font-weight: 800; letter-spacing: .3px; color: var(--text);
           padding: 3px 12px; margin-bottom: 14px; background: var(--brand-soft);
           border-inline: 3px double var(--brand); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 15px;
       border-radius: var(--radius); border: 1px solid var(--line); background: transparent; color: var(--text);
       font-family: 'Almarai', sans-serif; font-weight: 700; font-size: 13.5px; line-height: normal;
       cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { padding: 6px 9px; min-width: 32px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
input, select, textarea { width: 100%; background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
       border-radius: var(--radius); padding: 5px 12px; font-family: 'Almarai', sans-serif; font-weight: 400;
       font-size: 14px; line-height: 1.9; }
/* Almarai's own line metrics are shorter than its glyphs: the 1.9 line box (with 5px padding, ~38px total)
   keeps the dots under ي/ج from being clipped inside inputs. */
textarea { padding: 9px 12px; line-height: 1.7; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
textarea { resize: vertical; min-height: 90px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
label.lbl { display: block; font-size: 12.5px; color: var(--dim); font-weight: 700; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.hint, .meta { font-size: 12.5px; color: var(--dim); }
.hint { margin-top: 6px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > form { display: contents; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }

.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-weight: 700; font-size: 14px; }
.flash.ok { background: var(--brand-soft); color: #7fe0ad; border: 1px solid rgba(0, 166, 81, .4); }
.flash.warn { background: var(--danger-soft); color: #ffb0b2; border: 1px solid rgba(229, 72, 77, .4); }

/* ---------- surfaces ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px;
        display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card:hover { border-color: #4d514c; }
.card.sel { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.card.off { opacity: .6; }
.card h2 { font-size: 16px; font-weight: 800; }
.card h2 a { color: var(--text); }
.logo-box { width: 56px; height: 56px; flex: none; border-radius: 12px; background: var(--panel-2);
            display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; color: var(--brand); overflow: hidden; }
.logo-box img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.empty { padding: 42px 20px; text-align: center; color: var(--dim); border: 1px dashed var(--line); border-radius: 14px; margin-bottom: 16px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px;
         font-weight: 700; line-height: 1.4; vertical-align: middle;
         background: var(--panel-2); color: var(--dim); white-space: nowrap; }
.badge.active { background: var(--brand-soft); color: var(--brand); }
.badge.upcoming { background: rgba(132, 161, 210, .15); color: var(--info); }
.badge.finished { background: var(--panel-2); color: var(--dim); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #5a5e59; flex: none; }
.dot.on { background: var(--brand); box-shadow: 0 0 8px var(--brand); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; }
.tabs a { padding: 10px 16px; color: var(--dim); font-weight: 700; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--brand); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.filters a { padding: 5px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--dim); font-size: 13px; font-weight: 700; }
.filters a:hover { color: var(--text); text-decoration: none; }
.filters a.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- dialogs & toast ---------- */
dialog { margin: auto; width: min(480px, calc(100vw - 32px)); background: var(--panel); color: var(--text);
         border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
dialog::backdrop { background: rgba(0, 0, 0, .65); }
dialog h3 { font-size: 17px; font-weight: 800; margin-bottom: 16px; }
dialog .row.end { justify-content: flex-start; margin-top: 8px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90; padding: 11px 18px;
         border-radius: var(--radius); background: #111310; border: 1px solid var(--brand); font-weight: 700;
         box-shadow: 0 10px 30px rgba(0, 0, 0, .5); max-width: calc(100vw - 32px); }
.toast.warn { border-color: var(--danger); }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--panel); border-radius: 14px; overflow: hidden; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.tbl th { color: var(--dim); font-weight: 700; background: var(--panel-2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td > form { display: inline-flex; gap: 6px; align-items: center; vertical-align: middle; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }

/* ---------- screens ---------- */
.zone-head { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; font-weight: 800; font-size: 15px; }
.zone-head::before { content: ''; width: 4px; height: 18px; background: var(--brand); border-radius: 2px; }
.zone-head .count { color: var(--dim); font-weight: 400; font-size: 13px; }
.remote { display: flex; gap: 4px; flex-wrap: wrap; }
.bulkbar { position: sticky; bottom: 14px; z-index: 20; display: none; align-items: center; gap: 8px; flex-wrap: wrap;
           margin-top: 18px; padding: 12px 14px; border-radius: 14px; background: #121411; border: 1px solid var(--brand);
           box-shadow: 0 12px 30px rgba(0, 0, 0, .55); }
.bulkbar.show { display: flex; }
.bulkbar b { color: var(--brand); }
.bulkbar .sep { width: 1px; align-self: stretch; background: var(--line); }

/* running broadcasts bar */
.bcast { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 10px;
         border-radius: 14px; border: 1px solid var(--brand);
         background: linear-gradient(90deg, rgba(0, 166, 81, .18), rgba(0, 166, 81, .04)); }
.bcast .live { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 10px var(--brand);
               animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- library & playlists ---------- */
.add-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.add-grid h3 { font-size: 14px; margin-bottom: 10px; }
.add-grid form { display: flex; flex-direction: column; gap: 8px; }
.thumb { aspect-ratio: 16 / 9; border-radius: 10px; background: #121411; overflow: hidden; display: flex;
         align-items: center; justify-content: center; color: var(--dim); font-size: 13px; text-align: center; padding: 0; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .txt { padding: 12px; font-weight: 700; color: var(--text); white-space: pre-wrap; overflow: hidden; max-height: 100%; }
.progress { height: 8px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--brand); transition: width .15s; }
.editor { display: grid; gap: 16px; grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.4fr); align-items: start; }
.picker, .playlist { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow: auto; }
.picker li, .playlist li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius);
                           background: var(--panel-2); border: 1px solid var(--line); min-width: 0; }
.playlist .num { width: 22px; color: var(--brand); font-weight: 800; text-align: center; flex: none; }
.playlist .dur { width: 110px; flex: none; padding: 6px 8px; }
.playlist.is-empty::before { content: attr(data-empty); color: var(--dim); padding: 18px; text-align: center;
                             border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth .panel { width: 100%; max-width: 410px; padding: 28px; }
.auth .logo { display: block; height: 84px; margin: 0 auto 14px; }
.auth h1 { text-align: center; font-size: 20px; font-weight: 800; }
.auth .sub { text-align: center; color: var(--dim); font-size: 13.5px; margin-bottom: 20px; }

/* ---------- wall & print sheet ---------- */
.wall { display: grid; gap: 10px; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tile .head { display: flex; align-items: center; gap: 7px; padding: 7px 10px; font-size: 12.5px; }
.tile .head a { margin-inline-start: auto; font-size: 12px; }
.screenbox { position: relative; width: 100%; padding-top: 56.25%; background: #000; }
.screenbox .inner { position: absolute; inset: 0; overflow: hidden; }
.screenbox iframe { width: 1280px; height: 720px; border: 0; transform-origin: top right; }
.placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
               color: #4d514c; font-weight: 800; padding: 10px; text-align: center; }
.sheet-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.sheet-head img { height: 64px; }
.qr-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.qr-card { background: #fff; color: #111; border-radius: 12px; padding: 14px; display: flex; flex-direction: column;
           align-items: center; gap: 6px; text-align: center; break-inside: avoid; }
.qr-card canvas { width: 170px; height: 170px; image-rendering: pixelated; }
.qr-card .meta { color: #555; }
.qr-card code { font-size: 10px; word-break: break-all; color: #444; direction: ltr; }
.qr-large { display: block; margin: 0 auto 12px; width: 240px; height: 240px; background: #fff; border-radius: 12px; image-rendering: pixelated; }

/* ---------- logs ---------- */
.diff { margin-top: 8px; font-size: 12.5px; }
.diff pre { white-space: pre-wrap; word-break: break-word; font-family: 'Almarai', sans-serif; font-size: 12.5px; line-height: 1.7; margin: 0; }
details summary { cursor: pointer; color: var(--brand); font-size: 12.5px; font-weight: 700; margin-top: 6px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; }

@media (max-width: 800px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor > * { min-width: 0; }
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .brand span { display: none; }
  .topbar nav { margin-inline-start: 0; width: 100%; }
  .wrap { padding: 16px 16px 96px; }
  .grid { grid-template-columns: 1fr; }
  .playlist li { flex-wrap: wrap; }
  .playlist .title { flex: 1 1 55%; }
}
@media print {
  body { background: #fff; color: #000; }
  .topbar, .noprint, .flash, .toast { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .qr-card { border: 1px solid #ccc; }
}

/* ---------- icons, titles, notes, stats, status switch (UI polish) ---------- */
svg.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
svg.icon.lg { width: 1.5em; height: 1.5em; }
.btn svg.icon { width: 1.05em; height: 1.05em; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.title-row h1, .title-row h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.meta.row { gap: 6px 12px; }
.meta .icon { color: var(--dim); }

.note { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; margin: 10px 0; border-radius: var(--radius);
        font-size: 13px; line-height: 1.7; border: 1px solid; }
.note .icon { margin-top: 3px; }
.note.info { background: rgba(132, 161, 210, .10); border-color: rgba(132, 161, 210, .35); color: #cfdaef; }
.note.info .icon { color: var(--info); }
.note.warn { background: rgba(166, 163, 0, .12); border-color: rgba(166, 163, 0, .5); color: #e9e6a8; }
.note.warn .icon { color: #d9d400; }
.note .btn { margin-inline-start: auto; }

.stats { display: flex; gap: 6px; flex-wrap: wrap; }
.stat { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: var(--panel-2);
        font-size: 12.5px; color: var(--dim); }
.stat b { color: var(--text); font-weight: 700; }
.stat.ok { color: var(--brand); background: var(--brand-soft); }

.seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.seg button { border: 0; background: none; color: var(--dim); padding: 4px 12px; border-radius: 999px; cursor: pointer;
              font-family: 'Almarai', sans-serif; font-size: 12.5px; font-weight: 700; line-height: normal; }
.seg button:hover { color: var(--text); }
.seg button.on.upcoming { background: rgba(132, 161, 210, .2); color: var(--info); }
.seg button.on.active { background: var(--brand); color: #fff; }
.seg button.on.finished { background: var(--panel-2); color: var(--text); }

/* Add-content columns: same structure, buttons pinned to one row at the bottom. */
.add-grid { align-items: stretch; }
.add-col { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 12px;
           background: rgba(255, 255, 255, .02); }
.add-col h3 { display: flex; align-items: center; gap: 8px; margin: 0; }
.add-col h3 .icon { color: var(--brand); }
.add-grid .add-col form { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.add-col textarea { min-height: 44px; height: 44px; }
.add-foot { margin-top: auto; padding-top: 4px; }
.add-foot .btn { width: 100%; }
.field-row { display: grid; grid-template-columns: 1fr 120px; gap: 8px; }

dialog.confirm { width: min(420px, calc(100vw - 32px)); }
dialog.confirm .msg { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; line-height: 1.8; }
dialog.confirm .msg .icon { color: var(--danger); margin-top: 4px; }
dialog.confirm.info .msg .icon { color: var(--info); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { color: #fff; filter: brightness(1.08); }
.topbar nav a { display: inline-flex; align-items: center; gap: 6px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; }
.page-head .actions form { display: contents; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.file-pick { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px dashed var(--line);
             border-radius: var(--radius); cursor: pointer; min-width: 0; }
.file-pick:hover { border-color: var(--brand); }
.file-pick .meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pick:focus-within { outline: 2px solid var(--brand); outline-offset: 1px; }
.unit { position: relative; display: block; }
.unit input { padding-inline-end: 52px; }
.unit span { position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); color: var(--dim);
             font-size: 12.5px; pointer-events: none; }
.remote { align-items: center; }
