/* ════════════════════════════════════════════════════════════════════════
   Mokarrar PMS — Base UI (reads only from tokens.css custom properties)
   ════════════════════════════════════════════════════════════════════════ */

/* ── Reset / base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { overflow-x: clip; max-width: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    font-size: 14.5px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-variation-settings: 'wght' 400;
    transition: background .25s var(--ease), color .25s var(--ease);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
svg { display: inline-block; vertical-align: middle; }
.hidden { display: none !important; }

/* ── Utilities ────────────────────────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.grid { display: grid; }
.grid--2 { grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid--4 { grid-template-columns: repeat(4, 1fr); gap: 16px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; }
.text-xs { font-size: 12px; } .text-soft { color: var(--text-soft); }
.text-muted { color: var(--text-muted); } .fw-medium { font-weight: 600; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
    font-size: 13.5px; font-weight: 600; transition: all .15s var(--ease); white-space: nowrap;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-2); }
.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--text-muted); }
.btn--ghost:hover { background: var(--surface-3); color: var(--text); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--sm { padding: 6px 12px; font-size: 12.5px; }

/* ── Cards ────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); margin-bottom: 18px; overflow: hidden; }
.card__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card__title { font-size: 15px; font-weight: 700; }
.card__body { padding: 20px; }

/* ── Page head ────────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head__title { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.page-head__sub { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }

/* ── Stat cards ───────────────────────────────────────────────────────── */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; display: flex; align-items: center; gap: 15px; }
.stat__icon { width: 44px; height: 44px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.stat__value { font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat__label { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--neutral-soft); color: var(--text-muted); }
.badge--accent { background: var(--accent-soft); color: var(--accent); }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }

/* ── Forms ────────────────────────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.input, .select, .textarea {
    width: 100%; padding: 10px 13px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text); font-size: 13.5px; font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); background: var(--surface); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.8; }
.help { font-size: 12px; color: var(--text-soft); margin-top: 6px; line-height: 1.7; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 6px; }

/* Switch (toggle) */
.switch { position: relative; display: inline-block; width: 44px; height: 25px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: .2s var(--ease); cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 19px; height: 19px; right: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s var(--ease); box-shadow: var(--shadow-xs); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(-19px); }

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 15px; border: none; background: transparent; color: var(--text-muted); font-size: 13.5px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.tab:hover { color: var(--text); background: var(--surface-3); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 11px 14px; text-align: right; border-bottom: 1px solid var(--border); }
table.data th { font-size: 12px; font-weight: 700; color: var(--text-soft); background: var(--surface-2); }
table.data tbody tr:hover, table.data tr:hover { background: var(--surface-2); }

/* ── Admin shell ──────────────────────────────────────────────────────── */
.admin { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-inline-end: 1px solid var(--border); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.sidebar__brand { height: var(--header-h); display: flex; align-items: center; gap: 10px; padding: 0 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; font-weight: 800; font-size: 15px; }
.sidebar__brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.sidebar__brand small { display: block; font-size: 11px; color: var(--text-muted); font-weight: 600; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-section__title { font-size: 10.5px; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: .6px; padding: 14px 12px 7px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 2px; position: relative; transition: all .14s var(--ease); }
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent); }
.nav-link.is-active::before { content: ''; position: absolute; inset-inline-start: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 18px; border-radius: 4px; background: var(--accent); }
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link__badge { margin-inline-start: auto; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.sidebar__foot { padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0; }

.admin__main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: var(--header-h); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.topbar__title { font-weight: 700; font-size: 15px; }
.topbar__actions { display: flex; align-items: center; gap: 7px; margin-inline-start: auto; }
.icon-btn { width: 38px; height: 38px; border-radius: var(--radius-sm); display: grid; place-items: center; color: var(--text-muted); background: transparent; border: none; transition: all .15s var(--ease); position: relative; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot { position: absolute; top: 8px; inset-inline-end: 9px; width: 7px; height: 7px; background: var(--accent); border-radius: 50%; border: 1.5px solid var(--surface); }
.admin__content { padding: 26px 24px 50px; flex: 1; max-width: 1500px; width: 100%; margin-inline: auto; }
.ws-switch { display: flex; align-items: center; gap: 8px; }
.ws-switch .select { padding: 6px 10px; font-size: 12.5px; width: auto; }

.menu-toggle { display: none; }
.sidebar-overlay { display: none; }

/* ── Flash ────────────────────────────────────────────────────────────── */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.flash--success { background: var(--success-soft); color: var(--success); }
.flash--error { background: var(--danger-soft); color: var(--danger); }
.flash--info { background: var(--info-soft); color: var(--info); }
.flash--warning { background: var(--warning-soft); color: var(--warning); }

/* ── Avatars ──────────────────────────────────────────────────────────── */
.avatar, .avatar-sm { display: inline-grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; flex-shrink: 0; overflow: hidden; }
.avatar { width: 40px; height: 40px; font-size: 14px; }
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.avatar img, .avatar-sm img { width: 100%; height: 100%; object-fit: cover; }

/* ── Toolbar / filters ────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .input, .toolbar .select { width: auto; }
.toolbar__search { position: relative; flex: 1; min-width: 200px; max-width: 380px; }
.toolbar__search .input { width: 100%; padding-inline-start: 38px; }
.toolbar__search .ico { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--text-soft); pointer-events: none; }
.toolbar .spacer { flex: 1; }

/* ── Status pills ─────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--active { background: var(--success-soft); color: var(--success); }
.pill--suspended { background: var(--danger-soft); color: var(--danger); }

/* ── Table actions ────────────────────────────────────────────────────── */
.row-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-start; }
.act { width: 32px; height: 32px; border-radius: var(--radius-sm); display: grid; place-items: center; color: var(--text-muted); border: 1px solid transparent; background: transparent; }
.act:hover { background: var(--surface-3); color: var(--text); }
.act--danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ── Pagination ───────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 34px; height: 34px; padding: 0 10px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; border: 1px solid var(--border); color: var(--text-muted); }
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .is-disabled { opacity: .45; }

