/* Employee Tasks Management — hand-written, no build step.
   Logical properties (inline-start/end) make the same rules work for RTL Arabic and LTR English.
   Every colour is a variable so dark mode and company branding can override them. */

:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --hover: #f7f9fd;
  --border: #e3e8ef;
  --border-strong: #c9d3e3;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #1d4ed8;
  --primary-600: #1e40af;
  --primary-50: #eff4ff;
  --sidebar: #0b1b3a;
  --sidebar-text: #c7d2e6;
  --sidebar-muted: #7d8bab;
  --sidebar-active: #1d4ed8;
  --column: #eaeef5;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .14);

  --slate-bg: #eef2f7;  --slate-fg: #475569;
  --blue-bg: #e0ecff;   --blue-fg: #1d4ed8;
  --amber-bg: #fdf1d8;  --amber-fg: #a35a00;
  --green-bg: #dcf5e7;  --green-fg: #127a43;
  --red-bg: #fde4e4;    --red-fg: #b42318;
  --violet-bg: #efe7ff; --violet-fg: #6d28d9;
}

/* Dark theme: explicit choice, or system preference when the user picked "auto". */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220; --surface: #111a2c; --surface-2: #0f1727; --hover: #16213a;
  --border: #22304a; --border-strong: #33456a; --text: #e5ecf6; --muted: #93a3bd;
  --primary-50: #16244a; --sidebar: #070d19; --column: #0d1526;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
  --slate-bg: #1c2638; --slate-fg: #b4c0d4;
  --blue-bg: #13264d;  --blue-fg: #8db4ff;
  --amber-bg: #3a2a0d; --amber-fg: #f5c46b;
  --green-bg: #0f3123; --green-fg: #6ee0a6;
  --red-bg: #3d1517;   --red-fg: #ff9a92;
  --violet-bg: #2a1d4d; --violet-fg: #c4a8ff;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #0b1220; --surface: #111a2c; --surface-2: #0f1727; --hover: #16213a;
    --border: #22304a; --border-strong: #33456a; --text: #e5ecf6; --muted: #93a3bd;
    --primary-50: #16244a; --sidebar: #070d19; --column: #0d1526;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
    --slate-bg: #1c2638; --slate-fg: #b4c0d4;
    --blue-bg: #13264d;  --blue-fg: #8db4ff;
    --amber-bg: #3a2a0d; --amber-fg: #f5c46b;
    --green-bg: #0f3123; --green-fg: #6ee0a6;
    --red-bg: #3d1517;   --red-fg: #ff9a92;
    --violet-bg: #2a1d4d; --violet-fg: #c4a8ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
:root[data-theme="dark"] a, :root[data-theme="dark"] .btn-link { color: var(--blue-fg); }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 1.35rem; font-weight: 600; }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: .95rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .flip { transform: scaleX(-1); }
.text-red { color: var(--red-fg) !important; }
.text-amber { color: var(--amber-fg) !important; }
.text-green { color: var(--green-fg) !important; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex: none; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: 18px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; padding: 4px 10px 20px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); display: grid; place-items: center; flex: none; overflow: hidden; }
.brand-mark .icon { stroke: #fff; }
.brand-logo { height: 36px; width: auto; max-width: 150px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--sidebar-muted); padding: 16px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px;
  color: var(--sidebar-text); text-decoration: none;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; }
.nav a .count { margin-inline-start: auto; background: rgba(255, 255, 255, .15); border-radius: 99px; padding: 0 7px; font-size: .75rem; }
.sidebar-foot { margin-top: auto; font-size: .8rem; color: var(--sidebar-muted); padding: 12px 12px 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.topbar .search { flex: 1; max-width: 380px; position: relative; }
.topbar .search input { padding-inline-start: 36px; }
.topbar .search .icon { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; font: inherit;
}
.icon-btn:hover { background: var(--hover); text-decoration: none; }
.icon-btn.wide { width: auto; padding: 0 10px; gap: 6px; display: inline-flex; align-items: center; }
.dot-count {
  position: absolute; top: -5px; inset-inline-end: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center;
}
.timer-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px 0 12px; border-radius: 99px;
  background: var(--green-bg); color: var(--green-fg); font-weight: 500; max-width: 300px;
}
[dir="rtl"] .timer-chip { padding: 0 12px 0 6px; }
.timer-chip a { color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.timer-chip .elapsed { font-variant-numeric: tabular-nums; }
.timer-chip button { border: 0; background: var(--surface); color: var(--red-fg); border-radius: 99px; width: 28px; height: 28px; display: grid; place-items: center; cursor: pointer; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.menu-toggle { display: none; }
.content { padding: 24px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  display: none; position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 210px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 30;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 7px;
  background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; text-align: start; text-decoration: none;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--hover); text-decoration: none; }
.dropdown-menu .head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.bell-menu { width: 360px; max-width: calc(100vw - 24px); padding: 0; }
.bell-menu .bell-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.bell-menu .bell-list { max-height: 380px; overflow-y: auto; }
.bell-menu .bell-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); border-radius: 0; color: var(--text); white-space: normal; }
.bell-menu .bell-item.unread { background: var(--primary-50); }
.bell-menu .bell-foot { display: block; text-align: center; padding: 10px; }

