:root {
[hidden] { display: none !important; }
  /* ArabApps brand (from logo): deep navy-indigo + gray */
  --navy: #2e3566; --navy-2: #272c54; --navy-3: #363d78;
  --brand: #3a4391; --brand-2: #2e3566; --gray: #a7a9ac;
  --bg: #f4f6fb; --card: #ffffff; --line: #e9edf5; --line-2: #f1f4f9;
  --text: #2b3350; --muted: #929cb4;
  --ok: #22c55e; --okb: #e8f8ef; --warn: #f5a623; --warnb: #fdf3e3;
  --bad: #ef5350; --badb: #fdecec;
  --r: 14px; --r-sm: 10px;
  --shadow: 0 1px 3px rgba(32,43,84,.06), 0 8px 24px rgba(32,43,84,.05);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  font-size: 14px; line-height: 1.5;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.error { color: var(--bad); min-height: 1.2em; margin: 8px 0 0; font-size: .9rem; }

button { font-family: inherit; cursor: pointer; border: 0; }
.btn-primary {
  background: var(--brand); color: #fff; border-radius: 10px; padding: 11px 18px;
  font-weight: 700; font-size: .95rem; transition: background .15s;
}
.btn-primary:hover { background: var(--brand-2); }
.btn-ghost { background: var(--line-2); color: var(--text); border-radius: 10px; padding: 9px 16px; font-weight: 600; }
.btn-ghost:hover { background: var(--line); }
.icon-btn { background: transparent; color: inherit; padding: 8px; border-radius: 9px; display: inline-flex; }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.icon-btn:hover { background: rgba(0,0,0,.06); }

input, select {
  width: 100%; padding: 11px 13px; border-radius: 10px; margin-top: 5px;
  background: #fff; border: 1.5px solid var(--line); color: var(--text); font: inherit;
  transition: border-color .15s;
}
input:focus, select:focus { outline: 0; border-color: var(--brand); }
label { display: block; margin-bottom: 14px; font-size: .85rem; color: var(--muted); font-weight: 600; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 70% -10%, #e9ebfa, var(--bg)); }
.login-card { width: 100%; max-width: 460px; background: var(--card); border-radius: 18px; padding: 38px 40px; box-shadow: var(--shadow); text-align: center; }
.login-logo { margin-bottom: 14px; }
.login-card h1 { margin: 0; font-size: 1.35rem; font-weight: 800; color: var(--navy); }
.login-card p { margin: 3px 0 22px; }
.login-card label { text-align: right; }
.login-card .btn-primary { width: 100%; margin-top: 6px; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--navy); color: #cdd3e6;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 14px; font-weight: 800; font-size: 1.15rem; color: #fff; }
.brand img { width: 34px; height: auto; border-radius: 7px; box-shadow: 0 0 0 1px rgba(255,255,255,.18); flex-shrink: 0; }
.side-nav { flex: 1; padding: 6px 12px; }
.nav-group { display: block; font-size: .72rem; font-weight: 700; color: #6f78a0; letter-spacing: .04em; padding: 16px 12px 6px; }
.side-nav button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: right;
  background: transparent; color: #c2c9e0; padding: 11px 12px; border-radius: 10px;
  font-size: .92rem; font-weight: 600; margin-bottom: 2px; transition: background .12s, color .12s;
}
.side-nav button svg { width: 19px; height: 19px; fill: currentColor; opacity: .85; flex-shrink: 0; }
.side-nav button:hover { background: var(--navy-3); color: #fff; }
.side-nav button.active { background: linear-gradient(90deg, var(--brand), var(--navy-3)); color: #fff; }
.side-nav button.active svg { opacity: 1; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.su-meta { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.su-meta strong { color: #fff; font-size: .9rem; }
.su-meta .muted { color: #8893b7; font-size: .78rem; }
.side-user .icon-btn { color: #9aa3c6; }
.side-user .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

.avatar { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .95rem; flex-shrink: 0; }

/* ---------- Content ---------- */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  padding: 13px 24px; }
.page-title { margin: 0; font-size: 1.2rem; font-weight: 800; color: var(--navy); }
.hamburger { display: none; }
.date-input { width: auto; margin: 0; font-weight: 600; }
main { padding: 22px 24px 40px; width: 100%; }
@media (min-width: 1600px) { main { padding: 26px 32px 48px; } .topbar { padding-inline: 32px; } }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; }
.card h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 700; }
/* Generic horizontal layout used across the dashboard (class="row", "row between"). */
.row { display: flex; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 0 0 14px; }
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: 1.4fr 1fr; }
.mb { margin-bottom: 16px; }

/* period stat cards */
.stat-card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; }
.stat-card .label { color: var(--muted); font-weight: 700; font-size: .85rem; }
.stat-card .big { font-size: 1.9rem; font-weight: 800; color: var(--navy); margin: 6px 0 2px; }
.stat-card .delta { font-size: .8rem; font-weight: 700; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.stat-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }

/* summary tiles (members/projects/online) */
.kpi { display: flex; align-items: center; gap: 14px; }
.kpi .kv { font-size: 1.6rem; font-weight: 800; color: var(--navy); }
.kpi .kl { color: var(--muted); font-weight: 600; font-size: .85rem; }
.kpi-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: #eef0fb; }
.kpi-ic svg { width: 24px; height: 24px; fill: var(--brand); }

/* member activity list */
.mlist { display: flex; flex-direction: column; }
.mrow { display: flex; align-items: center; gap: 13px; padding: 11px 4px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.mrow:last-child { border-bottom: 0; }
.mrow:hover { background: var(--line-2); border-radius: 10px; }
.mrow .nm { flex: 1; font-weight: 700; }
.mrow .tm { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--ok); } .dot.off { background: #cfd5e4; }

/* table */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 12px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 700; font-size: .82rem; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; } tr.clickable:hover { background: var(--line-2); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge.on { background: var(--okb); color: #1a9e55; }
.badge.off { background: #f0f2f7; color: var(--muted); }

/* bar (apps) */
.bar { height: 7px; background: var(--line); border-radius: 999px; overflow: hidden; flex: 1; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.applist { display: flex; flex-direction: column; gap: 13px; }
.approw { display: flex; align-items: center; gap: 12px; }
.approw .an { width: 130px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.approw .at { width: 54px; text-align: left; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; }
.ico { position: relative; width: 24px; height: 24px; flex-shrink: 0; border-radius: 7px; overflow: hidden; }
.ico b { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: .75rem; font-weight: 700; }
.ico img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 2px; background: var(--card); }

/* ring */
.ring { position: relative; display: inline-grid; place-items: center; }
.ring .rv { position: absolute; font-weight: 800; color: var(--navy); font-size: .95rem; }
.ring.lg .rv { font-size: 1.5rem; }

/* screenshots gallery */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.shot { background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.shot img { width: 100%; height: 125px; object-fit: cover; display: block; background: #eef1f7; cursor: pointer; }
.shot .cap { padding: 9px 11px; font-size: .78rem; }
.shot .cap b { display: block; color: var(--text); }
.shot .cap span { color: var(--muted); }

/* hourly chart */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 10px; }
.chart .b { flex: 1; background: var(--line); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; transition: background .12s; }
.chart .b:hover { background: var(--brand); }
.chart .b > span { position: absolute; bottom: -20px; right: 50%; transform: translateX(50%); font-size: .62rem; color: var(--muted); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(27,32,54,.55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: var(--card); border-radius: 16px; width: 440px; max-width: 100%; max-height: 88vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 1.1rem; font-weight: 800; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-start; padding: 16px 22px; border-top: 1px solid var(--line); }
.check-row { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-radius: 9px; }
.check-row:hover { background: var(--line-2); }
.check-row input { width: auto; margin: 0; }

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(10,14,28,.9); display: grid; place-items: center; padding: 24px; z-index: 60; }
.lightbox img { max-width: 94vw; max-height: 88vh; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lightbox .close { position: absolute; top: 18px; left: 18px; color: #fff; background: rgba(255,255,255,.12); }

/* ---------- Kanban board ---------- */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col { background: #eef1f7; border-radius: 12px; width: 290px; flex-shrink: 0; display: flex; flex-direction: column; max-height: calc(100vh - 190px); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 700; }
.col-head .cnt { background: #fff; color: var(--muted); border-radius: 999px; padding: 1px 9px; font-size: .78rem; }
.col-head .spacer { flex: 1; }
.col-head .link { font-size: .8rem; }
.col-body { padding: 4px 10px; overflow-y: auto; flex: 1; min-height: 20px; }
.col-body.drag-over { background: rgba(58,67,145,.07); border-radius: 8px; }
.col-foot { padding: 8px 12px; }
.col-foot button { background: transparent; color: var(--muted); font-weight: 600; width: 100%; text-align: right; padding: 7px; border-radius: 8px; }
.col-foot button:hover { background: #e4e8f1; color: var(--text); }

.tcard { background: #fff; border-radius: 10px; box-shadow: 0 1px 2px rgba(32,43,84,.08); padding: 11px 12px; margin-bottom: 9px; cursor: grab; border-right: 3px solid transparent; }
.tcard:hover { box-shadow: 0 3px 10px rgba(32,43,84,.13); }
.tcard.dragging { opacity: .45; }
.tcard .ttitle { font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.tcard .tmeta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .76rem; }
.tcard .tmeta .av { display: flex; align-items: center; margin-right: auto; }
.tcard .tmeta .av .avatar { margin-right: -7px; border: 2px solid #fff; }
.av-add { width: 24px; height: 24px; border-radius: 50%; border: 1.5px dashed var(--muted); background: #fff; color: var(--muted); font-size: 15px; line-height: 1; display: inline-grid; place-items: center; cursor: pointer; margin-right: -7px; padding: 0; position: relative; z-index: 1; }
.av-add:hover { border-color: var(--brand); color: var(--brand); border-style: solid; }

.popover { position: absolute; z-index: 65; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; width: 230px; max-height: 280px; overflow: auto; }
.pop-head { font-size: .75rem; color: var(--muted); font-weight: 700; padding: 6px 8px; }
.pop-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: .85rem; }
.pop-row:hover { background: var(--line-2); }
.pop-row input { width: auto; margin: 0; }
.prio { border-right-color: var(--muted); }
.prio-low { border-right-color: #8aa0c6; } .prio-medium { border-right-color: var(--brand); }
.prio-high { border-right-color: var(--warn); } .prio-urgent { border-right-color: var(--bad); }
.pchip { padding: 1px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.pchip.low { background: #eaf0f9; color: #5a7; } .pchip.medium { background: #eceefb; color: var(--brand); }
.pchip.high { background: var(--warnb); color: #b7791f; } .pchip.urgent { background: var(--badb); color: #c0392b; }

/* task detail drawer */
.drawer { position: fixed; inset: 0 0 0 auto; width: 560px; max-width: 94vw; background: var(--card); box-shadow: -10px 0 40px rgba(0,0,0,.2); z-index: 55; display: flex; flex-direction: column; animation: slidein .2s; }
@keyframes slidein { from { transform: translateX(-30px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer .field { margin-bottom: 16px; }
.drawer .field > label { display: block; font-size: .78rem; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
.att { display: flex; align-items: center; gap: 9px; padding: 9px 11px; background: var(--line-2); border-radius: 9px; margin-bottom: 7px; font-size: .86rem; }
.att .ic { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: #fff; flex-shrink: 0; }
.att a { color: var(--brand); text-decoration: none; font-weight: 600; }
.att .spacer { flex: 1; }
.att pre { margin: 0; }
pre.code { background: #1b2130; color: #e6edf3; border-radius: 9px; padding: 12px 14px; overflow-x: auto; font-size: .8rem; direction: ltr; text-align: left; font-family: ui-monospace, "SF Mono", Menlo, monospace; white-space: pre; }
.cmt { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.cmt .ch { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cmt .ch b { font-size: .85rem; } .cmt .ch span { color: var(--muted); font-size: .74rem; }
.seg { display: inline-flex; gap: 4px; background: var(--line-2); padding: 3px; border-radius: 9px; }
.seg button { background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 7px; font-size: .82rem; font-weight: 600; }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* task full page */
.task-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.task-meta .mrow2 { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line-2); font-size: .9rem; }
.task-meta .mrow2:last-child { border-bottom: 0; }
.task-meta .mrow2 .k { color: var(--muted); font-weight: 600; }
.task-desc { white-space: pre-wrap; line-height: 1.7; }
.assignee-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--line-2); border-radius: 999px; padding: 3px 10px 3px 4px; margin: 0 0 6px 6px; font-size: .85rem; }
.act-row { display: flex; gap: 10px; padding: 7px 0; }
.act-row .act-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 6px; flex-shrink: 0; position: relative; }
.act-row:not(:last-child) .act-dot::after { content: ''; position: absolute; top: 12px; right: 3px; width: 2px; height: calc(100% + 6px); background: var(--line); }
@media (max-width: 860px) { .task-grid { grid-template-columns: 1fr; } }

/* nicer modal form grid */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* tags + checklist */
.tagchip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; margin: 0 0 4px 4px; }
.tag-x { cursor: pointer; opacity: .6; }
.tag-x:hover { opacity: 1; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line-2); }
.check-item:last-child { border-bottom: 0; }
.check-item input { width: auto; margin: 0; }
.check-item.done .ck-text { text-decoration: line-through; color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.link { color: var(--brand); cursor: pointer; font-weight: 600; }

/* responsive */
@media (max-width: 980px) {
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { position: fixed; right: 0; transform: translateX(100%); transition: transform .2s; z-index: 40; box-shadow: -8px 0 30px rgba(0,0,0,.2); }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: inline-flex; }
  .cols-4 { grid-template-columns: 1fr; }
}

/* ---------- Chat ---------- */
.nav-badge { margin-inline-start: auto; background: var(--bad); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 800; padding: 1px 7px; min-width: 20px; text-align: center; }
main.main-chat { padding-bottom: 16px; }
.chat { display: grid; grid-template-columns: 330px 1fr; height: calc(100dvh - 104px); min-height: 440px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.chat-side { display: flex; flex-direction: column; border-inline-end: 1px solid var(--line); min-height: 0; }
.chat-side-head { display: flex; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); }
.chat-side-head input { margin: 0; padding: 9px 12px; }
.chat-new { white-space: nowrap; padding: 9px 14px; font-size: .88rem; }
.chat-notify { background: var(--warnb); color: var(--text); padding: 9px 14px; text-align: start; font-size: .82rem; font-weight: 600; }
.chat-convs { overflow-y: auto; flex: 1; padding: 6px 8px 12px; }
.chat-group { font-size: .72rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; padding: 12px 8px 6px; }
.chat-conv { display: flex; gap: 11px; align-items: center; width: 100%; padding: 10px 8px; border-radius: 12px; background: transparent; text-align: start; color: var(--text); }
.chat-conv:hover { background: var(--line-2); }
.chat-conv.active { background: #eceefa; }
.chat-room-av { font-weight: 800; }
.chat-conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.chat-conv-top, .chat-conv-bottom { display: flex; align-items: center; gap: 8px; }
.chat-conv-top b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
.chat-conv-time { font-size: .72rem; color: var(--muted); flex-shrink: 0; }
.chat-conv-prev { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .8rem; color: var(--muted); }
.chat-conv.unread .chat-conv-prev { color: var(--text); font-weight: 600; }
.chat-conv.unread .chat-conv-time { color: var(--brand); font-weight: 700; }
.chat-unread { background: var(--brand); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 800; padding: 1px 7px; min-width: 20px; text-align: center; flex-shrink: 0; }

.chat-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #f7f8fc; position: relative; }
.chat-panel.drag::after { content: 'افلت الملف هنا'; position: absolute; inset: 10px; border: 2px dashed var(--brand); border-radius: 14px; display: grid; place-items: center; background: rgba(58,67,145,.06); color: var(--brand); font-weight: 800; pointer-events: none; }
.chat-placeholder { margin: auto; text-align: center; color: var(--muted); padding: 30px; }
.chat-placeholder div { font-size: 2.4rem; }
.chat-head { display: flex; align-items: center; gap: 11px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.chat-head-meta { display: flex; flex-direction: column; min-width: 0; }
.chat-head-meta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-meta small { font-size: .78rem; }
.chat-back { display: none; }
.chat-board { padding: 7px 12px; font-size: .82rem; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px 18px 8px; display: flex; flex-direction: column; gap: 3px; }
.chat-more { text-align: center; color: var(--muted); font-size: .78rem; padding: 4px; }
.chat-day { text-align: center; margin: 12px 0 8px; }
.chat-day span { background: var(--line); color: var(--muted); font-size: .74rem; font-weight: 700; padding: 3px 12px; border-radius: 999px; }
.chat-msg { display: flex; align-items: flex-end; gap: 8px; max-width: min(78%, 640px); margin-top: 8px; position: relative; }
.chat-msg.grouped { margin-top: 0; }
.chat-msg.mine { align-self: flex-end; }
.chat-msg-av { width: 30px; flex-shrink: 0; }
.chat-bubble { background: var(--card); border-radius: 14px; padding: 8px 12px 6px; box-shadow: 0 1px 2px rgba(32,43,84,.08); min-width: 0; }
.chat-msg.mine .chat-bubble { background: #e3e6fa; }
.chat-name { font-size: .78rem; font-weight: 800; margin-bottom: 2px; }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: .93rem; }
.chat-text a { color: var(--brand); }
.chat-meta { font-size: .68rem; color: var(--muted); text-align: end; margin-top: 2px; }
.chat-deleted { color: var(--muted); font-style: italic; font-size: .88rem; }
.chat-img { display: block; max-width: min(320px, 100%); max-height: 300px; border-radius: 10px; cursor: zoom-in; margin: 2px 0 4px; background: var(--line-2); }
.chat-filecard { display: flex; gap: 10px; align-items: center; background: var(--line-2); border-radius: 10px; padding: 8px 12px; margin: 2px 0 4px; color: var(--text); text-decoration: none; min-width: 0; }
.chat-filecard span:last-child { display: flex; flex-direction: column; min-width: 0; }
.chat-filecard b { font-size: .85rem; overflow-wrap: anywhere; }
.chat-filecard small { color: var(--muted); font-size: .74rem; }
.chat-file-ic { font-size: 1.3rem; }
.chat-actions { display: none; gap: 2px; align-self: center; }
.chat-msg:hover .chat-actions { display: flex; }
.chat-actions button { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 2px 7px; font-size: .8rem; color: var(--muted); }
.chat-actions button:hover { color: var(--text); }
.chat-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; background: var(--card); border-top: 1px solid var(--line); }
.chat-input-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.chat-file-chip { background: var(--line-2); border-radius: 9px; padding: 6px 10px; font-size: .82rem; overflow-wrap: anywhere; }
#chat-input, .chat-edit { width: 100%; resize: none; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 13px; font: inherit; color: var(--text); background: #fff; max-height: 160px; line-height: 1.5; }
#chat-input:focus, .chat-edit:focus { outline: 0; border-color: var(--brand); }
.chat-attach { color: var(--muted); padding: 10px; }
.chat-attach svg { fill: currentColor; width: 22px; height: 22px; }
.chat-send { padding: 10px 14px; display: inline-flex; }
.chat-send svg { width: 20px; height: 20px; fill: #fff; transform: scaleX(-1); }
.chat-send:disabled { opacity: .6; }
.chat-people { display: flex; flex-direction: column; gap: 2px; max-height: 55vh; overflow-y: auto; }
.chat-person { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; background: transparent; text-align: start; color: var(--text); }
button.chat-person:hover { background: var(--line-2); }
.chat-person span { display: flex; flex-direction: column; min-width: 0; }
.chat-person small { font-size: .76rem; }

@media (max-width: 860px) {
  .chat { grid-template-columns: 1fr; height: calc(100dvh - 92px); }
  .chat .chat-panel { display: none; }
  .chat.has-active .chat-side { display: none; }
  .chat.has-active .chat-panel { display: flex; }
  .chat-back { display: inline-flex; }
  .chat-msg { max-width: 88%; }
  .chat-board { display: none; }
}

/* ---------- Profile photos ---------- */
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.side-me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: transparent; color: inherit; text-align: start; padding: 4px; margin: -4px; border-radius: 10px; }
.side-me:hover { background: rgba(255,255,255,.06); }
.side-me .su-meta strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-edit { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
#ph-preview .avatar { border-radius: 24px; }
.photo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; flex: 1; min-width: 180px; }
.side-me .su-meta { min-width: 0; }
button.link { background: none; padding: 0; }

/* ---------- Project logos ---------- */
.plogo { display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 9px; overflow: hidden; color: #fff; font-weight: 800; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.plogo img { width: 100%; height: 100%; object-fit: contain; }
.logo-pick { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.logo-pick .plogo { border-radius: 14px; }
.logo-pick-actions { display: flex; flex-direction: column; gap: 6px; }
button.chat-notify { background: var(--warnb); padding: 9px 14px; }

/* ---------- Monthly payroll sheets ---------- */
.table-wrap { overflow-x: auto; }
.ps-table { min-width: 980px; }
.ps-table td { vertical-align: top; padding-top: 12px; padding-bottom: 12px; }
.ps-table tfoot td { font-weight: 800; border-top: 2px solid var(--line); color: var(--navy); }
.ps-base { display: flex; align-items: center; gap: 6px; }
.ps-base-in { width: 120px; margin: 0; padding: 7px 10px; font-weight: 700; }
.ps-refresh { font-size: 1rem; color: var(--muted); }
.ps-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; max-width: 280px; }
.ps-chip { border-radius: 8px; padding: 4px 9px; font-size: .78rem; text-align: start; line-height: 1.4; }
.ps-chip.addition { background: var(--okb); color: #15803d; }
.ps-chip.deduction { background: var(--badb); color: #b91c1c; }
.ps-chip:hover { filter: brightness(.96); }
.ps-add { font-size: .8rem; }
.ps-notes, .ps-sheet-note { width: 100%; min-width: 160px; resize: vertical; border: 1.5px solid var(--line); border-radius: 9px; padding: 7px 10px; font: inherit; font-size: .84rem; color: var(--text); background: #fff; }
.ps-notes:focus, .ps-sheet-note:focus { outline: 0; border-color: var(--brand); }
.ps-sheet-note { margin: 0 0 12px; }
.ps-net { font-weight: 800; color: var(--navy); white-space: nowrap; }
.ps-net.neg { color: var(--bad); }
.ps-total { background: var(--navy); color: #fff; }
.ps-total .label { color: #c9cfe8; }
.ps-total .big { color: #fff; }
.ps-table td:first-child { min-width: 210px; }
.ps-table td:first-child .row { flex-wrap: nowrap; }
.ps-pending { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: var(--warnb); border-radius: var(--r); padding: 12px 16px; margin-bottom: 16px; font-size: .88rem; font-weight: 600; }
.ps-pending .btn-primary { padding: 8px 18px; }

/* ---------- Desktop app release upload ---------- */
.rel-current { background: var(--line-2); border-radius: 10px; padding: 10px 14px; font-size: .88rem; margin-bottom: 12px; overflow-wrap: anywhere; }
.rel-drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 10px; font-size: .86rem; }
.rel-drop.drag { border-color: var(--brand); background: rgba(58,67,145,.05); }
.rel-drop code { background: var(--line-2); padding: 1px 6px; border-radius: 5px; font-size: .8rem; direction: ltr; display: inline-block; }
.rel-list { display: flex; flex-direction: column; gap: 6px; }
.rel-item { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: .84rem; }
.rel-item > span:first-child { width: 14px; color: var(--muted); }
.rel-item.ok > span:first-child { color: var(--ok); font-weight: 800; }
.rel-progress { position: relative; height: 26px; background: var(--line-2); border-radius: 8px; overflow: hidden; }
.rel-progress i { position: absolute; inset: 0 0 0 auto; width: 0; background: var(--okb); transition: width .2s; }
.rel-progress span { position: relative; display: block; padding: 4px 10px; font-size: .8rem; font-weight: 600; }

/* ---------- Screenshot admin tools ---------- */
.shot { position: relative; }
.shot-tools { position: absolute; top: 8px; inset-inline: 8px; display: flex; justify-content: space-between; pointer-events: none; }
.shot-tools > * { pointer-events: auto; }
.shot-pick { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,.92); box-shadow: 0 1px 4px rgba(0,0,0,.2); cursor: pointer; margin: 0; }
.shot-pick input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.shot-del { margin-inline-start: auto; width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,.92); box-shadow: 0 1px 4px rgba(0,0,0,.2); display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.shot-del svg { width: 16px; height: 16px; fill: var(--bad); }
.shot:hover .shot-del, .shot-del:focus-visible { opacity: 1; }
.shot.picked { outline: 3px solid var(--brand); outline-offset: -3px; }
.shot-bulk { display: inline-flex; align-items: center; gap: 8px; }
.btn-danger { background: var(--bad); color: #fff; border-radius: 10px; padding: 9px 16px; font-weight: 700; }
.btn-danger:hover { filter: brightness(.93); }
@media (hover: none) { .shot-del { opacity: 1; } }

/* ---------- Screenshot activity colour ---------- */
.shot { border-top: 4px solid transparent; }
.shot.act-good { border-top-color: var(--ok); }
.shot.act-mid { border-top-color: var(--warn); }
.shot.act-low { border-top-color: var(--bad); }
.shot-act { position: absolute; top: 92px; inset-inline-start: 8px; font-size: .74rem; font-weight: 800; color: #fff; padding: 2px 9px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.25); pointer-events: none; }
.shot-act.good { background: var(--ok); }
.shot-act.mid { background: var(--warn); }
.shot-act.low { background: var(--bad); }

/* ---------- Screenshot viewer ---------- */
.sv-bg { position: fixed; inset: 0; z-index: 80; background: rgba(15,18,38,.78); display: grid; place-items: center; padding: 20px; }
.sv { width: min(1280px, 100%); height: min(820px, 100%); display: grid; grid-template-columns: 1fr 380px; background: var(--card); border-radius: 16px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.sv-img { position: relative; background: #0f1226; display: grid; place-items: center; min-width: 0; min-height: 0; }
.sv-img img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.sv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.9); color: var(--navy); font-size: 1.6rem; line-height: 1; display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.sv-nav.prev { right: 14px; } .sv-nav.next { left: 14px; }
.sv-nav:disabled { opacity: .25; cursor: default; }
.sv-side { overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.sv-head { display: flex; align-items: center; gap: 10px; }
.sv-head .muted { font-size: .8rem; }
.sv-window { background: var(--line-2); border-radius: 10px; padding: 8px 12px; font-size: .84rem; }
.sv-act { display: flex; gap: 10px; }
.sv-act > div { flex: 1; border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; font-size: .76rem; font-weight: 700; background: var(--line-2); color: var(--muted); }
.sv-act.good > div:first-child { background: var(--okb); color: #15803d; }
.sv-act.mid > div:first-child { background: var(--warnb); color: #a16207; }
.sv-act.low > div:first-child { background: var(--badb); color: #b91c1c; }
.sv-big { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.sv-sec { display: grid; gap: 8px; }
.sv-sec h4 { margin: 0; font-size: .82rem; color: var(--muted); }
.sv-tl { display: flex; align-items: flex-end; gap: 2px; height: 54px; background: var(--line-2); border-radius: 8px; padding: 4px; direction: ltr; }
.sv-tl i { flex: 1; min-width: 2px; border-radius: 2px; }
.sv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sv-grid > div { background: var(--line-2); border-radius: 10px; padding: 8px 10px; display: grid; font-size: .74rem; }
.sv-grid b { font-size: 1rem; }
.sv-prod { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--line-2); }
.sv-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .74rem; color: var(--muted); }
.sv-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-inline-end: 5px; }
.sv-app { display: flex; gap: 10px; align-items: flex-start; }
.sv-app-main { flex: 1; min-width: 0; display: grid; gap: 3px; font-size: .84rem; }
.sv-app-main b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-cat { font-size: .68rem; font-weight: 700; padding: 0 7px; border-radius: 999px; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--text); flex-shrink: 0; }
.sv-titles, .sv-url { font-size: .74rem; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-foot { margin-top: auto; padding-top: 6px; border-top: 1px solid var(--line); }
@media (max-width: 860px) {
  .sv-bg { padding: 0; }
  .sv { height: 100%; border-radius: 0; grid-template-columns: 1fr; grid-template-rows: 42vh 1fr; }
}
.shot-bulk[hidden] { display: none; }
