@font-face { font-family: 'Cairo'; font-weight: 400; font-display: swap; src: url(../fonts/cairo-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Cairo'; font-weight: 600; font-display: swap; src: url(../fonts/cairo-arabic-600-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Cairo'; font-weight: 700; font-display: swap; src: url(../fonts/cairo-arabic-700-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Cairo'; font-weight: 400; font-display: swap; src: url(../fonts/cairo-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Cairo'; font-weight: 600; font-display: swap; src: url(../fonts/cairo-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Cairo'; font-weight: 700; font-display: swap; src: url(../fonts/cairo-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }

:root {
  --bg: #f4f5f7; --surface: #fff; --border: #e3e6eb; --text: #172b4d; --muted: #6b778c;
  --primary: #4f46e5; --primary-l: color-mix(in srgb, var(--primary) 10%, #fff);
  --danger: #dc2626; --success: #059669; --warn: #d97706;
  --radius: 10px; --shadow: 0 1px 2px rgba(9,30,66,.08), 0 1px 3px rgba(9,30,66,.06);
  --side: 240px; --side-bg: #1e1b4b;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 10px; }
code { background: #eef0f3; padding: 1px 6px; border-radius: 4px; direction: ltr; unicode-bidi: isolate; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.ltr { direction: ltr; text-align: left; }
.ltr-inline { direction: ltr; unicode-bidi: isolate; }
.upper { text-transform: uppercase; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--danger) !important; font-weight: 600; }
.text-warn { color: var(--warn) !important; font-weight: 600; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.pad { padding: 18px; }
.mt { margin-top: 12px; }
.nomt { margin-top: 0 !important; }
.inline { display: inline; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-inline-end: 6px; flex: none; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.clamp1 { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.narrow { max-width: 640px; margin: 0 auto; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--side); background: var(--side-bg); color: #c7d2fe; display: flex; flex-direction: column; position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 40; transition: transform .2s; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 700; font-size: 15px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); display: grid; place-items: center; font-size: 18px; font-weight: 800; flex: none; }
.brand-img { max-width: 40px; max-height: 40px; border-radius: 8px; background: #fff; padding: 3px; }
.brand-name { line-height: 1.3; }
.sidebar nav { flex: 1; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: #c7d2fe; font-weight: 500; }
.nav-link:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav-link.active { background: rgba(255,255,255,.14); color: #fff; }
.nav-tx { flex: 1; }
.nav-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.nav-badge { background: #ef4444; color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 700; min-width: 20px; text-align: center; }
.nav-sep { height: 1px; background: rgba(255,255,255,.1); margin: 10px 4px; }
.nav-title { font-size: 11px; text-transform: uppercase; opacity: .6; padding: 0 12px 4px; letter-spacing: .5px; }
.sidebar-user { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.1); }
.su-name { color: #fff; font-weight: 600; font-size: 13px; }
.su-role { font-size: 11px; opacity: .75; }
.main { flex: 1; margin-inline-start: var(--side); padding: 0 28px 40px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 6px; padding: 12px 0 14px; position: sticky; top: 0; z-index: 30; background: var(--bg); }
.top-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; min-width: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; position: relative; }
.top-btn:hover { text-decoration: none; background: #f7f8fa; }
.top-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bell-count { position: absolute; top: -6px; inset-inline-end: -6px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 0 5px; min-width: 18px; text-align: center; }
.menu-toggle { display: none; }
.sidebar-scrim { display: none; }
.viewas-bar { position: sticky; top: 0; z-index: 70; background: #f59e0b; color: #1f1300; padding: 8px 18px; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; font-weight: 600; }
.guest { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, var(--side-bg), var(--primary)); gap: 12px; }
.guest-lang { position: absolute; top: 14px; inset-inline-end: 18px; }
.guest-lang a { color: #fff; font-weight: 600; }
.guest-alert { max-width: 420px; width: 100%; margin: 0; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; }
.card-head.flat { padding: 0 0 10px; border: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.span-2 { grid-column: span 2; }
.cols-2 > .card, .cols-3 > .card { margin-bottom: 0; }
.hint-line { margin: -6px 0 10px; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1.4; }
.btn:hover { background: #f7f8fa; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 85%, #000); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-warn { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.btn-warn:hover { background: #ffedd5; }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.icon-btn, .link-btn { background: none; border: 0; cursor: pointer; font: inherit; color: var(--muted); padding: 4px; }
.link-btn { font-size: 12px; }
.link-btn:hover { color: var(--danger); }
input, select, textarea { font: inherit; color: inherit; padding: 8px 10px; border: 1px solid #cfd5de; border-radius: 8px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
input:disabled, select:disabled { background: #f4f5f7; color: var(--muted); }
input[type=color] { padding: 2px; height: 38px; width: 70px; }
input[type=checkbox], input[type=radio] { width: auto; flex: none; }
input[type=file] { padding: 6px; }
textarea { resize: vertical; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label, .side-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.row-actions input:not([type=file]) { width: auto; flex: 1; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-inline-end: 40px; }
.pw-toggle { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; font-size: 15px; opacity: .6; }
.strength { display: block; height: 4px; background: #eef0f3; border-radius: 4px; overflow: hidden; }
.strength span { display: block; height: 100%; width: 0; transition: .2s; }
.strength .weak { background: var(--danger); } .strength .ok { background: var(--warn); } .strength .strong { background: var(--success); }
.otp-input { font-size: 24px; letter-spacing: 6px; text-align: center; font-weight: 700; }

/* ---------- Alerts / toast ---------- */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.copy-box { display: flex; gap: 8px; align-items: center; background: #fff; border: 1px dashed #93c5fd; border-radius: 8px; padding: 8px; margin-top: 8px; }
.copy-box code { flex: 1; word-break: break-all; background: none; font-size: 12px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 40px); background: #172b4d; color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; transition: .25s; z-index: 100; pointer-events: none; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--success); }

/* ---------- Auth ---------- */
.auth-card { background: #fff; padding: 32px; border-radius: 14px; width: 100%; max-width: 420px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-card.wide { max-width: 720px; }
.auth-card h1 { justify-content: center; text-align: center; }
.auth-card > p { text-align: center; margin-top: 0; }
.auth-logo { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 14px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 28px; font-weight: 800; }
.auth-img { display: block; max-width: 120px; max-height: 70px; margin: 0 auto 10px; }
.auth-links { margin: 16px 0 0; font-size: 13px; }
.req { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; }
.req .ok { color: var(--success); } .req .bad { color: var(--danger); font-weight: 700; }
.checklist { padding-inline-start: 18px; }
.checklist li { margin-bottom: 6px; }
.steps { padding-inline-start: 20px; }
.qr-box { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
#qr { width: 190px; height: 190px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 4px; }
#qr svg { width: 100%; height: 100%; }
.secret { font-size: 15px; letter-spacing: 1px; display: inline-block; margin-top: 4px; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.recovery-codes code { font-size: 15px; padding: 6px 10px; text-align: center; }

/* ---------- Avatars / badges ---------- */
.avatar { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; vertical-align: middle; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.group { background: #e0e7ff; font-size: 14px; }
.avatar-empty { background: #dfe1e6; color: var(--muted); }
.member-stack { display: flex; }
.member-stack .avatar { border: 2px solid var(--bg); margin-inline-start: -6px; }
.badge { display: inline-block; padding: 1px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: #eef0f3; color: #42526e; white-space: nowrap; vertical-align: middle; }
.badge.big { font-size: 13px; padding: 3px 12px; }
.st-todo { background: #eef0f3; color: #42526e; }
.st-in_progress { background: #dbeafe; color: #1d4ed8; }
.st-review { background: #fef3c7; color: #92400e; }
.st-done { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warn { background: #ffedd5; color: #9a3412; }
.badge-sample { background: #e0f2fe; color: #0369a1; border: 1px dashed #7dd3fc; font-weight: 600; }
.role-super_admin { background: #fae8ff; color: #86198f; }
.role-admin { background: #ede9fe; color: #5b21b6; }
.role-manager { background: #dbeafe; color: #1e40af; }
.status-active { background: #d1fae5; color: #065f46; }
.status-invited { background: #fef3c7; color: #92400e; }
.status-incomplete { background: #e0f2fe; color: #0369a1; }
.status-disabled { background: #fee2e2; color: #b91c1c; }
.chip { display: inline-block; background: #eef2ff; color: #3730a3; border-radius: 6px; padding: 0 6px; margin-inline-end: 4px; }
.prio { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.prio-low { background: #94a3b8; } .prio-medium { background: #3b82f6; } .prio-high { background: #f97316; }
.prio-urgent { background: #ef4444; box-shadow: 0 0 0 2px #fecaca; }
.type { width: 14px; height: 14px; border-radius: 3px; display: inline-block; flex: none; }
.type-task { background: #4bade8; } .type-bug { background: #e5493a; border-radius: 50%; } .type-story { background: #65ba43; }
.type-design { background: #a855f7; transform: rotate(45deg) scale(.85); } .type-content { background: #f59e0b; border-radius: 50% 0; }
.tkey { font-size: 12px; color: var(--muted); font-weight: 600; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.due { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.due.overdue { color: var(--danger); font-weight: 700; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { display: block; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-inline-start: 4px solid var(--primary); color: var(--text); }
a.stat:hover { text-decoration: none; box-shadow: 0 4px 12px rgba(9,30,66,.1); }
.stat-danger { border-inline-start-color: var(--danger); } .stat-success { border-inline-start-color: var(--success); } .stat-warn { border-inline-start-color: var(--warn); }
.stat-n { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat-l { color: var(--muted); font-size: 12.5px; }

/* ---------- Lists ---------- */
.task-list, .event-list, .links, .notif-list { list-style: none; margin: 0; padding: 0; }
.tl-row { display: flex; align-items: center; gap: 10px; padding: 10px 18px; color: var(--text); border-bottom: 1px solid #f0f1f4; }
.tl-row:hover { background: #fafbfc; text-decoration: none; }
.tl-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-list a { display: flex; gap: 12px; align-items: center; padding: 10px 18px; border-bottom: 1px solid #f0f1f4; color: var(--text); }
.event-list a:hover { background: #fafbfc; text-decoration: none; }
.ev-date { width: 46px; text-align: center; border-radius: 8px; background: color-mix(in srgb, var(--ec) 14%, #fff); color: var(--ec); padding: 4px 0; flex: none; }
.ev-date b { display: block; font-size: 18px; line-height: 1.1; } .ev-date small { font-size: 10px; }
.activity { list-style: none; margin: 0; padding: 6px 18px; }
.activity li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f1f4; font-size: 13px; }
.activity li:last-child { border: 0; }
.activity.compact { padding: 0; }
.activity.compact li { padding: 6px 0; }
.notif-list a { display: flex; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid #f0f1f4; color: var(--text); }
.notif-list a:hover { background: #fafbfc; text-decoration: none; }
.notif-list .unread a { background: var(--primary-l); }
.n-ic { font-size: 18px; width: 28px; text-align: center; }
.dot-unread { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }

/* ---------- Projects ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card .proj-grid { padding: 18px; }
.proj-card { display: flex; flex-direction: column; gap: 8px; background: #fff; border: 1px solid var(--border); border-top: 4px solid var(--pc); border-radius: var(--radius); padding: 14px 16px; color: var(--text); box-shadow: var(--shadow); transition: .15s; }
.proj-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(9,30,66,.1); text-decoration: none; }
.proj-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.proj-key { background: var(--pc); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px; direction: ltr; }
.proj-meta { display: flex; gap: 12px; color: var(--muted); flex-wrap: wrap; }
.progress { height: 6px; background: #eef0f3; border-radius: 6px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--success); border-radius: 6px; }
.tabs-inline { display: flex; gap: 14px; font-size: 13px; }
.tabs-inline a { color: var(--muted); padding-bottom: 2px; }
.tabs-inline a.on { color: var(--primary); border-bottom: 2px solid var(--primary); font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 8px 16px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state h2 { color: var(--text); }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filters input[type=search] { width: 220px; }
.filters select { width: auto; min-width: 130px; }
.filters input[type=date] { width: auto; }
.inline-label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.quick-ranges { display: flex; gap: 10px; font-size: 12.5px; flex-wrap: wrap; }
.seg { display: inline-flex; background: #e9ebef; border-radius: 8px; padding: 3px; flex-wrap: wrap; }
.seg a { padding: 4px 14px; border-radius: 6px; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg a.on { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.seg a:hover { text-decoration: none; }

/* ---------- Board ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 10px; }
.col { background: #ebecf0; border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 6px; font-weight: 700; font-size: 12.5px; color: #5e6c84; }
.col-head::before { content: ''; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 8px; background: #94a3b8; }
.col-in_progress .col-head::before { background: #3b82f6; } .col-review .col-head::before { background: #f59e0b; } .col-done .col-head::before { background: #10b981; }
.col-head span:first-child { flex: 1; }
.col-count { background: rgba(9,30,66,.08); border-radius: 10px; padding: 0 8px; font-size: 12px; }
.col-body { padding: 4px 8px; overflow-y: auto; min-height: 60px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.tcard { background: #fff; border-radius: 8px; padding: 10px 12px; box-shadow: 0 1px 1px rgba(9,30,66,.2); cursor: grab; }
.tcard:hover { background: #fafbfc; }
.tcard.is-sample { border: 1px dashed #7dd3fc; }
.tcard-title { font-weight: 500; margin-bottom: 8px; word-break: break-word; }
.tcard-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cnt { font-size: 11.5px; color: var(--muted); }
.tcard-ghost { opacity: .35; background: var(--primary-l); }
.tcard-drag { transform: rotate(2deg); box-shadow: 0 10px 20px rgba(0,0,0,.15); }
.col-done .tcard-title { color: var(--muted); }
.quick-add { padding: 6px 8px 10px; }
.quick-add input { background: transparent; border-color: transparent; }
.quick-add input:focus { background: #fff; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); background: #fafbfc; white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid #f0f1f4; vertical-align: middle; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #fafbfc; }
tr.inactive td { opacity: .55; }
tr.warn td { background: #fffbeb; }
.audit-details { max-width: 360px; word-break: break-all; }
.mini-bar { display: inline-block; width: 70px; height: 6px; background: #eef0f3; border-radius: 6px; overflow: hidden; vertical-align: middle; }
.mini-bar span { display: block; height: 100%; background: var(--success); }
.mini-bar span.bad { background: var(--warn); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; }

/* ---------- Task page ---------- */
.workflow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wf-status, .wf-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-layout { display: grid; grid-template-columns: 1fr 310px; gap: 18px; align-items: start; }
.task-key-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.task-title { font-size: 22px; margin: 0 0 12px; }
.title-input { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.desc { word-break: break-word; }
.side-form { display: flex; flex-direction: column; gap: 10px; }
.side-form label { font-size: 12px; color: var(--muted); }
.st-select { font-weight: 700; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12.5px; margin: 8px 0 0; }
.meta.wide { margin-bottom: 14px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.dropzone { position: relative; border: 2px dashed #cfd5de; border-radius: 10px; text-align: center; padding: 18px; margin-bottom: 10px; transition: .15s; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone.over { border-color: var(--primary); background: var(--primary-l); }
.dropzone.loading { opacity: .6; pointer-events: none; }
.link-form { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.link-form input { flex: 1; min-width: 160px; }
.links li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f1f4; }
.links a { word-break: break-all; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 10px; }
.file { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.file-thumb { width: 48px; height: 48px; border-radius: 6px; overflow: hidden; background: #eef0f3; display: grid; place-items: center; flex: none; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ficon { font-size: 11px; font-weight: 800; color: var(--primary); }
.ficon.big { font-size: 20px; }
.file-info { flex: 1; min-width: 0; }
.file-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text); }
.comments { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.comment { display: flex; gap: 10px; }
.comment-body { flex: 1; background: #f7f8fa; border-radius: 8px; padding: 8px 12px; word-break: break-word; }
.comment-return .comment-body { background: #fff7ed; border: 1px solid #fed7aa; }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.comment-head form { margin-inline-start: auto; }
.comment-form { display: flex; gap: 10px; align-items: flex-start; }
.member-list { list-style: none; padding: 0; margin: 0 0 16px; }
.member-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f1f4; }
.danger-zone { border-color: #fecaca; }
.roles-help summary { cursor: pointer; }
.roles-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 10px; }
.roles-grid p { margin: 4px 0 0; color: var(--muted); }
.user-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }

/* ---------- Approvals ---------- */
.approval { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.approval h3 { margin: 4px 0; font-size: 16px; }
.approval-main { flex: 1; min-width: 240px; }
.approval-actions { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.return-box summary { list-style: none; }
.return-box summary::-webkit-details-marker { display: none; }
.return-box[open] form { margin-top: 8px; width: 280px; }
.inline-details { display: inline-block; }
.inline-details summary { list-style: none; display: inline-flex; }
.inline-details summary::-webkit-details-marker { display: none; }
.restore-form { position: absolute; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px; width: 300px; box-shadow: 0 10px 30px rgba(0,0,0,.15); z-index: 20; white-space: normal; }

/* ---------- Calendar ---------- */
.cal-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-nav h2 { margin: 0; min-width: 160px; text-align: center; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); overflow: hidden; }
.cal-wd { padding: 8px; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); background: #fafbfc; border-bottom: 1px solid var(--border); }
.cal-day { min-height: 110px; border-inline-end: 1px solid #f0f1f4; border-bottom: 1px solid #f0f1f4; padding: 4px 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.cal-day:hover { background: #fafbfc; }
.cal-day.out { background: #fafafa; } .cal-day.out .cal-num { opacity: .4; }
.cal-day.today .cal-num { background: var(--primary); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
.cal-num { font-size: 12px; font-weight: 700; }
.cal-ev, .cal-task { display: block; font-size: 11.5px; border-radius: 4px; padding: 1px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev { background: color-mix(in srgb, var(--ec) 15%, #fff); color: color-mix(in srgb, var(--ec) 80%, #000); border-inline-start: 3px solid var(--ec); }
.cal-task { color: var(--text); background: #f4f5f7; border: 1px dashed color-mix(in srgb, var(--ec) 60%, #fff); }
.cal-ev:hover, .cal-task:hover { text-decoration: none; filter: brightness(.95); }

/* ---------- Chat ---------- */
.chat-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; height: calc(100vh - 110px); min-height: 480px; }
.chat-layout > .card { margin: 0; display: flex; flex-direction: column; min-height: 0; }
.chat-list ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.chat-list a { display: flex; gap: 10px; align-items: center; padding: 10px 14px; color: var(--text); border-bottom: 1px solid #f0f1f4; }
.chat-list a:hover { background: #fafbfc; text-decoration: none; }
.chat-list a.on { background: var(--primary-l); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-back { display: none; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #fafbfc; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 78%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.system { align-self: center; max-width: 90%; }
.msg.system .bubble { background: #eef2ff; color: #3730a3; font-size: 12.5px; text-align: center; }
.bubble { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; word-break: break-word; min-width: 80px; }
.msg.mine .bubble { background: var(--primary); color: #fff; border-color: var(--primary); }
.msg.mine .bubble a { color: #fff; text-decoration: underline; }
.msg.mine .link-btn, .msg.mine .msg-time { color: rgba(255,255,255,.8); }
.msg-author { font-size: 11.5px; font-weight: 700; color: var(--primary); }
.msg-time { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.msg-img { max-width: 240px; max-height: 240px; border-radius: 8px; display: block; margin-top: 4px; }
.msg-file { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.chat-form textarea { flex: 1; resize: none; min-height: 40px; max-height: 160px; }
.chat-form .attach { font-size: 20px; cursor: pointer; padding: 6px; }
.chat-file-name { width: 100%; }

/* ---------- Media library ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.media-item { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.media-thumb { height: 140px; background: #eef0f3; display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-thumb.link { background: linear-gradient(135deg, #eef2ff, #e0f2fe); text-align: center; }
.media-thumb.link span { font-size: 34px; display: block; }
.media-thumb:hover { text-decoration: none; }
.media-info { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.media-info p { margin: 0; }
.media-actions { display: flex; gap: 4px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }

/* ---------- Team Hub ---------- */
.hub-cat { margin: 18px 0 10px; color: var(--muted); font-size: 13px; text-transform: uppercase; }
.hub-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.hub-link { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; align-items: flex-start; }
.hub-link-main { display: flex; gap: 12px; padding: 14px; color: var(--text); flex: 1; min-width: 0; }
.hub-link-main:hover { text-decoration: none; background: #fafbfc; }
.hub-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.hub-link-tools { display: flex; flex-direction: column; padding: 6px; }
.guide-layout { display: grid; grid-template-columns: 230px 1fr; gap: 16px; align-items: start; }
.guide-nav { padding: 10px; }
.guide-nav ul { list-style: none; margin: 0 0 10px; padding: 0; }
.guide-nav a { display: block; padding: 7px 10px; border-radius: 6px; color: var(--text); }
.guide-nav a.on { background: var(--primary-l); color: var(--primary); font-weight: 600; }
.guide-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.md h3 { font-size: 18px; margin: 18px 0 8px; } .md h4 { font-size: 15px; margin: 14px 0 6px; }
.md ul { padding-inline-start: 22px; } .md li { margin-bottom: 4px; } .md p { margin: 0 0 8px; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.team-card { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; margin: 0; }
.team-card form { margin-top: 6px; }

/* ---------- Settings ---------- */
.logo-preview { display: flex; align-items: center; gap: 12px; }
.logo-preview img { max-height: 50px; max-width: 140px; border: 1px solid var(--border); border-radius: 6px; padding: 4px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(9,30,66,.5); display: none; align-items: flex-start; justify-content: center; padding: 50px 16px; z-index: 60; overflow-y: auto; }
.modal.open { display: flex; }
.modal-box { background: #fff; border-radius: 12px; padding: 20px 22px; width: 100%; max-width: 640px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; }
.x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }

.chart-box { position: relative; height: 260px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .cols-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .task-layout { grid-template-columns: 1fr; }
  .roles-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .rtl .sidebar { transform: translateX(100%); }
  .ltr .sidebar { transform: translateX(-100%); }
  .nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 39; }
  .main { margin-inline-start: 0; padding: 0 12px 30px; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; background: var(--side-bg); color: #fff; border: 0; border-radius: 8px; width: 38px; height: 36px; font-size: 18px; cursor: pointer; }
  .cols-2, .grid-2, .grid-3, .roles-grid, .user-actions, .guide-layout { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; max-height: none; }
  .filters input[type=search] { width: 100%; }
  .filters select { flex: 1; }
  .calendar { grid-template-columns: repeat(7, minmax(44px, 1fr)); font-size: 11px; }
  .cal-day { min-height: 70px; padding: 2px; }
  .cal-ev b { display: none; }
  .chat-layout { grid-template-columns: 1fr; height: calc(100vh - 80px); }
  .chat-layout.has-conv .chat-list { display: none; }
  .chat-layout:not(.has-conv) .chat-main { display: none; }
  .chat-back { display: inline-flex; }
  .msg { max-width: 92%; }
  .auth-card { padding: 24px 18px; }
  .table td, .table th { padding: 8px 10px; }
  h1 { font-size: 19px; }
  .restore-form { inset-inline-end: 0; }
}
@media print {
  .sidebar, .menu-toggle, .filters, .head-actions, .toast, .topbar, .viewas-bar { display: none !important; }
  .main { margin: 0; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* ===== v3 additions ===== */
.req .warn { color: #b45309; font-weight: 600; }
.code-box { flex-wrap: wrap; }
.big-code { font-size: 26px; font-weight: 800; letter-spacing: 6px; font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--primary); background: #eef2ff; border-radius: 8px; padding: 4px 12px; }
.choice-box { border: 2px solid #fdba74; background: #fff7ed; margin: 12px 0; }
.choice-box label.check { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; font-weight: 400; }
pre.log { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; max-height: 360px; overflow: auto; font-size: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-all; direction: ltr; text-align: left; margin: 8px 0; }
details > summary { cursor: pointer; margin: 8px 0; color: var(--primary); font-weight: 600; }
.start-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 10px 0 0; padding: 0; list-style: none; }
.start-steps li { background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 10px 12px; }
.start-steps li.done { opacity: .6; text-decoration: line-through; }
.start-steps a { font-weight: 700; }