/* ---------- Cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.stat-value { font-size: 1.5rem; font-weight: 600; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .85rem; }
.tone-slate { background: var(--slate-bg); color: var(--slate-fg); }
.tone-blue { background: var(--blue-bg); color: var(--blue-fg); }
.tone-amber { background: var(--amber-bg); color: var(--amber-fg); }
.tone-green { background: var(--green-bg); color: var(--green-fg); }
.tone-red { background: var(--red-bg); color: var(--red-fg); }
.tone-violet { background: var(--violet-bg); color: var(--violet-fg); }

/* ---------- Badges / avatars / labels ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: .78rem; font-weight: 500; white-space: nowrap; line-height: 1.6;
}
.badge-slate { background: var(--slate-bg); color: var(--slate-fg); }
.badge-blue { background: var(--blue-bg); color: var(--blue-fg); }
.badge-amber { background: var(--amber-bg); color: var(--amber-fg); }
.badge-green { background: var(--green-bg); color: var(--green-fg); }
.badge-red { background: var(--red-bg); color: var(--red-fg); }
.badge-violet { background: var(--violet-bg); color: var(--violet-fg); }
.badge .icon { width: 13px; height: 13px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 6px; font-size: .75rem; font-weight: 500; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); white-space: nowrap; }
.chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary-50); color: var(--primary);
  display: inline-grid; place-items: center; font-size: .75rem; font-weight: 600; flex: none;
}
:root[data-theme="dark"] .avatar { color: var(--blue-fg); }
.avatar.sm { width: 24px; height: 24px; font-size: .66rem; }
.avatar.lg { width: 40px; height: 40px; font-size: .9rem; }
.person { display: inline-flex; align-items: center; gap: 8px; }
.avatars { display: inline-flex; }
.avatars .avatar { border: 2px solid var(--surface); margin-inline-start: -6px; }
.avatars .avatar:first-child { margin-inline-start: 0; }
.mention { background: var(--blue-bg); color: var(--blue-fg); border-radius: 4px; padding: 0 3px; font-weight: 500; }

/* ---------- Buttons / forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff !important; }
.btn-primary:hover { background: var(--primary-600); }
.btn-success { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { color: var(--red-fg); border-color: var(--red-bg); }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { height: 32px; padding: 0 10px; font-size: .85rem; }
.btn-xs { height: 26px; padding: 0 8px; font-size: .78rem; border-radius: 7px; }
.btn-link { border: 0; background: none; color: var(--primary); padding: 0; height: auto; cursor: pointer; font: inherit; }
.btn-block { width: 100%; }

label, .label { display: block; font-weight: 500; margin-bottom: 6px; }
.input, input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=datetime-local],
input[type=date], input[type=time], input[type=tel], input[type=file], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text); font: inherit;
}
input[type=file] { padding: 6px 10px; height: auto; }
input[type=color] { width: 54px; height: 38px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(29, 78, 216, .25); border-color: var(--primary); }
.field { margin-bottom: 16px; position: relative; }
.field .hint { color: var(--muted); font-size: .82rem; margin-top: 5px; }
.field .error, .error-text { color: var(--red-fg); font-size: .82rem; margin-top: 5px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.form-row-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.check input { width: 16px; height: 16px; flex: none; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin: 22px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.section-title:first-child { margin-top: 0; }
.label-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.label-picker label { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 4px 10px; border: 1px solid var(--border); border-radius: 99px; font-weight: 400; cursor: pointer; }
.label-picker input { width: 14px; height: 14px; }
.label-picker label:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 18px; }
.filters > * { flex: 0 1 auto; }
.filters input[type=search] { width: 220px; }
.filters select { width: auto; min-width: 130px; }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: 9px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: var(--green-bg); color: var(--green-fg); }
.alert-error { background: var(--red-bg); color: var(--red-fg); }
.alert-warn { background: var(--amber-bg); color: var(--amber-fg); }
.alert-info { background: var(--violet-bg); color: var(--violet-fg); }
.alert ul { margin: 0; padding-inline-start: 18px; }
.alert .grow { flex: 1; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--hover); }
.table tr.selected { background: var(--primary-50) !important; }
.table .title-cell a { color: var(--text); font-weight: 500; }
.table .check-cell { width: 36px; }
.table .check-cell input { width: 16px; height: 16px; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.row-flags { display: inline-flex; gap: 4px; margin-inline-start: 6px; vertical-align: middle; flex-wrap: wrap; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }

.bulk-bar {
  position: sticky; bottom: 12px; z-index: 15; margin-top: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--sidebar); color: #fff; border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow-lg);
}
.bulk-bar select { width: auto; min-width: 150px; height: 34px; }
.bulk-bar .btn { height: 34px; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; color: var(--text); }

.bar { height: 8px; background: var(--slate-bg); border-radius: 99px; overflow: hidden; display: flex; }
.bar.thin { height: 5px; }
.bar span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: .85rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.fill-slate { background: #94a3b8; } .fill-blue { background: #3b82f6; } .fill-amber { background: #f59e0b; } .fill-green { background: #22c55e; } .fill-red { background: #ef4444; } .fill-violet { background: #8b5cf6; }

/* ---------- Board ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.column { background: var(--column); border-radius: 12px; padding: 10px; min-height: 200px; }
.column-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; font-weight: 600; }
.column-head .count { background: var(--surface); border-radius: 99px; padding: 0 9px; font-size: .8rem; color: var(--muted); }
.column-head .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-inline-end: 8px; }
.column-body { display: flex; flex-direction: column; gap: 9px; min-height: 120px; border-radius: 9px; transition: background .15s; }
.column-body.drag-over { background: rgba(29, 78, 216, .08); outline: 2px dashed rgba(29, 78, 216, .35); }
.task-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px;
  box-shadow: var(--shadow); cursor: grab; display: block; color: inherit; text-decoration: none;
}
.task-card:hover { border-color: var(--border-strong); text-decoration: none; }
.task-card.dragging { opacity: .5; }
.task-card.is-overdue { border-inline-start: 3px solid #ef4444; }
.task-card.is-stale { border-inline-start: 3px solid #f59e0b; }
.task-card.is-pending { border-inline-start: 3px solid #8b5cf6; }
.task-card .t-title { font-weight: 500; margin: 6px 0 8px; color: var(--text); word-break: break-word; }
.task-card .t-project { font-size: .75rem; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.task-card .t-project i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.task-card .t-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--muted); }
.task-card .t-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.task-card .t-info { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.task-card .t-info .icon { width: 14px; height: 14px; }
.task-card .bar { margin: 0 0 8px; }

/* ---------- Calendar ---------- */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); border-top: 1px solid var(--border); border-inline-start: 1px solid var(--border); overflow-x: auto; }
.cal-head { padding: 8px; font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; background: var(--surface-2); border-inline-end: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 118px; padding: 6px; border-inline-end: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; transition: background .15s; }
.cal-day.other { background: var(--surface-2); }
.cal-day.other .cal-num { opacity: .45; }
.cal-day.today .cal-num b { background: var(--primary); color: #fff; border-radius: 99px; padding: 0 7px; }
.cal-day.drag-over { background: var(--primary-50); }
.cal-num { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; }
.cal-num a { color: var(--muted); opacity: 0; }
.cal-day:hover .cal-num a { opacity: 1; }
.cal-hijri { font-size: .7rem; color: var(--muted); }
.cal-task { display: block; font-size: .76rem; padding: 3px 6px; border-radius: 5px; background: var(--blue-bg); color: var(--blue-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: grab; text-decoration: none; border-inline-start: 3px solid transparent; }
.cal-task:hover { text-decoration: none; filter: brightness(.97); }
.cal-task.p-urgent { border-inline-start-color: #ef4444; }
.cal-task.p-high { border-inline-start-color: #f59e0b; }
.cal-task.overdue { background: var(--red-bg); color: var(--red-fg); }
.cal-task.done { background: var(--green-bg); color: var(--green-fg); text-decoration: line-through; }
.cal-more { font-size: .72rem; color: var(--muted); }

/* ---------- Task detail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.prop { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); align-items: center; }
.prop:last-child { border-bottom: 0; }
.prop .k { color: var(--muted); flex: none; }
.prop .v { text-align: end; min-width: 0; }
.status-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.status-switch button { cursor: pointer; border: 1px solid var(--border); }
.status-switch button.current { outline: 2px solid currentColor; outline-offset: 1px; }
.description { white-space: pre-wrap; word-break: break-word; }
.comment { display: flex; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment .body { flex: 1; min-width: 0; }
.comment .text { white-space: pre-wrap; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px; padding-inline-start: 20px; font-size: .88rem; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 4px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; }
.timeline li::after { content: ""; position: absolute; inset-inline-start: 7px; top: 16px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }

.checklist { list-style: none; margin: 0 0 12px; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist li.done .ci-title { text-decoration: line-through; color: var(--muted); }
.checklist .ci-title { flex: 1; min-width: 0; word-break: break-word; }
.checklist input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; flex: none; }
.checklist .ci-del { opacity: 0; }
.checklist li:hover .ci-del { opacity: 1; }

.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.file { border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface-2); display: flex; flex-direction: column; }
.file .thumb { height: 92px; display: grid; place-items: center; background: var(--slate-bg); color: var(--slate-fg); font-weight: 600; font-size: .9rem; text-transform: uppercase; }
.file .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file .meta { padding: 7px 9px; font-size: .78rem; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file .meta a { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-inline { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 7px; font-size: .8rem; margin: 6px 6px 0 0; color: var(--text); }
.drop-zone { border: 2px dashed var(--border-strong); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); transition: background .15s; }
.drop-zone.drag-over { background: var(--primary-50); border-color: var(--primary); }

.mention-menu { position: absolute; z-index: 40; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow-lg); min-width: 220px; max-height: 220px; overflow-y: auto; padding: 4px; }
.mention-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; background: none; color: var(--text); font: inherit; text-align: start; border-radius: 6px; cursor: pointer; }
.mention-menu button.active, .mention-menu button:hover { background: var(--primary-50); }

/* ---------- Notifications ---------- */
.notif { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.notif:hover { background: var(--hover); text-decoration: none; }
.notif.unread { background: var(--primary-50); }
.notif .n-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: none; }

/* ---------- Projects ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; color: inherit; text-decoration: none; border-top: 4px solid var(--pc, var(--primary)); }
.project-card:hover { text-decoration: none; border-color: var(--border-strong); border-top-color: var(--pc, var(--primary)); }
.project-card h3 { font-size: 1rem; color: var(--text); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }

/* ---------- Reports ---------- */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 10px; overflow-x: auto; }
.chart .col { flex: 1 0 22px; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart .bars { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart .bars span { width: 45%; max-width: 16px; border-radius: 3px 3px 0 0; min-height: 2px; }
.chart .lbl { font-size: .68rem; color: var(--muted); white-space: nowrap; }
.rate { font-weight: 600; }
.rate.good { color: var(--green-fg); } .rate.mid { color: var(--amber-fg); } .rate.bad { color: var(--red-fg); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, #0b1b3a 0%, #13306b 55%, var(--primary) 100%); }
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border-radius: 16px; padding: 30px 28px; box-shadow: var(--shadow-lg); }
.auth-card .brand { color: var(--text); padding: 0 0 18px; }
.auth-lang { display: flex; justify-content: center; margin-top: 18px; }
.auth-lang a { color: #dbe5ff; }

/* ---------- Pagination ---------- */
.pager { padding: 12px 18px; border-top: 1px solid var(--border); }
.pager-links { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pager-buttons { display: inline-flex; align-items: center; gap: 8px; }
.pager-buttons [aria-disabled] { opacity: .45; cursor: default; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid-main, .detail-grid, .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; inset-inline-start: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 35; }
  .menu-toggle { display: inline-grid; }
  .topbar { padding: 0 12px; gap: 6px; }
  .topbar .search, .hide-sm { display: none !important; }
  .content { padding: 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row, .form-row-3, .form-row-4 { grid-template-columns: minmax(0, 1fr); }
  .filters input[type=search], .filters select { width: 100%; }
  .filters > * { flex: 1 1 100%; }
  .timer-chip a { max-width: 70px; }
  .calendar { grid-template-columns: repeat(7, minmax(86px, 1fr)); }
}

/* ---------- Print / Save as PDF ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --border: #cbd5e1; }
  .sidebar, .topbar, .no-print, .bulk-bar, .filters, .pager { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  body { font-size: 11.5px; background: #fff; }
  a { color: #000; text-decoration: none; }
  .table th { background: #f1f5f9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .badge, .fill-green, .fill-blue, .fill-amber, .fill-red, .fill-slate, .chart span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
