:root {
    --rtm-primary: #2563eb;
    --rtm-primary-dark: #1d4ed8;
    --rtm-bg: #f4f6fb;
    --rtm-sidebar: #0f172a;
    --rtm-sidebar-muted: #94a3b8;
    --rtm-card-radius: 16px;
    --rtm-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 20px rgba(15, 23, 42, .05);
    --rtm-border: #e8ecf3;
}

* { box-sizing: border-box; }

body {
    background: var(--rtm-bg);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: #1e293b;
}

a { text-decoration: none; }

/* ---------- Layout ---------- */
.rtm-shell { display: flex; min-height: 100vh; }

.rtm-sidebar {
    width: 256px;
    background: var(--rtm-sidebar);
    color: #e2e8f0;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
}

.rtm-sidebar .brand {
    padding: 22px 22px 18px;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: .3px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.rtm-sidebar .brand .logo {
    min-width: 34px; height: 34px;
    padding: 0 7px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    display: grid; place-items: center;
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}
.rtm-sidebar .brand-text {
    min-width: 0;
    font-size: .92rem;
    font-weight: 700;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rtm-nav { padding: 8px 12px; overflow-y: auto; flex: 1; }
.rtm-nav .nav-section {
    color: var(--rtm-sidebar-muted);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    padding: 16px 12px 6px;
}
.rtm-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #cbd5e1;
    font-size: .9rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.rtm-nav a .bi { font-size: 1.05rem; }
.rtm-nav a:hover { background: rgba(148, 163, 184, .12); color: #fff; }
.rtm-nav a.active { background: var(--rtm-primary); color: #fff; }

.rtm-sidebar .sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid rgba(148,163,184,.15);
    font-size: .78rem;
    color: var(--rtm-sidebar-muted);
}

.rtm-main { flex: 1; margin-left: 256px; min-width: 0; display: flex; flex-direction: column; }

.rtm-topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid var(--rtm-border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.rtm-topbar .page-title { font-weight: 600; font-size: 1.05rem; margin: 0; }
.rtm-topbar .topbar-search { max-width: 320px; flex: 1; }

.rtm-content { padding: 24px; flex: 1; }

/* ---------- Cards ---------- */
.rtm-card {
    background: #fff;
    border: 1px solid var(--rtm-border);
    border-radius: var(--rtm-card-radius);
    box-shadow: var(--rtm-shadow);
}
.rtm-card .card-body { padding: 20px; }

.stat-card { padding: 20px; display: flex; align-items: center; gap: 16px; }
.stat-card .stat-icon {
    width: 50px; height: 50px;
    border-radius: 14px;
    display: grid; place-items: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { color: #64748b; font-size: .82rem; margin-top: 4px; }

.icon-soft-primary { background: #e0ebff; color: #2563eb; }
.icon-soft-info { background: #d8f3fb; color: #0891b2; }
.icon-soft-warning { background: #fff0d6; color: #d97706; }
.icon-soft-danger { background: #ffe1e1; color: #dc2626; }
.icon-soft-success { background: #d7f5e3; color: #16a34a; }
.icon-soft-secondary { background: #e9edf5; color: #475569; }

/* ---------- Badges / priorities ---------- */
.badge-priority { font-weight: 600; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.prio-low { background: #e2e8f0; color: #475569; }
.prio-medium { background: #dbeafe; color: #1d4ed8; }
.prio-high { background: #ffedd5; color: #c2410c; }
.prio-critical { background: #fee2e2; color: #b91c1c; }

.avatar-circle {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--rtm-primary);
    color: #fff;
    display: inline-grid; place-items: center;
    font-size: .75rem; font-weight: 600;
}

/* ---------- Kanban ---------- */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-col {
    flex: 0 0 286px;
    background: #eef1f7;
    border-radius: 14px;
    padding: 10px;
    max-height: calc(100vh - 190px);
    display: flex; flex-direction: column;
}
.kanban-col-header {
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 600; font-size: .8rem; color: #334155;
    text-transform: uppercase; letter-spacing: .03em;
    padding: 4px 6px 10px;
}
.kanban-col-header .col-name { display: inline-flex; align-items: center; gap: 7px; }
.kanban-col-header .count {
    background: #fff; border-radius: 20px; padding: 1px 9px;
    font-size: .72rem; font-weight: 600; color: #64748b; letter-spacing: 0;
}
.kanban-col-body { overflow-y: auto; flex: 1; min-height: 40px; padding: 2px; }

.kanban-card {
    position: relative;
    background: #fff;
    border-radius: 11px;
    border: 1px solid var(--rtm-border);
    padding: 11px 12px 10px;
    margin-bottom: 9px;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(15,23,42,.05);
    transition: box-shadow .15s ease, border-color .15s ease;
}
.kanban-card:hover { box-shadow: 0 3px 10px rgba(15,23,42,.09); border-color: #d7deea; }
.kanban-card:active { cursor: grabbing; }
.kanban-card .priority-bar { height: 3px; border-radius: 4px; margin: -11px -12px 9px; }

/* 1. priority/lock row */
.kanban-card-top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 6px; margin-bottom: 7px;
}
.kanban-card-top .kanban-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.kanban-card-top .kanban-lock { color: #94a3b8; font-size: .82rem; line-height: 1; }

/* 2. title */
.kanban-card-title {
    display: block;
    font-size: .855rem; font-weight: 600; line-height: 1.35;
    color: #1e293b;
    margin-bottom: 9px;
    overflow: hidden; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.kanban-card-title:hover { color: var(--rtm-primary); }

/* 3. assignee + due row */
.kanban-card-meta {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
}
.kanban-assignee { display: flex; align-items: center; gap: 6px; min-width: 0; }
.kanban-assignee .assignee-name {
    font-size: .735rem; color: #475569; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kanban-due {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: .72rem; color: #64748b; white-space: nowrap; flex-shrink: 0;
}
.kanban-due.is-overdue { color: #dc2626; font-weight: 600; }

/* 4. metadata footer */
.kanban-card-footer {
    display: flex; align-items: center; gap: 12px;
    margin-top: 9px; padding-top: 8px;
    border-top: 1px solid #f1f5f9;
    color: #94a3b8; font-size: .72rem;
}
.kanban-card-footer .meta-item { display: inline-flex; align-items: center; gap: 4px; }
.kanban-card-footer .project-name {
    margin-left: auto; max-width: 130px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kanban-card.sortable-ghost { opacity: .4; }

/* Avatar size variants */
.avatar-xs { width: 22px; height: 22px; font-size: .62rem; }

/* ---------- Kanban locked card ---------- */
.kanban-card.kanban-locked { cursor: default; background: #fbfcfe; }
.kanban-card.kanban-locked .kanban-card-title { color: #475569; }

/* ---------- Activity timeline ---------- */
.rtm-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.rtm-timeline::before {
    content: "";
    position: absolute;
    left: 13px; top: 4px; bottom: 4px;
    width: 2px;
    background: var(--rtm-border);
}
.rtm-timeline-item { position: relative; padding: 0 0 16px 38px; }
.rtm-timeline-item:last-child { padding-bottom: 0; }
.rtm-timeline-dot {
    position: absolute;
    left: 0; top: 0;
    width: 28px; height: 28px;
    border-radius: 50%;
    display: grid; place-items: center;
    color: #fff;
    font-size: .72rem;
    box-shadow: 0 0 0 3px #fff;
}
.rtm-timeline-content { padding-top: 3px; }

/* ---------- Page toolbar + filter bar (shared: tasks / kanban) ---------- */
.rtm-page-toolbar {
    display: flex; flex-wrap: wrap; align-items: center;
    justify-content: space-between; gap: 10px;
}
.rtm-page-toolbar .page-heading { font-size: 1.1rem; font-weight: 700; margin: 0; }

.rtm-filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rtm-filterbar .form-control,
.rtm-filterbar .form-select { height: 34px; }
.rtm-filterbar .form-control-sm,
.rtm-filterbar .form-select-sm { font-size: .82rem; }
.rtm-filterbar .filter-search { width: 200px; max-width: 60vw; }
.rtm-filterbar .filter-select { min-width: 130px; }
.rtm-filterbar .btn { height: 34px; display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Badges / typography consistency ---------- */
.badge { font-weight: 600; letter-spacing: .01em; padding: .34em .6em; border-radius: 7px; }
.badge.badge-priority { border-radius: 6px; }

/* ---------- Task detail: attachments ---------- */
.attachment-list { list-style: none; margin: 0; padding: 0; }
.attachment-list li {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 10px; border-radius: 9px; border: 1px solid transparent;
    transition: background .12s ease, border-color .12s ease;
}
.attachment-list li:hover { background: #f8fafc; border-color: var(--rtm-border); }
.attachment-list .att-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.attachment-list .att-name .file-ico {
    width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px;
    display: grid; place-items: center; font-size: .95rem;
    background: #eef2ff; color: #4f46e5;
}
.attachment-list .att-name .att-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Task detail: comments ---------- */
.comment-item { display: flex; gap: 10px; margin-bottom: 14px; }
.comment-item .comment-body {
    flex: 1; min-width: 0;
    background: #f8fafc; border: 1px solid var(--rtm-border);
    border-radius: 10px; padding: 8px 12px;
}
.comment-item .comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.comment-item .comment-head .name { font-weight: 600; font-size: .82rem; }
.comment-item .comment-text { font-size: .85rem; line-height: 1.5; color: #334155; }
.comment-item .reply-btn { font-size: .74rem; }
.comment-thread { margin-left: 22px; padding-left: 14px; border-left: 2px solid #eef1f7; }

/* ---------- Projects: grid + cards ---------- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.project-card { display: block; color: inherit; transition: box-shadow .15s ease, border-color .15s ease, transform .12s ease; }
.project-card:hover { box-shadow: 0 6px 18px rgba(15,23,42,.10); border-color: #d7deea; transform: translateY(-1px); }
.project-card .card-body { padding: 16px; }
.project-card .project-title { font-weight: 600; font-size: .95rem; color: #1e293b; line-height: 1.3; }
.project-card .project-desc {
    font-size: .8rem; color: #64748b; margin: 0 0 12px; line-height: 1.45;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.project-card .project-progress { margin-bottom: 12px; }
.project-card .project-meta {
    display: flex; flex-wrap: wrap; gap: 12px;
    font-size: .74rem; color: #64748b; padding-top: 10px; border-top: 1px solid #f1f5f9;
}
.project-card .project-meta .meta-item { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.project-card .project-meta .project-unit { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.project-card .project-due { margin-top: 8px; font-size: .74rem; color: #64748b; }
.project-card .project-due.is-overdue { color: #dc2626; font-weight: 600; }

/* ---------- Project detail: info grid ---------- */
.project-info-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px;
}
.project-info-grid > div { display: flex; flex-direction: column; gap: 2px; }
.project-info-grid .info-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; }
.project-info-grid .info-value { font-size: .85rem; font-weight: 500; color: #334155; }

/* ---------- Project detail: members ---------- */
.member-list { list-style: none; margin: 0; padding: 0; }
.member-list li {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 7px 0; border-bottom: 1px solid #f1f5f9;
}
.member-list li:last-child { border-bottom: 0; }
.member-list .member-info { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.member-list .member-text { display: flex; flex-direction: column; min-width: 0; }
.member-list .member-name { font-size: .83rem; font-weight: 500; color: #1e293b; line-height: 1.2; }
.member-list .member-role { font-size: .7rem; color: #94a3b8; }

/* member picker (form) */
.member-picker { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.member-option {
    display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px; cursor: pointer;
}
.member-option:hover { background: #f8fafc; }
.member-option input { margin: 0; }
.member-option .member-name { font-size: .83rem; color: #334155; }

/* ---------- Project detail: milestones ---------- */
.milestone-list { list-style: none; margin: 0; padding: 0; }
.milestone-list li {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
    padding: 8px 0; border-bottom: 1px solid #f1f5f9;
}
.milestone-list li:last-child { border-bottom: 0; }
.milestone-main { display: flex; align-items: flex-start; gap: 9px; margin: 0; cursor: pointer; flex: 1; min-width: 0; }
.milestone-main input { margin-top: 2px; flex-shrink: 0; }
.milestone-text { display: flex; flex-direction: column; min-width: 0; }
.milestone-title { font-size: .84rem; color: #1e293b; line-height: 1.3; }
.milestone-due { font-size: .72rem; color: #94a3b8; display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; }
.milestone-list li.is-done .milestone-title { text-decoration: line-through; color: #94a3b8; }

/* ---------- Project detail: Gantt ---------- */
.gantt-wrap { overflow-x: auto; }
.gantt-popup { font-size: .78rem; line-height: 1.45; }
.gantt .bar-progress { fill: #2563eb; }
.gantt .bar { fill: #c7d2fe; }
.gantt .gantt-todo .bar-progress { fill: #94a3b8; }
.gantt .gantt-in_progress .bar-progress { fill: #3b82f6; }
.gantt .gantt-blocked .bar-progress { fill: #ef4444; }
.gantt .gantt-done .bar-progress { fill: #22c55e; }
.gantt .gantt-closed .bar-progress { fill: #0f172a; }

/* ---------- Calendar: enterprise weekly lane board ---------- */
.cal-weeklabel { font-size: .85rem; color: #64748b; font-weight: 500; }
.cal-weeknav .btn { display: inline-flex; align-items: center; }
.cal-viewtoggle .btn { font-size: .78rem; }

/* modern toggle switch (weekend) */
.cal-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; margin: 0; }
.cal-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.cal-switch .cal-switch-track {
    position: relative; width: 36px; height: 20px; border-radius: 20px;
    background: #cbd5e1; transition: background .15s ease; flex-shrink: 0;
}
.cal-switch .cal-switch-track::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 2px rgba(15,23,42,.3); transition: transform .15s ease;
}
.cal-switch input:checked + .cal-switch-track { background: var(--rtm-primary); }
.cal-switch input:checked + .cal-switch-track::after { transform: translateX(16px); }
.cal-switch input:focus-visible + .cal-switch-track { box-shadow: 0 0 0 3px rgba(37,99,235,.25); }
.cal-switch .cal-switch-label { font-size: .8rem; color: #475569; font-weight: 500; }

/* board scroll container (horizontal scroll on small screens) */
.cal-board { width: 100%; }
.cal-board-scroll { overflow-x: auto; padding-bottom: 6px; }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 5), minmax(140px, 1fr));
    gap: 10px;
}

/* sticky weekday header */
.cal-week-head {
    position: sticky; top: 0; z-index: 5;
    background: var(--rtm-bg, #f4f6fb);
    padding: 4px 0 8px;
    margin-bottom: 4px;
}
.cal-wh {
    display: flex; align-items: baseline; gap: 6px;
    padding: 6px 10px; border-radius: 9px;
    background: #eef1f7; border: 1px solid var(--rtm-border);
}
.cal-wh.is-today { border-color: #bcd0ff; box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.cal-wh.is-weekend { background: #e9edf5; }
.cal-wh-name { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #64748b; }
.cal-wh.is-today .cal-wh-name { color: var(--rtm-primary); }
.cal-wh-date { font-size: .78rem; font-weight: 600; color: #334155; margin-left: auto; }
.cal-wh-month { font-weight: 500; color: #94a3b8; font-size: .7rem; }

/* lane (section card per unit / EVP) */
.cal-lane {
    background: #fff;
    border: 1px solid var(--rtm-border);
    border-radius: 12px;
    box-shadow: var(--rtm-shadow);
    margin-bottom: 12px;
    overflow: hidden;
}
.cal-lane.is-executive { border-color: #fde68a; }
.cal-lane-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 14px;
    background: #f8fafc; border-bottom: 1px solid var(--rtm-border);
}
.cal-lane.is-executive .cal-lane-head { background: #fffbeb; }
.cal-lane-name {
    font-size: .8rem; font-weight: 700; color: #334155;
    text-transform: uppercase; letter-spacing: .03em;
    display: inline-flex; align-items: center; gap: 8px;
}
.cal-lane.is-executive .cal-lane-name { color: #b45309; }
.cal-lane-count {
    background: #fff; border: 1px solid var(--rtm-border); border-radius: 20px;
    padding: 1px 9px; font-size: .72rem; font-weight: 600; color: #64748b;
}
.cal-lane-body { padding: 10px; }

/* day cell within a lane */
.cal-cell {
    background: #f6f8fc; border: 1px solid #eef1f7; border-radius: 9px;
    padding: 7px; min-height: 72px;
    display: flex; flex-direction: column; gap: 6px;
}
.cal-cell.is-today { background: #f1f5ff; border-color: #dbe4ff; }
.cal-cell.is-weekend { background: #f1f3f9; }

.cal-activity {
    display: block;
    background: #fff;
    border: 1px solid var(--rtm-border);
    border-left: 3px solid var(--accent, #2563eb);
    border-radius: 9px;
    padding: 7px 9px;
    color: inherit;
    transition: box-shadow .12s ease, transform .1s ease, border-color .12s ease;
}
.cal-activity:hover { box-shadow: 0 3px 10px rgba(15,23,42,.09); transform: translateY(-1px); }
.cal-activity-top { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.cal-type-ico { color: var(--accent, #2563eb); font-size: .82rem; line-height: 1; display: inline-flex; }
.cal-activity-time { font-size: .7rem; font-weight: 600; color: #64748b; }
.cal-tentative-dot {
    width: 7px; height: 7px; border-radius: 50%;
    border: 1.5px dashed #f59e0b; margin-left: auto; flex-shrink: 0;
}
.cal-activity-title {
    font-size: .8rem; font-weight: 600; color: #1e293b; line-height: 1.3;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.cal-activity-foot { display: flex; align-items: center; gap: 6px; margin-top: 5px; color: #94a3b8; font-size: .72rem; }
.cal-activity-foot .cal-haslink { color: #16a34a; }
.cal-activity-foot .cal-gsync { color: #ea4335; }
.cal-activity-foot .cal-recurs { margin-left: auto; }

/* tentative treatment */
.cal-activity.is-tentative {
    background: #fbfcfe;
    border-style: dashed;
    border-left-style: solid;
    opacity: .92;
}
.cal-activity.is-tentative .cal-activity-title { color: #475569; font-weight: 500; }

.cal-empty {
    flex: 1; min-height: 56px;
    display: grid; place-items: center;
    color: #c2cbdc; font-size: 1rem; border-radius: 9px;
    border: 1px dashed #dde3ee; background: rgba(255,255,255,.45);
    transition: background .12s, color .12s, border-color .12s;
}
.cal-empty:hover { background: #fff; color: var(--rtm-primary); border-color: #bcd0ff; }
.cal-addmore {
    display: grid; place-items: center;
    height: 24px; border-radius: 7px; color: #94a3b8;
    border: 1px dashed transparent; font-size: .9rem;
}
.cal-addmore:hover { color: var(--rtm-primary); border-color: #d7deea; background: #fff; }

/* auto-task toggle hint card */
.cal-task-toggle { background: #f8fafc; border: 1px solid var(--rtm-border); border-radius: 10px; padding: 10px 12px; }

/* Google integration: attendee picker */
.cal-google-opts { border-top: 1px dashed var(--rtm-border); padding-top: 12px; margin-top: 6px; }
.cal-attendee-picker {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 4px; max-height: 240px; overflow-y: auto;
    border: 1px solid var(--rtm-border); border-radius: 10px; padding: 6px;
}
.cal-attendee {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px; border-radius: 8px; cursor: pointer; margin: 0;
}
.cal-attendee:hover { background: #f8fafc; }
.cal-attendee input { margin: 0; flex-shrink: 0; }
.cal-attendee-text { display: flex; flex-direction: column; min-width: 0; }
.cal-attendee-name { font-size: .82rem; color: #1e293b; font-weight: 500; line-height: 1.2; }
.cal-gmail-badge { font-size: .7rem; color: #16a34a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-gmail-badge.is-missing { color: #94a3b8; }

@media (max-width: 991.98px) {
    .cal-grid { grid-template-columns: repeat(var(--cols, 5), minmax(132px, 1fr)); }
    .cal-week-head { position: static; }
    .cal-attendee-picker { grid-template-columns: 1fr; }
}

/* ===================================================================
   Tasks module: work-management grid, detail workspace, evidence
   =================================================================== */

/* avatars (shared) */
.rtm-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--rtm-primary); color: #fff;
    display: inline-grid; place-items: center;
    font-size: .72rem; font-weight: 600;
    overflow: hidden; flex-shrink: 0;
    border: 2px solid #fff;
}
.rtm-avatar img { width: 100%; height: 100%; object-fit: cover; }
.rtm-avatar.avatar-xs { width: 22px; height: 22px; font-size: .6rem; }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .rtm-avatar { margin-left: -8px; }
.avatar-stack .rtm-avatar:first-child { margin-left: 0; }
.avatar-stack .avatar-more { background: #e2e8f0; color: #475569; font-size: .64rem; }

/* ---------- Tasks: clean enterprise table (Monday/Linear-style) ---------- */
.tasks-card { overflow: hidden; }
.rtm-grid-wrap { overflow-x: auto; }
.rtm-grid {
    width: 100%; min-width: 880px;
    border-collapse: separate; border-spacing: 0;
    font-size: .875rem; color: #1e293b;
}
.rtm-grid thead th {
    position: sticky; top: 0; z-index: 2;
    background: #fbfcfe;
    font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
    color: #94a3b8; font-weight: 700;
    padding: 14px 18px; text-align: left; white-space: nowrap;
    border-bottom: 1px solid var(--rtm-border);
}
.rtm-grid tbody td {
    padding: 16px 18px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.rtm-grid tbody tr:last-child td { border-bottom: 0; }
.task-row { cursor: pointer; transition: background .12s ease; }
.task-row:hover { background: #f7f9ff; }
.task-row:focus-visible { outline: 2px solid var(--rtm-primary); outline-offset: -2px; }

/* sensible column widths so nothing collides */
.rtm-grid .col-assignee { width: 150px; }
.rtm-grid .col-creator { width: 170px; }
.rtm-grid .col-priority { width: 110px; }
.rtm-grid .col-progress { width: 170px; }
.rtm-grid .col-status { width: 130px; }
.rtm-grid .col-due { width: 130px; }

/* 1. Assignee — avatar(s) with name caption below */
.assignee-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.assignee-cell .avatar-stack .rtm-avatar { width: 28px; height: 28px; font-size: .68rem; }
.assignee-caption {
    font-size: .78rem; color: #334155; font-weight: 500; line-height: 1.2;
    max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.users-grid .assignee-cell { flex-direction: row; align-items: center; gap: 10px; }
.users-grid .assignee-caption {
    max-width: none; white-space: normal; overflow: visible; text-overflow: unset;
}

/* 2. Task creator — mini avatar + soft secondary name */
.creator-cell { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.creator-cell .creator-name {
    font-size: .8rem; color: #64748b; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px;
}

/* 3. Task name — primary visual focus */
.task-cell-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.task-title {
    font-weight: 600; font-size: .92rem; color: #0f172a; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.task-title:hover { color: var(--rtm-primary); }
.task-project {
    font-size: .76rem; color: #94a3b8; line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px;
}

/* 4. Priority — soft rounded pill */
.prio-pill {
    display: inline-flex; align-items: center;
    font-size: .72rem; font-weight: 600; line-height: 1;
    padding: .42em .85em; border-radius: 999px; white-space: nowrap;
}
.prio-pill.prio-low { background: #f1f5f9; color: #64748b; }
.prio-pill.prio-medium { background: #e0ecff; color: #2563eb; }
.prio-pill.prio-high { background: #ffedd5; color: #c2410c; }
.prio-pill.prio-critical { background: #fee2e2; color: #b91c1c; }

/* 5. Progress — clean horizontal bar + percentage */
.progress-cell { display: flex; align-items: center; gap: 10px; }
.rtm-progress { height: 8px; background: #eef1f7; border-radius: 999px; overflow: hidden; flex: 1; min-width: 70px; }
.rtm-progress .progress-bar { border-radius: 999px; transition: width .4s ease; }
.rtm-progress .pb-gray { background: #cbd5e1; }
.rtm-progress .pb-blue { background: #3b82f6; }
.rtm-progress .pb-orange { background: #f97316; }
.rtm-progress .pb-green { background: #16a34a; }
.progress-cell .progress-pct { font-size: .76rem; color: #64748b; font-weight: 600; width: 36px; text-align: right; flex-shrink: 0; }

/* 6. Status — modern uppercase chip */
.status-chip {
    display: inline-flex; align-items: center;
    font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    padding: .4em .7em; border-radius: 999px; white-space: nowrap;
}
.status-todo { background: #eef1f7; color: #64748b; }
.status-in_progress { background: #e0ecff; color: #2563eb; }
.status-blocked { background: #fee2e2; color: #dc2626; }
.status-in_review { background: #fff0d6; color: #d97706; }
.status-done { background: #d7f5e3; color: #16a34a; }
.status-closed { background: #1e293b; color: #e2e8f0; }

/* 7. Due date */
.due-pill { display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; color: #475569; white-space: nowrap; }
.due-overdue { color: #dc2626; font-weight: 600; }
.due-today { color: #d97706; font-weight: 600; }
.due-none { color: #cbd5e1; }

/* responsive: collapse grid into stacked task cards on mobile */
@media (max-width: 767.98px) {
    .rtm-grid { min-width: 0; }
    .rtm-grid, .rtm-grid thead, .rtm-grid tbody, .rtm-grid tr, .rtm-grid td { display: block; width: 100%; }
    .rtm-grid thead { display: none; }
    .rtm-grid tbody tr {
        border: 1px solid var(--rtm-border); border-radius: 14px;
        margin: 0 12px 12px; padding: 6px 16px; background: #fff;
        box-shadow: 0 1px 2px rgba(15,23,42,.04);
    }
    .rtm-grid tbody tr:first-child { margin-top: 12px; }
    .rtm-grid tbody td {
        border-bottom: 1px solid #f6f8fc; padding: 11px 0;
        display: flex; justify-content: space-between; align-items: center; gap: 14px;
    }
    .rtm-grid tbody tr td:last-child { border-bottom: 0; }
    .rtm-grid tbody td::before {
        content: attr(data-label); font-size: .66rem; text-transform: uppercase;
        letter-spacing: .05em; color: #94a3b8; font-weight: 700; flex-shrink: 0;
    }
    .rtm-grid .col-assignee, .rtm-grid .col-creator,
    .rtm-grid .col-priority, .rtm-grid .col-progress,
    .rtm-grid .col-status, .rtm-grid .col-due { width: auto; }
    .rtm-grid .col-task { flex-direction: column; align-items: flex-start; gap: 4px; }
    .rtm-grid .col-task::before { margin-bottom: 2px; }
    .assignee-cell { flex-direction: row; align-items: center; gap: 8px; }
    .progress-cell { flex: 1; max-width: 60%; }
    .task-project { white-space: normal; max-width: 100%; }
}

/* ---------- Tasks form: assignee picker ---------- */
.assignee-picker {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2px; max-height: 220px; overflow-y: auto;
    border: 1px solid var(--rtm-border); border-radius: 10px; padding: 6px;
}
.assignee-option { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; margin: 0; }
.assignee-option:hover { background: #f8fafc; }
.assignee-option input { margin: 0; flex-shrink: 0; }
.assignee-option .assignee-name { font-size: .83rem; color: #334155; }
@media (max-width: 575.98px) { .assignee-picker { grid-template-columns: 1fr; } }

/* ---------- Task detail: sticky sidebar + details ---------- */
@media (min-width: 992px) {
    .rtm-sidebar-sticky { position: sticky; top: 80px; }
}
.detail-list { display: grid; grid-template-columns: 88px 1fr; gap: 8px 10px; margin: 0; font-size: .82rem; }
.detail-list dt { color: #94a3b8; font-weight: 500; }
.detail-list dd { margin: 0; color: #334155; }
.detail-label { font-size: .82rem; color: #94a3b8; font-weight: 500; }
.detail-progress #progressSlider { width: 100%; }
.assignee-list { display: flex; flex-direction: column; gap: 5px; }
.assignee-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; }

/* review banner */
.review-banner { border-left: 4px solid #f59e0b; background: #fffdf5; }

/* ---------- Evidence tags ---------- */
.evidence-tag {
    font-size: .6rem; font-weight: 700; letter-spacing: .04em;
    padding: .15em .45em; border-radius: 5px; flex-shrink: 0;
}
.evidence-working { background: #e0ebff; color: #2563eb; }
.evidence-final { background: #d7f5e3; color: #16a34a; }

/* checklist rows tighten */
.checklist-row { margin-bottom: 6px; }

/* ---------- Misc ---------- */
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #64748b; }
.progress { background: #eef1f7; }
.list-tight li { margin-bottom: 10px; }
.text-muted-sm { color: #94a3b8; font-size: .8rem; }

/* ---------- Auth ---------- */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(1200px 600px at 10% -10%, #dbeafe, transparent),
                radial-gradient(1000px 500px at 110% 110%, #e0e7ff, transparent),
                #f4f6fb;
    padding: 24px;
}
.auth-card { width: 100%; max-width: 420px; }
.auth-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 22px; }
.auth-brand .logo {
    min-width: 44px; height: 44px; padding: 0 8px; border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    display: grid; place-items: center; color: #fff; font-weight: 700;
    font-size: .8rem; white-space: nowrap;
}

/* ---------- Responsive ---------- */
.rtm-sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .rtm-sidebar { transform: translateX(-100%); }
    .rtm-sidebar.open { transform: translateX(0); }
    .rtm-main { margin-left: 0; }
    .rtm-sidebar-backdrop.show {
        display: block; position: fixed; inset: 0;
        background: rgba(15,23,42,.45); z-index: 1035;
    }
}

@media (max-width: 575.98px) {
    .rtm-filterbar { width: 100%; }
    .rtm-filterbar .filter-search,
    .rtm-filterbar .filter-select { flex: 1 1 100%; width: 100%; max-width: none; }
    .rtm-filterbar .btn { flex: 1 1 auto; justify-content: center; }
}

/* ===================== Insight (AI Intelligence Workspace) ===================== */
.min-w-0 { min-width: 0; }

.insight-section-title { font-size: .92rem; font-weight: 700; color: #1e293b; }

/* Page header: dominant title + subtitle, full-width filter card below */
.insight-page-header { margin-bottom: 18px; }
.insight-title-area { margin-bottom: 14px; }
.insight-page-title {
    font-size: 1.45rem; font-weight: 700; color: #0f172a; margin: 0;
    display: flex; align-items: center; gap: 8px; letter-spacing: -.01em;
}
.insight-page-subtitle { font-size: .85rem; color: #94a3b8; margin-top: 3px; }

.insight-filterbar {
    display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
    background: #fff; border: 1px solid var(--rtm-border);
    border-radius: 18px; box-shadow: var(--rtm-shadow); padding: 16px 18px;
}
.insight-filterbar .filter-field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 170px; min-width: 0; }
.insight-filterbar .filter-field label {
    font-size: .68rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
    color: #94a3b8; margin: 0;
}
.insight-filterbar .form-select { height: 38px; font-size: .85rem; border-radius: 10px; }
.insight-filterbar .form-select:hover { border-color: #cbd5e1; }
.insight-filterbar .filter-actions { display: flex; gap: 8px; align-items: flex-end; flex: 0 0 auto; }
.insight-filterbar .filter-actions .btn {
    height: 38px; border-radius: 10px; display: inline-flex; align-items: center; gap: 6px;
    transition: transform .12s ease, box-shadow .12s ease;
}
.insight-filterbar .filter-actions .btn:hover { transform: translateY(-1px); }

@media (max-width: 991.98px) {
    .insight-filterbar .filter-field { flex-basis: calc(50% - 7px); }
    .insight-filterbar .filter-actions { flex: 1 1 100%; }
    .insight-filterbar .filter-actions .btn { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 575.98px) {
    .insight-filterbar { gap: 10px; padding: 14px; }
    .insight-filterbar .filter-field { flex-basis: 100%; }
}

/* Section 1 — Executive AI Summary */
.insight-summary {
    border: 1px solid #dbe4f7;
    background: linear-gradient(135deg, #f5f8ff 0%, #eef2fe 100%);
}
.insight-summary-icon {
    width: 42px; height: 42px; flex-shrink: 0;
    border-radius: 12px;
    display: grid; place-items: center;
    color: #fff; font-size: 1.25rem;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    box-shadow: 0 6px 16px rgba(79, 70, 229, .25);
}
.insight-eyebrow {
    font-size: .7rem; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase; color: #4f46e5;
}
.insight-summary-text { font-size: .92rem; line-height: 1.55; color: #334155; }

/* KPI chips */
.insight-kpi { padding: 14px 16px; gap: 12px; }
.insight-kpi .stat-icon { width: 42px; height: 42px; font-size: 1.15rem; border-radius: 12px; }
.insight-kpi .stat-value { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }

/* Workload + health rows */
.insight-workload-list { display: flex; flex-direction: column; gap: 10px; }
.insight-workload-row,
.insight-health-row { display: flex; align-items: center; gap: 10px; }
.iw-meta { flex: 1 1 auto; min-width: 0; }
.iw-name { font-size: .85rem; font-weight: 600; color: #1e293b; }
.iw-bar { flex: 0 0 90px; }
.iw-bar-track { height: 6px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.iw-bar-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.iw-badge { min-width: 62px; text-align: center; }
.iw-rank { font-size: .8rem; font-weight: 700; color: #94a3b8; width: 26px; flex-shrink: 0; }
.iw-score { font-size: .9rem; font-weight: 700; flex-shrink: 0; }
.insight-health-row + .insight-health-row { margin-top: 12px; }

/* Feeds (bottleneck + risk) */
.insight-feed { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.insight-feed-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid var(--rtm-border);
}
.insight-feed-item:last-child { border-bottom: 0; }
.insight-feed-icon { font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center; }
.insight-feed-text { font-size: .84rem; color: #334155; }
a.insight-feed-text:hover { color: var(--rtm-primary); }
.insight-risk-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.insight-empty { font-size: .85rem; color: #16a34a; display: flex; align-items: center; gap: 6px; padding: 6px 0; }

/* Recommendations */
.insight-rec {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 10px 12px; border-radius: 10px; height: 100%;
    font-size: .84rem; line-height: 1.4;
    border: 1px solid var(--rtm-border); background: #f8fafc; color: #334155;
}
.insight-rec .bi { margin-top: 1px; flex-shrink: 0; }
.insight-rec-danger { border-color: #fcd5d5; background: #fff5f5; color: #b91c1c; }
.insight-rec-warning { border-color: #fde9c8; background: #fffaf0; color: #b45309; }
.insight-rec-success { border-color: #c9eed7; background: #f3fbf6; color: #15803d; }
.insight-rec-info { border-color: #cfeefb; background: #f2fbff; color: #0e7490; }

/* History table */
.insight-history { font-size: .82rem; }
.insight-history thead th {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
    color: #94a3b8; font-weight: 600; border-bottom: 1px solid var(--rtm-border);
}
.insight-history td { vertical-align: middle; }

@media (max-width: 575.98px) {
    .iw-bar { flex-basis: 64px; }
}
