.activities {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 2px;
    color: #1f2937;
    font-size: 13px;
    box-sizing: border-box;
}
.activities * { box-sizing: border-box; }

/* ---------- "add activity" buttons (valueClass = activity-add-btn) ---------- */
.activity-add-btn {
    border: 1px solid #d8dce3 !important;
    background: #fff !important;
    color: #374151 !important;
    border-radius: 999px !important;
    padding: 5px 13px 5px 11px !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    line-height: 1.1 !important;
    box-shadow: 0 1px 2px rgba(16,24,40,.05);
    transition: background .12s, border-color .12s, color .12s, box-shadow .12s, transform .08s;
}
.activity-add-btn:hover {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: #fff !important;
    box-shadow: 0 3px 9px rgba(37,99,235,.28);
    transform: translateY(-1px);
}
.activity-add-btn:active { transform: translateY(0); }
/* the add.png glyph inside the button */
.activity-add-btn img {
    width: 12px;
    height: 12px;
    margin-right: 5px;
    opacity: .8;
    transition: filter .12s, opacity .12s;
}
.activity-add-btn:hover img {
    opacity: 1;
    filter: brightness(0) invert(1); /* turn the dark glyph white on hover */
}

/* ---------- empty state ---------- */
.act-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 12px;
    color: #94a0b0;
    font-weight: 600;
}
.act-empty i { font-size: 26px; opacity: .65; }

/* ---------- card ---------- */
.act {
    --hue: 212;
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0;
    background: #fff;
    border: 1px solid #edf0f4;
    border-radius: 11px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(16,24,40,.05);
    transition: box-shadow .12s, transform .08s, border-color .12s;
}
.act:hover {
    box-shadow: 0 4px 14px rgba(16,24,40,.12);
    border-color: #e0e5ec;
    transform: translateY(-1px);
}

