/* Garraio IT Support — RTL UI */
@font-face { font-family: 'Plex Arabic'; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: 'Plex Arabic'; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: 'Plex Arabic'; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: 'Plex Arabic'; font-weight: 700; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: 'Plex Arabic'; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: 'Plex Arabic'; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: 'Plex Arabic'; font-weight: 700; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }

:root {
  --brand: #0b3c7a;
  --brand-2: #1565d8;
  --brand-soft: #e8f0fc;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --line: #e3e7ef;
  --text: #1b2333;
  --muted: #667085;
  --ok: #12805c;   --ok-bg: #e5f6ef;
  --warn: #b25e09; --warn-bg: #fff2e0;
  --bad: #c0262d;  --bad-bg: #fde8e9;
  --info: #1565d8; --info-bg: #e8f0fc;
  --violet: #6c3fc5; --violet-bg: #f0eafc;
  --gray-bg: #eef0f4;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.16);
  --nav-w: 248px;
  --top-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #7fb0ff; --brand-2: #5b9dff; --brand-soft: #1b2a44;
    --bg: #0f141c; --surface: #171e29; --surface-2: #1c2431; --line: #2a3443; --text: #e7ecf3; --muted: #98a3b5;
    --ok: #4cd4a0; --ok-bg: #12322a; --warn: #f3a85a; --warn-bg: #3a2914; --bad: #ff7a80; --bad-bg: #3d1a1d;
    --info: #7fb0ff; --info-bg: #1b2a44; --violet: #b49bff; --violet-bg: #2a2142; --gray-bg: #232c3a;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #7fb0ff; --brand-2: #5b9dff; --brand-soft: #1b2a44;
  --bg: #0f141c; --surface: #171e29; --surface-2: #1c2431; --line: #2a3443; --text: #e7ecf3; --muted: #98a3b5;
  --ok: #4cd4a0; --ok-bg: #12322a; --warn: #f3a85a; --warn-bg: #3a2914; --bad: #ff7a80; --bad-bg: #3d1a1d;
  --info: #7fb0ff; --info-bg: #1b2a44; --violet: #b49bff; --violet-bg: #2a2142; --gray-bg: #232c3a;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Plex Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.35; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; max-width: 150px; object-fit: contain; }
.brand .brand-name { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .brand-name small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; margin-top: -2px; }
.topbar .spacer { flex: 1; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 10px; border: 0; background: transparent; color: var(--text); cursor: pointer; font-size: 19px;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .dot {
  position: absolute; top: 4px; inset-inline-end: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 14px;
}
.layout { display: flex; min-height: calc(100vh - var(--top-h)); }
.sidenav {
  width: var(--nav-w); flex: none; padding: 16px 12px; background: var(--surface); border-inline-end: 1px solid var(--line);
  position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto;
}
.sidenav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text);
  font-weight: 500; margin-bottom: 2px;
}
.sidenav a:hover { background: var(--surface-2); text-decoration: none; }
.sidenav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.sidenav a .ico { width: 22px; text-align: center; font-size: 17px; }
.sidenav a .count { margin-inline-start: auto; background: var(--gray-bg); color: var(--muted); border-radius: 20px; padding: 0 8px; font-size: 12px; font-weight: 700; }
.sidenav a .count.hot { background: var(--bad); color: #fff; }
.sidenav .sep { height: 1px; background: var(--line); margin: 12px 4px; }
.sidenav .label { font-size: 12px; color: var(--muted); padding: 4px 12px; }
main { flex: 1; min-width: 0; padding: 24px; max-width: 1280px; }
.bottomnav { display: none; }

@media (max-width: 900px) {
  .sidenav { display: none; }
  main { padding: 16px 14px calc(84px + var(--safe-b)); }
  .bottomnav {
    display: flex; position: fixed; bottom: 0; right: 0; left: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b));
  }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 600; position: relative; }
  .bottomnav a:hover { text-decoration: none; }
  .bottomnav a .ico { font-size: 20px; line-height: 1.2; }
  .bottomnav a.active { color: var(--brand); }
  .bottomnav a.cta .ico { background: var(--brand); color: #fff; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; margin-top: -18px; box-shadow: var(--shadow-lg); }
  .bottomnav a .count { position: absolute; top: -2px; inset-inline-start: calc(50% + 6px); background: var(--bad); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; }
  .brand .brand-name small { display: none; }
  h1 { font-size: 19px; }
}

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .grow { flex: 1; min-width: 200px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-bottom: 8px; font-size: 14px; }

