/* The manager portal. Builds on /tokens.css. Logical properties throughout, so it flips between Arabic (RTL) and English (LTR). */
[hidden] { display: none !important; }
body { margin: 0; }
.boot { text-align: center; color: var(--muted); padding: 40vh 0; }
h1 { margin: 0; font-size: 22px; } h2 { margin: 0 0 8px; font-size: 17px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.stack { display: grid; gap: 12px; } .center { text-align: center; justify-items: center; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.grow { flex: 1; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
label.f { display: grid; gap: 4px; font-size: 13px; flex: 1 1 180px; min-width: 0; }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: inherit; min-width: 0; width: 100%; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: none; box-shadow: var(--focus); }
input:disabled, select:disabled { opacity: .6; }
button { font: inherit; font-weight: 700; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: inherit; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.sm { padding: 4px 10px; font-size: 13px; font-weight: 600; }
button.danger { color: var(--bad); }
button.link { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 4px; }
button:disabled { opacity: .55; cursor: default; }
.msg { padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); }
.msg.bad { background: var(--bad-soft); color: var(--bad); } .msg.ok { background: var(--ok-soft); color: var(--ok); }
.bad-text { color: var(--bad); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
code { direction: ltr; unicode-bidi: isolate; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; user-select: all; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: start; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr.off td { opacity: .55; }
.scroll { overflow-x: auto; }

/* Sign-in and the other first screens */
.lang-corner { position: fixed; inset-block-start: 12px; inset-inline-end: 12px; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; }
.auth-card { width: min(440px, 100%); display: grid; gap: 14px; }

/* The shell */
.top { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; padding: 10px 20px; background: var(--surface); border-block-end: 1px solid var(--line); position: sticky; inset-block-start: 0; z-index: 5; }
.brand { display: flex; gap: 10px; align-items: center; font-size: 17px; }
.brand img { max-height: 28px; width: auto; }
/* The bar: the daily sections in a row, the set-up ones under «more»; one line from a desktop down to a tablet, one «menu» button on a phone. */
.tabs { display: flex; gap: 4px; flex: 1; align-items: center; min-width: 0; position: relative; }
.nav-links { display: flex; gap: 4px; align-items: center; flex-wrap: nowrap; }
.tabs a, .morebtn, .menubtn { padding: 7px 14px; border-radius: 99px; text-decoration: none; color: var(--ink-2); font-weight: 600; white-space: nowrap; background: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.tabs a.on, .more.on > .morebtn { background: var(--accent-soft); color: var(--accent); }
.tabs a:hover, .morebtn:hover { background: var(--surface-2, var(--accent-soft)); }
.tabs a:focus-visible, .morebtn:focus-visible, .menubtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.more { position: relative; }
.more-list { display: none; position: absolute; inset-inline-start: 0; inset-block-start: calc(100% + 6px); min-width: 190px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .15); z-index: 20; flex-direction: column; gap: 2px; }
.more.open .more-list { display: flex; }
.more-list a { border-radius: 8px; }
.menubtn { display: none; border: 1px solid var(--line); }
@media (max-width: 760px) {
  .menubtn { display: inline-flex; }
  .brand { flex: 1; min-width: 0; }
  .tabs { flex: 0 0 auto; position: static; }
  .tools { flex: 1 0 100%; gap: 6px; }
  .nav-links { display: none; position: absolute; inset-inline: 8px; inset-block-start: calc(100% + 4px); max-height: 80vh; overflow-y: auto; flex-direction: column; align-items: stretch; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .15); z-index: 20; }
  .tabs.open .nav-links { display: flex; }
  .nav-links a, .morebtn { padding: 12px 14px; border-radius: 8px; }
  .morebtn { display: none; }
  .more { display: contents; }
  .more-list { display: flex; position: static; border: 0; box-shadow: none; padding: 0; min-width: 0; }
}
.tools { align-items: center; }
.banner { background: var(--bad-soft); color: var(--bad); padding: 10px 20px; font-weight: 600; }
.content { max-width: 1100px; margin: 0 auto; padding: 22px 16px 70px; display: grid; gap: 16px; }
.bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.filters > * { flex: 1 1 160px; }
.filters label.check { flex: 0 0 auto; }

/* Structure */
.tree { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tree .tree { margin-inline-start: 18px; padding-inline-start: 12px; border-inline-start: 2px solid var(--line); margin-block-start: 8px; }
.grp, .loc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.grp.dim { opacity: .6; }
.grp-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.loc { display: flex; gap: 10px; align-items: center; background: var(--surface-2); }
.loc.off { opacity: .55; }

/* Dialogs */
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; width: min(520px, 94vw); background: var(--surface); color: inherit; max-height: 92vh; overflow: auto; }
dialog.wide { width: min(720px, 94vw); }
dialog::backdrop { background: rgba(0, 0, 0, .4); }
dialog form { display: grid; gap: 12px; }
.actions { justify-content: flex-start; }
fieldset.fs { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; min-width: 0; }
fieldset.fs legend { padding: 0 6px; font-weight: 700; font-size: 13px; }
.checks { display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.hours { display: grid; gap: 6px; }
.hours-row { display: grid; grid-template-columns: 74px 1fr 98px 12px 98px; gap: 6px; align-items: center; }
.tagrow > input { flex: 1 1 120px; }
.logo-preview { max-height: 60px; width: auto; justify-self: start; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; }
.bigcode { font-size: 44px; font-weight: 900; letter-spacing: .08em; background: var(--accent-soft); color: var(--accent); border-radius: var(--radius); padding: 12px 22px; }
.temp { display: flex; gap: 10px; align-items: center; } .temp code { font-size: 24px; padding: 6px 12px; }
@media (max-width: 640px) { .top { padding: 10px 12px; } .hours-row { grid-template-columns: 60px 1fr 86px 8px 86px; } .bigcode { font-size: 32px; } }

/* Templates, schedules, runs */
.problems { margin: 0; padding-inline-start: 18px; max-height: 240px; overflow: auto; font-size: 13px; display: grid; gap: 4px; }
.fields { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.flags { display: flex; flex-wrap: wrap; gap: 4px; }
.corr { color: var(--info); }
tbody tr[style*=pointer]:hover td { background: var(--surface-2); }

/* Tickets (stage 3) */
.ticket-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .ticket-grid { grid-template-columns: minmax(0, 1fr); } }
.back { text-decoration: none; color: var(--accent); font-weight: 600; }
.desc { white-space: pre-wrap; margin: 0; }
.ctx { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; justify-items: start; }
h3 { margin: 0; font-size: 14px; color: var(--ink-2); }
.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { display: grid; place-items: center; width: 110px; height: 110px; border-radius: 12px; overflow: hidden; background: var(--surface-2); text-align: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li { border-inline-start: 3px solid var(--line-strong); padding-inline-start: 12px; display: grid; gap: 4px; justify-items: start; }
.timeline li[data-kind=comment] { border-inline-start-color: var(--accent); }
.timeline li[data-kind=escalation] { border-inline-start-color: var(--bad); }
.note { background: var(--surface-2); border-radius: 8px; padding: 6px 10px; white-space: pre-wrap; }
.linkurl { display: block; word-break: break-all; user-select: all; }

/* Registers, the bell and «حسابي» (stage 4) */
a.button { display: inline-block; font: inherit; font-weight: 700; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: inherit; text-decoration: none; }
a.button.sm { padding: 4px 10px; font-size: 13px; font-weight: 600; }
a.button.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }
.stat { display: grid; gap: 2px; background: var(--surface-2); border-radius: 10px; padding: 8px 14px; min-width: 110px; } .stat b { font-size: 20px; }
ul.plain { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; }
.rule-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 8px; }
.rule-row .row { align-items: center; } .rule-row input[type=number] { width: 90px; } .rule-row input, .rule-row select { width: auto; flex: 1 1 130px; }
.rule-row .row input[type=checkbox] { flex: 0 0 auto; }
.center-cell { text-align: center; }
.timeline li.unread { border-inline-start-color: var(--accent); background: var(--accent-soft); padding-block: 4px; border-radius: 0 8px 8px 0; }
.timeline li[data-kind=rule] { border-inline-start-color: var(--warn); } .timeline li[data-kind=service_moved] { border-inline-start-color: var(--ok); }
.bell-wrap { position: relative; }
.bell { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.badge { position: absolute; inset-block-start: -6px; inset-inline-end: -6px; min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box; border-radius: 99px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.bell-panel { position: absolute; inset-block-start: calc(100% + 8px); inset-inline-end: 0; width: min(360px, 90vw); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; display: grid; gap: 8px; z-index: 20; }
.bell-head { justify-content: space-between; align-items: center; }
.bell-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 320px; overflow: auto; }
.bell-list li { border-radius: 8px; } .bell-list li.unread { background: var(--accent-soft); }
.bell-list li button.link { display: block; width: 100%; text-align: start; padding: 6px 8px; color: inherit; font-weight: 500; }
@media (max-width: 640px) { .bell-panel { position: fixed; inset-inline: 8px; inset-block-start: 56px; width: auto; } .tools { gap: 6px; } }

.content a:not(.button):not(.back) { color: var(--accent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.timeline li.unread { border-radius: 8px; padding-inline: 8px; }
.content > *, .stack > * { min-width: 0; }

/* Dashboard and reports (stage 5) */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.seg button.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.row.tight { gap: 8px; align-items: center; }
.strong { font-weight: 700; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; align-items: start; }
.panel > .bar { margin-block-end: 8px; } .panel .stack { gap: 14px; } .panel h3 { margin-block: 4px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.metric { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; display: grid; gap: 6px; align-content: start; }
.metric-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.metric-value { font-size: 34px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; } .metric-value .unit { font-size: 14px; font-weight: 600; color: var(--muted); }
details.help summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; } details.help p { margin: 6px 0 0; color: var(--ink-2); }
.stats { align-items: stretch; } a.stat { text-decoration: none; color: inherit; } a.stat:hover { background: var(--accent-soft); } a.stat.bad { background: var(--bad-soft); color: var(--bad); }
svg.chart { display: block; width: 100%; max-width: 560px; height: auto; }
.grid2 > *, .metrics > *, .panel > * { min-width: 0; }
.ch-label { font-size: 12px; fill: var(--ink-2); } .ch-label.small { font-size: 11px; } .ch-num { font-size: 12px; font-weight: 700; fill: var(--ink); unicode-bidi: isolate; }
.ch-track { fill: var(--surface-2); } .ch-axis { stroke: var(--line-strong); stroke-width: 1; } .ch-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.ch-bar.c-ok { fill: var(--ok); } .ch-bar.c-warn { fill: var(--warn); } .ch-bar.c-bad { fill: var(--bad); } .ch-bar.c-info { fill: var(--info); } .ch-bar.c-accent { fill: var(--accent); } .ch-bar.c-muted { fill: var(--muted); }
.ch-hatch-bg { fill: var(--warn-soft); } .ch-hatch-line { stroke: var(--warn); }
.ch-target { stroke: var(--ink); } .ch-line { stroke: var(--accent); stroke-width: 1.5; } .ch-dot { fill: var(--accent); } .ch-crit { fill: var(--bad); stroke: var(--surface); stroke-width: 1; }
a.ch-link { cursor: pointer; } a.ch-link:hover .ch-bar { opacity: .8; } a.ch-link:focus-visible { outline: none; } a.ch-link:focus-visible .ch-track { stroke: var(--accent); stroke-width: 2; }
table.dash-table td.num { font-variant-numeric: tabular-nums; } .warn-text a { color: var(--warn) !important; font-weight: 700; } .bad-text a { color: var(--bad) !important; font-weight: 700; } td.prov a { font-weight: 700; text-decoration: underline dotted; }
table.dash-table tr.total td { border-block-start: 2px solid var(--line-strong); font-weight: 700; }
.ratecell .row { flex-wrap: nowrap; }
ul.oldest li { overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.subtabs { display: flex; flex-wrap: wrap; gap: 6px; }
.pager { justify-content: center; align-items: center; }
table.rep { font-size: 13px; } table.rep th, table.rep td { white-space: nowrap; } table.rep td { vertical-align: middle; }
table.rep td.n, table.rep th.n { text-align: start; }
table.rep tr.clickable { cursor: pointer; } table.rep tr.clickable:hover td { background: var(--surface-2); } table.rep tr.clickable:focus-visible { outline: none; box-shadow: var(--focus); }
.mk { font-weight: 700; } .mk-bad { color: var(--bad); } .mk-warn { color: var(--warn); } .mk-ok { color: var(--ok); }
.rep-section h2 { margin-block: 14px 6px; }
@media (max-width: 640px) {
  .metric-value { font-size: 28px; }
  table.dash-table thead { position: absolute; inset-inline-start: -9999px; }
  table.dash-table, table.dash-table tbody, table.dash-table tr, table.dash-table td { display: block; width: 100%; }
  table.dash-table tr { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-block-end: 10px; padding: 6px 10px; }
  table.dash-table td { display: flex; justify-content: space-between; gap: 10px; align-items: center; border: 0; padding: 4px 0; text-align: end; }
  table.dash-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: start; }
  table.dash-table td[data-label=""]::before { content: none; }
  table.dash-table td.ratecell .row { justify-content: flex-end; }
}

/* The template builder, the schedule editor, packs, the first-run guide and the plan page (stage 6) */
.bld { display: grid; gap: 14px; }
.bld-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.bld-bar h1 { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.bld-actions { align-items: center; }
.bld-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.bld-edit { display: grid; gap: 14px; min-width: 0; }
.bld-preview { position: sticky; inset-block-start: 70px; display: grid; gap: 10px; min-width: 0; }
.preview-frame { width: 100%; height: 74vh; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.bld-bar .seg { display: none; }
.bld-bar .seg button[aria-selected=true] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
@media (max-width: 1000px) {
  .bld-grid { grid-template-columns: minmax(0, 1fr); }
  .bld-bar .seg { display: inline-flex; }
  .bld[data-view=edit] .bld-preview, .bld[data-view=preview] .bld-edit { display: none; }
  .bld-preview { position: static; } .preview-frame { height: 78vh; }
}
.bld-gaps { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 8px 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }
.ltexts { display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); gap: 8px; }
@media (max-width: 640px) { .ltexts { grid-template-columns: minmax(0, 1fr); } }
.lt { display: grid; gap: 4px; font-size: 13px; min-width: 0; }
.lt-head { display: flex; justify-content: space-between; gap: 6px; align-items: center; min-height: 22px; }
.lt textarea { resize: vertical; }
.scard { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.shead { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.shead h3 { font-size: 15px; color: var(--ink); }
.flist { display: grid; gap: 8px; }
.fcard { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); min-width: 0; }
.fcard.open { background: var(--surface); border-color: var(--line-strong); }
.fhead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 6px 10px; }
.ftoggle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 0; background: none; padding: 6px 4px; text-align: start; flex: 1 1 240px; font-weight: 600; min-width: 0; }
.ftoggle b { overflow-wrap: anywhere; }
.fno { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; }
.fbtns { align-items: center; gap: 6px; }
.fbtns select.sm { width: auto; padding: 4px 8px; font-size: 13px; max-width: 180px; }
.fbody { padding: 4px 12px 14px; }
.fbody h4 { margin: 4px 0 0; font-size: 14px; }
.optrow { display: grid; gap: 6px; border-inline-start: 3px solid var(--line-strong); padding-inline-start: 10px; }
.optbtns { align-items: center; }
.ticketrule { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.addfield { align-items: end; }
.diff { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 320px; overflow: auto; }
.pack { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-block-end: 8px; }
.packlist { display: grid; gap: 4px; }
.sched-editor .checks { max-height: 200px; }
.guide { border-color: var(--accent); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.steps li.done { opacity: .75; }
.tick { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 800; flex: none; }
.steps li.done .tick { background: var(--ok); color: #fff; }
.plan .stats { gap: 12px; }
@media (max-width: 640px) { .fbtns { width: 100%; } .bld-bar .bld-actions { width: 100%; } }

.times { min-width: 70px; } .times .time { display: inline-block; margin: 1px 3px 1px 0; padding: 0 6px; border-radius: 6px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
a.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); justify-self: start; }

/* A branch and its group: the group is a small label above the branch's name (only when the company has more than one group). */
.branch .bgrp { display: block; font-size: 11px; line-height: 1.3; color: var(--muted); font-weight: 400; }