/* ── Forms extras ─────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .col-2 { grid-column: 1 / -1; }
.checkbox, .radio { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.checkbox input, .radio input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ── Empty state ──────────────────────────────────────────────────────── */
.empty-state { padding: 46px 20px; text-align: center; color: var(--text-soft); }
.empty-state svg { opacity: .5; margin-bottom: 8px; }

/* ── Auth extras ──────────────────────────────────────────────────────── */
.auth-links { display: flex; justify-content: space-between; margin-top: 16px; font-size: 13px; }
.auth-links a { color: var(--accent); font-weight: 600; }
.auth-sep { text-align: center; color: var(--text-soft); font-size: 12.5px; margin: 18px 0; position: relative; }
.otp-input { text-align: center; letter-spacing: 12px; font-size: 24px; font-weight: 700; font-family: monospace; padding-inline: 12px; }

/* ── 2FA / QR card ────────────────────────────────────────────────────── */
.qr-box { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.qr-box img { width: 190px; height: 190px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; padding: 8px; }
.secret-key { font-family: monospace; direction: ltr; background: var(--surface-3); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; letter-spacing: 2px; word-break: break-all; display: inline-block; }

/* ── Permission matrix ────────────────────────────────────────────────── */
.matrix-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.matrix { border-collapse: collapse; width: 100%; font-size: 13px; }
table.matrix th, table.matrix td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
table.matrix thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; font-weight: 700; }
table.matrix th.perm-col, table.matrix td.perm-col { text-align: right; position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; min-width: 240px; box-shadow: 1px 0 0 var(--border); }
table.matrix tbody tr:hover td { background: var(--surface-2); }
table.matrix tbody tr:hover td.perm-col { background: var(--surface-3); }
.matrix__group td { background: var(--surface-3); font-weight: 700; text-align: right; color: var(--text); }
.matrix input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.matrix .col-super { color: var(--accent); font-weight: 700; }
.role-head { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.role-head small { font-weight: 500; color: var(--text-soft); font-size: 10.5px; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .admin { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset-inline-start: 0; top: 0; z-index: 120; transform: translateX(100%); transition: transform .25s var(--ease); width: var(--sidebar-w); }
    [dir='ltr'] .sidebar { transform: translateX(-100%); }
    .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .menu-toggle { display: grid; }
    .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 110; display: none; }
    .sidebar-overlay.is-open { display: block; }
}
@media (max-width: 720px) {
    .grid--4 { grid-template-columns: repeat(2, 1fr); }
    .grid--3, .grid--2 { grid-template-columns: 1fr; }
}