.act-bar {
    flex: 0 0 auto;
    width: 4px;
    background: hsl(var(--hue), 62%, 52%);
}
.act.status-overdue .act-bar { background: #ef4444; }
.act.status-done .act-bar { background: #22c55e; }

.act-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 9px 11px 10px;
}

/* ---------- head ---------- */
.act-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.act-type {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: hsl(var(--hue), 45%, 35%);
    background: hsl(var(--hue), 85%, 95%);
    border-radius: 20px;
    padding: 2px 10px;
    white-space: nowrap;
    flex: 0 0 auto;
}
.act.status-overdue .act-type { color: #9f1239; background: #ffe4e6; }
.act.status-done .act-type { color: #14633b; background: #dcfce7; }

.act-due {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
}
.act-due i { color: #9ca3af; font-size: 12px; flex: 0 0 auto; }
.act.status-overdue .act-due { color: #b91c1c; }
.act.status-overdue .act-due i { color: #ef4444; }
.act.status-done .act-due { color: #15803d; }
.act.status-done .act-due i { color: #22c55e; }

.act-actions {
    display: flex;
    gap: 3px;
    flex: 0 0 auto;
    opacity: 0;
    transition: opacity .12s;
}
.act:hover .act-actions { opacity: 1; }

.act-btn {
    border: 1px solid transparent;
    background: transparent;
    border-radius: 7px;
    width: 26px;
    height: 26px;
    padding: 0;
    cursor: pointer;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
    transition: background .12s, color .12s, border-color .12s;
}
.act-btn:hover { background: #eef2f7; border-color: #e3e7ec; }
.act-done:hover { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }
.act-edit:hover { color: #2563eb; background: #eef4ff; border-color: #cdddff; }
.act-delete:hover { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }

/* ---------- title ---------- */
.act-title {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.3;
    margin-bottom: 4px;
    word-break: break-word;
}
.act.status-done .act-title { text-decoration: line-through; color: #94a0b0; }

/* ---------- description ---------- */
.act-desc {
    color: #4b5563;
    line-height: 1.5;
    word-break: break-word;
}
.act-desc.ql-editor { padding: 0; }
.act-desc p { margin: 0 0 4px; }
.act-desc p:last-child { margin-bottom: 0; }
.act-desc ul { margin: 4px 0; padding-left: 18px; }
.act-desc a { color: #2563eb; }

/* ---------- footer ---------- */
.act-foot {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f2f5;
}
.act-avatar {
    --ahue: 210;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    background: hsl(var(--ahue), 52%, 52%);
    user-select: none;
}
.act-assigned {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ======================================================================
   Calendar custom view (.acal*) — merged from activityCalendar.css
   ====================================================================== */

.acal {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    min-height: 520px;
    font-size: 13px;
    color: #1f2937;
    background: #fff;
    box-sizing: border-box;
    padding: 4px 4px 2px;
}
.acal * { box-sizing: border-box; }

/* ---------- toolbar ---------- */
.acal-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px 10px;
    flex: 0 0 auto;
}
.acal-tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.acal-title { font-size: 18px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.acal-nav { display: flex; gap: 5px; }
.acal-btn {
    border: 1px solid #d8dce3; background: #fff; border-radius: 8px;
    padding: 5px 10px; cursor: pointer; line-height: 1; color: #374151;
    display: inline-flex; align-items: center; gap: 5px;
    transition: background .12s, border-color .12s, box-shadow .12s;
}
.acal-btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.acal-today { font-weight: 600; }

.acal-switch {
    display: inline-flex; background: #eef1f5; border-radius: 9px; padding: 3px; gap: 2px;
    margin-left: auto;
}
.acal-switch-btn {
    border: none; background: transparent; border-radius: 7px;
    padding: 5px 14px; cursor: pointer; font-weight: 600; color: #5b6472; font-size: 12.5px;
    transition: background .12s, color .12s, box-shadow .12s;
}
.acal-switch-btn:hover { color: #1f2937; }
.acal-switch-btn.active { background: #fff; color: #2563eb; box-shadow: 0 1px 3px rgba(16,24,40,.12); }

.acal-stats { display: flex; gap: 6px; }
.acal-stat {
    font-size: 12px; font-weight: 600; color: #475569;
    background: #f1f5f9; border-radius: 20px; padding: 4px 11px; white-space: nowrap;
}
.acal-stat.overdue { color: #b91c1c; background: #fee2e2; }

/* ---------- legend / filters ---------- */
.acal-legend {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
    padding: 0 6px 9px; flex: 0 0 auto;
}
.acal-legend-group { display: flex; flex-wrap: wrap; gap: 6px; }
.acal-legend-status { display: inline-flex; background: #eef1f5; border-radius: 8px; padding: 2px; gap: 2px; margin-right: 4px; }
.acal-seg {
    border: none; background: transparent; border-radius: 6px; padding: 3px 12px;
    cursor: pointer; font-weight: 600; font-size: 12px; color: #5b6472;
    transition: background .12s, color .12s, box-shadow .12s;
}
.acal-seg:hover { color: #1f2937; }
.acal-seg.active { background: #fff; color: #2563eb; box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.acal-chip {
    --hue: 212; --ahue: 212;
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid #e3e7ec; background: #fff; border-radius: 20px;
    padding: 3px 11px 3px 8px; font-size: 12px; font-weight: 600; color: #374151; cursor: pointer;
    transition: background .12s, border-color .12s, opacity .12s, filter .12s;
}
.acal-chip:hover { background: #f6f8fa; }
.acal-chip.off { opacity: .42; filter: grayscale(.7); text-decoration: line-through; }
.acal-chip.on { border-color: hsl(var(--ahue), 60%, 58%); background: hsl(var(--ahue), 85%, 95%); box-shadow: inset 0 0 0 1px hsl(var(--ahue), 60%, 70%); }
.acal-chip-sw { width: 12px; height: 12px; border-radius: 4px; background: hsl(var(--hue), 62%, 55%); }
.acal-chip-av {
    width: 18px; height: 18px; border-radius: 50%; color: #fff; font-size: 9px; font-weight: 700;
    line-height: 18px; text-align: center; background: hsl(var(--ahue), 52%, 52%);
}

/* ---------- body ---------- */
.acal-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* ---------- month ---------- */
.acal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; flex: 0 0 auto; }
.acal-weekday {
    text-align: center; font-weight: 700; font-size: 11px; text-transform: uppercase;
    letter-spacing: .6px; color: #94a0b0; padding: 4px 0 6px;
}
.acal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr;
    gap: 5px; flex: 1 1 auto; min-height: 0;
}
.acal-day {
    position: relative; display: flex; flex-direction: column;
    border: 1px solid #edf0f4; border-radius: 11px; background: #fbfcfd;
    min-height: 82px; overflow: hidden; padding: 3px 3px 4px;
    transition: background .1s, box-shadow .1s, border-color .1s;
}
.acal-day.weekend { background: #f5f6f8; }
.acal-day.other-month { background: #fff; opacity: .5; }
.acal-day.today { border-color: #bcd0ff; background: #f3f7ff; box-shadow: inset 0 0 0 1px #bcd0ff; }
.acal-day.drag-over { border: 1px dashed #2563eb; background: #e4edff; box-shadow: inset 0 0 0 2px #aecbff; }
.acal-daynum { display: flex; justify-content: flex-end; padding: 1px 3px 2px; flex: 0 0 auto; }
.acal-daynum-v {
    font-size: 12px; font-weight: 700; color: #98a2b3; min-width: 20px;
    height: 20px; line-height: 20px; text-align: center; border-radius: 50%;
}
.acal-day.today .acal-daynum-v { background: #2563eb; color: #fff; }

.acal-events { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.acal-events::-webkit-scrollbar { width: 6px; }
.acal-events::-webkit-scrollbar-thumb { background: #d6dbe2; border-radius: 3px; }
.acal-more {
    border: none; background: transparent; color: #64748b; font-size: 11px; font-weight: 700;
    text-align: left; padding: 1px 6px; cursor: pointer; border-radius: 5px;
}
.acal-more:hover { background: #eef2f7; color: #2563eb; }

/* quick-add "+" */
.acal-add {
    position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; padding: 0;
    border: none; border-radius: 6px; background: #2563eb; color: #fff; font-size: 11px;
    cursor: pointer; opacity: 0; transform: scale(.7); z-index: 6;
    display: flex; align-items: center; justify-content: center;
    transition: opacity .12s, transform .12s, background .12s;
}
.acal-day:hover .acal-add, .acal-wcol-head:hover .acal-add { opacity: .95; transform: scale(1); }
.acal-add:hover { background: #1d4ed8; opacity: 1; }

/* ---------- card ---------- */
.acal-card {
    --hue: 212; position: relative; display: flex; align-items: center; gap: 5px;
    padding: 3px 7px 3px 9px; border-radius: 7px; cursor: grab; font-size: 12px; line-height: 1.45;
    color: hsl(var(--hue), 42%, 27%);
    background: linear-gradient(180deg, hsl(var(--hue), 88%, 97%), hsl(var(--hue), 82%, 93.5%));
    border: 1px solid hsl(var(--hue), 60%, 86%);
    box-shadow: inset 3px 0 0 hsl(var(--hue), 62%, 52%);
    white-space: nowrap; overflow: hidden;
    transition: transform .08s, box-shadow .12s, filter .12s;
}
.acal-card:hover { filter: saturate(1.06); box-shadow: inset 3px 0 0 hsl(var(--hue), 62%, 52%), 0 4px 10px rgba(16,24,40,.16); transform: translateY(-1px); z-index: 2; }
.acal-card:active { cursor: grabbing; }
.acal-card.dragging { opacity: .45; transform: scale(.98); }
.acal-card.current { outline: 2px solid hsl(var(--hue), 62%, 50%); }
.acal-card.block { padding: 5px 8px 5px 9px; align-items: flex-start; flex-wrap: wrap; }
.acal-card.block .acal-card-title { white-space: normal; }
.acal-card.status-overdue {
    color: #9f1239; background: linear-gradient(180deg, #fff1f2, #ffe4e6);
    border-color: #fecdd3; box-shadow: inset 3px 0 0 #ef4444;
}
.acal-card.status-overdue:hover { box-shadow: inset 3px 0 0 #ef4444, 0 4px 10px rgba(190,18,60,.2); }
.acal-card.status-done {
    color: #14633b; background: linear-gradient(180deg, #f0fdf4, #dcfce7);
    border-color: #bbf7d0; box-shadow: inset 3px 0 0 #22c55e;
}
.acal-card.status-done .acal-card-title { text-decoration: line-through; opacity: .8; }
.acal-card-time { font-weight: 700; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.acal-card-dot { width: 6px; height: 6px; border-radius: 50%; background: hsl(var(--hue), 62%, 52%); flex: 0 0 auto; }
.acal-card.status-overdue .acal-card-dot { background: #ef4444; }
.acal-card-title { overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; }
.acal-card-avatar {
    --ahue: 210; flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%;
    font-size: 9px; font-weight: 700; line-height: 18px; text-align: center; color: #fff;
    background: hsl(var(--ahue), 52%, 52%);
}

/* ---------- week ---------- */
.acal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; flex: 1 1 auto; min-height: 0; }
.acal-wcol { display: flex; flex-direction: column; border: 1px solid #edf0f4; border-radius: 11px; background: #fbfcfd; overflow: hidden; }
.acal-wcol.weekend { background: #f5f6f8; }
.acal-wcol.today { border-color: #bcd0ff; box-shadow: inset 0 0 0 1px #bcd0ff; }
.acal-wcol-head {
    position: relative; display: flex; align-items: baseline; gap: 6px; justify-content: center;
    padding: 7px 4px; border-bottom: 1px solid #eef1f5; background: #fff; flex: 0 0 auto;
}
.acal-wcol.today .acal-wcol-head { background: #f3f7ff; }
.acal-wcol-dow { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #94a0b0; }
.acal-wcol-date { font-size: 15px; font-weight: 700; color: #374151; }
.acal-wcol.today .acal-wcol-date { color: #2563eb; }
.acal-wcol-body { display: flex; flex-direction: column; gap: 4px; padding: 5px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.acal-wcol-body::-webkit-scrollbar { width: 6px; }
.acal-wcol-body::-webkit-scrollbar-thumb { background: #d6dbe2; border-radius: 3px; }
.acal-wcol.drag-over { border: 1px dashed #2563eb; box-shadow: inset 0 0 0 2px #aecbff; }

/* ---------- agenda ---------- */
.acal-agenda { overflow-y: auto; flex: 1 1 auto; min-height: 0; padding: 0 4px 6px; }
.acal-agenda-empty { color: #94a0b0; text-align: center; padding: 40px; }
.acal-agenda-day {
    display: flex; align-items: baseline; gap: 8px; padding: 12px 6px 5px;
    position: sticky; top: 0; background: #fff; z-index: 1;
}
.acal-agenda-dow { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #94a0b0; width: 34px; }
.acal-agenda-num { font-size: 17px; font-weight: 800; color: #1f2937; }
.acal-agenda-day.today .acal-agenda-num { color: #2563eb; }
.acal-agenda-mon { font-size: 12px; color: #94a0b0; }
.acal-arow {
    --hue: 212; display: flex; align-items: center; gap: 10px; cursor: grab;
    padding: 7px 10px; margin: 3px 0; border-radius: 9px; background: #fbfcfd;
    border: 1px solid #eef1f5; border-left: 4px solid hsl(var(--hue), 62%, 52%);
    transition: background .1s, box-shadow .1s, transform .08s;
}
.acal-arow:hover { background: #fff; box-shadow: 0 3px 10px rgba(16,24,40,.1); transform: translateX(2px); }
.acal-arow.current { background: hsl(var(--hue), 85%, 96%); border-color: hsl(var(--hue), 60%, 75%); }
.acal-arow.status-overdue { border-left-color: #ef4444; }
.acal-arow.status-done { border-left-color: #22c55e; }
.acal-arow.status-done .acal-arow-name { text-decoration: line-through; color: #94a0b0; }
.acal-arow-time { font-weight: 700; font-variant-numeric: tabular-nums; color: #475569; width: 92px; flex: 0 0 auto; font-size: 12px; }
.acal-arow-type {
    font-size: 11px; font-weight: 700; color: hsl(var(--hue), 45%, 35%);
    background: hsl(var(--hue), 85%, 95%); border-radius: 20px; padding: 2px 9px; flex: 0 0 auto;
}
.acal-arow-name { font-weight: 600; color: #1f2937; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acal-arow-meta { color: #94a0b0; font-size: 12px; flex: 0 0 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px; }

/* ---------- hover popup ---------- */
.acal-pop {
    --hue: 212; position: absolute; z-index: 50; width: 282px; max-width: 92%;
    background: #fff; border: 1px solid #e5e7eb; border-top: 3px solid hsl(var(--hue), 62%, 52%);
    border-radius: 11px; box-shadow: 0 14px 36px rgba(16,24,40,.24); padding: 11px 13px 12px; font-size: 13px;
}
.acal-pop.status-overdue { border-top-color: #ef4444; }
.acal-pop.status-done { border-top-color: #22c55e; }
.acal-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.acal-pop-type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: hsl(var(--hue), 50%, 38%); background: hsl(var(--hue), 85%, 95%); border-radius: 20px; padding: 2px 9px; }
.acal-pop-status { font-size: 11px; font-weight: 700; border-radius: 20px; padding: 2px 9px; color: #1d4ed8; background: #e0ecff; }
.acal-pop.status-overdue .acal-pop-status { color: #b91c1c; background: #fee2e2; }
.acal-pop.status-done .acal-pop-status { color: #15803d; background: #dcfce7; }
.acal-pop-title { font-size: 15px; font-weight: 700; line-height: 1.3; margin-bottom: 7px; }
.acal-pop-meta { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.acal-pop-row { display: flex; align-items: center; gap: 7px; color: #4b5563; }
.acal-pop-row i { color: #9ca3af; width: 14px; text-align: center; flex: 0 0 auto; }
.acal-pop-row span { flex: 1 1 auto; }
.acal-pop-link { cursor: pointer; border-radius: 6px; padding: 2px 4px; margin: 0 -4px; transition: background .1s, color .1s; }
.acal-pop-link:hover { background: #eef4ff; color: #1d4ed8; }
.acal-pop-link:hover i { color: #2563eb; }
.acal-pop-go { font-size: 11px; }

/* assignee picker */
.acal-pop-assign { border-top: 1px solid #f0f2f5; padding-top: 8px; margin-bottom: 9px; }
.acal-pop-assign-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #4b5563; margin-bottom: 6px; }
.acal-pop-assign-label i { color: #9ca3af; }
.acal-pop-assign-avs { display: flex; flex-wrap: wrap; gap: 6px; }
.acal-asg-av {
    --ahue: 210; width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent;
    color: #fff; font-size: 10px; font-weight: 700; cursor: pointer;
    background: hsl(var(--ahue), 52%, 52%); opacity: .55;
    /* zero the default button padding and center via flex so both initials stay on one line */
    padding: 0; display: inline-flex; align-items: center; justify-content: center;
    line-height: 1; white-space: nowrap;
    transition: opacity .12s, transform .1s, border-color .12s;
}
.acal-asg-av:hover { opacity: 1; transform: scale(1.08); }
.acal-asg-av.current { opacity: 1; border-color: #1f2937; }
.acal-pop-desc { font-size: 12px; color: #374151; background: #f7f8fa; border-radius: 7px; padding: 7px 9px; margin-bottom: 9px; max-height: 120px; overflow: auto; }
.acal-pop-desc p { margin: 0 0 4px; }
.acal-pop-actions { display: flex; gap: 6px; }
.acal-pop-actions .acal-btn { font-size: 12px; padding: 5px 10px; }
.acal-pop-actions .acal-done { color: #15803d; border-color: #bbf7d0; background: #f0fdf4; }
.acal-pop-actions .acal-done:hover { background: #dcfce7; }
.acal-pop-actions .acal-del { color: #b91c1c; border-color: #fecaca; background: #fef2f2; margin-left: auto; }
.acal-pop-actions .acal-del:hover { background: #fee2e2; }


/* ======================================================================
   Dark theme (Bootstrap 5.3 [data-bs-theme="dark"]) — mirrors the kanban
   board's theme-aware treatment. The hand-tuned light rules above are left
   unchanged; these overrides recolor the neutral chrome with --bs-* theme
   variables, map the status colors onto Bootstrap's theme-aware
   emphasis/subtle variables (with rgba fallbacks), and give the hue-tinted
   cards/pills a dark-surface + light-text formula.
   ====================================================================== */
[data-bs-theme="dark"] .activities { color: var(--bs-body-color); }

/* ---------- "add activity" buttons ---------- */
[data-bs-theme="dark"] .activity-add-btn {
    border-color: var(--bs-border-color) !important;
    background: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
}
[data-bs-theme="dark"] .activity-add-btn:hover {
    background: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
    color: #fff !important;
}
/* the add.png glyph is a dark icon — invert it so it shows on the dark button */
[data-bs-theme="dark"] .activity-add-btn img { filter: brightness(0) invert(1); }

/* ---------- empty state ---------- */
[data-bs-theme="dark"] .act-empty { color: var(--bs-secondary-color); }

/* ---------- list card ---------- */
[data-bs-theme="dark"] .act {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .act:hover {
    border-color: var(--bs-border-color);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
[data-bs-theme="dark"] .act.status-overdue .act-bar { background: var(--bs-danger); }
[data-bs-theme="dark"] .act.status-done .act-bar { background: var(--bs-success); }

[data-bs-theme="dark"] .act-type {
    color: hsl(var(--hue), 70%, 80%);
    background: hsl(var(--hue), 40%, 22%);
}
[data-bs-theme="dark"] .act.status-overdue .act-type {
    color: var(--bs-danger-text-emphasis, #ea868f);
    background: var(--bs-danger-bg-subtle, rgba(var(--bs-danger-rgb), 0.2));
}
[data-bs-theme="dark"] .act.status-done .act-type {
    color: var(--bs-success-text-emphasis, #75b798);
    background: var(--bs-success-bg-subtle, rgba(var(--bs-success-rgb), 0.2));
}

[data-bs-theme="dark"] .act-due { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .act-due i { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .act.status-overdue .act-due,
[data-bs-theme="dark"] .act.status-overdue .act-due i { color: var(--bs-danger); }
[data-bs-theme="dark"] .act.status-done .act-due,
[data-bs-theme="dark"] .act.status-done .act-due i { color: var(--bs-success); }

[data-bs-theme="dark"] .act-btn { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .act-btn:hover { background: var(--bs-tertiary-bg); border-color: var(--bs-border-color); }
[data-bs-theme="dark"] .act-done:hover { color: var(--bs-success); background: rgba(var(--bs-success-rgb), 0.15); border-color: rgba(var(--bs-success-rgb), 0.5); }
[data-bs-theme="dark"] .act-edit:hover { color: var(--bs-primary); background: rgba(var(--bs-primary-rgb), 0.15); border-color: rgba(var(--bs-primary-rgb), 0.5); }
[data-bs-theme="dark"] .act-delete:hover { color: var(--bs-danger); background: rgba(var(--bs-danger-rgb), 0.15); border-color: rgba(var(--bs-danger-rgb), 0.5); }

[data-bs-theme="dark"] .act-title { color: var(--bs-body-color); }
[data-bs-theme="dark"] .act.status-done .act-title { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .act-desc { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .act-desc a { color: var(--bs-link-color, var(--bs-primary)); }
[data-bs-theme="dark"] .act-foot { border-top-color: var(--bs-border-color); }
[data-bs-theme="dark"] .act-assigned { color: var(--bs-secondary-color); }

/* ======================================================================
   Calendar view (.acal*) — dark theme
   ====================================================================== */
[data-bs-theme="dark"] .acal { color: var(--bs-body-color); background: var(--bs-body-bg); }

/* ---------- toolbar ---------- */
[data-bs-theme="dark"] .acal-btn {
    border-color: var(--bs-border-color);
    background: transparent;
    color: var(--bs-body-color);
}
[data-bs-theme="dark"] .acal-btn:hover { background: var(--bs-tertiary-bg); border-color: var(--bs-secondary-color); }

[data-bs-theme="dark"] .acal-switch { background: var(--bs-tertiary-bg); }
[data-bs-theme="dark"] .acal-switch-btn { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-switch-btn:hover { color: var(--bs-body-color); }
[data-bs-theme="dark"] .acal-switch-btn.active { background: var(--bs-secondary-bg); color: var(--bs-primary); box-shadow: none; }

[data-bs-theme="dark"] .acal-stat { color: var(--bs-secondary-color); background: var(--bs-secondary-bg); }
[data-bs-theme="dark"] .acal-stat.overdue { color: var(--bs-danger); background: rgba(var(--bs-danger-rgb), 0.16); }

/* ---------- legend / filters ---------- */
[data-bs-theme="dark"] .acal-legend-status { background: var(--bs-tertiary-bg); }
[data-bs-theme="dark"] .acal-seg { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-seg:hover { color: var(--bs-body-color); }
[data-bs-theme="dark"] .acal-seg.active { background: var(--bs-secondary-bg); color: var(--bs-primary); box-shadow: none; }
[data-bs-theme="dark"] .acal-chip {
    border-color: var(--bs-border-color);
    background: transparent;
    color: var(--bs-body-color);
}
[data-bs-theme="dark"] .acal-chip:hover { background: var(--bs-tertiary-bg); }
[data-bs-theme="dark"] .acal-chip.on {
    border-color: hsl(var(--ahue), 45%, 45%);
    background: hsl(var(--ahue), 40%, 24%);
    box-shadow: inset 0 0 0 1px hsl(var(--ahue), 45%, 40%);
}

/* ---------- month ---------- */
[data-bs-theme="dark"] .acal-weekday { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-day {
    border-color: var(--bs-border-color);
    background: var(--bs-body-bg);
}
[data-bs-theme="dark"] .acal-day.weekend { background: var(--bs-tertiary-bg); }
[data-bs-theme="dark"] .acal-day.other-month { background: var(--bs-body-bg); }
[data-bs-theme="dark"] .acal-day.today {
    border-color: rgba(var(--bs-primary-rgb), 0.5);
    background: rgba(var(--bs-primary-rgb), 0.1);
    box-shadow: inset 0 0 0 1px rgba(var(--bs-primary-rgb), 0.5);
}
[data-bs-theme="dark"] .acal-day.drag-over {
    border: 1px dashed var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.18);
    box-shadow: inset 0 0 0 2px rgba(var(--bs-primary-rgb), 0.55);
}
[data-bs-theme="dark"] .acal-daynum-v { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-day.today .acal-daynum-v { background: var(--bs-primary); color: #fff; }
[data-bs-theme="dark"] .acal-events::-webkit-scrollbar-thumb { background: var(--bs-secondary-bg); }
[data-bs-theme="dark"] .acal-more { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-more:hover { background: var(--bs-tertiary-bg); color: var(--bs-primary); }
[data-bs-theme="dark"] .acal-add { background: var(--bs-primary); }
[data-bs-theme="dark"] .acal-add:hover { background: var(--bs-primary); filter: brightness(1.12); }

/* ---------- card ---------- */
[data-bs-theme="dark"] .acal-card {
    color: hsl(var(--hue), 75%, 80%);
    background: linear-gradient(180deg, hsl(var(--hue), 38%, 22%), hsl(var(--hue), 40%, 18%));
    border-color: hsl(var(--hue), 35%, 34%);
    box-shadow: inset 3px 0 0 hsl(var(--hue), 60%, 55%);
}
[data-bs-theme="dark"] .acal-card:hover { box-shadow: inset 3px 0 0 hsl(var(--hue), 60%, 55%), 0 4px 10px rgba(0, 0, 0, 0.45); }
[data-bs-theme="dark"] .acal-card.status-overdue {
    color: var(--bs-danger-text-emphasis, #ea868f);
    background: var(--bs-danger-bg-subtle, rgba(var(--bs-danger-rgb), 0.18));
    border-color: var(--bs-danger-border-subtle, rgba(var(--bs-danger-rgb), 0.4));
    box-shadow: inset 3px 0 0 var(--bs-danger);
}
[data-bs-theme="dark"] .acal-card.status-overdue:hover { box-shadow: inset 3px 0 0 var(--bs-danger), 0 4px 10px rgba(0, 0, 0, 0.45); }
[data-bs-theme="dark"] .acal-card.status-done {
    color: var(--bs-success-text-emphasis, #75b798);
    background: var(--bs-success-bg-subtle, rgba(var(--bs-success-rgb), 0.18));
    border-color: var(--bs-success-border-subtle, rgba(var(--bs-success-rgb), 0.4));
    box-shadow: inset 3px 0 0 var(--bs-success);
}

/* ---------- week ---------- */
[data-bs-theme="dark"] .acal-wcol {
    border-color: var(--bs-border-color);
    background: var(--bs-body-bg);
}
[data-bs-theme="dark"] .acal-wcol.weekend { background: var(--bs-tertiary-bg); }
[data-bs-theme="dark"] .acal-wcol.today {
    border-color: rgba(var(--bs-primary-rgb), 0.5);
    box-shadow: inset 0 0 0 1px rgba(var(--bs-primary-rgb), 0.5);
}
[data-bs-theme="dark"] .acal-wcol-head {
    border-bottom-color: var(--bs-border-color);
    background: var(--bs-secondary-bg);
}
[data-bs-theme="dark"] .acal-wcol.today .acal-wcol-head { background: rgba(var(--bs-primary-rgb), 0.12); }
[data-bs-theme="dark"] .acal-wcol-dow { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-wcol-date { color: var(--bs-body-color); }
[data-bs-theme="dark"] .acal-wcol.today .acal-wcol-date { color: var(--bs-primary); }
[data-bs-theme="dark"] .acal-wcol-body::-webkit-scrollbar-thumb { background: var(--bs-secondary-bg); }
[data-bs-theme="dark"] .acal-wcol.drag-over {
    border: 1px dashed var(--bs-primary);
    box-shadow: inset 0 0 0 2px rgba(var(--bs-primary-rgb), 0.55);
}

/* ---------- agenda ---------- */
[data-bs-theme="dark"] .acal-agenda-empty { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-agenda-day { background: var(--bs-body-bg); }
[data-bs-theme="dark"] .acal-agenda-dow { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-agenda-num { color: var(--bs-body-color); }
[data-bs-theme="dark"] .acal-agenda-day.today .acal-agenda-num { color: var(--bs-primary); }
[data-bs-theme="dark"] .acal-agenda-mon { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-arow {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
    border-left-color: hsl(var(--hue), 60%, 55%);
}
[data-bs-theme="dark"] .acal-arow:hover { background: var(--bs-secondary-bg); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4); }
[data-bs-theme="dark"] .acal-arow.current {
    background: hsl(var(--hue), 40%, 22%);
    border-color: hsl(var(--hue), 45%, 42%);
}
[data-bs-theme="dark"] .acal-arow.status-overdue { border-left-color: var(--bs-danger); }
[data-bs-theme="dark"] .acal-arow.status-done { border-left-color: var(--bs-success); }
[data-bs-theme="dark"] .acal-arow.status-done .acal-arow-name { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-arow-time { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-arow-type {
    color: hsl(var(--hue), 70%, 80%);
    background: hsl(var(--hue), 40%, 22%);
}
[data-bs-theme="dark"] .acal-arow-name { color: var(--bs-body-color); }
[data-bs-theme="dark"] .acal-arow-meta { color: var(--bs-secondary-color); }

/* ---------- hover popup ---------- */
[data-bs-theme="dark"] .acal-pop {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
    border-top-color: hsl(var(--hue), 62%, 58%);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
}
[data-bs-theme="dark"] .acal-pop.status-overdue { border-top-color: var(--bs-danger); }
[data-bs-theme="dark"] .acal-pop.status-done { border-top-color: var(--bs-success); }
[data-bs-theme="dark"] .acal-pop-type {
    color: hsl(var(--hue), 70%, 80%);
    background: hsl(var(--hue), 40%, 22%);
}
[data-bs-theme="dark"] .acal-pop-status {
    color: var(--bs-primary-text-emphasis, #6ea8fe);
    background: var(--bs-primary-bg-subtle, rgba(var(--bs-primary-rgb), 0.2));
}
[data-bs-theme="dark"] .acal-pop.status-overdue .acal-pop-status {
    color: var(--bs-danger-text-emphasis, #ea868f);
    background: var(--bs-danger-bg-subtle, rgba(var(--bs-danger-rgb), 0.2));
}
[data-bs-theme="dark"] .acal-pop.status-done .acal-pop-status {
    color: var(--bs-success-text-emphasis, #75b798);
    background: var(--bs-success-bg-subtle, rgba(var(--bs-success-rgb), 0.2));
}
[data-bs-theme="dark"] .acal-pop-row { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-pop-row i { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-pop-link:hover { background: rgba(var(--bs-primary-rgb), 0.15); color: var(--bs-primary); }
[data-bs-theme="dark"] .acal-pop-link:hover i { color: var(--bs-primary); }
[data-bs-theme="dark"] .acal-pop-assign { border-top-color: var(--bs-border-color); }
[data-bs-theme="dark"] .acal-pop-assign-label { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-pop-assign-label i { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .acal-asg-av.current { border-color: var(--bs-body-color); }
[data-bs-theme="dark"] .acal-pop-desc {
    color: var(--bs-body-color);
    background: var(--bs-tertiary-bg);
}
[data-bs-theme="dark"] .acal-pop-desc a { color: var(--bs-link-color, var(--bs-primary)); }
[data-bs-theme="dark"] .acal-pop-actions .acal-btn { border-color: var(--bs-border-color); background: transparent; color: var(--bs-body-color); }
[data-bs-theme="dark"] .acal-pop-actions .acal-done {
    color: var(--bs-success);
    border-color: rgba(var(--bs-success-rgb), 0.5);
    background: rgba(var(--bs-success-rgb), 0.12);
}
[data-bs-theme="dark"] .acal-pop-actions .acal-done:hover { background: rgba(var(--bs-success-rgb), 0.2); }
[data-bs-theme="dark"] .acal-pop-actions .acal-del {
    color: var(--bs-danger);
    border-color: rgba(var(--bs-danger-rgb), 0.5);
    background: rgba(var(--bs-danger-rgb), 0.12);
}
[data-bs-theme="dark"] .acal-pop-actions .acal-del:hover { background: rgba(var(--bs-danger-rgb), 0.2); }


/* ======================================================================
   Mobile portrait (≤ 600px) — make the calendar usable on a phone held
   vertically. Desktop is "fill the box, scroll inside each region"; on a
   phone we let the form grow to content height and reflow:
     · toolbar  → nav+title on row 1, a full-width segmented switch on row 2
     · legend   → one horizontally-swipeable filter row (was a tall wrap)
     · month    → keep 7 columns but compact; cards collapse to slim pills
     · week     → the 7-column grid stacks into full-width day sections
     · agenda   → drop the fixed time/meta column widths, rows wrap
     · popup    → a bottom sheet (overrides the JS inline left/top anchor)
   The default view is also switched to Agenda on small screens (see the
   activityCalendar JS) since a vertical list is the natural phone layout.
   ====================================================================== */
@media (max-width: 600px) {
    .acal {
        height: auto;          /* grow with content; the form container scrolls */
        min-height: 60vh;
        padding: 2px;
    }

    /* ---------- toolbar ---------- */
    .acal-toolbar { flex-wrap: wrap; gap: 8px; padding: 2px 2px 8px; }
    .acal-tb-left { order: 1; flex: 1 1 auto; gap: 8px; }
    .acal-stats   { order: 2; flex: 0 0 auto; }
    .acal-switch  { display: flex; order: 3; flex: 1 1 100%; margin-left: 0; }
    .acal-switch-btn { flex: 1 1 0; padding: 7px 0; text-align: center; }
    .acal-title { font-size: 16px; }
    .acal-btn { padding: 6px 10px; }   /* roomier tap targets */

    /* ---------- legend → swipeable filter row ---------- */
    .acal-legend {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px;
        padding: 0 2px 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .acal-legend::-webkit-scrollbar { display: none; }
    .acal-legend-group { flex-wrap: nowrap; flex: 0 0 auto; }
    .acal-legend-status { flex: 0 0 auto; margin-right: 0; }
    .acal-chip, .acal-seg { flex: 0 0 auto; }

    /* ---------- month: 7 compact columns, slim pill cards ---------- */
    .acal-weekdays, .acal-grid { gap: 3px; }
    .acal-weekday { font-size: 9px; letter-spacing: .3px; padding: 2px 0 4px; }
    .acal-grid { grid-auto-rows: minmax(54px, auto); }
    .acal-day { min-height: 54px; border-radius: 8px; padding: 2px; }
    .acal-daynum { padding: 0 2px 1px; }
    .acal-daynum-v { font-size: 11px; min-width: 17px; height: 17px; line-height: 17px; }
    /* no hover on touch — keep the quick-add "+" visible, but small & quiet so it
       doesn't dominate the 42-cell grid */
    .acal-add { width: 15px; height: 15px; top: 2px; left: 2px; opacity: .4; transform: scale(1); }
    .acal-day:active .acal-add { opacity: .95; }
    .acal-events { gap: 2px; }
    .acal-card { padding: 2px 4px; font-size: 10px; line-height: 1.3; gap: 3px; border-radius: 5px; }
    .acal-card-time, .acal-card-avatar, .acal-card-dot { display: none; }   /* title + colour bar only */
    .acal-more { font-size: 10px; padding: 1px 4px; }

    /* ---------- week: stack the 7 day-columns vertically ---------- */
    .acal-week { display: flex; flex-direction: column; gap: 8px; }
    .acal-wcol { overflow: visible; border-radius: 9px; }
    .acal-wcol-head { justify-content: flex-start; gap: 8px; padding: 7px 10px; }
    .acal-wcol-body { overflow: visible; padding: 7px 8px; }
    /* full multi-line cards inside the stacked day (restore time + avatar) */
    .acal-week .acal-card { font-size: 12px; padding: 5px 8px; }
    .acal-week .acal-card-time, .acal-week .acal-card-avatar { display: inline-flex; }
    .acal-wcol-head .acal-add { position: static; margin-left: auto; opacity: 1; transform: none; }

    /* ---------- agenda: relax fixed widths, let rows wrap ---------- */
    .acal-arow { flex-wrap: wrap; gap: 6px 8px; padding: 8px 10px; }
    .acal-arow-time { width: auto; flex: 0 0 auto; }
    .acal-arow-name { flex: 1 1 100%; white-space: normal; order: 5; }
    .acal-arow-meta { flex: 1 1 100%; max-width: none; white-space: normal; order: 6; }
    .acal-agenda { padding: 0 2px 6px; }
    .acal-agenda-day { padding: 10px 4px 4px; }

    /* ---------- popup → centered modal (override the JS inline left/top) ----------
       A bottom sheet would collide with the lsFusion form's own bottom toolbar
       (Save/OK/Close), which renders above it, so we float the detail card in the
       middle of the screen instead. Click-away (JS) dismisses it. */
    .acal-pop {
        position: fixed !important;
        left: 50% !important;
        top: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%);
        width: calc(100vw - 24px) !important;
        max-width: 440px !important;
        max-height: 82vh;
        overflow-y: auto;
        border-radius: 14px;
        z-index: 2000;
        box-shadow: 0 18px 48px rgba(16, 24, 40, .34);
    }
    .acal-pop-assign-avs { gap: 8px; }
    .acal-asg-av { width: 34px; height: 34px; }      /* bigger tap targets */
    .acal-pop-actions .acal-btn { padding: 8px 12px; }
}