/* ---------- Cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h2 { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 16px; }

/* KPI tiles */
.kpi { padding: 16px 18px; }
.kpi .k-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi .k-value { font-size: 28px; font-weight: 700; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.alert .k-value { color: var(--bad); }
.kpi.good .k-value { color: var(--ok); }
a.kpi { display: block; color: inherit; }
a.kpi:hover { text-decoration: none; border-color: var(--brand-2); }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 16px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
label.field > small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit;
}
textarea.input { min-height: 120px; resize: vertical; line-height: 1.7; }
.input:focus { outline: 2px solid color-mix(in srgb, var(--brand-2) 35%, transparent); border-color: var(--brand-2); }
.input[dir="ltr"] { text-align: left; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 140px; height: 38px; min-height: 38px; padding: 6px 10px; }
.filters .search { flex: 1; min-width: 200px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-2); }

/* Segmented control / chips */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); padding: 5px 12px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.cat-grid button {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; text-align: center;
}
.cat-grid button .e { font-size: 24px; }
.cat-grid button.on { border-color: var(--brand-2); background: var(--brand-soft); color: var(--brand); }
.prio-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
@media (max-width: 600px) { .prio-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.prio-grid button { text-align: start; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.prio-grid button b { display: block; font-size: 14px; }
.prio-grid button small { color: var(--muted); font-size: 12px; line-height: 1.4; display: block; }
.prio-grid button.on { border-color: var(--brand-2); background: var(--brand-soft); }

/* Dropzone */
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; background: var(--surface-2); }
.drop.over { border-color: var(--brand-2); background: var(--brand-soft); }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.thumb { position: relative; width: 92px; height: 92px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; font-size: 12px; text-align: center; padding: 4px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.thumb .x { position: absolute; top: 4px; inset-inline-end: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; z-index: 2; }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-new { background: var(--info-bg); color: var(--info); }
.s-in_progress { background: var(--warn-bg); color: var(--warn); }
.s-waiting_user { background: var(--violet-bg); color: var(--violet); }
.s-pending_approval { background: #fff0e6; color: #c2410c; }
.s-resolved { background: var(--ok-bg); color: var(--ok); }
.s-closed, .s-cancelled { background: var(--gray-bg); color: var(--muted); }
.p-low { background: var(--gray-bg); color: var(--muted); }
.p-medium { background: var(--info-bg); color: var(--info); }
.p-high { background: var(--warn-bg); color: var(--warn); }
.p-critical { background: var(--bad-bg); color: var(--bad); }
.pr-pending { background: #fff0e6; color: #c2410c; }
.pr-approved, .pr-delivered { background: var(--ok-bg); color: var(--ok); }
.pr-ordered { background: var(--info-bg); color: var(--info); }
.pr-rejected { background: var(--bad-bg); color: var(--bad); }
.pr-cancelled { background: var(--gray-bg); color: var(--muted); }
.tag-late { background: var(--bad); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .s-pending_approval, :root:not([data-theme="light"]) .pr-pending { background: #3b2416; color: #ffab70; } }

/* ---------- Ticket list ---------- */
.tlist { list-style: none; margin: 0; padding: 0; }
.tlist li + li { border-top: 1px solid var(--line); }
.trow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; padding: 14px 18px; color: var(--text); }
.trow:hover { background: var(--surface-2); text-decoration: none; }
.trow .t-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .t-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 13px; align-items: center; }
.trow .t-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.trow .num { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); direction: ltr; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .e { font-size: 40px; margin-bottom: 8px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 14px; }

/* ---------- Ticket detail ---------- */
.t-desc { white-space: pre-wrap; word-wrap: break-word; }
.thread { list-style: none; margin: 0; padding: 0; }
.msg { display: flex; gap: 12px; padding: 16px 18px; }
.msg + .msg { border-top: 1px solid var(--line); }
.msg .body { flex: 1; min-width: 0; }
.msg .who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 4px; }
.msg .who b { font-weight: 700; }
.msg .text { white-space: pre-wrap; word-wrap: break-word; }
.msg.internal { background: repeating-linear-gradient(-45deg, var(--warn-bg), var(--warn-bg) 10px, color-mix(in srgb, var(--warn-bg) 70%, var(--surface)) 10px, color-mix(in srgb, var(--warn-bg) 70%, var(--surface)) 20px); }
.msg.event { padding: 8px 18px; color: var(--muted); font-size: 13px; align-items: center; }
.msg.event .dotline { width: 34px; display: grid; place-items: center; font-size: 14px; }
.role-badge { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.files a.img { width: 120px; height: 90px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); display: block; }
.files a.img img { width: 100%; height: 100%; object-fit: cover; }
.files a.file { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-size: 13px; background: var(--surface-2); }
.reply { padding: 16px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.reply.internal-on textarea { background: var(--warn-bg); }
.kv { display: grid; grid-template-columns: 110px minmax(0,1fr); gap: 10px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-wrap: break-word; }
.sla { display: flex; flex-direction: column; gap: 10px; }
.sla .bar { height: 8px; border-radius: 4px; background: var(--gray-bg); overflow: hidden; }
.sla .bar > i { display: block; height: 100%; background: var(--ok); border-radius: 4px; }
.sla .bar.warn > i { background: var(--warn); }
.sla .bar.bad > i { background: var(--bad); }
.stars { display: inline-flex; gap: 4px; direction: ltr; }
.stars button { border: 0; background: none; font-size: 30px; cursor: pointer; color: var(--line); padding: 0; line-height: 1; }
.stars button.on { color: #f5b301; }
.notice { border-radius: 12px; padding: 12px 16px; display: flex; gap: 10px; align-items: flex-start; }
.notice.info { background: var(--info-bg); color: var(--info); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice .grow { flex: 1; }
.notice b { color: inherit; }

/* PR card */
.pr-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); }
.pr-card + .pr-card { margin-top: 10px; }
.pr-card .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th { text-align: start; font-weight: 600; color: var(--muted); font-size: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr.click { cursor: pointer; }
table.tbl tr.click:hover td { background: var(--surface-2); }
.num-cell { font-variant-numeric: tabular-nums; text-align: end; }

/* Charts */
.chart-box { position: relative; height: 260px; padding: 12px 16px 16px; }
.chart-box.tall { height: 320px; }
.bars { padding: 6px 18px 16px; }
.bars .b { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 48px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.bars .b .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .b .track { height: 10px; background: var(--gray-bg); border-radius: 5px; overflow: hidden; }
.bars .b .track i { display: block; height: 100%; background: var(--brand-2); border-radius: 5px; }
.bars .b .v { text-align: end; font-variant-numeric: tabular-nums; font-weight: 600; }
.heat { display: grid; grid-template-columns: 54px repeat(24, minmax(10px, 1fr)); gap: 2px; font-size: 10px; padding: 8px 16px 16px; direction: ltr; }
.heat .c { aspect-ratio: 1; border-radius: 3px; background: var(--gray-bg); }
.heat .h { text-align: center; color: var(--muted); }
.heat .d { color: var(--muted); font-size: 11px; text-align: right; padding-right: 4px; white-space: nowrap; }
.ring { display: flex; align-items: center; gap: 16px; padding: 16px 18px; }
.ring svg { flex: none; }
.ring .rv { font-size: 26px; font-weight: 700; }

/* ---------- Overlays ---------- */
.toast-wrap { position: fixed; z-index: 100; bottom: calc(90px + var(--safe-b)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: #1b2333; color: #fff; padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 600; max-width: 92vw; animation: pop .2s ease-out; }
.toast.bad { background: var(--bad); }
.toast.ok { background: #12805c; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.modal-bg { position: fixed; inset: 0; z-index: 90; background: rgba(15,20,30,.5); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(540px, 100%); max-height: 90vh; overflow-y: auto; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); }
.modal .m-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal .m-head h2 { flex: 1; }
.modal .m-body { padding: 18px 20px; }
.modal .m-foot { display: flex; gap: 8px; justify-content: flex-start; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.88); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.menu-pop { position: absolute; top: calc(var(--top-h) - 6px); inset-inline-end: 12px; z-index: 50; width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px; }
.menu-pop a, .menu-pop button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: start; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); text-decoration: none; }
.menu-pop .who { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }

/* Notifications */
.notif { display: flex; gap: 12px; padding: 14px 18px; color: var(--text); }
.notif + .notif { border-top: 1px solid var(--line); }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif.unread { background: var(--brand-soft); }
.notif .ni { font-size: 20px; width: 28px; text-align: center; }
.notif .nb { flex: 1; min-width: 0; }
.notif .nb b { display: block; }
.notif .nb p { margin: 2px 0 0; color: var(--muted); font-size: 13px; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Install banner */
.install { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--brand); color: #fff; margin-bottom: 16px; }
.install .grow { flex: 1; }
.install .btn { background: #fff; color: var(--brand); border-color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .install { background: #1d3a66; } }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(1200px 600px at 100% 0%, color-mix(in srgb, var(--brand-2) 18%, transparent), transparent),
  radial-gradient(900px 500px at 0% 100%, color-mix(in srgb, var(--brand) 14%, transparent), transparent), var(--bg); }
.login { width: min(420px, 100%); padding: 32px 28px; text-align: center; }
.login .logo { max-width: 220px; max-height: 90px; margin: 0 auto 18px; display: block; }
.login h1 { font-size: 21px; margin-bottom: 6px; }
.login p { color: var(--muted); margin: 0 0 24px; }
.ms-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; font-size: 15px; width: 100%; }
.ms-btn:hover { background: var(--surface-2); text-decoration: none; }
.login details { margin-top: 20px; text-align: start; }
.login summary { cursor: pointer; color: var(--muted); font-size: 13px; text-align: center; }

/* Help */
.help h2 { margin: 26px 0 10px; padding-top: 6px; }
.help h3 { margin: 18px 0 6px; }
.help ol, .help ul { padding-inline-start: 22px; }
.help li { margin: 4px 0; }
.help .toc { display: flex; gap: 8px; flex-wrap: wrap; }

.skeleton { background: linear-gradient(90deg, var(--gray-bg), var(--surface-2), var(--gray-bg)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; min-height: 18px; }
@keyframes sk { to { background-position: -200% 0; } }
.spin { display: inline-block; width: 18px; height: 18px; border: 2.5px solid currentColor; border-left-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.loading-page { display: grid; place-items: center; padding: 60px; color: var(--muted); }
@media (max-width: 600px) {
  .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .cat-grid button { padding: 10px 4px; font-size: 12px; }
  .cat-grid button .e { font-size: 20px; }
  .trow { grid-template-columns: 1fr; }
  .trow .t-side { flex-direction: row; align-items: center; justify-content: flex-start; }
  .kv { grid-template-columns: 96px minmax(0,1fr); }
}
@media (max-width: 700px) {
  .grid-3:has(> .kpi) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .grid-3 > .kpi, .grid-4 > .kpi { padding: 12px; }
  .grid-3 > .kpi .k-value, .grid-4 > .kpi .k-value { font-size: 22px; }
  .grid-3 > .kpi .k-label { font-size: 12px; }
}

/* Language switch */
.lang-btn {
  height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.lang-btn:hover { background: var(--surface-2); }
.login-wrap { position: relative; }
.login-lang { position: absolute; top: 16px; inset-inline-end: 16px; }
.lang-btn .short { display: none; }
@media (max-width: 600px) {
  .topbar .lang-btn { padding: 0; width: 36px; }
  .topbar .lang-btn .full { display: none; }
  .topbar .lang-btn .short { display: inline; }
  .topbar { gap: 6px; padding: 0 12px; }
}
/* English reads better a touch tighter */
:root[lang="en"] body { line-height: 1.55; }

/* Devices, checklists, quotes */
.as-in_use { background: var(--info-bg); color: var(--info); }
.as-in_stock { background: var(--ok-bg); color: var(--ok); }
.as-repair { background: var(--warn-bg); color: var(--warn); }
.as-retired { background: var(--gray-bg); color: var(--muted); }
.k-onboarding { background: var(--ok-bg); color: var(--ok); }
.k-offboarding { background: var(--violet-bg); color: var(--violet); }
.dev { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface); }
.dev + .dev { margin-top: 8px; }
.dev:hover { text-decoration: none; border-color: var(--brand-2); }
.dev .di { font-size: 22px; width: 30px; text-align: center; }
.dev .dn { flex: 1; min-width: 0; }
.dev .dn b { display: block; }
.warn-text { color: var(--warn); font-weight: 600; }
.bad-text { color: var(--bad); font-weight: 600; }
.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tasks li:last-child { border-bottom: 0; }
.tasks li input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--ok); flex: none; }
.tasks li.done .tt { text-decoration: line-through; color: var(--muted); }
.tasks li .tt { flex: 1; }
.tasks li .tm { font-size: 11px; color: var(--muted); display: block; }
.progress { height: 8px; background: var(--gray-bg); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ok); }
.quote-row { display: grid; grid-template-columns: 1.4fr 1fr 1.4fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 600px) { .quote-row { grid-template-columns: 1fr 1fr; } }
.quote-pick { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; margin-bottom: 8px; }
.quote-pick:has(input:checked) { border-color: var(--ok); background: var(--ok-bg); }
.best { background: var(--ok); color: #fff; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.choice-grid a { display: block; padding: 18px; border: 1.5px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface); }
.choice-grid a:hover { border-color: var(--brand-2); text-decoration: none; }
.choice-grid a .e { font-size: 28px; }
@media (max-width: 600px) { .choice-grid { grid-template-columns: 1fr; } }