/* ── Notification bell + dropdown ─────────────────────────────────────── */
.notif { position: relative; }
.notif__badge { position: absolute; top: 4px; inset-inline-end: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 1.5px solid var(--surface); }
.notif__panel { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: 340px; max-width: 90vw; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 200; overflow: hidden; animation: pop .16s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.notif__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 13.5px; }
.notif__markall { border: none; background: none; color: var(--accent); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.notif__list { max-height: 380px; overflow-y: auto; }
.notif__item { display: block; padding: 12px 14px; border-bottom: 1px solid var(--border); transition: background .12s; }
.notif__item:hover { background: var(--surface-2); }
.notif__item.is-unread { background: var(--accent-soft); }
.notif__item.is-unread:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.notif__item-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.notif__item-body { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.notif__item-time { font-size: 11px; color: var(--text-soft); margin-top: 4px; }
.notif__empty { padding: 34px 14px; text-align: center; color: var(--text-soft); font-size: 13px; }

/* ── Toasts ───────────────────────────────────────────────────────────── */
.toast-wrap { position: fixed; bottom: 22px; inset-inline-start: 22px; z-index: 400; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast { display: flex; gap: 11px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-inline-start: 3px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 13px 15px; opacity: 0; transform: translateX(-16px); transition: opacity .3s var(--ease), transform .3s var(--ease); }
[dir='rtl'] .toast { transform: translateX(16px); }
.toast.is-in { opacity: 1; transform: translateX(0); }
.toast__icon { font-size: 18px; line-height: 1; }
.toast__title { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.toast__body { font-size: 12px; color: var(--text-muted); line-height: 1.6; }

/* ── Projects ─────────────────────────────────────────────────────────── */
.proj-key { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 6px; color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .5px; direction: ltr; }
.proj-card { transition: border-color .15s, transform .15s; }
.proj-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.progress { height: 7px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.proj-tabs { margin-top: -6px; }
.col-edit { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.col-edit__form { display: flex; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap; }

/* ── Board toolbar / segments ─────────────────────────────────────────── */
.board-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.seg__btn { padding: 5px 11px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.seg__btn.is-active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-xs); }

/* ── Kanban board ─────────────────────────────────────────────────────── */
.board-scroll { overflow-x: auto; padding-bottom: 8px; }
.board { min-width: min-content; }
.swimlane { margin-bottom: 14px; }
.swimlane__head { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-muted); padding: 6px 4px; position: sticky; inset-inline-start: 0; }
.board__cols { display: flex; gap: 12px; align-items: flex-start; }
.bcol { flex: 0 0 288px; width: 288px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 240px); }
.bcol.is-blocked { outline: 2px dashed var(--danger); outline-offset: 1px; }
.bcol__head { display: flex; align-items: center; justify-content: space-between; padding: 11px 13px; border-top: 3px solid var(--border-strong); border-radius: var(--radius) var(--radius) 0 0; font-weight: 700; font-size: 13px; }
.bcol__count { font-size: 11.5px; font-weight: 700; color: var(--text-soft); background: var(--surface-3); padding: 2px 8px; border-radius: 999px; }
.bcol__count.is-over { background: var(--danger-soft); color: var(--danger); }
.bcol__body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 9px; min-height: 80px; }

/* Task card */
.tcard { background: var(--surface); border: 1px solid var(--border); border-inline-start: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 11px 12px; cursor: grab; box-shadow: var(--shadow-xs); transition: box-shadow .15s, transform .05s; position: relative; }
.tcard:hover { box-shadow: var(--shadow-sm); }
.tcard.dragging { opacity: .5; cursor: grabbing; }
.tcard__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.tcard__key { font-size: 11px; font-weight: 700; color: var(--text-soft); direction: ltr; }
.tcard__prio { width: 9px; height: 9px; border-radius: 50%; }
.tcard__title { font-size: 13px; font-weight: 500; line-height: 1.6; margin-bottom: 8px; }
.tcard__dod { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.tcard__dod-bar { flex: 1; height: 5px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.tcard__dod-bar > span { display: block; height: 100%; background: var(--success); }
.tcard__dod-num { font-size: 10.5px; color: var(--text-soft); }
.tcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tcard__meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--text-muted); background: var(--surface-3); padding: 2px 7px; border-radius: 6px; }
.chip--danger { background: var(--danger-soft); color: var(--danger); }
.tcard__avatars { display: flex; }
.tcard__avatars .avatar-sm { margin-inline-start: -6px; border: 2px solid var(--surface); }
.tcard__avatars .avatar-sm:first-child { margin-inline-start: 0; }
.tcard__sla { position: absolute; bottom: 0; inset-inline: 0; height: 3px; background: var(--surface-3); border-radius: 0 0 var(--radius-sm) var(--radius-sm); overflow: hidden; }
.tcard__sla > span { display: block; height: 100%; }
.tcard__sla--green > span { background: var(--success); }
.tcard__sla--yellow > span { background: var(--warning); }
.tcard__sla--red > span { background: var(--danger); }
.tcard__sla--breached { background: var(--danger); }
.tcard__sla--breached > span { background: var(--danger); width: 100% !important; }

/* ── Backlog (Scrum) ──────────────────────────────────────────────────── */
.backlog-task { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 8px; cursor: grab; }
.backlog-task.dragging { opacity: .5; }
.backlog-zone { min-height: 60px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 8px; transition: border-color .15s, background .15s; }
.backlog-zone.drop-over { border-color: var(--accent); background: var(--accent-soft); }
.sprint-card { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.sprint-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }

/* ── Calendar ─────────────────────────────────────────────────────────── */
.cal { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal__dow { padding: 10px; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal__cell { min-height: 108px; border-inline-end: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; position: relative; }
.cal__cell.is-empty { background: var(--surface-2); }
.cal__cell.is-today { background: var(--accent-soft); }
.cal__day { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 5px; }
.cal__task { display: block; font-size: 11px; padding: 3px 6px; border-radius: 5px; margin-bottom: 3px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Dependency graph ─────────────────────────────────────────────────── */
#depGraph { width: 100%; height: 600px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
#depGraph svg { width: 100%; height: 100%; }
.gnode rect { fill: var(--surface-2); stroke: var(--border-strong); rx: 8; }
.gnode.done rect { fill: var(--success-soft); stroke: var(--success); }
.gnode text { font-family: var(--font); font-size: 11px; fill: var(--text); }
.gnode__key { font-weight: 700; }
.gedge { stroke: var(--text-soft); stroke-width: 1.6; fill: none; }
.gedge--blocks { stroke: var(--danger); }
.gedge--relates_to { stroke-dasharray: 4 3; }

/* ── Task detail ──────────────────────────────────────────────────────── */
.task-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.dod-item { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.dod-item input { width: 16px; height: 16px; accent-color: var(--success); }
.dod-item.done label { text-decoration: line-through; color: var(--text-soft); }
.sla-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.sla-bar > span { display: block; height: 100%; }
.subtree { list-style: none; padding-inline-start: 16px; border-inline-start: 1px solid var(--border); margin-inline-start: 4px; }
.subtree li { padding: 4px 0; }
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.meta-row__k { color: var(--text-muted); }
@media (max-width: 900px) { .task-layout { grid-template-columns: 1fr; } }

/* ── Dynamic form (record forms / preview) ────────────────────────────── */
.dynform { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.dynfield { grid-column: 1 / -1; }
.dynfield--half { grid-column: span 1; }
@media (max-width: 640px) { .dynform { grid-template-columns: 1fr; } .dynfield--half { grid-column: 1 / -1; } }

/* ── Form Builder (split-screen designer) ─────────────────────────────── */
.builder { display: grid; grid-template-columns: 220px 1fr 300px; gap: 16px; align-items: start; }
.builder__palette, .builder__props { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; position: sticky; top: 84px; }
.builder__ptitle { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .4px; }
.palette-item { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; font-weight: 600; margin-bottom: 7px; cursor: grab; color: var(--text-muted); transition: border-color .12s, color .12s; }
.palette-item:hover { border-color: var(--accent); color: var(--accent); }
.builder__canvas { min-height: 400px; background: var(--surface-2); border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.fb-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-soft); gap: 8px; min-height: 300px; }
.fb-field { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.fb-field:hover { border-color: var(--border-strong); }
.fb-field.is-selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.fb-field__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fb-field__label { font-size: 13.5px; font-weight: 600; }
.fb-field__meta { display: flex; align-items: center; gap: 5px; }
.fb-field__meta .act { width: 24px; height: 24px; font-size: 13px; }
.fb-field__prev { font-size: 11.5px; color: var(--text-soft); margin-top: 4px; direction: ltr; text-align: right; }
.fb-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 980px) { .builder { grid-template-columns: 1fr; } .builder__palette, .builder__props { position: static; } .builder__palette { display: flex; flex-wrap: wrap; gap: 7px; } .palette-item { margin-bottom: 0; } }

/* ── Workflow designer ────────────────────────────────────────────────── */
.wf { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
.wf__canvas { min-height: 420px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; position: relative; }
.wf__panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; position: sticky; top: 84px; min-height: 200px; }
.wf-edge { stroke: var(--accent); stroke-width: 2; fill: none; }
.wf-edge.is-sel { stroke-width: 3.5; }
.wf-node text { user-select: none; }
@media (max-width: 900px) { .wf { grid-template-columns: 1fr; } .wf__panel { position: static; } }

/* ── Automation rows ──────────────────────────────────────────────────── */
.auto-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--border); }
.auto-row .select, .auto-row .input { width: auto; min-width: 130px; }
.auto-val, .auto-params { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; }
.auto-params .input { flex: 1; }

/* ── Resource workload heatmap ────────────────────────────────────────── */
table.heat { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.heat th, table.heat td { padding: 8px 6px; text-align: center; border: 1px solid var(--border); }
table.heat thead th { background: var(--surface-2); font-weight: 700; color: var(--text-muted); font-size: 11.5px; }
table.heat .heat__u { text-align: right; min-width: 180px; position: sticky; inset-inline-start: 0; background: var(--surface); }
table.heat .heat__c { color: var(--text-soft); white-space: nowrap; }
.heat-cell { font-weight: 700; }
.heat-cell__h { font-size: 13px; }
.heat-cell__p { font-size: 10px; font-weight: 500; opacity: .8; }
.heat--green { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.heat--yellow { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--warning); }
.heat--red { background: color-mix(in srgb, var(--danger) 20%, transparent); color: var(--danger); }
.heat--idle { color: var(--text-soft); }
.heat-key { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.heat-key.heat--green { background: var(--success); }
.heat-key.heat--yellow { background: var(--warning); }
.heat-key.heat--red { background: var(--danger); }
.heat-key.heat--idle { background: var(--surface-3); border: 1px solid var(--border); }

/* ── Risk matrix ──────────────────────────────────────────────────────── */
table.risk-matrix { border-collapse: collapse; width: 100%; }
table.risk-matrix th, table.risk-matrix td { border: 1px solid var(--border); padding: 6px; text-align: center; }
table.risk-matrix thead th { background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--text-muted); }
.rm-corner { background: var(--surface-2); font-size: 11px !important; }
.rm-row { background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.rm-cell { vertical-align: top; min-width: 96px; height: 70px; }
.rm-exp { font-weight: 800; font-size: 13px; }
.rm-chip { display: block; font-size: 10.5px; background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; margin-top: 3px; color: var(--text); }
.rm-more { font-size: 10px; color: var(--text-soft); margin-top: 2px; }

/* ── Markdown rendering ───────────────────────────────────────────────── */
.markdown { line-height: 1.9; font-size: 14px; }
.markdown h1 { font-size: 22px; font-weight: 800; margin: 12px 0 8px; }
.markdown h2 { font-size: 18px; font-weight: 700; margin: 12px 0 6px; }
.markdown h3 { font-size: 15.5px; font-weight: 700; margin: 10px 0 5px; }
.markdown p { margin: 6px 0; }
.markdown ul, .markdown ol { padding-inline-start: 22px; margin: 6px 0; }
.markdown li { margin: 3px 0; }
.markdown code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; direction: ltr; }
.markdown pre { background: var(--surface-3); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; direction: ltr; }
.markdown pre code { background: none; padding: 0; }
.markdown blockquote { border-inline-start: 3px solid var(--accent); padding-inline-start: 12px; color: var(--text-muted); margin: 8px 0; }
.markdown a { color: var(--accent); }
.markdown hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ── Wiki ─────────────────────────────────────────────────────────────── */
.wiki { display: grid; grid-template-columns: 250px 1fr; gap: 18px; align-items: start; }
.wiki__tree { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow-y: auto; }
.wtree__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.wtree { padding: 8px; }
.wtree__link { display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-muted); }
.wtree__link:hover { background: var(--surface-3); color: var(--text); }
.wtree__link.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.wtree__link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiki__main { min-width: 0; }
.wiki__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.wiki__title { font-size: 26px; font-weight: 800; border: none; background: none; outline: none; flex: 1; color: var(--text); font-family: inherit; }
.wiki__editor { }
.wblock { display: flex; align-items: flex-start; gap: 6px; padding: 2px 0; position: relative; }
.wblock__type { width: auto; min-width: 96px; padding: 4px 8px; font-size: 11.5px; border: 1px solid transparent; background: transparent; color: var(--text-soft); border-radius: 6px; flex-shrink: 0; opacity: 0; transition: opacity .12s; }
.wblock:hover .wblock__type { opacity: 1; border-color: var(--border); }
.wblock__content { flex: 1; padding: 4px 6px; border-radius: 6px; outline: none; line-height: 1.8; min-height: 1.6em; }
.wblock__content:focus { background: var(--surface-2); }
.wblock__content[data-ph]:empty::before { content: attr(data-ph); color: var(--text-soft); }
.wblock--h1 .wblock__content { font-size: 24px; font-weight: 800; }
.wblock--h2 .wblock__content { font-size: 19px; font-weight: 700; }
.wblock--h3 .wblock__content { font-size: 16px; font-weight: 700; }
.wblock--quote .wblock__content { border-inline-start: 3px solid var(--accent); color: var(--text-muted); background: var(--surface-2); }
.wblock--code .wblock__content { font-family: monospace; background: var(--surface-3); direction: ltr; font-size: 13px; white-space: pre-wrap; }
.wblock--bullet .wblock__content, .wblock--numbered .wblock__content { white-space: pre-wrap; }
.wblock__hr { flex: 1; padding: 10px 0; }
.wblock__hr hr { border: none; border-top: 1px solid var(--border-strong); }
.wblock__del { opacity: 0; border: none; background: none; color: var(--text-soft); cursor: pointer; padding: 4px 6px; flex-shrink: 0; }
.wblock:hover .wblock__del { opacity: 1; }
@media (max-width: 820px) { .wiki { grid-template-columns: 1fr; } .wiki__tree { position: static; max-height: none; } }

/* ── Diff ─────────────────────────────────────────────────────────────── */
.diff-view { font-size: 13.5px; line-height: 1.9; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.diff-line { padding: 3px 12px; display: flex; gap: 8px; }
.diff-sign { width: 14px; color: var(--text-soft); flex-shrink: 0; text-align: center; }
.diff--add { background: var(--success-soft); }
.diff--del { background: var(--danger-soft); text-decoration: line-through; color: var(--text-muted); }
.diff-key { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.diff-key.diff--add { background: var(--success); }
.diff-key.diff--del { background: var(--danger); }

/* ════════════════════════════════════════════════════════════════════════
   Phase 5 — Whiteboard, Mind Map & Decision Log
   ════════════════════════════════════════════════════════════════════════ */

/* ── Shared board head (title row above the canvas) ─────────────────────── */
.wb-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; flex-wrap: wrap; }
.wb-head__title { display: flex; align-items: center; gap: 7px; font-size: 16px; font-weight: 800; margin: 0; }
.input--sm { padding: 5px 9px; font-size: 13px; }

/* Board / map gallery thumbnails */
.wb-thumb { height: 118px; display: grid; place-items: center; color: var(--accent);
    background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 12px, var(--surface-3) 12px, var(--surface-3) 24px);
    border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }

/* ── Whiteboard shell ──────────────────────────────────────────────────── */
.wb, .mm { display: flex; flex-direction: column; height: calc(100vh - 208px); min-height: 460px;
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.wb__bar { display: flex; align-items: center; gap: 10px; padding: 7px 10px; flex-wrap: wrap;
    background: var(--surface-2); border-bottom: 1px solid var(--border); }
.wb__group { display: flex; align-items: center; gap: 3px; padding: 2px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm); }
.wb__tool, .wb__btn { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 7px;
    border: none; background: transparent; color: var(--text-soft); border-radius: 7px; cursor: pointer;
    font-size: 12.5px; font-weight: 700; gap: 4px; transition: background .12s var(--ease), color .12s var(--ease); }
.wb__tool:hover, .wb__btn:hover { background: var(--surface-3); color: var(--text); }
.wb__tool.is-active { background: var(--accent); color: #fff; }
.wb__zoom { gap: 1px; }
.wb__zoom .wb__btn { min-width: 30px; }
.wb__colors { gap: 5px; padding: 4px 6px; }
.wb__swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--surface); cursor: pointer;
    box-shadow: 0 0 0 1px var(--border); transition: transform .1s var(--ease); }
.wb__swatch:hover { transform: scale(1.12); }
.wb__swatch.is-active { box-shadow: 0 0 0 2px var(--accent); transform: scale(1.12); }
.wb__status { font-size: 12px; color: var(--text-muted); min-width: 74px; text-align: left; }
.wb__presence { display: flex; align-items: center; }
.wb-avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
    color: #fff; font-size: 10.5px; font-weight: 800; margin-inline-start: -7px; border: 2px solid var(--surface); }

.wb__stage { position: relative; flex: 1; overflow: hidden; background: var(--surface);
    touch-action: none; user-select: none; }
.wb__stage canvas { display: block; position: absolute; inset: 0; }
.wb__cursors { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.wb-cursor { position: absolute; top: 0; left: 0; will-change: transform; transition: transform .09s linear; }
.wb-cursor__name { position: absolute; top: 14px; inset-inline-start: 12px; white-space: nowrap; color: #fff;
    font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 8px; box-shadow: var(--shadow-xs); }
.wb__editor { position: absolute; display: none; z-index: 5; border: 2px solid var(--accent); border-radius: 6px;
    padding: 8px 10px; resize: none; outline: none; background: #fff; font-family: var(--font);
    line-height: 1.4; box-shadow: var(--shadow-lg); overflow: hidden; }

/* ── Mind map ──────────────────────────────────────────────────────────── */
.mm__stage { position: relative; flex: 1; overflow: hidden; background:
    radial-gradient(circle at 1px 1px, rgba(120,120,130,0.18) 1px, transparent 0) 0 0 / 26px 26px, var(--surface);
    cursor: grab; user-select: none; }
.mm__edges { position: absolute; inset: 0; transform-origin: 0 0; overflow: visible; pointer-events: none; }
.mm__nodes { position: absolute; inset: 0; transform-origin: 0 0; }
.mm-node { position: absolute; min-width: 96px; max-width: 220px; padding: 9px 13px; background: var(--surface);
    border: 2px solid var(--accent); border-radius: 11px; box-shadow: var(--shadow-xs); cursor: grab;
    font-size: 13.5px; font-weight: 600; color: var(--text); }
.mm-node.is-selected { box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-sm); }
.mm-node__text { display: block; outline: none; word-break: break-word; line-height: 1.5; }
.mm-node__text.is-editing { cursor: text; }
.mm-node__toggle { position: absolute; inset-inline-start: -12px; top: 50%; transform: translateY(-50%);
    width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; cursor: pointer;
    background: var(--surface); border: 1.5px solid var(--border-strong); color: var(--text-soft);
    font-size: 15px; font-weight: 800; line-height: 1; padding: 0; }
.mm-node__toggle:hover { border-color: var(--accent); color: var(--accent); }
.mm__hint { padding: 7px 12px; border-top: 1px solid var(--border); background: var(--surface-2);
    display: flex; align-items: center; gap: 6px; font-size: 12px; }

/* ── Decision log ──────────────────────────────────────────────────────── */
.opt-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.dec-print { max-width: 900px; margin: 0 auto; }
.dec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
    padding-bottom: 14px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.dec-eyebrow { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--accent); }
.dec-title { font-size: 24px; font-weight: 800; margin: 6px 0 0; line-height: 1.35; }
.dec-meta { display: flex; flex-wrap: wrap; gap: 26px; margin-bottom: 20px; }
.dec-meta__k { display: block; font-size: 11.5px; color: var(--text-muted); margin-bottom: 2px; }
.dec-meta__v { font-size: 14px; font-weight: 700; }
.dec-sec { margin-bottom: 20px; }
.dec-sec h3 { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 800; margin: 0 0 8px;
    padding-inline-start: 10px; border-inline-start: 3px solid var(--accent); }
.dec-sec--decision { background: var(--success-soft); border-radius: var(--radius); padding: 14px 16px; }
.dec-sec--decision h3 { border-inline-start-color: var(--success); }
.md-body { line-height: 1.85; color: var(--text); white-space: pre-wrap; }
.md-body p { margin: 0 0 8px; }
.dec-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dec-table th, .dec-table td { border: 1px solid var(--border); padding: 9px 11px; text-align: start; vertical-align: top; }
.dec-table th { background: var(--surface-2); font-weight: 700; }
.dec-pros { color: var(--success); } .dec-cons { color: var(--danger); }

@media (max-width: 720px) {
    .opt-row { grid-template-columns: 1fr 1fr; }
    .wb, .mm { height: calc(100vh - 240px); }
}

/* ── Print (Decision record) ───────────────────────────────────────────── */
@media print {
    .admin__sidebar, .sidebar, .sidebar-overlay, .admin__main > .topbar, .topbar,
    .proj-tabs, .page-head, .toolbar, .no-print, .flash { display: none !important; }
    .admin, .admin__main, .admin__content { display: block !important; margin: 0 !important; padding: 0 !important; }
    .dec-print { max-width: none; box-shadow: none; border: none; }
    .dec-print.card, .dec-print .card__body { border: none !important; box-shadow: none !important; padding: 0 !important; }
    .dec-sec--decision { background: #f4f7f4 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    body { background: #fff !important; }
}

/* ── Phase 5 Part 2 — Task comments & mentions ─────────────────────────── */
.comments .card__title .badge { margin-inline-start: 6px; }
.comment-thread { display: flex; flex-direction: column; }
.comment { display: flex; gap: 11px; padding: 12px 0; border-top: 1px solid var(--border); }
.comment:first-child { border-top: none; }
.comment__avatar { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    color: #fff; font-size: 12px; font-weight: 800; }
.comment__main { flex: 1; min-width: 0; }
.comment__head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.comment__head b { font-weight: 700; }
.comment__time { color: var(--text-muted); font-size: 11.5px; }
.comment__body { margin: 4px 0 6px; line-height: 1.8; font-size: 13.5px; word-break: break-word; }
.comment__body p { margin: 0 0 6px; }
.comment__body pre { background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius-sm); overflow-x: auto; }
.comment__foot { display: flex; gap: 12px; }
.comment__act { display: inline-flex; align-items: center; gap: 4px; background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 12px; font-weight: 600; padding: 0; }
.comment__act:hover { color: var(--accent); }
.comment__act--del:hover { color: var(--danger); }
.comment__replies { margin-top: 8px; padding-inline-start: 14px; border-inline-start: 2px solid var(--border); }
.comment__replies:empty { display: none; }
.comment__replies .comment { padding: 9px 0; }

.mention { background: var(--accent-soft); color: var(--accent); font-weight: 700; padding: 0 4px; border-radius: 5px; }

.comment-composer { display: flex; gap: 11px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.comment-composer__box { flex: 1; position: relative; }
.comment-composer__box .textarea { width: 100%; resize: none; min-height: 40px; }
.comment-composer__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; }
.reply-box { margin-bottom: 8px; }
.reply-box .textarea { width: 100%; resize: none; }
.reply-box__foot { display: flex; gap: 6px; margin-top: 5px; }

.mention-menu { position: absolute; z-index: 20; inset-inline-start: 0; top: 100%; margin-top: 3px; min-width: 210px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); overflow: hidden; max-height: 220px; overflow-y: auto; }
.mention-opt { display: block; width: 100%; text-align: start; padding: 7px 11px; background: none; border: none; cursor: pointer;
    font-size: 12.5px; font-weight: 700; color: var(--accent); }
.mention-opt span { color: var(--text-muted); font-weight: 500; margin-inline-start: 5px; }
.mention-opt:hover { background: var(--surface-2); }

/* ── Phase 5 Part 3 — Developer Hub ─────────────────────────────────────── */
.token-reveal { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px dashed var(--success);
    border-radius: var(--radius-sm); padding: 10px 12px; }
.token-reveal code { font-size: 13px; word-break: break-all; flex: 1; }
.api-hint { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.api-hint pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 9px 12px; overflow-x: auto; font-size: 12.5px; margin: 4px 0 8px; }
.api-hint code, .card__body code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.hook-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0;
    border-top: 1px solid var(--border); }
.hook-row:first-of-type { border-top: none; }
.hook-row__main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.hook-url { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 4px 9px; font-size: 12px; color: var(--text); }
.table--sm th, .table--sm td { padding: 6px 8px; font-size: 12.5px; }

/* ════════════════════════════════════════════════════════════════════════
   Phase 6 — Analytics, OKR & KPI dashboard
   ════════════════════════════════════════════════════════════════════════ */

/* ── OKR ────────────────────────────────────────────────────────────────── */
.okr-add > summary, .kr-add > summary { cursor: pointer; list-style: none; }
.okr-add > summary { padding: 12px 16px; font-weight: 700; }
.okr-add > summary::-webkit-details-marker, .kr-add > summary::-webkit-details-marker { display: none; }
.okr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.okr__head { display: flex; align-items: flex-start; gap: 14px; }
.okr__ring { flex: 0 0 auto; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
    background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0); }
