:root {
  --bg: #131a24;
  --surface: #1a222e;
  --surface-2: #212b38;
  --surface-3: #2a3543;
  --ink: #f5f8fc;
  --ink-soft: #c4cfdd;
  --muted: #8b98a9;
  --line: rgba(148, 163, 184, .18);
  --line-strong: rgba(148, 163, 184, .30);
  --nav: #161f2b;
  --nav-2: #1b2533;
  --primary: #f4a62a;
  --primary-2: #ffc15a;
  --icon-menu: #ffd48c;
  --icon-action: #ffc15a;
  --icon-tile: #16202c;
  --teal: #2dd4bf;
  --green: #4ade80;
  --amber: #ffc15a;
  --red: #fb7185;
  --violet: #a78bfa;
  --wood: #233044;
  --shadow: 0 26px 70px -42px rgba(10, 16, 28, .72);
  --shadow-soft: 0 18px 40px -34px rgba(10, 16, 28, .58);
  --radius: 8px;
  --radius-sm: 6px;
  --control: 42px;
}

* { box-sizing: border-box; }
html, body, #app {
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  background: linear-gradient(180deg, #131a24 0%, #182230 100%);
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", system-ui, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.65;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { border: 0; }
a { color: var(--primary); text-decoration: none; }
[v-cloak] { display: none; }

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  gap: 12px;
  color: var(--muted);
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(244,166,42,.08), transparent 42%),
    linear-gradient(180deg, #131a24, #1b2533);
}
.boot-card {
  width: min(320px, 100%);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18,24,33,.86);
  box-shadow: var(--shadow-soft);
}
.loader {
  width: 36px;
  height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, .82fr) minmax(0, 1.18fr);
  background: var(--bg);
}
.auth-form {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 4vw, 56px);
  background: var(--surface);
  border-inline-start: 1px solid var(--line);
}
.auth-visual {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(28px, 4vw, 56px);
  color: #f8fafc;
  background:
    linear-gradient(135deg, rgba(13,17,23,.91), rgba(15,23,42,.95)),
    url("https://media.zid.store/7575353c-f146-4fc5-9dda-ed2df2b625cc/7709e17d-c9b5-4b2a-84be-5efeff084dee-200x.png");
  background-size: cover, min(460px, 58vw) auto;
  background-position: center, center;
  background-repeat: no-repeat;
}
.auth-visual .visual-panel {
  max-width: 620px;
  align-self: flex-start;
  background: rgba(15,23,42,.72);
  border: 1px solid rgba(226,232,240,.16);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(16px);
}
.auth-visual h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.3;
}
.auth-visual p { margin: 0; color: rgba(248,250,252,.76); }
.auth-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.auth-metric {
  border: 1px solid rgba(226,232,240,.16);
  background: rgba(15,23,42,.62);
  border-radius: var(--radius);
  padding: 14px;
  backdrop-filter: blur(12px);
}
.auth-metric b { display: block; font-size: 20px; }
.auth-metric span { color: rgba(248,250,252,.72); font-size: 12px; }
.auth-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: #27100a;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  font-weight: 800;
  flex: 0 0 auto;
}
.brand-text { min-width: 0; }
.brand-text b { display: block; font-size: 15px; line-height: 1.2; }
.brand-text span { color: var(--muted); font-size: 12px; }
.logos {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.logos img {
  max-width: 96px;
  max-height: 30px;
  object-fit: contain;
  filter: grayscale(.1);
}
.logos .sep {
  width: 1px;
  height: 24px;
  background: var(--line);
}

.h1 {
  margin: 18px 0 6px;
  font-size: 25px;
  line-height: 1.25;
  letter-spacing: 0;
}
.lead { margin: 0 0 22px; color: var(--muted); }
.muted { color: var(--muted); }
.dim { color: var(--ink-soft); }
.small { font-size: 12px; }
.strong { font-weight: 800; }
.nowrap { white-space: nowrap; }

.form-stack { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}
input, select, textarea {
  width: 100%;
  min-height: var(--control);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
select {
  appearance: none;
  -webkit-appearance: none;
  direction: rtl;
  padding-inline-start: 12px;
  padding-inline-end: 42px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5' stroke='%23ffb238' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: 14px center; /* RTL: caret sits at the inline-end (left) edge, inside the box */
  background-size: 16px 16px;
  background-repeat: no-repeat;
}
select::-ms-expand { display: none; }
select[multiple] {
  padding: 10px 12px;
  background-image: none;
}
input[type="date"] {
  color-scheme: dark;
  direction: ltr;
  text-align: right;
  padding-inline-start: 42px;
}
input[type="date"]::-webkit-datetime-edit {
  color: var(--ink);
}
input[type="date"]::-webkit-datetime-edit-fields-wrapper {
  direction: ltr;
}
input[type="date"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field {
  color: var(--ink);
}
input[type="date"]::-webkit-calendar-picker-indicator {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  opacity: 1;
  filter: invert(72%) sepia(80%) saturate(930%) hue-rotate(348deg) brightness(103%) contrast(92%);
}
textarea {
  min-height: 94px;
  padding: 10px 12px;
  resize: vertical;
}
input[type="file"] { padding: 9px 12px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245,158,27,.14);
}
input::placeholder, textarea::placeholder { color: #9ba5b4; }
.checkline {
  min-height: var(--control);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-weight: 700;
}
.checkline input { width: 17px; min-height: 17px; }

.country-picker { position: relative; }
.country-trigger {
  width: 100%;
  min-height: var(--control);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}
.country-trigger .caret { margin-inline-start: auto; color: var(--ink-soft); }
.country-trigger .fi { width: 22px; height: 16px; border-radius: 2px; }
.country-scrim { position: fixed; inset: 0; z-index: 40; background: transparent; border: 0; }
.country-menu {
  position: absolute;
  z-index: 50;
  inset-inline: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 18px 40px rgba(10,15,25,.45);
  padding: 8px;
}
.country-search {
  width: 100%;
  margin-bottom: 8px;
}
.country-options { max-height: 240px; overflow: auto; scrollbar-width: thin; display: grid; gap: 4px; }
.country-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit;
  text-align: start;
}
.country-option:hover { color: var(--ink); border-color: var(--line); }
.country-option .fi { width: 22px; height: 16px; border-radius: 2px; flex: none; }
.country-option.active {
  color: var(--ink);
  border-color: var(--primary);
  background: rgba(244,166,42,.12);
}

.gender-row { display: flex; gap: 8px; }
.gender-opt {
  flex: 1;
  min-height: var(--control);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-soft);
  cursor: pointer;
  font-weight: 700;
}
.gender-opt input { width: 15px; min-height: 15px; }
.gender-opt.active {
  color: var(--ink);
  border-color: var(--primary);
  background: rgba(244,166,42,.12);
}

.tag.brand-argatall { background: rgba(245,158,27,.16); color: #f5a91b; border-color: rgba(245,158,27,.32); }
.tag.brand-woodland { background: rgba(34,197,94,.16); color: #34d399; border-color: rgba(34,197,94,.32); }
.tag.brand-unknown  { background: rgba(148,163,184,.18); color: #cbd5e1; border-color: rgba(148,163,184,.32); }
.portfolio-links { display: grid; gap: 6px; margin-top: 6px; }
.portfolio-links a { color: var(--primary); word-break: break-all; }
.code-badge {
  display: inline-block;
  font: 600 11px/1.4 monospace;
  letter-spacing: .5px;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(245,158,27,.14);
  color: #f5a91b;
}

/* dashboard brand filter */
.brand-filter {
  min-height: var(--control);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
}

/* back button + title row */
.page-title { display: flex; align-items: center; gap: 10px; }
.back-btn { flex: none; }

/* clickable employee chip + attendance cell in tables */
.user-chip-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: start;
  color: inherit;
  font: inherit;
}
.user-chip-btn:hover b { color: var(--primary); }
.att-cell { display: inline-flex; flex-direction: column; line-height: 1.3; }
.att-cell b { font-size: 13px; }
.att-cell span { font-size: 11px; color: var(--muted); }

/* clickable mini-cards (dashboard task drill-down) */
.mini-card.clickable { cursor: pointer; transition: border-color .15s, transform .15s; }
.mini-card.clickable:hover { border-color: var(--primary); transform: translateY(-1px); }

/* employee profile modal */
.profile-modal { max-width: 760px; }
.profile-id { display: flex; align-items: center; gap: 10px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.profile-docs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.profile-section { margin-top: 14px; }
.profile-section > b { display: block; margin-bottom: 6px; }

/* task accesses box (read-only view for employees) */
.access-box {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 0;
  font: inherit;
  color: var(--ink);
}

/* clickable stat card (button) */
button.stat-card { font: inherit; text-align: start; width: 100%; cursor: pointer; }
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { border-color: var(--primary); }

/* dashboard filter row: date + brand on the same line */
.dash-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.dash-filters .time-range { flex: 1 1 320px; }
.brand-logo-filter { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.brand-logo-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; min-height: var(--control);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink-soft); cursor: pointer; font: inherit;
}
.brand-logo-btn.active { border-color: var(--primary); color: var(--ink); background: rgba(244,166,42,.12); }
.brand-check { display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--line-strong); border-radius: 4px; flex: none; }
.brand-logo-btn.active .brand-check { background: var(--primary); border-color: var(--primary); color: #1b1206; }
.brand-check .svg-icon { width: 12px; height: 12px; }
.danger-zone { border-color: rgba(251,113,133,.42); }
.danger-zone .panel-title { color: var(--red); }
.brand-edit { display: flex; align-items: center; gap: 8px; }

/* brand logos */
.brand-logo-xs { width: 15px; height: 15px; object-fit: contain; border-radius: 3px; background: #fff; padding: 1px; vertical-align: middle; margin-inline-end: 4px; }
.brand-logo-sm { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; background: #fff; padding: 1px; flex: none; }

/* space between employee name and the metric numbers */
.activity-table td, .activity-table th { padding: 10px 12px; }
.activity-table .emp-cell { padding-inline-end: 26px; }

/* employee activity cards (replaces the scrolling table) */
.emp-cards { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 25px; }
.emp-card { flex: 1 1 360px; max-width: 100%; display: flex; flex-direction: column; gap: 14px; padding: 18px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: linear-gradient(180deg, var(--surface-2), var(--surface)); box-shadow: var(--shadow-soft); }
.emp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.emp-card-head .person-link { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; color: var(--ink); cursor: pointer; font: inherit; font-weight: 800; font-size: 16px; min-width: 0; }
.emp-card-head .person-link .avatar { width: 42px; height: 42px; flex: none; }
.emp-card-head .person-link span { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emp-kpi-chip { flex: none; padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; color: #16202c; }
.emp-kpi-chip.good { background: var(--green); }
.emp-kpi-chip.mid { background: var(--amber); }
.emp-kpi-chip.low { background: var(--red); color: #fff; }
.emp-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.emp-metric { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 66px; padding: 10px 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-3); color: var(--ink); cursor: pointer; font: inherit; text-align: center; transition: border-color .12s, transform .12s; }
button.emp-metric:hover { border-color: var(--primary); transform: translateY(-1px); }
.emp-metric b { font-size: 20px; line-height: 1; color: #f8fafc; }
.emp-metric span { font-size: 11px; font-weight: 700; color: var(--muted); }
.emp-metric.good b { color: var(--green); }
.emp-metric.mid b { color: var(--amber); }
.emp-metric.low b { color: var(--red); }
.emp-metric.score b { font-size: 17px; }
.emp-kpi-bar { height: 26px; min-width: 0; }
@media (max-width: 760px) {
  .emp-card { flex: 1 1 100%; }
}
@media (max-width: 380px) {
  .emp-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* large employee profile modal */
.profile-modal-lg { max-width: 940px; width: 96%; }

/* fix cramped stat cards: let them wrap into a neat grid with breathing room */
.kpi-strip { flex-wrap: wrap; overflow-x: visible; gap: 10px; }
.kpi-strip > .stat-card { flex: 1 1 140px; min-width: 132px; }

/* active preset highlight in the date filter */
.time-range-actions .btn.sm.active { border-color: var(--primary); background: rgba(244,166,42,.16); color: var(--ink); }

/* single-box tag/mention picker */
.tag-input-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; min-height: var(--control); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.tag-input-box input { border: 0; background: transparent; flex: 1; min-width: 120px; min-height: 28px; padding: 2px 4px; color: var(--ink); }
.tag-input-box input:focus { outline: none; box-shadow: none; }

/* checklist inside task blocks (Trello-style) with progress */
.checklist-edit, .checklist-view { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.checklist-item { display: flex; align-items: center; gap: 8px; }
.checklist-item input[type=checkbox] { width: 16px; min-height: 16px; flex: none; cursor: pointer; }
.checklist-item.done > span { text-decoration: line-through; opacity: .55; }
.checklist-text { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; color: var(--ink); }
.checklist-progress { display: flex; align-items: center; gap: 8px; }
.checklist-bar { flex: 1; height: 6px; background: var(--surface); border-radius: 99px; overflow: hidden; }
.checklist-bar-fill { height: 100%; background: #34d399; border-radius: 99px; transition: width .2s; }
.checklist-progress > span { font-size: 12px; font-weight: 700; color: var(--muted); }

/* departments list */
.dept-row { display: flex; align-items: center; justify-content: space-between; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.dept-name { display: flex; align-items: center; gap: 8px; }
.dept-count { color: var(--primary); font-weight: 700; }

/* stronger separation for the stat cards */
.kpi-strip { gap: 14px; }
.kpi-strip > .stat-card { flex: 1 1 150px; min-width: 146px; }

/* auto-linked emails / urls */
.auto-link { color: var(--primary); text-decoration: underline; word-break: break-all; }
.linkable { white-space: pre-wrap; word-break: break-word; }

/* modern time picker */
.time-select { display: inline-flex; align-items: center; gap: 4px; }
.time-select select {
  min-width: 56px; min-height: var(--control);
  padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); font: inherit; cursor: pointer; text-align: center;
}
.time-select .time-ap { min-width: 48px; }
.time-sep { font-weight: 800; color: var(--muted); }

/* task modal property icons in the brand/orange tone */
.task-modal .prop-key .svg-icon { color: var(--primary); }

/* task attachments */
.attachments { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.attachment { position: relative; display: inline-flex; align-items: center; }
.att-thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.att-video { max-width: 220px; border-radius: 8px; border: 1px solid var(--line); }
.attachment audio { height: 36px; }
.att-del { position: absolute; top: -8px; inset-inline-start: -8px; background: var(--surface); border: 1px solid var(--line); border-radius: 50%; z-index: 2; }
.attachments { gap: 16px; align-items: flex-start; }
.attachment { padding: 4px; }
.att-thumb { width: 110px; height: 110px; }
.att-file { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* image lightbox (zoom + download) */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(10,15,25,.88); display: flex; flex-direction: column; }
.lightbox-bar { display: flex; align-items: center; gap: 10px; padding: 12px; justify-content: center; flex-wrap: wrap; }
.lightbox-bar .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); color: #fff; }
.lightbox-zoom { color: #fff; font-weight: 700; min-width: 52px; text-align: center; }
.lightbox-canvas { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 16px; }
.lightbox-img { max-width: 92vw; max-height: 80vh; transform-origin: center; transition: transform .15s ease; border-radius: 8px; background: #fff; }

/* extra-firm separation for stat cards */
.kpi-strip { gap: 18px !important; }
.kpi-strip > .stat-card { flex: 1 1 160px !important; min-width: 156px !important; padding: 14px 16px !important; }

/* loading overlay shown while a filter applies */
.view-loading { position: fixed; inset: 0; z-index: 60; background: rgba(16,22,34,.55); backdrop-filter: blur(2px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--ink); }
.view-loading span { font-weight: 700; }

/* clear gap between the employee name and the metric numbers */
.activity-table .emp-cell { padding-inline-end: 48px !important; min-width: 170px; }
.activity-table tbody td { border-bottom: 1px solid rgba(255,255,255,.04); }

/* bonus / penalty colors in the score history */
.log-who.pos { color: #34d399; font-weight: 800; }
.log-who.neg { color: #ef4444; font-weight: 800; }

/* lightbox above everything + drag/zoom cursor */
.lightbox { z-index: 1000 !important; }
.lightbox-img { cursor: grab; user-select: none; }
.lightbox-img.grabbing { cursor: grabbing; }

/* attachment icon containment + z-index fix (no stray floating icons) */
.attachment { position: relative !important; overflow: visible; }
.att-del { top: 2px !important; inset-inline-end: 2px !important; inset-inline-start: auto !important; z-index: 4 !important; }
.attachment audio { min-width: 230px; }
.attachment video { max-width: 240px; }

/* task label badge colors (Trello-style) */
.tag.color-default { background: rgba(148,163,184,.18); color: #cbd5e1; border-color: rgba(148,163,184,.3); }
.tag.color-amber { background: rgba(245,158,27,.18); color: #f5a91b; border-color: rgba(245,158,27,.3); }
.tag.color-green { background: rgba(34,197,94,.18); color: #34d399; border-color: rgba(34,197,94,.3); }
.tag.color-violet { background: rgba(139,92,246,.18); color: #a78bfa; border-color: rgba(139,92,246,.3); }
.tag.color-red { background: rgba(239,68,68,.18); color: #f87171; border-color: rgba(239,68,68,.3); }
.tag.color-teal { background: rgba(20,184,166,.18); color: #2dd4bf; border-color: rgba(20,184,166,.3); }
.tag.color-blue { background: rgba(59,130,246,.18); color: #60a5fa; border-color: rgba(59,130,246,.3); }
.label-text { flex: 1; min-width: 180px; }

/* activity log: keep text clear of the scrollbar + show date/time clearly */
.activity-log { padding-inline-end: 10px; }
.activity-log .log-row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.activity-log .log-at { margin-inline-start: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }

/* attachment cards: media + date/time stamp under each file */
.attachment { display: flex !important; flex-direction: column; align-items: stretch; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); position: relative; }
.att-thumb { width: 130px; height: 110px; }
.attachment audio { width: 240px; }
.att-date { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); }
.att-date .svg-icon { width: 12px; height: 12px; }

/* kanban column editor */
.stage-editor { display: flex; flex-direction: column; gap: 6px; }
.stage-row { display: flex; align-items: center; gap: 8px; }
.stage-row input { flex: 1; }

/* attachment header (type + delete) — keeps delete off the play button */
.att-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.att-type { font-size: 10px; font-weight: 700; color: var(--primary); background: rgba(245,158,27,.12); padding: 1px 6px; border-radius: 4px; }

/* Facebook-style profile header */
.profile-cover { background: linear-gradient(120deg, rgba(245,158,27,.22), rgba(139,92,246,.18)); border-radius: 14px 14px 0 0; padding: 20px 16px; }
.profile-cover .avatar { width: 64px; height: 64px; font-size: 24px; border: 3px solid var(--surface); }
.profile-cover .panel-title { font-size: 20px; }

/* clickable people chips in the departments modal */
.dept-people { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dept-people .person-link { background: var(--surface-2); border: 1px solid var(--line); padding: 5px 10px; border-radius: 20px; }
.dept-people .person-link:hover { border-color: var(--primary); }

/* mention suggestions popover for any text field */
/* @-mention suggestions anchored to the field being typed in */
.mention-anchored { position: fixed; z-index: 1200; min-width: 200px; max-width: 320px; max-height: 230px; overflow: auto; display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--primary); border-radius: 10px; padding: 6px; box-shadow: 0 16px 40px rgba(10,15,25,.5); }
.mention-anchored-head { font-size: 11px; font-weight: 800; color: var(--muted); padding: 4px 8px 2px; }
.mention-anchored button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: start; background: transparent; border: 0; color: var(--ink); border-radius: 7px; padding: 7px 8px; cursor: pointer; font: inherit; }
.mention-anchored button:hover { background: var(--surface-2); }
.mention-anchored .avatar.sm { width: 24px; height: 24px; font-size: 11px; }

/* right-click card menu */
.card-menu { position: fixed; z-index: 1100; min-width: 170px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 40px rgba(10,15,25,.5); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.card-menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: start; background: transparent; border: 0; color: var(--ink); padding: 8px 10px; border-radius: 7px; cursor: pointer; font: inherit; }
.card-menu button:hover { background: var(--surface-2); }
.card-menu button.danger { color: #ef4444; }
.card-menu-scrim { position: fixed; inset: 0; z-index: 1099; background: transparent; border: 0; }

.time-range {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) auto;
  align-items: end;
  gap: 10px;
}
.time-range.compact {
  grid-template-columns: repeat(2, minmax(130px, 1fr)) auto;
}
.time-range-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tag-picker {
  position: relative;
  display: grid;
  gap: 7px;
}
.tag-picker-selected {
  min-height: 36px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.person-tag {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 7px;
  border: 1px solid rgba(245,158,27,.34);
  border-radius: 999px;
  background: rgba(245,158,27,.1);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}
.person-tag .avatar {
  width: 22px;
  height: 22px;
  font-size: 11px;
}
.person-tag button {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.person-tag button:hover { color: var(--red); }
.person-tag .svg-icon { width: 12px; height: 12px; }
.tag-picker-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 40;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: var(--shadow-soft);
}
.tag-picker-menu button {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: right;
}
.tag-picker-menu button:hover { background: var(--surface-3); }
.tag-picker-menu .avatar {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.btn {
  min-height: var(--control);
  min-width: 112px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  padding: 0 15px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: none; border-color: rgba(245,158,27,.5); background: var(--surface-3); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn i { width: 16px; text-align: center; }
.btn.primary { color: #27100a; background: var(--primary); border-color: var(--primary); }
.btn.primary:hover { color: #27100a; background: var(--primary-2); border-color: var(--primary-2); }
.btn.teal { color: #27100a; background: var(--teal); border-color: var(--teal); }
.btn.green { color: #0c2a18; background: var(--green); border-color: var(--green); }
.btn.green:hover { background: #6ee79a; border-color: #6ee79a; }
.btn.green .svg-icon { color: #0c2a18; }
.btn.red { color: #fff; background: var(--red); border-color: var(--red); }
.btn.red:hover { background: #ff8a96; border-color: #ff8a96; }
.btn.red .svg-icon { color: #fff; }
.btn.ghost { background: transparent; color: var(--primary); border-color: transparent; }
.btn.ghost:hover { background: rgba(245,158,27,.1); border-color: rgba(245,158,27,.24); box-shadow: none; }
.btn.danger { color: var(--red); border-color: rgba(255,107,99,.45); background: transparent; }
.btn.danger:hover { background: rgba(255,107,99,.09); }
.btn.ok { color: var(--green); border-color: rgba(85,201,143,.45); background: transparent; }
.btn.block { width: 100%; min-width: 0; }
.btn .svg-icon,
.top-actions .svg-icon {
  color: var(--icon-action);
  opacity: 1;
}
.top-actions .btn:not(.logout-btn) {
  color: var(--icon-action);
  border-color: rgba(255,178,56,.24);
  background: rgba(255,178,56,.035);
}
.top-actions .btn:not(.logout-btn):hover {
  border-color: rgba(255,178,56,.48);
  background: rgba(255,178,56,.09);
}
.top-actions .btn:not(.logout-btn) span:not(.svg-icon) {
  color: var(--ink);
}
.top-actions .logout-btn {
  color: #ef4444;
  border-color: rgba(239,68,68,.45);
  background: rgba(239,68,68,.08);
}
.top-actions .logout-btn:hover {
  border-color: rgba(239,68,68,.7);
  background: rgba(239,68,68,.16);
}
.top-actions .logout-btn .svg-icon { color: #ef4444; }
.top-actions .logout-btn span:not(.svg-icon) {
  color: #ef4444;
}
.btn.primary .svg-icon {
  color: var(--icon-tile);
}
.btn.sm {
  min-height: 34px;
  min-width: 0;
  padding: 0 11px;
  font-size: 12px;
}
.icon-btn {
  width: var(--control);
  min-width: var(--control);
  padding: 0;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.spread {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.grid2, .grid3, .grid4 {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.alert {
  border-radius: var(--radius);
  padding: 11px 13px;
  border: 1px solid;
  font-weight: 700;
}
.alert.error { color: #ffc8c4; background: rgba(255,107,99,.12); border-color: rgba(255,107,99,.38); }
.alert.ok { color: #b9ead4; background: rgba(85,201,143,.12); border-color: rgba(85,201,143,.35); }
.empty {
  padding: 26px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-2);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  direction: ltr;
}
.sidebar {
  grid-column: 2;
  grid-row: 1;
  direction: rtl;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: linear-gradient(180deg, var(--nav), #1a2434);
  color: #e8edf5;
  padding: 18px 14px;
  border-inline-start: 1px solid var(--line);
  box-shadow: -18px 0 48px -44px rgba(10,15,25,.9);
}
.side-head {
  display: grid;
  gap: 16px;
  padding: 4px 6px 16px;
  border-bottom: 1px solid var(--line);
}
.side-head .brand-text span { color: #9da9ba; }
.side-head .logos img { filter: brightness(0) invert(1); opacity: .9; }
.mobile-menu-bar {
  display: none;
}
.mobile-menu-scrim {
  display: none;
}
.side-nav {
  display: grid;
  gap: 14px;
  padding: 14px 0;
}
.nav-group {
  display: grid;
  gap: 5px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.nav-group:first-child {
  padding-top: 0;
  border-top: 0;
}
.nav-group-label {
  display: grid;
  gap: 3px;
  padding: 0 12px 5px;
}
.nav-group-label b {
  color: var(--primary-2);
  font-size: 12px;
  line-height: 1.2;
}
.nav-group-label span {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.45;
}
.nav-btn {
  position: relative;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding: 0 44px 0 12px;
  color: var(--ink-soft);
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: right;
  font-weight: 800;
  direction: rtl;
}
.nav-btn > .svg-icon {
  position: absolute;
  right: 14px;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
}
.nav-btn > span:not(.svg-icon) {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-btn i { width: 18px; color: var(--muted); }
.nav-btn { color: #f1f5fb; }
.nav-btn:hover .svg-icon { color: var(--primary-2); }
.nav-btn:hover { background: rgba(245,158,27,.12); color: var(--primary-2); outline: none; }
.nav-btn.active {
  color: var(--ink);
  background: linear-gradient(90deg, rgba(244,166,42,.14), rgba(244,166,42,.04));
  box-shadow: inset -3px 0 0 var(--primary);
  /* accent edge (right side in RTL) stays square — only inner corners round */
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.nav-btn.active .svg-icon { color: var(--primary); }
.side-footer {
  margin-top: 14px;
  padding: 14px 8px 0;
  border-top: 1px solid var(--line);
}
.user-chip {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #27100a;
  font-weight: 800;
  flex: 0 0 auto;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-chip b, .user-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip span { color: #9da9ba; font-size: 12px; }
.role-badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.role-badge .svg-icon {
  width: 16px;
  height: 16px;
  color: var(--icon-action);
}
.user-chip .role-badge,
.chat-item .role-badge,
.permission-head .role-badge {
  display: inline-flex;
}

.content {
  grid-column: 1;
  grid-row: 1;
  direction: rtl;
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(22,31,43,.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 24px;
}
.page-title h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
}
.page-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.main {
  min-width: 0;
  max-width: 100%;
  padding: 24px;
}
.view {
  width: 100%;
  min-width: 0;
  max-width: 1380px;
  margin: 0 auto;
  display: grid;
  gap: 22px;
}

.panel {
  min-width: 0;
  max-width: 100%;
  background: rgba(26,34,46,.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}
.panel.tight { padding: 12px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
  min-width: 0;
}
.panel-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}
.panel-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.stat-card {
  background: linear-gradient(180deg, rgba(23,32,43,.98), rgba(18,24,33,.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-height: 64px;
  display: grid;
  align-content: space-between;
  box-shadow: var(--shadow-soft);
}
.stat-card .icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--icon-tile);
  background: var(--primary);
}
.stat-card.teal .icon { background: var(--teal); }
.stat-card.green .icon { background: var(--green); }
.stat-card.amber .icon { background: var(--amber); }
.stat-card.violet .icon { background: var(--violet); }
.stat-card b {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  line-height: 1;
}
.stat-card span { color: var(--muted); font-size: 11px; font-weight: 700; }
.stat-card .icon { width: 28px; height: 28px; }

.kpi-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.kpi-strip > .stat-card { flex: 1 1 0; min-width: 0; }
.status-band {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr);
  gap: 16px;
  align-items: stretch;
  min-width: 0;
}
.command-panel {
  background: linear-gradient(135deg, #1b2533, #161f2b);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  gap: 16px;
  box-shadow: var(--shadow);
}
.command-panel h2 { margin: 0; font-size: 22px; }
.quick-list {
  display: grid;
  gap: 9px;
}
.quick-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.quick-item:last-child { border-bottom: 0; }

.table-wrap {
  margin-top: 20px;
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  background: var(--surface);
}
th, td {
  padding: 12px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 800;
}
tbody tr:hover td { background: rgba(245,158,27,.06); }
tbody tr:last-child td { border-bottom: 0; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}
.tag.approved, .tag.done { color: #b9ead4; background: rgba(85,201,143,.12); border-color: rgba(85,201,143,.34); }
.tag.pending, .tag.open { color: #ffe0a3; background: rgba(242,184,75,.12); border-color: rgba(242,184,75,.35); }
.tag.rejected, .tag.late { color: #ffc8c4; background: rgba(255,107,99,.12); border-color: rgba(255,107,99,.35); }
.tag.info { color: #ffdda0; background: rgba(245,158,27,.12); border-color: rgba(245,158,27,.32); }
.tag.violet { color: #ddd4ff; background: rgba(167,139,250,.13); border-color: rgba(167,139,250,.34); }
.code {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  background: #241817;
  color: #ffdda0;
  font-family: Consolas, "Courier New", monospace;
  font-weight: 800;
  letter-spacing: 1px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding-bottom: 2px;
}
.tab {
  min-height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  padding: 0 13px;
  background: var(--surface);
  color: var(--ink-soft);
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.tab.active {
  color: #27100a;
  background: var(--primary);
  border-color: var(--primary);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  min-width: 0;
}
.mini-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 10px;
}
.mini-card.done { opacity: .72; }
.mini-card h3 { margin: 0; font-size: 15px; line-height: 1.45; }
.meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.policy-method-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.policy-method-grid textarea {
  min-height: 86px;
}
.policy-grid {
  align-items: stretch;
}
.policy-card {
  gap: 12px;
}
.policy-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.policy-sections {
  display: grid;
  gap: 8px;
}
.policy-sections > div {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.policy-sections b {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 12px;
}
.policy-sections p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* policy PDF library */
.policy-upload { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.policy-upload .field { flex: 1 1 240px; }
.policy-drop { display: inline-flex; align-items: center; gap: 8px; min-height: var(--control); padding: 8px 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink-soft); cursor: pointer; font-weight: 700; }
.policy-drop:hover { border-color: var(--primary); color: var(--ink); }
.policy-doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.policy-doc-card { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.policy-doc-icon { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 10px; background: rgba(244,166,42,.16); color: var(--primary); }
.policy-doc-icon .svg-icon { width: 24px; height: 24px; }
.policy-doc-info { flex: 1; min-width: 0; }
.policy-doc-info h3 { margin: 0 0 4px; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.policy-doc-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 12px; }
.policy-doc-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pdf-modal { max-width: 1000px; width: 96%; height: 92vh; display: flex; flex-direction: column; }
.pdf-frame-wrap { flex: 1; min-height: 0; padding: 0 14px 14px; }
.pdf-frame { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
@media (max-width: 640px) {
  .policy-doc-grid { grid-template-columns: 1fr; }
  .policy-doc-card { flex-wrap: wrap; }
  .policy-doc-actions { width: 100%; }
  .pdf-modal { height: 88vh; width: 98%; }
}
.avatar-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.avatar-row .avatar {
  width: 28px;
  height: 28px;
  font-size: 11px;
  border: 2px solid var(--surface);
  margin-inline-start: -6px;
}
.avatar-row .avatar:first-child { margin-inline-start: 0; }
.subtasks {
  display: grid;
  gap: 6px;
}
.subtask {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-soft);
}
.subtask input { width: 16px; min-height: 16px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17,24,39,.52);
  backdrop-filter: blur(8px);
}
.modal {
  width: min(680px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px -34px rgba(10,15,25,.55);
}
.modal.lg { width: min(920px, 100%); }
.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.modal-body {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.bell-wrap { position: relative; }
.bell-dot {
  position: absolute;
  top: -4px;
  inset-inline-start: -3px;
  min-width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  font-size: 11px;
  font-weight: 800;
  border: 2px solid var(--surface);
}
.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: 0;
  width: min(360px, 86vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dropdown-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}
.dropdown-list {
  max-height: 360px;
  overflow: auto;
}
.notice {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}
.notice.unread { background: rgba(245,158,27,.12); color: var(--ink); }

.chat-drawer {
  position: static;
  inset: auto;
  z-index: auto;
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: calc(100vh - 118px);
}
.chat-side {
  border-inline-start: 1px solid var(--line);
  background: var(--surface-2);
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-width: 0;
}
.chat-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.chat-list {
  overflow: auto;
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 5px;
}
.chat-item {
  min-height: 48px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: right;
}
.chat-item:hover { background: rgba(245,158,27,.08); outline: 1px solid rgba(245,158,27,.16); }
.chat-item.active { background: rgba(245,158,27,.14); outline: 1px solid rgba(245,158,27,.38); }
.chat-item .txt {
  min-width: 0;
  flex: 1;
}
.chat-item b, .chat-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-item span { color: var(--muted); font-size: 12px; }
.chat-item .role-badge {
  display: inline-flex;
  color: #e7eef6;
}
.chat-item b, .chat-main-head b { color: #ffffff; }
.chat-item .role-badge .svg-icon {
  color: var(--icon-action);
}
.unread-badge {
  background: var(--red) !important;
  color: #fff !important;
  font-weight: 800;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary);
  color: #27100a;
  font-size: 11px;
  font-weight: 800;
}
.chat-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.chat-main-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.messages {
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, var(--bg), #10161f);
}
.msg {
  max-width: min(680px, 82%);
  display: grid;
  gap: 4px;
  align-self: flex-start;
}
.msg.mine { align-self: flex-end; }
.msg-bubble {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface-3);
  color: #ffffff;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-soft);
  white-space: pre-wrap;
}
.msg.mine .msg-bubble {
  color: #27100a;
  background: var(--primary);
  border-color: var(--primary);
}
.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
}
.msg-meta span { color: #ffffff; font-weight: 700; }
.msg-meta b { color: var(--ink); }
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 6px;
}
.media-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: zoom-in;
}
.media-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.35);
}
.mention-line {
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 800;
}
.composer {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.composer-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}
.mention-popover {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% - 4px);
  z-index: 35;
  max-height: 180px;
  overflow: auto;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(23,32,43,.98);
  box-shadow: var(--shadow-soft);
  scrollbar-width: thin;
}
.mention-popover button {
  min-height: 38px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  text-align: right;
}
.mention-popover button:only-child,
.composer-wrap .mention-popover button {
  grid-template-columns: minmax(0, 1fr);
}
.mention-popover button:hover {
  background: rgba(245,158,27,.11);
}
.mention-popover .avatar {
  width: 32px;
  height: 32px;
}
.mention-popover small {
  color: var(--muted);
  font-size: 11px;
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(10,15,25,.82);
  backdrop-filter: blur(8px);
}
.lightbox img {
  max-width: min(96vw, 1100px);
  max-height: 88vh;
  border-radius: var(--radius);
  border: 1px solid rgba(255,174,34,.28);
  box-shadow: var(--shadow);
  object-fit: contain;
}
.lightbox-close {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 101;
  background: var(--surface-2);
}

.monitor-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}
.conversation-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}
.conversation-card {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  text-align: right;
}
.conversation-card:hover {
  border-color: rgba(245,158,27,.32);
  background: rgba(245,158,27,.07);
}
.conversation-card.active {
  border-color: rgba(245,158,27,.55);
  background: rgba(245,158,27,.12);
  box-shadow: inset -3px 0 0 var(--primary);
}
.conversation-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--icon-tile);
  background: var(--primary);
}
.conversation-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.conversation-copy b,
.conversation-copy small,
.conversation-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-copy small {
  color: var(--muted);
  font-size: 11px;
}
.conversation-copy span {
  color: var(--ink-soft);
  font-size: 12px;
}
.conversation-detail {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}
.conversation-head {
  min-height: 64px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}
.conversation-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}
.conversation-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.conversation-messages {
  max-height: 60vh;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
}
.audit-message {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.audit-message p {
  margin: 0;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.audit-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.profile-card {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.profile-photo {
  width: 110px;
  height: 110px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--surface-3);
  border: 1px solid var(--line);
}

.svg-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex: 0 0 auto;
  color: currentColor;
  vertical-align: middle;
  opacity: 1;
  visibility: visible;
}
.btn .svg-icon,
.nav-btn .svg-icon,
.chat-item .svg-icon,
.mobile-menu-bar .svg-icon {
  min-width: 18px;
  pointer-events: none;
}
.svg-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  stroke: currentColor;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.stat-card .svg-icon {
  width: 18px;
  height: 18px;
  color: var(--icon-tile);
}
.nav-btn .svg-icon {
  color: var(--icon-menu);
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(255,178,56,.22));
}
.nav-btn:hover .svg-icon {
  color: #fff1cf;
}
.nav-btn.active .svg-icon { color: var(--primary-2); }
.chat-item .svg-icon {
  color: var(--icon-action);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(85,201,143,.12);
}
.online-chip {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid rgba(245,158,27,.32);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(245,158,27,.08);
  cursor: pointer;
  font-weight: 800;
}
.online-chip:hover {
  background: rgba(245,158,27,.16);
  border-color: rgba(245,158,27,.52);
}
.person-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}
.person-link .avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
}
.metric-link {
  min-width: 38px;
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font-weight: 900;
}
.metric-link.good { background: rgba(74,222,128,.72); }
.metric-link.mid { background: rgba(255,193,90,.78); color: #27100a; }
.metric-link.low { background: rgba(251,113,133,.82); }
.kv {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); font-weight: 700; }

.permissions-list {
  display: grid;
  gap: 12px;
}
.permission-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.permission-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.permission-head b,
.permission-head span {
  display: block;
}
.permission-head span {
  color: var(--muted);
  font-size: 12px;
}
.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}
.switch-line {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
}
.switch-line input {
  width: 17px;
  min-height: 17px;
  accent-color: var(--primary);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 16px;
}

@media (max-width: 1120px) {
  .kpi-strip, .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-band, .split { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-form { min-height: 100vh; padding: 28px 20px; }
  .app-shell {
    display: block;
    min-height: 100vh;
    direction: rtl;
  }
  .app-shell.mobile-nav-open {
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
  }
  body:has(.mobile-nav-open) {
    overflow: hidden;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 70;
    width: 100%;
    height: auto;
    padding: 10px 12px;
    overflow: visible;
    border-bottom: 1px solid var(--line);
    border-inline-start: 0;
  }
  .content {
    display: block;
    width: 100%;
  }
  .side-head { display: none; }
  .mobile-menu-bar {
    position: relative;
    z-index: 80;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding-inline-end: 52px;
    padding-inline-start: 8px;
  }
  .mobile-menu-bar .brand {
    min-width: 0;
  }
  .mobile-menu-bar .brand-mark {
    width: 34px;
    height: 34px;
  }
  .mobile-menu-bar .brand-text b {
    font-size: 14px;
  }
  .mobile-menu-bar .brand-text span {
    display: none;
  }
  .mobile-menu-btn {
    position: absolute;
    right: 0;
    left: auto;
    top: 50%;
    z-index: 82;
    transform: translateY(-50%);
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    color: var(--icon-action);
    border-color: rgba(255,178,56,.34);
    background: var(--surface-2);
  }
  .mobile-menu-scrim {
    position: fixed;
    inset: 0;
    z-index: 65;
    display: block;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background: rgba(12,18,30,.62);
    backdrop-filter: blur(3px);
    cursor: default;
  }
  .mobile-menu-btn span {
    width: 17px;
    height: 2px;
    display: block;
    border-radius: 99px;
    background: currentColor;
  }
  .side-nav {
    position: fixed;
    top: 64px;
    right: 10px;
    left: 10px;
    z-index: 90;
    display: none;
    padding: 12px;
    gap: 10px;
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px);
    overflow: auto;
    overscroll-behavior: contain;
    background: rgba(24,33,46,.99);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    /* clean instant dropdown - no slide/transform animation */
  }
  .side-nav.open {
    display: grid;
  }
  .nav-btn {
    width: 100%;
    min-height: 40px;
    padding: 0 44px 0 12px;
    border-radius: var(--radius-sm);
  }
  .nav-btn.active {
    background: rgba(245,158,27,.13);
    box-shadow: inset -3px 0 0 var(--primary);
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
  .side-footer { display: none; }
  .topbar {
    position: static;
    top: auto;
  }
  .topbar-inner {
    min-height: auto;
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    padding: 14px;
    min-width: 0;
  }
  .top-actions {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: visible;
    padding-bottom: 2px;
  }
  .main { padding: 14px; }
  .chat-drawer {
    inset: 0;
    border-radius: 0;
    grid-template-columns: 1fr;
  }
  .chat-side {
    min-height: 220px;
    max-height: 42vh;
    border-bottom: 1px solid var(--line);
  }
  .chat-main { min-height: 58vh; }
}
@media (max-width: 640px) {
  .grid2, .grid3, .grid4, .kpi-strip { grid-template-columns: 1fr; }
  .time-range,
  .time-range.compact {
    grid-template-columns: 1fr;
  }
  .time-range-actions .btn {
    flex: 1 1 90px;
  }
  .page-title p { display: none; }
  .top-actions .labelled,
  .top-actions .icon-btn {
    min-width: var(--control);
    width: var(--control);
    padding: 0;
  }
  .top-actions .logout-btn {
    width: auto;
    min-width: 118px;
    padding: 0 12px;
    margin-inline-start: auto;
  }
  .top-actions .labelled span:not(.svg-icon) { display: none; }
  .top-actions .logout-btn span:not(.svg-icon) { display: inline; }
  .top-actions .svg-icon {
    display: block;
    color: var(--primary-2);
  }
  .main { padding: 12px; }
  .panel { padding: 12px; }
  .panel-head {
    display: grid;
    grid-template-columns: 1fr;
  }
  .panel-head > .row {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
  .panel-head > .row input,
  .panel-head > .row select,
  .panel-head > .row .btn {
    width: 100% !important;
    min-width: 0;
  }
  .cards-grid { grid-template-columns: 1fr; }
  table { min-width: 560px; }
  .monitor-layout { grid-template-columns: 1fr; }
  .conversation-messages { max-height: none; }
  .chat-drawer {
    min-height: calc(100vh - 150px);
  }
  .chat-main-head {
    display: grid;
    gap: 10px;
    align-items: start;
  }
  .composer-row {
    grid-template-columns: minmax(0, 1fr) var(--control) var(--control);
  }
  .permission-head {
    display: grid;
    grid-template-columns: 1fr;
  }
  .permission-grid { grid-template-columns: 1fr; }
  .profile-card { grid-template-columns: 1fr; }
  .auth-meta { grid-template-columns: 1fr; }
}

/* ============================ Kanban board ============================ */
.board-panel { padding: 14px; }
.kanban {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}
.kanban-col {
  flex: 0 0 264px;
  width: 264px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 230px);
  transition: border-color .15s ease, background .15s ease;
}
.kanban-col.dragover {
  border-color: var(--primary);
  background: var(--surface-3);
  box-shadow: 0 0 0 1px var(--primary) inset;
}
.kanban-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.kanban-col-head b { font-weight: 700; color: var(--ink); }
.kanban-col-head .count {
  margin-inline-start: auto;
  min-width: 22px;
  text-align: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.kanban-col-head .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}
.stage-not_started .kanban-col-head .dot { background: #8c7a6a; }
.stage-in_progress .kanban-col-head .dot { background: var(--primary); }
.stage-edit .kanban-col-head .dot { background: var(--violet); }
.stage-ready .kanban-col-head .dot { background: var(--teal); }
.stage-done .kanban-col-head .dot { background: var(--green); }
.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
  min-height: 80px;
  flex: 1;
}
.kanban-card {
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-soft);
  transition: transform .12s ease, border-color .12s ease, opacity .12s ease;
}
.kanban-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .4; }
.kanban-card-title { font-weight: 700; font-size: 14px; line-height: 1.5; color: var(--ink); }
.kanban-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.kanban-tags .tag { display: inline-flex; align-items: center; gap: 4px; }
.kanban-tags .tag .svg-icon { width: 13px; height: 13px; }
.kanban-notes {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kanban-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
}
.assignee-stack { display: flex; }
.assignee-stack .avatar.sm { margin-inline-start: -6px; border: 2px solid var(--surface-3); }
.assignee-stack .avatar.sm:first-child { margin-inline-start: 0; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.kanban-empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 16px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}
@media (max-width: 720px) {
  .kanban-col { flex-basis: 80vw; width: 80vw; }
}

/* ===================== Task modal / properties / blocks ===================== */
.task-modal { max-width: 760px; width: min(760px, 96vw); }
.task-title-input { font-size: 18px; font-weight: 800; border: 1px solid transparent; background: transparent; padding: 4px 6px; flex: 1; }
.task-title-input:hover { border-color: var(--line); }
.task-title-input:focus { border-color: var(--primary); background: var(--surface); }
.prop-grid { display: flex; flex-direction: column; gap: 2px; }
.prop-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.prop-key { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.prop-key .svg-icon { width: 15px; height: 15px; }
.prop-val { min-width: 0; }
.prop-val input, .prop-val select { min-height: 34px; }
.priority-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.priority-row select {
  width: min(260px, 100%);
}
.deadline-edit { display: flex; gap: 6px; }
.deadline-edit input[type="date"] { flex: 1 1 60%; min-width: 0; }
.deadline-edit input[type="time"] { flex: 0 0 110px; }
.prop-val a { word-break: break-all; }
.assignee-names { display: flex; flex-wrap: wrap; gap: 6px; }

.blocks-head, .comments-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 8px; font-size: 14px; }
.blocks { display: flex; flex-direction: column; gap: 10px; }
.block-callout { border: 1px solid var(--line-strong); border-inline-start-width: 4px; border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.block-callout b { font-size: 14px; }
.block-callout p { margin: 0; color: var(--ink-soft); font-size: 13.5px; white-space: pre-wrap; line-height: 1.6; }
.block-callout textarea { min-height: 60px; }
.block-atts { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.block-atts .attachments { margin-top: 0; }
.block-edit-row { display: flex; gap: 8px; align-items: center; }
.block-edit-row .block-title { flex: 1; min-height: 34px; }
.block-edit-row .block-color { width: 130px; min-height: 34px; }
.block-callout.color-default { border-inline-start-color: var(--muted); }
.block-callout.color-amber { border-inline-start-color: var(--amber); background: rgba(245,158,27,.08); }
.block-callout.color-green { border-inline-start-color: var(--green); background: rgba(85,201,143,.08); }
.block-callout.color-violet { border-inline-start-color: #a78bfa; background: rgba(167,139,250,.08); }
.block-callout.color-red { border-inline-start-color: var(--red); background: rgba(255,107,99,.08); }
.block-callout.color-teal { border-inline-start-color: #2dd4bf; background: rgba(45,212,191,.08); }
.block-callout.color-blue { border-inline-start-color: #60a5fa; background: rgba(96,165,250,.08); }

.comments { display: flex; flex-direction: column; gap: 8px; }
.comment { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.comment-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.comment-meta b { color: var(--ink); }

/* =========================================================
   Unified responsive stat strip + dashboard layout polish
   (authoritative — defined last so it wins the cascade)
   ========================================================= */
.kpi-strip {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 14px !important;
  overflow: visible !important;
}
.kpi-strip > .stat-card {
  flex: none !important;
  min-width: 0 !important;
}
.stat-card {
  padding: 16px 18px;
  min-height: 84px;
  gap: 6px;
}
.stat-card b { font-size: 26px; color: #f8fafc; }
.stat-card span { font-size: 12px; color: var(--muted); }
.stat-card .icon { width: 38px; height: 38px; }
.stat-card .icon .svg-icon { width: 20px; height: 20px; }
/* guarantee every dashboard figure stays bright (no dark/black numerals) */
.kpi-strip .stat-card b, .quick-item b, .emp-metric b, .emp-card-head .person-link span { color: #f8fafc; }
.dash-section-gap { height: 4px; }
/* more breathing room between dashboard panels */
.view > .panel + .panel, .view > .split, .view > .kpi-strip + .panel { margin-top: 4px; }

@media (max-width: 760px) {
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px !important; }
  .stat-card { padding: 13px 14px; min-height: 74px; }
  .stat-card b { font-size: 22px; }
}
@media (max-width: 400px) {
  .kpi-strip { grid-template-columns: 1fr; }
}
.comment p { margin: 0; font-size: 13.5px; white-space: pre-wrap; }
.bell-dot, .unread-badge { background: var(--red) !important; color: #fff !important; }
.chat-item .unread-badge, .msg-bubble .reaction-count { color: var(--red); }

/* attendance: highlight a row flagged for possible IP/location tampering */
.att-flagged > td { background: rgba(251,113,133,.13); }
.att-flagged > td:first-child { box-shadow: inset 3px 0 0 var(--red); font-weight: 800; color: #ffd7db; }

/* channel inline rename */
.channel-edit { display: flex; flex-direction: column; gap: 8px; }
.channel-edit input { width: 100%; }

/* WhatsApp-style chat: links, video, file chips, paste preview */
.msg-text { white-space: pre-wrap; word-break: break-word; }
.msg-text a, .msg-bubble a.auto-link { color: var(--primary-2); text-decoration: underline; word-break: break-all; }
.msg.mine .msg-text a { color: #fff; }
.media-vid { max-width: 260px; max-height: 320px; border-radius: 10px; border: 1px solid var(--line); background: #000; }
.chat-file { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pending { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 4px; }
.chat-pending-item { position: relative; display: inline-flex; align-items: center; }
.chat-pending-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-strong); }
.chat-pending-file { display: inline-flex; align-items: center; gap: 6px; max-width: 180px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-strong); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pending-x { position: absolute; top: -7px; inset-inline-start: -7px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--red); color: #fff; border: 0; cursor: pointer; }
.chat-pending-x .svg-icon { width: 12px; height: 12px; }
/* voice-note record button: pulses red while recording */
.composer-row .btn.recording { background: var(--red); border-color: var(--red); color: #fff; animation: recPulse 1s ease-in-out infinite; }
.composer-row .btn.recording .svg-icon { color: #fff; }
@keyframes recPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(251,113,133,.5); } 50% { box-shadow: 0 0 0 6px rgba(251,113,133,0); } }
.composer-row .send-btn { flex: none; }

/* clickable notifications + open hint */
.notice-btn { display: block; width: 100%; text-align: start; background: transparent; cursor: default; border: 0; border-bottom: 1px solid var(--line); padding: 11px 13px; color: var(--ink); font-weight: 600; line-height: 1.55; }
.notice-btn .small { font-weight: 500; }
.notice-btn.linked { cursor: pointer; }
.notice-btn.linked:hover { background: var(--surface-3); }
.notice-btn.unread { background: rgba(245,158,27,.12); border-inline-start: 3px solid var(--primary); color: #fff; }
.notice-btn.unread .muted { color: var(--ink-soft); }
.open-hint { color: var(--primary-2); font-weight: 700; }
.bell-dot { background: var(--red); color: #fff; font-weight: 800; }

/* board settings (custom fields + templates) */
.board-settings .settings-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-strong); font-size: 12.5px; }
.chip-x { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.chip-x:hover { color: var(--red); }
.chip-x .svg-icon { width: 12px; height: 12px; }
.btn.active { border-color: var(--primary); color: var(--primary-2); }
.segmented-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.task-guide {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}
.task-guide video {
  display: block;
  width: 100%;
  max-height: 320px;
  background: #05070b;
}
.kanban-card.done { opacity: .7; }

/* inline add-task (Notion-style) */
.kanban-add { display: flex; align-items: center; gap: 6px; width: 100%; justify-content: flex-start; background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); border-radius: var(--radius-sm); padding: 9px 10px; cursor: pointer; font-size: 13px; transition: color .15s, border-color .15s, background .15s; }
.kanban-add:hover { color: var(--primary-2); border-color: var(--primary); background: var(--surface-2); }
.kanban-add .svg-icon { width: 15px; height: 15px; }
.kanban-new { background: var(--surface-3); border: 1px solid var(--primary); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.kanban-new-input { min-height: 36px; font-weight: 600; }
.kanban-new-tpl { min-height: 34px; }
.kanban-new-assign select { min-height: auto; }
.kanban-new-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kanban-new-actions .btn { white-space: nowrap; }

/* repeat picker */
.repeat-days { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-check { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 12px; cursor: pointer; }
.chip-check input { width: auto; min-height: auto; }
.repeat-dom { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.repeat-dom input { width: 80px; }
.repeat-dom label { color: var(--muted); font-size: 12.5px; }

/* calendar-style recurrence picker */
.repeat-cal { margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.repeat-cal-title { font-size: 12px; font-weight: 800; color: var(--ink-soft); margin-bottom: 8px; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-day { display: flex; align-items: center; justify-content: center; min-height: 38px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink-soft); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: border-color .12s, background .12s; }
.cal-day.num { min-height: 34px; }
.cal-day:hover { border-color: var(--primary); }
.cal-day.sel { background: var(--primary); border-color: var(--primary); color: #1b1206; }
.repeat-cal-sel { margin-top: 8px; font-size: 12px; color: var(--muted); }
@media (max-width: 520px) {
  .cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .cal-day { min-height: 32px; font-size: 12px; }
  .cal-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* activity log */
.composer-wrap { position: relative; }
.activity-log { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.log-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.log-who { font-weight: 700; color: var(--ink); }
.log-act { color: var(--ink-soft); flex: 1; min-width: 120px; }
.log-at { color: var(--muted); font-size: 11.5px; }

/* KPI bar */
.kpi-formula { margin-bottom: 12px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.kpi-bar { position: relative; height: 22px; background: var(--surface-3); border-radius: 999px; overflow: hidden; min-width: 140px; }
.kpi-bar-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.kpi-bar-fill.low { background: linear-gradient(90deg, #b94a44, var(--red)); }
.kpi-bar-fill.mid { background: linear-gradient(90deg, #c98a2d, var(--amber)); }
.kpi-bar-fill.good { background: linear-gradient(90deg, #3f9e6b, var(--green)); }
.kpi-bar-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(10,15,25,.6); }

/* =======================================================================
   FINAL COLOR SYSTEM  (clean, coherent — overrides earlier ad-hoc tweaks)
   text: bright primary / readable secondary / dim muted · accent = amber
   ======================================================================= */
body { color: var(--ink); }
h1, h2, h3, h4, .panel-title, .page-title h1, .modal-head .panel-title { color: var(--ink); }
.panel-subtitle, .page-title p, .muted, p.muted, .small.muted, .meta-line span, .field label { color: var(--muted); }
a, .auto-link { color: var(--primary-2); }

/* sidebar nav: idle light, hover/active amber */
.side-nav .nav-btn { color: var(--ink-soft); }
.side-nav .nav-btn > .svg-icon { color: var(--icon-menu); }
.side-nav .nav-btn:hover, .side-nav .nav-btn.active { color: var(--primary-2); }
.side-nav .nav-btn:hover > .svg-icon, .side-nav .nav-btn.active > .svg-icon { color: var(--primary-2); }
.nav-group-label b { color: var(--primary-2); }
.nav-group-label span { color: var(--muted); }

/* tables: header readable, body bright */
th { color: var(--ink-soft); font-weight: 700; }
td { color: var(--ink); }

/* stat cards + KPIs: figures bright, labels muted */
.stat-card b, .emp-metric b, .quick-item b, .kpi-strip .stat-card b { color: var(--ink); }
.stat-card span, .emp-metric span { color: var(--muted); }

/* chat: readable bubbles, white timestamps, amber links, red counters */
.messages { background: linear-gradient(180deg, var(--bg), #10161f); }
.msg-bubble { color: #ffffff; }
.msg.mine .msg-bubble { color: #1c1206; }
.msg-meta b, .chat-item b, .chat-main-head b { color: var(--ink); }
.msg-meta span { color: #ffffff; }
.msg.mine .msg-text a { color: #fff; }
.chat-item span { color: var(--muted); }
.chat-item .role-badge, .role-badge { color: var(--ink-soft); }
.unread-badge, .bell-dot { background: var(--red); color: #fff; }

/* forms readable */
input, select, textarea { color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); }