.okr__ring span { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); display: grid; place-items: center;
    font-size: 12px; font-weight: 800; }
.okr__title { flex: 1; min-width: 0; }
.okr__title b { font-size: 15.5px; font-weight: 800; }
.okr__actions { display: flex; align-items: center; gap: 4px; position: relative; }
.okr__bar { height: 8px; border-radius: 5px; background: var(--surface-3); overflow: hidden; margin-top: 12px; }
.okr__bar span { display: block; height: 100%; border-radius: 5px; transition: width .4s var(--ease); }
.okr__bar--sm { height: 6px; margin-top: 5px; }
.okr__krs { margin-top: 12px; padding-top: 4px; border-top: 1px dashed var(--border); }
.kr { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.kr:last-of-type { border-bottom: none; }
.kr__main { flex: 1; min-width: 0; }
.kr__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kr__title { font-weight: 600; font-size: 13.5px; }
.kr__vals { color: var(--text-muted); font-size: 12px; margin-inline-start: auto; }
.kr__pct { font-weight: 800; font-size: 14px; min-width: 44px; text-align: center; }
.kr__actions { display: flex; align-items: center; gap: 4px; position: relative; }
.okr-edit { position: relative; }
.okr-edit > summary { list-style: none; cursor: pointer; }
.okr-edit > summary::-webkit-details-marker { display: none; }
.okr-pop { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 30; width: 420px; max-width: 86vw;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px; }
.kr-add { margin-top: 8px; }
.kr-add > summary { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-weight: 700; font-size: 12.5px; cursor: pointer; }
.kr-add .okr-pop { position: static; width: auto; box-shadow: none; margin-top: 8px; }

/* ── Analytics dashboard ────────────────────────────────────────────────── */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown__panel { position: absolute; z-index: 40; inset-inline-start: 0; top: calc(100% + 6px); width: 460px; max-width: 90vw;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px; }

.awidgets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.awidget { grid-column: span 2; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.awidget.is-dragging { opacity: .4; outline: 2px dashed var(--accent); }
.awidget__head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.awidget__grip { cursor: grab; color: var(--text-muted); }
.awidget__title { font-weight: 700; font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.awidget__tools { display: flex; align-items: center; gap: 3px; }
.awidget__body { padding: 8px 10px 12px; min-height: 150px; }
.awidget__chart { min-height: 150px; }
.awidget__loading, .awidget__empty { display: grid; place-items: center; min-height: 150px; color: var(--text-muted); font-size: 12.5px; }
.metric-number { display: grid; place-items: center; min-height: 180px; }
.metric-number span { font-size: 44px; font-weight: 800; color: var(--accent); line-height: 1; }
.metric-number small { color: var(--text-muted); margin-top: 6px; }

/* ── Forecast + project analytics ───────────────────────────────────────── */
.forecast-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; text-align: center; }
.stat-tile__v { font-size: 26px; font-weight: 800; }
.stat-tile__k { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.stat-tile--accent { background: var(--accent-soft); border-color: var(--accent); }
.stat-tile--accent .stat-tile__v { color: var(--accent); }
.pa-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 14px; }
.pa-chart { min-height: 240px; }

@media (max-width: 900px) {
    .awidgets { grid-template-columns: repeat(2, 1fr); }
    .awidget, .awidget[style] { grid-column: span 2 !important; }
    .pa-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════════════════
   Phase 7 — AI Copilot (floating chat)
   ════════════════════════════════════════════════════════════════════════ */
.copilot-fab { position: fixed; bottom: 22px; left: 22px; z-index: 900; width: 52px; height: 52px; border-radius: 50%;
    border: none; cursor: pointer; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, var(--accent), #7c1d2b); box-shadow: 0 8px 24px rgba(0,0,0,.28);
    transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.copilot-fab:hover { transform: translateY(-2px) scale(1.05); }
.copilot-fab.is-open { transform: scale(.9); opacity: .6; }

.copilot { position: fixed; bottom: 22px; left: 22px; z-index: 950; width: 390px; max-width: calc(100vw - 32px);
    height: 620px; max-height: calc(100vh - 44px); display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.34); }
.copilot__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 14px;
    background: linear-gradient(135deg, var(--accent), #7c1d2b); color: #fff; }
.copilot__title { display: flex; align-items: center; gap: 7px; font-weight: 800; font-size: 14px; }
.copilot__provider { font-size: 11px; font-weight: 500; opacity: .85; }
.copilot__head-actions { display: flex; gap: 2px; }
.copilot__head-actions .act { color: #fff; }
.copilot__head-actions .act:hover { background: rgba(255,255,255,.18); }
.copilot__quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.copilot__quick:empty { display: none; }
.copilot-chip { background: var(--accent-soft); color: var(--accent); border: 1px solid transparent; border-radius: 20px;
    padding: 4px 11px; font-size: 12px; font-weight: 700; cursor: pointer; }
.copilot-chip:hover { border-color: var(--accent); }

.copilot__history { position: absolute; inset: 54px 0 0; background: var(--surface); z-index: 5; overflow-y: auto; padding: 8px; border-bottom: 1px solid var(--border); }
.copilot-hist { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 11px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.copilot-hist:hover { background: var(--surface-2); }
.copilot-hist span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.copilot__body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.copilot-msg { display: flex; gap: 9px; align-items: flex-start; }
.copilot-msg--user { flex-direction: row-reverse; }
.copilot-msg__ava { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
    font-size: 11px; font-weight: 800; color: #fff; background: var(--accent); }
.copilot-msg--user .copilot-msg__ava { background: var(--surface-3); color: var(--text-soft); font-size: 10px; }
.copilot-msg__c { max-width: 84%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.85; word-break: break-word; }
.copilot-msg--assistant .copilot-msg__c { background: var(--surface); border: 1px solid var(--border); border-start-start-radius: 3px; }
.copilot-msg--user .copilot-msg__c { background: var(--accent); color: #fff; border-start-end-radius: 3px; }
.copilot-msg__c p { margin: 0 0 7px; } .copilot-msg__c p:last-child { margin: 0; }
.copilot-msg__c ul, .copilot-msg__c ol { margin: 4px 0; padding-inline-start: 20px; }
.copilot-msg__c pre { background: var(--surface-2); padding: 9px 11px; border-radius: 8px; overflow-x: auto; font-size: 12px; direction: ltr; }
.copilot-msg__c code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.copilot-msg__c table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 6px 0; }
.copilot-msg__c th, .copilot-msg__c td { border: 1px solid var(--border); padding: 5px 8px; text-align: start; }
.copilot-msg__c h2, .copilot-msg__c h3 { font-size: 14px; font-weight: 800; margin: 8px 0 5px; }

.copilot-typing { display: inline-flex; gap: 3px; vertical-align: middle; }
.copilot-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: cp-b 1s infinite ease-in-out; }
.copilot-typing i:nth-child(2) { animation-delay: .15s; } .copilot-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes cp-b { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

.copilot__composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); }
.copilot__input { flex: 1; resize: none; border: 1px solid var(--border-strong); border-radius: 12px; padding: 9px 12px;
    font-family: var(--font); font-size: 13.5px; line-height: 1.5; background: var(--surface); color: var(--text); max-height: 120px; outline: none; }
.copilot__input:focus { border-color: var(--accent); }
.copilot__send { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; border: none; cursor: pointer;
    background: var(--accent); color: #fff; display: grid; place-items: center; }
.copilot__send:hover { filter: brightness(1.08); }

.copilot-suggest { font-size: 13px; }
.sg-epic { margin-bottom: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.sg-h { display: flex; align-items: center; gap: 6px; font-weight: 700; cursor: pointer; }
.sg-task { display: flex; align-items: center; gap: 6px; padding: 3px 0 3px 14px; cursor: pointer; font-size: 12.5px; }
.sg-pri { margin-inline-start: auto; font-size: 10.5px; color: var(--text-muted); background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.sg-import { margin-top: 6px; width: 100%; }
.copilot-demo { margin-top: 6px; font-size: 11.5px; color: var(--warning); }
.copilot-ok { margin-top: 6px; font-size: 12.5px; color: var(--success); font-weight: 700; }

@media (max-width: 480px) {
    .copilot { left: 8px; right: 8px; width: auto; bottom: 8px; height: calc(100vh - 16px); }
    .copilot-fab { left: 14px; bottom: 14px; }
}

/* ── Copilot: respect the hidden attribute (start closed, open on click) ── */
.copilot[hidden], .copilot__history[hidden] { display: none !important; }

/* ── Jalali (Persian) date picker ──────────────────────────────────────── */
.jdate-display { cursor: pointer; background: var(--surface); }
.jdate-time { max-width: 120px; }
.jdp { position: absolute; z-index: 1200; width: 260px; background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 10px; font-family: var(--font); direction: rtl; }
.jdp[hidden] { display: none; }
.jdp__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.jdp__title { font-weight: 800; font-size: 13.5px; }
.jdp__nav { width: 28px; height: 28px; border: none; background: var(--surface-2); border-radius: 8px; cursor: pointer;
    font-size: 17px; line-height: 1; color: var(--text-soft); }
.jdp__nav:hover { background: var(--accent-soft); color: var(--accent); }
.jdp__wd { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.jdp__wd span { text-align: center; font-size: 11px; color: var(--text-muted); font-weight: 700; padding: 4px 0; }
.jdp__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jdp__day, .jdp__empty { height: 30px; display: grid; place-items: center; font-size: 12.5px; border-radius: 8px; }
.jdp__day { border: none; background: transparent; cursor: pointer; color: var(--text); }
.jdp__day:hover { background: var(--surface-2); }
.jdp__day.is-today { color: var(--accent); font-weight: 800; box-shadow: inset 0 0 0 1px var(--accent); }
.jdp__day.is-sel { background: var(--accent); color: #fff; font-weight: 800; }
.jdp__foot { display: flex; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.jdp__today, .jdp__clear { flex: 1; padding: 5px; border: 1px solid var(--border); background: var(--surface-2);
    border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--text-soft); font-family: var(--font); }
.jdp__today:hover { border-color: var(--accent); color: var(--accent); }
