#aimTopProgress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--aim-primary), var(--aim-primary-light));
  box-shadow: 0 0 8px rgba(var(--aim-primary-rgb),.6);
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
}
:root, :root[data-theme="light"] {
  --aim-primary: #ff8a2b;
  --aim-primary-rgb: 255, 138, 43;
  --aim-primary-dark: #d95400;
  --aim-primary-light: #ffab66;
  --aim-primary-soft: #fff1e3;
  --aim-on-primary: #241000;
  --aim-primary-fg: #e8640a;
  --aim-accent-teal: #00686b;
  --aim-accent-violet: #6f66d8;
  --aim-accent-green: #00994f;
  --aim-accent-amber: #b3720a;
  --aim-accent-red: #b3261e;
  --aim-bg: #fef7ef;
  --aim-surface: #ffffff;
  --aim-surface-alt: #fffaf4;
  --aim-hover: #fdf2e6;
  --aim-chip-bg: #f7eee4;
  --aim-border: #eee2d5;
  --aim-border-soft: #f6ede3;
  --aim-border-hover: #f7c393;
  --aim-active-border: #f6d9bd;
  --aim-code-bg: #f8f1e9;
  --aim-unread-bg: #fff4e8;
  --aim-danger-soft: #fef2f2;
  --aim-glass-bg: rgba(255,252,247,.32);
  --aim-glass-border: rgba(255,255,255,.55);
  --aim-glass-active: rgba(255,255,255,.5);
  --aim-text: #20201e;
  --aim-muted: #726a63;
  --aim-sidebar-w: 256px;
  --aim-sidebar-w-collapsed: 76px;
  --aim-topbar-h: 62px;
  --aim-radius: 12px;
  --aim-shadow-sm: 0 1px 2px rgba(56,36,16,.05);
  --bs-primary: #ff8a2b;
  --bs-primary-rgb: 255, 138, 43;
  --bs-link-color: #e8640a;
  --bs-link-color-rgb: 232, 100, 10;
  --bs-link-hover-color: #b84400;
  --bs-body-bg: #fef7ef;
  --bs-body-color: #20201e;
  --bs-border-color: #eee2d5;
  color-scheme: light;
}

/* explicit dark theme (data-theme="dark") and system-preferred dark (data-theme="system" or unset, matching prefers-color-scheme) */
:root[data-theme="dark"],
:root[data-theme="system"] {
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { color-scheme: dark; }
}
:root[data-theme="dark"],
:root[data-theme="system"] {
  --aim-primary: #ff7c1a;
  --aim-primary-rgb: 255, 124, 26;
  --aim-primary-dark: #ff9f55;
  --aim-primary-light: #ffbd85;
  --aim-primary-soft: #3a2411;
  --aim-on-primary: #1a1206;
  --aim-primary-fg: #ff7c1a;
  --aim-accent-teal: #2bb3b4;
  --aim-accent-violet: #9a92f0;
  --aim-accent-green: #35c06f;
  --aim-accent-amber: #f0a93c;
  --aim-accent-red: #ff8080;
  --aim-bg: #17130f;
  --aim-surface: #1f1a15;
  --aim-surface-alt: #251f19;
  --aim-hover: #2d251e;
  --aim-chip-bg: #2d251e;
  --aim-border: #392f26;
  --aim-border-soft: #2d251e;
  --aim-border-hover: #a85a17;
  --aim-active-border: #7d4211;
  --aim-code-bg: #251f19;
  --aim-unread-bg: #3b2712;
  --aim-danger-soft: #3a1c22;
  --aim-glass-bg: rgba(31,26,21,.55);
  --aim-glass-border: rgba(255,255,255,.08);
  --aim-glass-active: rgba(255,255,255,.08);
  --aim-text: #ece5dd;
  --aim-muted: #a89e93;
  --bs-primary: #ff7c1a;
  --bs-primary-rgb: 255, 124, 26;
  --bs-link-color: #ff9f55;
  --bs-link-color-rgb: 255, 159, 85;
  --bs-link-hover-color: #ffbd85;
  --bs-body-bg: #17130f;
  --bs-body-color: #ece5dd;
  --bs-border-color: #392f26;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    --aim-primary: #ff8a2b; --aim-primary-rgb: 255, 138, 43; --aim-primary-dark: #d95400; --aim-primary-light: #ffab66;
    --aim-primary-soft: #fff1e3; --aim-on-primary: #241000; --aim-primary-fg: #e8640a; --aim-accent-teal: #00686b; --aim-accent-violet: #6f66d8; --aim-accent-green: #00994f; --aim-accent-amber: #b3720a; --aim-accent-red: #b3261e;
    --aim-bg: #fef7ef; --aim-surface: #ffffff; --aim-surface-alt: #fffaf4; --aim-hover: #fdf2e6; --aim-chip-bg: #f7eee4;
    --aim-border: #eee2d5; --aim-border-soft: #f6ede3; --aim-border-hover: #f7c393; --aim-active-border: #f6d9bd;
    --aim-code-bg: #f8f1e9; --aim-unread-bg: #fff4e8; --aim-danger-soft: #fef2f2;
    --aim-glass-bg: rgba(255,252,247,.32); --aim-glass-border: rgba(255,255,255,.55); --aim-glass-active: rgba(255,255,255,.5);
    --aim-text: #20201e; --aim-muted: #726a63;
    --bs-primary: #ff8a2b; --bs-primary-rgb: 255, 138, 43; --bs-link-color: #e8640a; --bs-link-color-rgb: 232, 100, 10;
    --bs-link-hover-color: #b84400; --bs-body-bg: #fef7ef; --bs-body-color: #20201e; --bs-border-color: #eee2d5;
    color-scheme: light;
  }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --aim-primary: #ff7c1a; --aim-primary-rgb: 255, 124, 26; --aim-primary-dark: #ff9f55; --aim-primary-light: #ffbd85;
    --aim-primary-soft: #3a2411; --aim-on-primary: #1a1206; --aim-primary-fg: #ff7c1a; --aim-accent-teal: #2bb3b4; --aim-accent-violet: #9a92f0; --aim-accent-green: #35c06f; --aim-accent-amber: #f0a93c; --aim-accent-red: #ff8080;
    --aim-bg: #17130f; --aim-surface: #1f1a15; --aim-surface-alt: #251f19; --aim-hover: #2d251e; --aim-chip-bg: #2d251e;
    --aim-border: #392f26; --aim-border-soft: #2d251e; --aim-border-hover: #a85a17; --aim-active-border: #7d4211;
    --aim-code-bg: #251f19; --aim-unread-bg: #3b2712; --aim-danger-soft: #3a1c22;
    --aim-glass-bg: rgba(31,26,21,.55); --aim-glass-border: rgba(255,255,255,.08); --aim-glass-active: rgba(255,255,255,.08);
    --aim-text: #ece5dd; --aim-muted: #a89e93;
    --bs-primary: #ff7c1a; --bs-primary-rgb: 255, 124, 26; --bs-link-color: #ff9f55; --bs-link-color-rgb: 255, 159, 85;
    --bs-link-hover-color: #ffbd85; --bs-body-bg: #17130f; --bs-body-color: #ece5dd; --bs-border-color: #392f26;
  }
}
:root[data-theme="dark"] { color-scheme: dark; }
html { font-size: 19px; }
html, body { height: 100%; overscroll-behavior-x: none; }
:root {
  --font-sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --bs-font-sans-serif: var(--font-sans);
  --bs-font-monospace: var(--font-mono);
  --bs-body-font-family: var(--font-sans);
}
body { font-family: var(--font-sans); background: var(--aim-bg); color: var(--aim-text); font-size: 17px; }
/* Desktop only: adjusted type scale. Mobile/tablet keep the sizes above unchanged. */
@media (min-width: 992px) {
  html { font-size: 16px; }
  body { font-size: 14.5px; }
}
a { text-decoration: none; }
.btn-primary { --bs-btn-color: var(--aim-on-primary); --bs-btn-hover-color: var(--aim-on-primary); --bs-btn-active-color: var(--aim-on-primary); --bs-btn-disabled-color: var(--aim-on-primary); --bs-btn-bg: var(--aim-primary); --bs-btn-border-color: var(--aim-primary); --bs-btn-hover-bg: var(--aim-primary-dark); --bs-btn-hover-border-color: var(--aim-primary-dark); --bs-btn-active-bg: var(--aim-primary-dark); --bs-btn-active-border-color: var(--aim-primary-dark); --bs-btn-disabled-bg: var(--aim-border-hover); --bs-btn-disabled-border-color: var(--aim-border-hover); }
.btn-outline-primary { --bs-btn-hover-color: var(--aim-on-primary); --bs-btn-active-color: var(--aim-on-primary); --bs-btn-color: var(--aim-primary-fg); --bs-btn-border-color: var(--aim-primary); --bs-btn-hover-bg: var(--aim-primary); --bs-btn-hover-border-color: var(--aim-primary); --bs-btn-active-bg: var(--aim-primary-dark); --bs-btn-active-border-color: var(--aim-primary-dark); }
.text-primary { color: var(--aim-primary-fg) !important; }
.bg-primary { background-color: var(--aim-primary) !important; }
.form-control:focus, .form-select:focus { border-color: var(--aim-border-hover); box-shadow: 0 0 0 .2rem rgba(var(--aim-primary-rgb),.15); }
.form-check-input:checked { background-color: var(--aim-primary); border-color: var(--aim-primary); }
.nav-pills .nav-link.active { background: var(--aim-primary); color: var(--aim-on-primary); }
/* warm bootstrap's own neutrals so greys don't sit cold against the cream canvas */
:root, :root[data-theme="light"] {
  --bs-secondary-color: #7b736c;
  --bs-secondary-bg: #f7eee4;
  --bs-tertiary-bg: #fffaf4;
  --bs-emphasis-color: #20201e;
}
:root[data-theme="dark"], :root[data-theme="system"] {
  --bs-secondary-color: #a89e93;
  --bs-secondary-bg: #2d251e;
  --bs-tertiary-bg: #251f19;
  --bs-emphasis-color: #ece5dd;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { --bs-secondary-color: #a89e93; --bs-secondary-bg: #2d251e; --bs-tertiary-bg: #251f19; --bs-emphasis-color: #ece5dd; }
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] { --bs-secondary-color: #7b736c; --bs-secondary-bg: #f7eee4; --bs-tertiary-bg: #fffaf4; --bs-emphasis-color: #20201e; }
}
.btn-light { --bs-btn-bg: var(--aim-chip-bg); --bs-btn-border-color: var(--aim-border); --bs-btn-color: var(--aim-text); --bs-btn-hover-bg: var(--aim-hover); --bs-btn-hover-border-color: var(--aim-border-hover); --bs-btn-hover-color: var(--aim-text); --bs-btn-active-bg: var(--aim-hover); --bs-btn-active-border-color: var(--aim-border-hover); --bs-btn-active-color: var(--aim-text); }
.bg-light { background-color: var(--aim-surface-alt) !important; }
.bg-white { background-color: var(--aim-surface) !important; }
.text-muted { color: var(--aim-muted) !important; }
/* bootstrap wires .text-body to --bs-body-color-rgb, which it does not recolour per mode; .text-dark
   is deliberately left alone so it still reads on the fixed-yellow bg-warning badges */
.text-body { color: var(--aim-text) !important; }
.badge.bg-light { color: var(--aim-text); }
.badge.bg-secondary { color: #fff; }
.badge.bg-primary, .text-bg-primary { color: var(--aim-on-primary) !important; }
/* bootstrap's secondary is a cool slate; warm it so segmented controls and status badges
   sit with the rest of the palette instead of reading as leftover grey */
:root, :root[data-theme="light"] { --aim-neutral: #6b5d52; }
:root[data-theme="dark"], :root[data-theme="system"] { --aim-neutral: #bdb2a6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --aim-neutral: #bdb2a6; } }
@media (prefers-color-scheme: light) { :root[data-theme="system"] { --aim-neutral: #6b5d52; } }

/* task label chip: light yellow on light, a muted dark amber on dark - never the raw light yellow on a dark surface */
:root, :root[data-theme="light"] { --aim-label-bg: #fff3b0; --aim-label-fg: #6b5300; }
:root[data-theme="dark"], :root[data-theme="system"] { --aim-label-bg: #4a3a12; --aim-label-fg: #f5d67a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --aim-label-bg: #4a3a12; --aim-label-fg: #f5d67a; } }
@media (prefers-color-scheme: light) { :root[data-theme="system"] { --aim-label-bg: #fff3b0; --aim-label-fg: #6b5300; } }
.btn-outline-secondary {
  --bs-btn-color: var(--aim-neutral);
  --bs-btn-border-color: var(--aim-border);
  --bs-btn-hover-bg: var(--aim-hover);
  --bs-btn-hover-border-color: var(--aim-border-hover);
  --bs-btn-hover-color: var(--aim-text);
  --bs-btn-active-bg: var(--aim-primary-soft);
  --bs-btn-active-border-color: var(--aim-active-border);
  --bs-btn-active-color: var(--aim-primary-dark);
  --bs-btn-disabled-color: var(--aim-muted);
  --bs-btn-disabled-border-color: var(--aim-border);
}
.bg-secondary { background-color: #6f6055 !important; }
.list-group-item { background-color: var(--aim-surface); border-color: var(--aim-border); color: var(--aim-text); }
.list-group-item.active { background-color: var(--aim-primary-soft); border-color: var(--aim-active-border); color: var(--aim-primary-dark); }

.dropdown-menu { --bs-dropdown-bg: var(--aim-surface); --bs-dropdown-border-color: var(--aim-border); --bs-dropdown-link-color: var(--aim-text); --bs-dropdown-link-hover-bg: var(--aim-hover); --bs-dropdown-link-active-bg: var(--aim-primary-soft); --bs-dropdown-link-active-color: var(--aim-primary-dark); }
/* menus read as UI, not body copy — on touch they stay finger-sized */
.dropdown-menu { --bs-dropdown-font-size: .8125rem; --bs-dropdown-item-padding-y: .375rem; --bs-dropdown-item-padding-x: .875rem; --bs-dropdown-header-padding-y: .375rem; }
.dropdown-menu .dropdown-header { font-size: .75rem; }
@media (max-width: 767.98px) {
  .dropdown-menu { --bs-dropdown-font-size: 1rem; --bs-dropdown-item-padding-y: .5rem; }
  .dropdown-menu .dropdown-header { font-size: .875rem; }
}
.modal-content, .offcanvas { background-color: var(--aim-surface); color: var(--aim-text); }
.table { --bs-table-bg: transparent; --bs-table-color: var(--aim-text); --bs-table-border-color: var(--aim-border); --bs-table-hover-bg: var(--aim-hover); --bs-table-striped-bg: var(--aim-surface-alt); }
.card { border: 1px solid var(--aim-border); border-radius: var(--aim-radius); box-shadow: 0 1px 2px rgba(61,39,18,.04); }
.card-title { font-size: 1rem; font-weight: 600; }
.activity-toggle-btn { display: flex; align-items: center; width: 100%; border: 0; background: transparent; padding: 0; text-align: left; color: inherit; }
.activity-toggle-btn:hover { color: var(--aim-primary-fg); }
.activity-toggle-btn .bi-chevron-right, .activity-toggle-btn .bi-chevron-down { font-size: .75rem; color: var(--aim-muted); transition: transform .15s ease; }
.btn-icon { border: 0; background: transparent; padding: .35rem .5rem; color: var(--aim-muted); border-radius: 8px; line-height: 1; }
.btn-icon:hover { background: var(--aim-chip-bg); color: var(--aim-text); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; font-weight: 600; font-size: .75rem; object-fit: cover; flex: 0 0 auto; }
.avatar-sm { width: 28px; height: 28px; font-size: .7rem; }
.avatar-xs { width: 22px; height: 22px; font-size: .6rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--aim-surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.team-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: .7rem; color: #fff; font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .72rem; background: var(--aim-chip-bg); color: var(--aim-muted); }
.chip i { font-size: .8rem; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.text-xs { font-size: .72rem; }
.cursor-pointer { cursor: pointer; }
.empty-state { text-align: center; color: var(--aim-muted); padding: 40px 16px; }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: 8px; opacity: .6; }

/* ---------- app layout */
.aim-app { display: flex; min-height: 100vh; }
.sidebar { width: var(--aim-sidebar-w); background: var(--aim-surface); border-right: 1px solid var(--aim-border); position: fixed; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; z-index: 1040; transition: transform .2s ease; }
.has-banner .sidebar { top: 42px; }
.sidebar-brand { height: var(--aim-topbar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--aim-border); }
.brand-link { display: inline-flex; align-items: center; gap: 10px; color: var(--aim-text); min-width: 0; }
.brand-icon { width: 34px; height: 34px; border-radius: 8px; flex: 0 0 auto; }
.brand-icon-dark { display: none; }
[data-theme="dark"] .brand-icon-light { display: none; }
[data-theme="dark"] .brand-icon-dark { display: inline-block; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .brand-icon-light, :root:not([data-theme]) .brand-icon-light { display: none; }
  :root[data-theme="system"] .brand-icon-dark, :root:not([data-theme]) .brand-icon-dark { display: inline-block; }
}
.brand-text { font-weight: 800; font-size: 1.25rem; letter-spacing: .5px; color: var(--aim-primary-fg); white-space: nowrap; overflow: hidden; }
.brand-sub { color: var(--aim-muted); font-size: .8rem; margin-left: 4px; }
.sidebar-company { padding: 12px 12px 4px; }
.company-btn { width: 100%; display: flex; align-items: center; gap: 10px; border: 1px solid var(--aim-border); background: var(--aim-surface-alt); border-radius: 10px; padding: 8px 10px; text-align: left; }
.company-btn::after { margin-left: auto; }
.company-logo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; }
.company-logo-xs { width: 22px; height: 22px; border-radius: 6px; }
.company-logo-text {display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: .75rem; }
.company-name { font-weight: 600; }
.sidebar-nav-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 8px 12px; scrollbar-width: none; -ms-overflow-style: none; }
.sidebar-nav::-webkit-scrollbar { width: 0; height: 0; display: none; }
.nav-scroll-btn { flex: 0 0 auto; width: 100%; border: 0; background: transparent; color: var(--aim-muted); height: 20px; display: flex; align-items: center; justify-content: center; font-size: .7rem; cursor: pointer; }
.nav-scroll-btn:hover { color: var(--aim-primary-fg); background: var(--aim-hover); }
.nav-scroll-btn[hidden] { display: none; }
.nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--aim-muted); padding: 14px 10px 6px; font-weight: 600; white-space: nowrap; }
.sidebar .nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--aim-text); font-weight: 500; margin-bottom: 2px; white-space: nowrap; }
.sidebar .nav-item i { font-size: 1.05rem; color: var(--aim-muted); width: 20px; text-align: center; flex: 0 0 auto; }
.sidebar .nav-item span { overflow: hidden; text-overflow: ellipsis; }
.sidebar .nav-item:hover { background: var(--aim-hover); }
.sidebar .nav-item.active { background: var(--aim-primary-soft); color: var(--aim-primary-dark); }
.sidebar .nav-item.active i { color: var(--aim-primary-dark); }
.user-menu-theme { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px var(--bs-dropdown-item-padding-x, 16px); font-size: .9rem; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
/* profile: sign-in emails & phones - one line per address, actions behind a menu */
.contact-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; }
.contact-row .min-w-0 { min-width: 0; }
.contact-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: .75rem; min-width: 0; }
.contact-meta:empty { display: none; }
.contact-verify { font-size: .72rem; font-weight: 600; color: var(--bs-warning-text-emphasis); background: var(--bs-warning-bg-subtle); border-radius: 999px; padding: 1px 8px; text-decoration: none; }
a.contact-verify:hover { text-decoration: underline; }
.contact-primary { font-size: .7rem; font-weight: 600; color: var(--aim-primary-dark); background: var(--aim-primary-soft); border-radius: 999px; padding: 1px 8px; }
.user-menu-theme:hover { background: var(--bs-dropdown-link-hover-bg, var(--aim-hover)); }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(43,28,15,.5); z-index: 1035; }
.main { flex: 1; margin-left: var(--aim-sidebar-w); min-width: 0; display: flex; flex-direction: column; transition: margin-left .18s ease; }
.has-banner .main { padding-top: 42px; }
.topbar { height: var(--aim-topbar-h); background: var(--aim-surface); border-bottom: 1px solid var(--aim-border); display: flex; align-items: center; gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 1020; }
.has-banner .topbar { top: 42px; }
.page-title { font-size: 1.15rem; font-weight: 700; margin: 0; flex: 1; }
/* the page title takes the row, and a count sits against it on the pages that
   have one - the title shrinks first so a long one truncates rather than
   pushing the number out of the bar */
.page-title-wrap { flex: 1; display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.page-title-wrap .page-title { flex: 0 1 auto; min-width: 0; }
.page-count { font-size: .8rem; color: var(--aim-muted); white-space: nowrap; }
.page-count:empty { display: none; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: #d8cdc2; margin-right: 6px; }
.conn-dot.on { background: var(--aim-accent-green); box-shadow: 0 0 0 3px rgba(0,153,79,.2); }
.notif-count { position: absolute; top: 2px; right: 2px; background: #d92d20; color: #fff; font-size: .62rem; font-weight: 700; padding: 1px 5px; border-radius: 999px; min-width: 16px; text-align: center; }

/* ---------- theme switcher */
.theme-switch { display: flex; align-items: center; gap: 2px; background: var(--aim-chip-bg); border-radius: 999px; padding: 3px; }
.theme-switch-btn { border: 0; background: transparent; color: var(--aim-muted); width: 28px; height: 28px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; }
.theme-switch-btn:hover { color: var(--aim-text); }
.theme-switch-btn.active { background: var(--aim-surface); color: var(--aim-primary-fg); box-shadow: 0 1px 3px rgba(61,39,18,.12); }

/* ---------- collapsible desktop sidebar */
@media (min-width: 992px) {
  .sidebar-toggle-btn { border: 0; background: transparent; color: var(--aim-muted); width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
  .sidebar-toggle-btn:hover { background: var(--aim-hover); color: var(--aim-text); }
  html[data-sidebar-collapsed="1"] .sidebar { width: var(--aim-sidebar-w-collapsed); }
  html[data-sidebar-collapsed="1"] .main { margin-left: var(--aim-sidebar-w-collapsed); }
  html[data-sidebar-collapsed="1"] .sidebar-brand { justify-content: center; padding: 0 10px; }
  html[data-sidebar-collapsed="1"] .brand-text, html[data-sidebar-collapsed="1"] .brand-sub, html[data-sidebar-collapsed="1"] .sidebar-toggle-btn { display: none !important; }
  html[data-sidebar-collapsed="1"] .sidebar-company { padding: 12px 10px 4px; }
  html[data-sidebar-collapsed="1"] .company-btn { justify-content: center; padding: 8px; }
  html[data-sidebar-collapsed="1"] .company-btn .company-name, html[data-sidebar-collapsed="1"] .company-btn::after { display: none; }
  html[data-sidebar-collapsed="1"] .sidebar-nav { padding: 8px; }
  html[data-sidebar-collapsed="1"] .nav-section { height: 1px; padding: 0; margin: 10px 6px; background: var(--aim-border); overflow: hidden; text-indent: -9999px; }
  html[data-sidebar-collapsed="1"] .sidebar .nav-item { justify-content: center; padding: 10px; position: relative; }
  html[data-sidebar-collapsed="1"] .sidebar .nav-item span:not(.sidebar-collapsed-badge) { display: none; }
  html[data-sidebar-collapsed="1"] .sidebar .nav-item .badge { position: absolute; top: 4px; right: 4px; margin-left: 0 !important; }
  html[data-sidebar-collapsed="1"] .sidebar-brand .brand-link { justify-content: center; }
  html[data-sidebar-collapsed="1"] .sidebar-expand-btn { display: inline-flex; }
}
.sidebar-expand-btn {
  display: none; position: absolute; top: 22px; right: -13px; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--aim-border); background: var(--aim-surface); color: var(--aim-muted); align-items: center;
  justify-content: center; font-size: .75rem; z-index: 1041; box-shadow: 0 2px 6px rgba(61,39,18,.1);
}
.sidebar-expand-btn:hover { color: var(--aim-primary-fg); border-color: var(--aim-border-hover); }
.user-menu { min-width: 230px; font-size: 13px; }
.user-menu .dropdown-header { padding: 10px 14px 8px; }
.user-menu .dropdown-header .fw-semibold { font-size: 14px; }
.user-menu .dropdown-item { font-size: 13px; padding: 7px 14px; }
@media (max-width: 767.98px) {
  .user-menu { font-size: 16px; }
  .user-menu .dropdown-header .fw-semibold { font-size: 17px; }
  .user-menu .dropdown-item { font-size: 16px; padding: 10px 14px; }
}
.notif-menu { width: 360px; max-width: 92vw; padding: 0; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--aim-border-soft); color: var(--aim-text); }
.notif-item:hover { background: var(--aim-hover); }
.notif-item.unread { background: var(--aim-unread-bg); }
.notif-item .t { font-weight: 600; font-size: .85rem; }
.notif-item .b { font-size: .78rem; color: var(--aim-muted); }
.content { padding: 20px; flex: 1; }
/* blood red, and the same red in either theme - a banner saying you are signed
   in as somebody else should not soften into an accent colour anywhere */
.imp-banner { position: fixed; top: 0; left: 0; right: 0; height: 42px; background: #8a0303; color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; z-index: 1050; font-size: .85rem; padding: 0 12px; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .main { margin-left: 0; }
  .content { padding: 14px; padding-bottom: calc(14px + 58px + 22px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: 0 12px; }
  .theme-switch-btn { width: 25px; height: 25px; }

  /* prevent iOS/Android auto-zoom when a text field gets focus */
  input, select, textarea,
  .form-control, .form-select, .form-control-sm, .form-select-sm,
  .ts-control, .ts-control input, .ql-editor {
    font-size: 16px !important;
  }

  /* floating iOS-style glossy pill dock */
  .bottom-nav {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 58px;
    background: var(--aim-glass-bg);
    backdrop-filter: saturate(200%) blur(22px);
    -webkit-backdrop-filter: saturate(200%) blur(22px);
    border: 1px solid var(--aim-glass-border);
    border-radius: 29px;
    box-shadow: 0 10px 30px rgba(61,39,18,.16), inset 0 1px 0 var(--aim-glass-border);
  }
  .bnav-item {
    border: 0;
    background: transparent;
    color: var(--aim-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.25rem;
    position: relative;
  }
  .bnav-item:active { background: var(--aim-glass-active); }
  .bnav-item.active { color: var(--aim-primary-fg); }
  .bnav-fab {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--aim-primary);
    color: var(--aim-on-primary);
    box-shadow: 0 4px 14px rgba(var(--aim-primary-rgb),.4);
    font-size: 1.3rem;
  }
  .bnav-fab:active { background: var(--aim-primary-dark); color: var(--aim-on-primary); }
  .bnav-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: #d92d20; border: 2px solid rgba(255,255,255,.9); }
}

/* in portrait mobile, open the menu as a bottom sheet within thumb reach */
@media (max-width: 991.98px) and (orientation: portrait) {
  .sidebar {
    top: auto;
    right: 0;
    width: 100%;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    height: 72vh;
    max-height: 72vh;
    border-right: 0;
    border-top: 1px solid var(--aim-border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 30px rgba(61,39,18,.18);
    transform: translateY(calc(100% + 84px + env(safe-area-inset-bottom, 0px)));
  }
  .has-banner .sidebar { top: auto; }
  body.sidebar-open .sidebar { transform: translateY(0); }
  .sidebar-nav { overflow-y: auto; }
}

/* ---------- auth layout */
.auth-body { background: linear-gradient(160deg, var(--aim-primary-soft) 0%, var(--aim-surface-alt) 45%, var(--aim-bg) 100%); min-height: 100vh; }
.auth-wrap { max-width: 1100px; margin: 0 auto; padding: 16px 16px 40px; min-height: 100vh; display: flex; flex-direction: column; }
.auth-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 24px; }
.auth-logout-btn {
  width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50%; border: 1px solid var(--aim-border);
  background: var(--aim-surface); color: var(--aim-muted); display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.auth-logout-btn:hover { background: var(--aim-danger-soft); color: #dc2626; border-color: #fecaca; }
.auth-content { flex: 1; }
.auth-footer { text-align: center; color: var(--aim-muted); font-size: .8rem; padding-top: 30px; }
.auth-card { background: var(--aim-surface); border: 1px solid var(--aim-border); border-radius: 16px; padding: 32px 28px; max-width: 460px; box-shadow: 0 10px 30px rgba(61,39,18,.07); }
@media (max-width: 767.98px) {
  .auth-card { padding-left: 10px; padding-right: 10px; }
}
.shield-wrap { min-height: 120px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.shield-wrap shield-auth { width: 100%; display: flex; justify-content: center; }
.shield-loader { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 0 32px; }
.shield-loader .spinner-border { width: 2.25rem; height: 2.25rem; border-width: .22em; }
.select-wrap { max-width: 960px; display: flex; flex-direction: column; min-height: calc(100vh - 230px); overflow: hidden; }
.home-hero { text-align: center; padding: 30px 0 10px; }
.home-title { font-weight: 800; font-size: 2.2rem; }
.home-sub { color: var(--aim-muted); font-size: 1.05rem; max-width: 620px; margin: 0 auto; }
.home-features .feature { background: var(--aim-surface); border: 1px solid var(--aim-border); border-radius: 14px; padding: 20px; height: 100%; }
.home-features .feature i { font-size: 1.6rem; color: var(--aim-primary-fg); }
.home-features .feature h6 { margin: 10px 0 6px; font-weight: 700; }
.home-features .feature p { color: var(--aim-muted); margin: 0; font-size: .88rem; }
/* AI boxes stay white cards like the rest (a tint read as the page background showing through) - an orange top edge marks them */
.home-features .feature-ai { border-color: rgba(var(--aim-primary-rgb), .45); box-shadow: inset 0 3px 0 var(--aim-primary); }
.feature-tag { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--aim-primary); color: #fff; font-size: .66rem; font-weight: 700; vertical-align: middle; letter-spacing: .03em; }
.company-card-logo { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; font-size: 1rem; }
.company-card-body { flex: 1; min-width: 0; }
.company-card-name { font-weight: 700; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- select-company: vertically-centered, fanned card stack */
.select-intro { margin-bottom: 0; }
/* the stack sits right under the intro; a tall window leaves its spare height below, not above */
.select-wrap .stack-wrap { justify-content: flex-start; padding-top: 0; }
.select-wrap .stack-stage { padding-top: 14px; }
.account-bar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-bottom: 28px; }
.company-card-account { color: var(--aim-primary-fg); font-weight: 600; }
.home-companies { max-width: 960px; overflow: hidden; }
.stack-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 8px 0; width: 100%; overflow: hidden; }
.stack-stage { display: flex; align-items: center; justify-content: center; gap: 18px; width: 100%; padding: 26px 0 18px; overflow: hidden; }
.stack-viewport {
  position: relative; width: 340px; max-width: calc(100vw - 140px); height: 420px; outline: none;
  touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.stack-track { position: absolute; inset: 0; perspective: 1200px; }
.stack-card {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--aim-surface); border: 1px solid var(--aim-border);
  border-radius: 18px; padding: 20px; display: flex; flex-direction: column; color: var(--aim-text); text-decoration: none;
  box-shadow: 0 16px 34px rgba(61,39,18,.12), 0 2px 6px rgba(61,39,18,.05); cursor: grab; transform-origin: 50% 100%;
  will-change: transform, opacity; -webkit-user-drag: none; overflow: hidden;
  transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .35s ease, box-shadow .25s ease;
}
.stack-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--aim-bg); opacity: var(--dim, 0); pointer-events: none; transition: opacity .45s ease; }
.stack-track.dragging .stack-card, .stack-track.dragging .stack-card::after { transition: none; }
.stack-track.dragging .stack-card { cursor: grabbing; }
.stack-card.is-active { border-color: var(--aim-active-border); box-shadow: 0 22px 44px rgba(var(--aim-primary-rgb),.14), 0 3px 8px rgba(61,39,18,.06); }
.stack-card.is-active:hover { box-shadow: 0 26px 50px rgba(var(--aim-primary-rgb),.18), 0 3px 8px rgba(61,39,18,.06); }
.stack-viewport:focus-visible .stack-card.is-active { box-shadow: 0 0 0 3px rgba(var(--aim-primary-rgb),.35), 0 22px 44px rgba(var(--aim-primary-rgb),.14); }
.stack-card:not(.is-active) .stack-card-inner { pointer-events: none; }
.stack-card-inner { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; }
/* a form card that still outgrows the card on a small screen scrolls inside it, so its button stays reachable */
.stack-card:not(.company-stack-card) .stack-card-inner { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.stack-card .card-title { font-size: 1rem; margin-bottom: 12px; }
.stack-card input, .stack-card select, .stack-card textarea { -webkit-user-select: text; user-select: text; }
.stack-card-band { position: absolute; top: -20px; left: -20px; right: -20px; height: 104px; background: linear-gradient(135deg, var(--aim-primary-dark) 0%, var(--aim-primary) 45%, var(--aim-primary-light) 100%); }
.stack-card-band::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 80% 20%, rgba(255,255,255,.35), transparent 45%); }
.company-stack-card .stack-card-inner { align-items: center; text-align: center; }
.company-stack-card .company-card-logo { position: relative; z-index: 1; width: 76px; height: 76px; margin-top: 40px; font-size: 1.35rem; border-radius: 20px; border: 4px solid #fff; box-shadow: 0 6px 16px rgba(61,39,18,.15); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; background: #fff; }
.company-stack-card .company-card-body { width: 100%; margin-top: 12px; flex: 1; }
.company-stack-card .company-card-name { white-space: normal; font-size: 1.15rem; font-weight: 800; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.company-card-role { display: inline-block; margin-top: 8px; padding: 2px 10px; border-radius: 999px; background: var(--aim-primary-soft); color: var(--aim-primary-dark); font-size: .74rem; font-weight: 600; }
.company-card-meta { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; color: var(--aim-muted); font-size: .82rem; }
.company-card-open { margin-top: auto; padding-top: 10px; width: 100%; }
.company-card-open .btn { width: 100%; border-radius: 10px; }
.stack-card-scroll { flex: 1; overflow-y: auto; }
.stack-card-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding-top: 32px; }
.stack-card-empty .bi { font-size: 1.8rem; opacity: .5; }
.stack-arrow {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--aim-border);
  background: var(--aim-surface); color: var(--aim-primary-fg); display: flex; align-items: center; justify-content: center;
  font-size: 1rem; box-shadow: 0 4px 12px rgba(61,39,18,.08); z-index: 30; transition: transform .15s ease, background .15s ease, opacity .2s ease;
}
.stack-arrow:hover { background: var(--aim-primary-soft); transform: scale(1.08); }
.stack-arrow:active { transform: scale(.96); }
.stack-arrow[disabled] { opacity: .35; pointer-events: none; }
.stack-nav { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.stack-dots { display: flex; gap: 6px; justify-content: center; }
.stack-dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: var(--aim-border); transition: all .25s ease; }
.stack-dot:hover { background: var(--aim-border-hover); }
.stack-dot.active { background: var(--aim-primary); width: 24px; border-radius: 5px; }
.stack-counter { font-size: .78rem; color: var(--aim-muted); letter-spacing: .02em; }
.stack-counter strong { color: var(--aim-text); font-weight: 600; }
@media (max-width: 767.98px) {
  .stack-stage { gap: 6px; padding: 22px 0 14px; }
  .stack-viewport { width: min(76vw, 320px); max-width: none; height: 440px; }
  .stack-card { padding: 16px; }
  .stack-card .card-title { margin-bottom: 8px; }
  /* 16px+ keeps iOS from zooming into a field on focus */
  .stack-card .form-control, .stack-card .form-select, .stack-card .btn { font-size: 16px; padding-top: .35rem; padding-bottom: .35rem; }
  /* keep the arrows on touch screens too, just small enough to sit beside the card */
  .stack-arrow { width: 26px; height: 26px; font-size: .7rem; box-shadow: 0 2px 6px rgba(61,39,18,.12); }
}
@media (prefers-reduced-motion: reduce) {
  .stack-card, .stack-card::after, .stack-arrow, .stack-dot { transition: none; }
}

/* ---------- dashboard */
.stat-card { display: flex; align-items: center; gap: 14px; }
.stat-card-center { flex-direction: column; justify-content: center; text-align: center; gap: 8px; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.stat-label { color: var(--aim-muted); font-size: .8rem; }
/* tile tints used to be fixed light hexes inlined from php, so they stayed light in dark mode */
.stat-icon-brand { background: var(--aim-primary-soft); color: var(--aim-primary-dark); }
.stat-icon-teal { background: var(--aim-chip-bg); color: var(--aim-accent-teal); }
.stat-icon-amber { background: var(--aim-chip-bg); color: var(--aim-accent-amber); }
.stat-icon-red { background: var(--aim-chip-bg); color: var(--aim-accent-red); }
.stat-icon-green { background: var(--aim-chip-bg); color: var(--aim-accent-green); }
.mini-task { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--aim-border-soft); color: var(--aim-text); }
.mini-task:last-child { border-bottom: 0; }

/* dashboard playbook row - like .mini-task but two lines of text */
.mini-playbook { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--aim-border-soft); color: var(--aim-text); text-decoration: none; }
.mini-playbook:last-of-type { border-bottom: 0; }
.mini-playbook:hover { color: var(--aim-primary-fg); }
.mini-playbook .dot { margin-top: 6px; flex: 0 0 auto; }
.mini-playbook .title { font-weight: 500; font-size: .85rem; }
.mini-playbook .text-xs { white-space: nowrap; }
.mini-task .title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.progress { height: 8px; border-radius: 999px; background: var(--aim-chip-bg); }
.activity-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--aim-border-soft); font-size: .85rem; }
.activity-item:last-child { border-bottom: 0; }

/* ---------- task ui */
.taskui { display: flex; flex-direction: column; gap: 12px; }
.taskui-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--aim-surface); border: 1px solid var(--aim-border); border-radius: var(--aim-radius); padding: 10px 12px; }
.taskui-toolbar .form-select, .taskui-toolbar .form-control { width: auto; min-width: 140px; }
/* the search box: its own full-width row at the top of the toolbar, on every screen size */
.taskui-search { position: relative; flex: 1 1 100%; }
.taskui-search > .bi-search { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--aim-primary); font-size: 1.05rem; pointer-events: none; }
.taskui-toolbar .taskui-search .form-control { width: 100%; min-width: 0; height: 44px; padding: 0 44px 0 42px; font-size: 1rem; border: 1.5px solid var(--aim-border); border-radius: 10px; }
.taskui-toolbar .taskui-search .form-control:focus { border-color: var(--aim-primary); box-shadow: 0 0 0 3px var(--aim-primary-soft); }
.taskui-toolbar .taskui-search .form-control:not(:placeholder-shown) { border-color: var(--aim-primary); }
.taskui-search-key { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: none; pointer-events: none; }
@media (min-width: 768px) { .taskui-search-key { display: inline-block; } }
.taskui-search .form-control:focus ~ .taskui-search-key,
.taskui-search .form-control:not(:placeholder-shown) ~ .taskui-search-key { display: none; }
.filters-group { display: contents; }
.filter-toggle-btn { display: none; }
.taskui-toolbar .form-select.taskui-sort { min-width: 190px; }
/* the "who worked on it" pickers sit in a panel, so they fill it rather than
   inheriting the toolbar's auto width */
.people-filter-menu { min-width: 250px; }
.taskui-toolbar .people-filter-menu .form-select { width: 100%; min-width: 0; }
.people-filter > .btn.has-filters,
.status-filter > .btn.has-filters { border-color: var(--aim-primary); color: var(--aim-primary-dark); background: var(--aim-primary-soft); }
.status-filter .dropdown-item { cursor: pointer; }
.taskui-body { display: flex; gap: 14px; align-items: flex-start; }
.lists-panel { width: 250px; flex: 0 0 250px; background: var(--aim-surface); border: 1px solid var(--aim-border); border-radius: var(--aim-radius); padding: 10px; position: sticky; top: calc(var(--aim-topbar-h) + 14px); max-height: calc(100vh - var(--aim-topbar-h) - 30px); overflow-y: auto; }
.lists-panel h6 { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--aim-muted); margin: 4px 6px 8px; display: flex; justify-content: space-between; align-items: center; }
.list-node { display: flex; align-items: center; gap: 4px; padding: 4px 4px; border-radius: 6px; font-size: .86rem; }
.ln-group { display: flex; align-items: center; gap: 6px; padding: 10px 4px 2px; font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--aim-muted); min-width: 0; }
.ln-group:first-child { padding-top: 2px; }
.list-node:hover { background: var(--aim-hover); }
.list-node .form-check-input { margin: 0; flex: 0 0 auto; }
.list-node .ln-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.list-node .ln-project { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
.list-node .ln-count { font-size: .7rem; color: var(--aim-muted); }
.list-node .ln-actions { opacity: 0; display: inline-flex; }
.list-node:hover .ln-actions { opacity: 1; }
.list-node .ln-toggle { width: 16px; text-align: center; color: var(--aim-muted); cursor: pointer; font-size: .7rem; flex: 0 0 auto; }
.list-children { margin-left: 14px; border-left: 1px dashed var(--aim-border); padding-left: 4px; }
.list-children.collapsed { display: none; }
.taskui-view { flex: 1; min-width: 0; }
@media (max-width: 991.98px) {
  .taskui-body { flex-direction: column; align-items: stretch; }
  .lists-panel { width: 100%; flex: none; position: static; max-height: 260px; }
  .taskui-view { width: 100%; }
}
@media (max-width: 767.98px) {
  /* collapse task list/board filters (and the Lists panel) behind a filter icon on mobile */
  .filter-toggle-btn { display: inline-flex; }
  .toolbar-actions { display: none !important; }
  .filters-group { display: none; }
  .lists-panel { display: none; }
  .lists-panel.open { display: block; }
  .filters-group.open { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; order: 5; margin-top: 4px; }
}

/* board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; min-height: 60vh; }
.board-col { flex: 0 0 290px; width: 290px; background: var(--aim-chip-bg); border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 200px); }
.board-col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 700; font-size: .88rem; }
.board-col-head .count { margin-left: auto; background: var(--aim-surface); color: var(--aim-muted); font-size: .72rem; padding: 1px 8px; border-radius: 999px; }
.board-cards { flex: 1; overflow-y: auto; padding: 4px 8px 8px; min-height: 60px; }
.task-card { background: var(--aim-surface); border: 1px solid var(--aim-border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; box-shadow: 0 1px 2px rgba(61,39,18,.04); transition: box-shadow .12s; }
.task-card:hover { box-shadow: 0 4px 14px rgba(61,39,18,.08); border-color: var(--aim-border-hover); }
.task-card.sortable-ghost { opacity: .4; }
.task-card.sortable-chosen { box-shadow: 0 8px 20px rgba(var(--aim-primary-rgb),.2); }
.task-card .tc-title { font-weight: 600; font-size: .9rem; line-height: 1.3; word-break: break-word; }
.task-card .tc-title.done { text-decoration: line-through; color: var(--aim-muted); }
.task-card .tc-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.task-card .tc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.task-card.overdue { border-left: 3px solid #ef4444; }
.task-card.hidden-task { opacity: .55; }
/* the fill and the ink both come from priority_meta(), inline - see prioBadge() */
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.board-add { margin: 4px 8px 8px; }

/* list view */
.task-table { background: var(--aim-surface); border: 1px solid var(--aim-border); border-radius: var(--aim-radius); overflow: visible; }
.task-row { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px; border-bottom: 1px solid var(--aim-border-soft); background: var(--aim-surface); cursor: pointer; }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--aim-hover); }
/* the handle carries the row's priority as a slim bar down its left edge (--prio,
   set in rowHtml), so the colour reads down the list without filling the column */
.task-row .drag { color: var(--aim-muted); cursor: grab; align-self: stretch; position: relative; display: flex; align-items: center; justify-content: flex-end; min-height: 22px; }
.task-row .drag::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 2px; background: var(--prio, transparent); }
/* medium is the one priority whose stripe changes with the theme: a light grey
   that would disappear on a dark surface, so it lifts there instead */
:root, :root[data-theme="light"] { --aim-prio-medium: #d0d0d0; }
:root[data-theme="dark"], :root[data-theme="system"] { --aim-prio-medium: #7e7e7e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --aim-prio-medium: #7e7e7e; } }
@media (prefers-color-scheme: light) { :root[data-theme="system"] { --aim-prio-medium: #d0d0d0; } }
.task-row .drag[data-prio="medium"]::before { background: var(--aim-prio-medium); }
.tr-title-line { display: flex; align-items: flex-start; gap: 7px; }
.prio-dot { width: 9px; height: 9px; min-width: 9px; border-radius: 50%; display: inline-block; margin-top: 6px; flex: 0 0 auto; }
.prio-dot-btn { border: 0; background: transparent; padding: 0; line-height: 1; }
/* whoever picked a team task up, ringed so their face is not mistaken for one
   more assignee sitting alongside the team */
.picked-by { display: inline-flex; margin-left: 4px; }
.picked-by .avatar { box-shadow: 0 0 0 2px var(--aim-surface), 0 0 0 3px var(--aim-primary); }
/* the ring sits ~3px outside the avatar, so a 4px gap left the name touching it;
   the wrapper sets the spacing here and the avatar's own row margin steps aside */
.picked-by-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.picked-by-line .picked-by { margin-left: 0; }
.task-row .tr-title { font-weight: 600; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.task-row .tr-title.done { text-decoration: line-through; color: var(--aim-muted); }
/* picked up by a team member: someone is on it */
.task-row .tr-title.picked, .tc-title.picked { font-weight: 400; font-style: italic; }
.task-row .tr-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .72rem; color: var(--aim-muted); margin-top: 4px; }
.task-row .tr-sub-item { display: inline-flex; align-items: center; }
.task-row.sortable-ghost { opacity: .4; }
/* row quick-pickers: caret-triggered dropdowns instead of native selects */
.row-picker { min-width: 0; }
.row-picker-btn { border: 1px solid transparent; background: transparent; padding: 2px 6px; border-radius: 6px; font-size: .72rem; display: inline-flex; align-items: center; gap: 5px; color: var(--aim-muted); max-width: 100%; }
.row-picker-btn:hover { background: var(--aim-hover); border-color: var(--aim-border); }
.row-picker-btn .rp-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-picker-btn .bi-caret-down-fill { font-size: .5rem; color: var(--aim-muted); flex: 0 0 auto; }
.row-picker-menu { min-width: 220px; max-height: 260px; overflow-y: auto; }
/* the same picker as a field control: full width, bordered like a select */
.row-picker.rp-field { display: block; }
.rp-field .row-picker-btn { width: 100%; font-size: .8rem; padding: .3rem .6rem; border-color: var(--aim-border); background: var(--aim-surface); color: var(--aim-text); }
.rp-field .row-picker-btn:hover { border-color: var(--aim-border-hover); }
.rp-field .row-picker-btn .bi-caret-down-fill { font-size: .6rem; }
.rp-field-menu { min-width: 100%; max-height: 260px; overflow-y: auto; }
.team-avatar i { font-size: .65rem; }
.task-row-add { cursor: default; background: var(--bs-body-bg); }
.task-row-add:hover { background: var(--aim-primary-soft); }
.task-row-add input {
  border: 1.5px solid var(--aim-primary);
  background: transparent;
  box-shadow: 0 0 0 0 rgba(var(--aim-primary-rgb),.35);
  animation: aim-pulse-border 2.2s ease-in-out infinite;
}
.task-row-add input:focus {
  border-style: solid;
  border-color: var(--aim-border-hover);
  box-shadow: 0 0 0 .2rem rgba(var(--aim-primary-rgb),.15);
  animation: none;
}
@keyframes aim-pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(var(--aim-primary-rgb),.35); border-color: var(--aim-primary); }
  70% { box-shadow: 0 0 0 6px rgba(var(--aim-primary-rgb),0); border-color: var(--aim-active-border); }
  100% { box-shadow: 0 0 0 0 rgba(var(--aim-primary-rgb),0); border-color: var(--aim-primary); }
}

/* calendar */
.calendar-wrap { background: var(--aim-surface); border: 1px solid var(--aim-border); border-radius: var(--aim-radius); padding: 12px; }
.fc .fc-toolbar-title { font-size: 1.1rem; }
.fc .fc-button-primary { background: var(--aim-primary); border-color: var(--aim-primary); color: var(--aim-on-primary); }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { background: var(--aim-primary-dark); border-color: var(--aim-primary-dark); }
.fc-event { cursor: pointer; font-size: .78rem; }
@media (max-width: 767.98px) {
  /* FullCalendar's own toolbar (prev/next/today, title, month/week/list) otherwise wraps into an
     uneven, overflowing mess on narrow screens; lay it out as three clean, evenly-sized rows instead. */
  .calendar-wrap { padding: 10px 6px; }
  .fc .fc-header-toolbar { flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 10px !important; }
  .fc .fc-toolbar-chunk { width: 100%; display: flex; justify-content: center; align-items: center; }
  .fc .fc-toolbar-chunk:nth-child(1) { order: 2; justify-content: space-between; gap: 8px; }
  .fc .fc-toolbar-chunk:nth-child(2) { order: 1; min-width: 0; }
  .fc .fc-toolbar-chunk:nth-child(3) { order: 3; }
  .fc .fc-toolbar-title {
    font-size: .95rem; margin: 0; text-align: center; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 100%;
  }
  .fc .fc-button { padding: .32rem .55rem; font-size: .76rem; line-height: 1.15; }
  .fc .fc-toolbar-chunk:nth-child(1) .fc-button-group { flex: 0 0 auto; }
  .fc .fc-toolbar-chunk:nth-child(3) .fc-button-group { display: flex; width: 100%; }
  .fc .fc-toolbar-chunk:nth-child(3) .fc-button-group .fc-button { flex: 1; }
  .fc-daygrid-day-number { font-size: .72rem; padding: 2px 4px; }
  .fc-col-header-cell-cushion { font-size: .68rem; padding: 4px 0; }
  .fc-daygrid-event, .fc-timegrid-event { font-size: .7rem; padding: 0 2px; }
  .fc-list-day-cushion { font-size: .78rem; padding: 6px 8px !important; }
  .fc-list-event-title, .fc-list-event-time { font-size: .8rem; }
  .fc-list-event-dot { transform: scale(.85); }
}

/* task detail page */
.task-detail-page { background: var(--aim-surface); border: 1px solid var(--aim-border); border-radius: var(--aim-radius); overflow: hidden; }
.tdp-header { padding: 10px 20px; border-bottom: 1px solid var(--aim-border); }
.tdp-form-wrap { padding: 20px 24px; max-width: 860px; }
/* the new-task form runs two panes, so it takes the whole width the way the
   task page does rather than sitting in the reading column */
.tdp-form-wrap.is-wide { max-width: none; }
.tf-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.tf-main { min-width: 0; }
.tf-side { background: var(--aim-surface-alt); border: 1px solid var(--aim-border); border-radius: 10px; padding: 14px; }
/* the pane is 320px wide, so every field in it takes the full width rather than
   holding the side-by-side columns the one-column form uses */
.tf-side .row > [class*="col-"] { flex: 0 0 100%; max-width: 100%; }
.tf-side #recPanel .form-label { margin-bottom: 2px; }
.tdp-form-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--aim-border); background: var(--aim-surface-alt); }
.td-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; }
.td-main { padding: 20px 24px; border-right: 1px solid var(--aim-border); min-width: 0; }
.td-side { padding: 16px; background: var(--aim-surface-alt); }
.td-side .lbl { font-size: .66rem; text-transform: uppercase; letter-spacing: .04em; color: var(--aim-muted); font-weight: 600; margin-bottom: 3px; }
.activity-toggle { display: flex; align-items: center; gap: 4px; border: 0; background: transparent; padding: 0; cursor: pointer; }
.activity-toggle:hover { color: var(--aim-primary-fg); }
.activity-toggle i { font-size: .7rem; }
.td-side .fld { margin-bottom: 10px; }
.td-side-row { display: flex; gap: 10px; }
.td-side-row .fld { flex: 1; min-width: 0; }
.td-meta { color: var(--aim-muted); border-top: 1px solid var(--aim-border); padding-top: 8px; margin-top: 2px; }
.td-title { font-size: 1.35rem; font-weight: 700; line-height: 1.25; }
.td-section { margin-top: 14px; background: var(--aim-surface-alt); border: 1px solid var(--aim-border); border-radius: 10px; padding: 10px 12px; }
.td-section h6 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--aim-primary-fg); font-weight: 700; display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--aim-border); }
.td-section h6 i { font-size: 1rem; }
/* the reply box sits apart from the thread so it reads as "your turn", not as another response */
.td-composer { margin-top: 14px; background: var(--aim-surface); border: 1.5px solid var(--aim-primary); border-radius: 10px; padding: 10px 12px; box-shadow: 0 4px 14px rgba(var(--aim-primary-rgb), .10); }
.td-composer h6 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--aim-primary-fg); font-weight: 700; display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.td-composer h6 i { font-size: 1rem; }
.rich { line-height: 1.6; word-break: break-word; }
.rich img { max-width: 100%; height: auto; border-radius: 6px; cursor: zoom-in; }
.lightbox-modal .modal-content { background: transparent; border: 0; box-shadow: none; }
.lightbox-modal .modal-body { padding: 0; display: flex; justify-content: center; }
.lightbox-body { max-width: 100%; }
.lightbox-body img { max-width: 100%; max-height: 85vh; display: block; margin: 0 auto; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.rich p { margin: 0; } /* match the Quill editor's own paragraph spacing (margin: 0) so text renders with the exact line breaks typed, instead of an extra gap forced onto every line */
.rich p:empty { min-height: 1.6em; min-height: 1lh; } /* a blank line saved as Quill's getSemanticHTML() output is a truly empty <p>, which has no height on its own — restore it to one line so the blank line the user typed still shows */
.rich pre { background: var(--aim-code-bg); padding: 10px; border-radius: 6px; }
/* Quill's stylesheet only reaches blockquotes inside its own editor, so a quote
   typed into a description or a response came back out of .rich with no bar and
   no indent - an ordinary paragraph. Give it both, and match the editor to it so
   what you type is what you get, in either theme. */
.rich blockquote { margin: 8px 0; padding: 2px 0 2px 14px; border-left: 3px solid var(--aim-border-hover); }
.rich blockquote:first-child { margin-top: 0; }
.rich blockquote:last-child { margin-bottom: 0; }
.ql-editor blockquote { border-left: 3px solid var(--aim-border-hover); padding-left: 14px; }
/* the indent buttons save a ql-indent-N class; Quill's stylesheet only indents it inside the editor,
   so give saved text the same 3em steps when it is shown */
.rich .ql-indent-1 { padding-left: 3em; }
.rich .ql-indent-2 { padding-left: 6em; }
.rich .ql-indent-3 { padding-left: 9em; }
.rich .ql-indent-4 { padding-left: 12em; }
.rich .ql-indent-5 { padding-left: 15em; }
.rich .ql-indent-6 { padding-left: 18em; }
.rich .ql-indent-7 { padding-left: 21em; }
.rich .ql-indent-8 { padding-left: 24em; }
code { color: var(--aim-primary-dark); }

/* the checklist rows on the task form reorder by drag before anything is saved */
.input-group-text.cl-drag { cursor: grab; color: var(--aim-muted); padding-left: .55rem; padding-right: .55rem; }
.input-group-text.cl-drag:active { cursor: grabbing; }
.checklist-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--aim-chip-bg); }
.checklist-item:last-child { border-bottom: 0; }
.checklist-item .drag { color: var(--aim-muted); cursor: grab; padding-top: 2px; }
.checklist-item .ci-title { font-weight: 400; }
.checklist-item.done .ci-title { text-decoration: line-through; color: var(--aim-muted); }
.checklist-item .ci-desc { font-size: .8rem; color: var(--aim-muted); white-space: pre-wrap; }
.checklist-item .ci-actions { opacity: 0; }
.checklist-item:hover .ci-actions { opacity: 1; }
.att-list { display: flex; flex-wrap: wrap; gap: 8px; }
.att { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--aim-border); border-radius: 8px; padding: 6px 10px; background: var(--aim-surface); max-width: 100%; }
.att[data-url] { cursor: pointer; }
.att[data-url]:hover { border-color: var(--aim-border-hover); }
.att img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; }
.att .name { font-size: .8rem; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att .size { font-size: .7rem; color: var(--aim-muted); }
.response { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--aim-border-soft); }
.response .rbody { flex: 1; min-width: 0; }
.response .rhead { display: flex; align-items: center; gap: 8px; font-size: .8rem; margin-bottom: 4px; }
.att-add-btn { flex: 0 0 auto; }
.att-add-btn.drag { border-color: var(--aim-primary); background: var(--aim-primary-soft); color: var(--aim-primary-dark); }
.ql-container { font-size: 14px; font-family: inherit; }
.ql-editor { min-height: 130px; }
.ql-toolbar.ql-snow, .ql-container.ql-snow { border-color: var(--aim-border); }
.ql-toolbar.ql-snow { border-radius: 8px 8px 0 0; }
.ql-container.ql-snow { border-radius: 0 0 8px 8px; }
.ql-fs-toggle { border: 0; background: transparent; color: var(--aim-muted); padding: 3px 6px; cursor: pointer; font-size: 15px; line-height: 1; }
.ql-fs-toggle:hover { color: var(--aim-primary-fg); }
.ql-fullscreen-wrap { position: relative; }
.ql-fullscreen-wrap.is-fullscreen { position: fixed; inset: 0; z-index: 2000; background: var(--aim-surface); display: flex; flex-direction: column; padding: 14px; }
.ql-fullscreen-wrap.is-fullscreen .ql-container { flex: 1; overflow-y: auto; }
.ql-fullscreen-wrap.is-fullscreen .ql-editor { min-height: 100%; }
body.ql-fullscreen-lock { overflow: hidden; }
.ql-editor img { max-width: 100%; height: auto; cursor: pointer; }
.ql-editor img.ql-img-active { outline: 2px solid var(--aim-primary); outline-offset: 1px; }
.ql-img-toolbar { position: absolute; z-index: 30; display: flex; align-items: center; gap: 2px; background: var(--aim-surface); border: 1px solid var(--aim-border); border-radius: 8px; padding: 3px; box-shadow: 0 4px 14px rgba(61,39,18,.14); }
.ql-img-toolbar button { border: 0; background: transparent; color: var(--aim-text); font-size: .72rem; font-weight: 600; padding: 4px 7px; border-radius: 5px; cursor: pointer; line-height: 1; }
.ql-img-toolbar button:hover { background: var(--aim-hover); }
.ql-img-toolbar .ql-img-sep { width: 1px; align-self: stretch; background: var(--aim-border); margin: 0 2px; }
.ql-img-toolbar button[data-act="attach"] { color: var(--aim-primary-fg); }

/* the picture editor: a tall canvas with the library's own menu under it */
.img-edit-modal .modal-body { padding: 10px 12px; }
.img-edit-host { position: relative; height: 74vh; min-height: 420px; background: #1e1e1e; border-radius: 8px; overflow: hidden; }
.img-edit-canvas { height: 100%; }
/* covers the frame until the editor and the picture are both up */
.img-edit-status { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; color: #ddd; font-size: .85rem; background: #1e1e1e; }
.img-edit-status .spinner-border { color: var(--aim-primary); }
/* the library ships its own load/download buttons; ours are in the footer */
.img-edit-modal .tui-image-editor-header-buttons, .img-edit-modal .tui-image-editor-header-logo { display: none; }
@media (max-width: 767.98px) {
  .img-edit-host { height: 76vh; }
}
/* filters live on across reloads, so the view says when it is showing less than everything */
.task-filter-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; padding: 7px 12px; border: 1px solid var(--aim-border); border-radius: 8px; background: var(--aim-primary-soft); color: var(--aim-primary-dark); font-size: .82rem; }
.task-filter-note i { color: var(--aim-primary); }
.filter-toggle-btn.has-filters { border-color: var(--aim-primary); color: var(--aim-primary-dark); background: var(--aim-primary-soft); }
/* a team task waiting to be picked up: read-only until someone takes it on */
.td-pickup { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--aim-border); border-radius: 10px; background: var(--aim-primary-soft); color: var(--aim-primary-dark); font-size: .85rem; }
/* only the banner's own leading icon - the one in the button keeps the button's ink */
.td-pickup > i { font-size: 1.1rem; color: var(--aim-primary); }
.task-row.locked .drag, .task-card.locked { cursor: default; }
.task-row.locked .drag { color: var(--aim-muted); opacity: .5; }
/* the country-code box only ever holds a few digits */
.phone-cc { max-width: 5.5rem; flex: 0 0 auto; }
.activity-log { font-size: .8rem; color: var(--aim-muted); }
.activity-log li { padding: 4px 0; border-bottom: 1px dashed var(--aim-chip-bg); }
.ext-item { border: 1px solid var(--aim-border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: .85rem; background: var(--aim-surface); }
@media (max-width: 991.98px) {
  .td-grid { grid-template-columns: 1fr; }
  .tf-grid { grid-template-columns: 1fr; gap: 16px; }
  .td-main { border-right: 0; }
}
@media (max-width: 767.98px) {
  .td-main, .td-side { padding: 14px; }
  .td-section, .td-composer { padding: 8px 10px; margin-top: 12px; }
}

/* roles matrix */
.perm-module { border: 1px solid var(--aim-border); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.perm-module-head { background: var(--aim-surface-alt); padding: 8px 12px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.perm-actions { padding: 8px 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.role-list .list-group-item.active { background: var(--aim-primary-soft); color: var(--aim-primary-dark); border-color: var(--aim-active-border); }

/* statuses */
.status-row { display: flex; align-items: center; gap: 10px; background: var(--aim-surface); border: 1px solid var(--aim-border); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
.status-row .drag { color: var(--aim-muted); cursor: grab; }

/* projects */
.project-card { height: 100%; transition: box-shadow .12s; }
.project-card:hover { box-shadow: 0 8px 22px rgba(61,39,18,.08); }
.project-color { width: 10px; height: 34px; border-radius: 4px; }

/* misc */
.toast { border-radius: 10px; }
.undo-pill { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1090; display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 1px solid var(--aim-border); border-radius: 999px; background: var(--aim-surface); color: var(--aim-text); font-size: .85rem; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.14); cursor: pointer; animation: undoPillIn .18s ease-out; transition: opacity .2s; }
.undo-pill:hover { border-color: var(--aim-primary); color: var(--aim-primary-fg); }
.undo-pill.hide { opacity: 0; pointer-events: none; }
@keyframes undoPillIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.tom-select .ts-control { border-radius: 8px; min-height: 38px; }
.ts-dropdown { z-index: 1075; max-height: 240px; }
.ts-dropdown .ts-dropdown-content { max-height: 240px; overflow-y: auto; }
.form-label { font-weight: 600; font-size: .8rem; color: var(--aim-text); }
.modal-content { border-radius: 14px; border: 0; }
.modal-header { border-bottom: 1px solid var(--aim-border); }
.table > :not(caption) > * > * { padding: .6rem .75rem; }
.badge { font-weight: 600; }
.sortable-drag { opacity: .9; }
kbd { background: var(--aim-chip-bg); color: var(--aim-text); border-radius: 4px; padding: 1px 5px; font-size: .7rem; }

/* ---------- dark theme: patch third-party components not covered by bootstrap's own color-mode vars */
[data-theme="dark"] .text-danger, [data-theme="system"] .text-danger { color: #ff8080 !important; }
[data-theme="dark"] .auth-logout-btn:hover, [data-theme="system"] .auth-logout-btn:hover { color: #ff8080; border-color: #6b2b2b; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .text-danger { color: #ff8080 !important; }
  html:not([data-theme]) .auth-logout-btn:hover { color: #ff8080; border-color: #6b2b2b; }
}
@media (prefers-color-scheme: light) {
  html[data-theme="system"] .text-danger { color: var(--bs-danger) !important; }
  html[data-theme="system"] .auth-logout-btn:hover { color: #dc2626; border-color: #fecaca; }
}
[data-theme="dark"] .ts-control, [data-theme="dark"] .ts-dropdown {
  background: var(--aim-surface); color: var(--aim-text); border-color: var(--aim-border) !important;
}
[data-theme="dark"] .ts-dropdown .option { color: var(--aim-text); }
[data-theme="dark"] .ts-dropdown .active { background: var(--aim-hover); }
[data-theme="dark"] .ql-toolbar.ql-snow { background: var(--aim-surface-alt); }
[data-theme="dark"] .ql-snow .ql-stroke { stroke: var(--aim-muted); }
[data-theme="dark"] .ql-snow .ql-fill { fill: var(--aim-muted); }
[data-theme="dark"] .ql-snow .ql-picker { color: var(--aim-muted); }
[data-theme="dark"] .ql-editor.ql-blank::before { color: var(--aim-muted); }
[data-theme="dark"] .ql-editor { color: var(--aim-text); }
[data-theme="dark"] .fc { --fc-page-bg-color: var(--aim-surface); --fc-neutral-bg-color: var(--aim-surface-alt); --fc-border-color: var(--aim-border); --fc-list-event-hover-bg-color: var(--aim-hover); }
[data-theme="dark"] .fc .fc-daygrid-day.fc-day-today { background: var(--aim-primary-soft); }
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .ts-control, html:not([data-theme]) .ts-control,
  html[data-theme="system"] .ts-dropdown, html:not([data-theme]) .ts-dropdown {
    background: var(--aim-surface); color: var(--aim-text); border-color: var(--aim-border) !important;
  }
  html[data-theme="system"] .ts-dropdown .option, html:not([data-theme]) .ts-dropdown .option { color: var(--aim-text); }
  html[data-theme="system"] .ts-dropdown .active, html:not([data-theme]) .ts-dropdown .active { background: var(--aim-hover); }
  html[data-theme="system"] .ql-toolbar.ql-snow, html:not([data-theme]) .ql-toolbar.ql-snow { background: var(--aim-surface-alt); }
  html[data-theme="system"] .ql-snow .ql-stroke, html:not([data-theme]) .ql-snow .ql-stroke { stroke: var(--aim-muted); }
  html[data-theme="system"] .ql-snow .ql-fill, html:not([data-theme]) .ql-snow .ql-fill { fill: var(--aim-muted); }
  html[data-theme="system"] .ql-snow .ql-picker, html:not([data-theme]) .ql-snow .ql-picker { color: var(--aim-muted); }
  html[data-theme="system"] .ql-editor, html:not([data-theme]) .ql-editor { color: var(--aim-text); }
  html[data-theme="system"] .fc, html:not([data-theme]) .fc { --fc-page-bg-color: var(--aim-surface); --fc-neutral-bg-color: var(--aim-surface-alt); --fc-border-color: var(--aim-border); --fc-list-event-hover-bg-color: var(--aim-hover); }
}

/* ---------------------------------------------------------------- AI assistant */
.ai-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(430px, 100vw);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--aim-surface);
  border-left: 1px solid var(--aim-border);
  box-shadow: -12px 0 32px rgba(61,39,18,.12);
  transform: translateX(105%);
  transition: transform .22s ease;
  z-index: 1045;
}
.ai-drawer.open { transform: none; }
.ai-drawer-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--aim-border);
}
.ai-drawer-title { font-weight: 600; }
.ai-drawer-title .bi { color: var(--aim-primary-fg); margin-right: .35rem; }
.ai-drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 1rem .9rem; }
.ai-drawer-foot {
  display: flex;
  gap: .5rem;
  align-items: flex-end;
  padding: .7rem .9rem;
  border-top: 1px solid var(--aim-border);
  background: var(--aim-surface-alt);
}
.ai-drawer-foot textarea { resize: none; max-height: 140px; }

/* inline (full-page) variant */
.ai-drawer.ai-inline {
  position: static;
  width: auto;
  height: min(72vh, 760px);
  transform: none;
  border-left: 0;
  box-shadow: none;
  border-radius: var(--aim-radius);
}
.ai-page-card { overflow: hidden; }
.ai-page-mount { display: flex; flex-direction: column; }

.ai-msg { margin-bottom: .85rem; display: flex; flex-direction: column; }
.ai-msg-user { align-items: flex-end; }
.ai-msg .ai-bubble {
  max-width: 92%;
  padding: .6rem .8rem;
  border-radius: 14px;
  background: var(--aim-hover);
  font-size: .925rem;
}
.ai-msg-user .ai-bubble { background: var(--aim-primary); color: var(--aim-on-primary); border-bottom-right-radius: 4px; }
.ai-msg-assistant .ai-bubble { border-bottom-left-radius: 4px; }
.ai-msg .ai-bubble p:last-child, .ai-msg .ai-bubble ul:last-child { margin-bottom: 0; }
.ai-msg .ai-bubble h5, .ai-msg .ai-bubble h6 { font-size: .95rem; font-weight: 600; margin: .6rem 0 .3rem; }
.ai-msg .ai-bubble ul { padding-left: 1.1rem; margin-bottom: .4rem; }
.ai-actions { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.ai-action-pill {
  font-size: .72rem;
  padding: .12rem .5rem;
  border-radius: 999px;
  background: var(--aim-primary-soft);
  color: var(--aim-primary-dark);
  text-transform: capitalize;
}
.ai-action-pill .bi { margin-right: .2rem; }
.ai-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.ai-chip {
  border: 1px solid var(--aim-border);
  background: var(--aim-surface);
  border-radius: 999px;
  font-size: .8rem;
  padding: .25rem .7rem;
  color: var(--aim-text);
}
.ai-chip:hover { border-color: var(--aim-border-hover); background: var(--aim-primary-soft); }
.ai-loading { display: flex; align-items: center; gap: .5rem; color: var(--aim-muted); font-size: .9rem; }
.ai-code { background: var(--aim-code-bg); padding: .6rem .7rem; border-radius: 8px; font-size: .82rem; overflow-x: auto; }

.ai-md h5, .ai-md h6 { font-weight: 600; margin: .9rem 0 .35rem; }
.ai-md h5:first-child, .ai-md h6:first-child { margin-top: 0; }
.ai-md ul { padding-left: 1.15rem; }
.ai-md p:last-child { margin-bottom: 0; }

.ai-pick {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  padding: .55rem .2rem;
  border-bottom: 1px solid var(--aim-border-soft);
  cursor: pointer;
}
.ai-pick:last-child { border-bottom: 0; }
.ai-kv { display: grid; grid-template-columns: 110px 1fr; gap: .35rem .75rem; margin: 0; }
.ai-kv dt { color: var(--aim-muted); font-weight: 500; }
.ai-kv dd { margin: 0; }
.ai-plan-list { margin-bottom: .6rem; }
.ai-plan-list ul { padding-left: 1.15rem; }
.ai-inline-badge { font-size: .7rem; color: var(--aim-primary-fg); }
.ai-topbar-btn .bi { color: var(--aim-primary-fg); }

/* ============================================================ Playbooks */
.pb-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; background: var(--aim-primary-soft); color: var(--aim-primary-fg); font-size: 1.05rem; }
.pb-icon-lg { width: 44px; height: 44px; flex-basis: 44px; font-size: 1.35rem; border-radius: 12px; }
.playbook-card { transition: box-shadow .12s; }
.playbook-card:hover { box-shadow: 0 8px 22px rgba(61,39,18,.08); }
/* file counts on a playbook card - readable at a glance, not 10px icon soup */
.chip-count { font-size: .74rem; font-weight: 600; padding: 3px 9px; color: var(--aim-text); background: var(--aim-chip-bg); gap: 5px; }
.chip-count i { font-size: .85rem; color: var(--aim-primary-fg); }
.chip-count .chip-word { font-weight: 400; color: var(--aim-muted); }
.chip-empty, .chip-empty i { color: var(--aim-muted); font-weight: 400; }
@media (max-width: 420px) { .chip-count .chip-word { display: none; } }

.pb-body img { max-width: 100%; height: auto; }
/* media gallery: screenshots, recordings and files all as one kind of tile */
.pb-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.pb-tile-wrap { position: relative; }
.pb-tile { display: block; width: 100%; text-align: left; padding: 0; border: 1px solid var(--aim-border); border-radius: 10px; background: var(--aim-surface); overflow: hidden; transition: border-color .12s, box-shadow .12s; }
.pb-tile:hover, .pb-tile:focus-visible { border-color: var(--aim-border-hover); box-shadow: 0 6px 18px rgba(61,39,18,.1); }
.tile-media { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--aim-surface-alt); overflow: hidden; }
.tile-media img, .tile-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--aim-muted); }
.tile-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.tile-play i { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 1.2rem; padding-left: 2px; }
.tile-name { display: block; padding: 7px 9px 0; font-size: .76rem; font-weight: 600; color: var(--aim-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-size { display: block; padding: 0 9px 8px; font-size: .68rem; color: var(--aim-muted); }
.pb-tile-wrap .tile-actions { position: absolute; top: 5px; right: 5px; display: none; gap: 2px; background: var(--aim-surface); border: 1px solid var(--aim-border); border-radius: 8px; padding: 1px; }
.pb-tile-wrap:hover .tile-actions, .pb-tile-wrap:focus-within .tile-actions { display: flex; }

/* full-size preview pane */
.fp-wrap { position: fixed; inset: 0; z-index: 1090; }
.fp-backdrop { position: absolute; inset: 0; background: rgba(12,8,4,.82); opacity: 0; transition: opacity .16s; }
.fp-wrap.open .fp-backdrop { opacity: 1; }
.fp-shell { position: absolute; inset: 0; display: grid; grid-template-columns: 56px 1fr 56px; grid-template-rows: auto 1fr; opacity: 0; transition: opacity .16s; }
.fp-wrap.open .fp-shell { opacity: 1; }
.fp-head { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: #fff; }
.fp-head .btn-icon { color: #fff; }
.fp-head .btn-icon:hover { background: rgba(255,255,255,.14); color: #fff; }
.fp-name { font-weight: 600; font-size: .9rem; max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-meta { font-size: .78rem; color: rgba(255,255,255,.7); flex: 1 1 auto; }
.fp-stage { grid-row: 2; grid-column: 2; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; padding: 0 0 22px; }
.fp-stage img, .fp-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #000; }
.fp-stage iframe { width: 100%; height: 100%; border: 0; border-radius: 6px; background: #fff; }
.fp-audio { display: flex; flex-direction: column; align-items: center; gap: 14px; color: #fff; }
.fp-audio i { font-size: 3.4rem; opacity: .8; }
.fp-generic { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #fff; text-align: center; }
.fp-generic i { font-size: 3.4rem; opacity: .8; }
.fp-nav { grid-row: 2; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; color: #fff; font-size: 1.6rem; opacity: .65; }
.fp-nav:hover { opacity: 1; background: rgba(255,255,255,.08); }
.fp-prev { grid-column: 1; }
.fp-next { grid-column: 3; }
body.fp-open { overflow: hidden; }

/* mention typeahead */
.pb-mention-menu { position: fixed; z-index: 2000; width: 320px; max-height: 260px; overflow-y: auto; background: var(--aim-surface); border: 1px solid var(--aim-border); border-radius: 10px; box-shadow: 0 12px 30px rgba(61,39,18,.16); padding: 4px; }
.pb-mention-item { display: flex; align-items: flex-start; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 7px; padding: 7px 9px; color: var(--aim-text); }
.pb-mention-item:hover, .pb-mention-item.active { background: var(--aim-hover); }
.pb-mention-item > i { color: var(--aim-primary-fg); margin-top: 2px; }
.pb-mm-body { display: flex; flex-direction: column; min-width: 0; }
.pb-mm-title { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-mm-sub { font-size: .72rem; color: var(--aim-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-mention-empty { padding: 10px 12px; font-size: .8rem; color: var(--aim-muted); }

/* a mention as rendered inside rich text */
.rich a[href*="/playbooks/"] { display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; border-radius: 999px; background: var(--aim-primary-soft); color: var(--aim-primary-fg); font-weight: 600; text-decoration: none; }
.rich a[href*="/playbooks/"]:hover { background: var(--aim-primary-light); color: var(--aim-on-primary); }

/* slide-in reader */
.pb-panel-wrap { position: fixed; inset: 0; z-index: 1085; }
.pb-panel-backdrop { position: absolute; inset: 0; background: rgba(28,18,8,.35); opacity: 0; transition: opacity .18s; }
.pb-panel-wrap.open .pb-panel-backdrop { opacity: 1; }
.pb-panel { position: absolute; top: 0; right: 0; height: 100%; width: min(640px, 100%); display: flex; flex-direction: column; background: var(--aim-surface); border-left: 1px solid var(--aim-border); box-shadow: -12px 0 34px rgba(61,39,18,.16); transform: translateX(100%); transition: transform .2s ease; }
.pb-panel-wrap.open .pb-panel { transform: none; }
.pb-panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--aim-border); }
.pb-panel-head > i { color: var(--aim-primary-fg); font-size: 1.1rem; }
.pb-panel-title { font-size: 1rem; font-weight: 700; margin: 0; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-panel-body { padding: 16px; overflow-y: auto; flex: 1 1 auto; }
.pb-panel-h { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--aim-muted); margin: 18px 0 8px; }
body.pb-panel-open { overflow: hidden; }

/* screen-recording indicator */
.pb-recorder { position: fixed; z-index: 2100; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; background: #1c1208; color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.35); font-size: .85rem; }
.pb-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #e5484d; animation: pb-rec-pulse 1.2s infinite; }
.pb-rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.pb-rec-note { font-size: .75rem; color: #ffcf99; }
.pb-recorder.is-long .pb-rec-dot { background: #ffab66; }
@keyframes pb-rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.modal.pb-hidden-while-recording { opacity: 0; pointer-events: none; }
/* a full-page form (new task) steps out of the way the same way a modal does */
.aim-hidden-while-capturing { opacity: 0; pointer-events: none; }

@media (max-width: 575.98px) {
  .pb-panel { width: 100%; }
  .pb-recorder { left: 12px; right: 12px; transform: none; justify-content: center; flex-wrap: wrap; }
  .pb-tiles { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
  .fp-shell { grid-template-columns: 34px 1fr 34px; }
  .fp-nav { font-size: 1.2rem; }
  .fp-name { max-width: 42vw; }
  .pb-tile-wrap .tile-actions { display: flex; }
}

/* ============================================================ keyboard shortcuts */
.ks-sheet { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 28px; }
.ks-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--aim-muted); margin: 0 0 8px; }
.ks-row { display: flex; align-items: baseline; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--aim-border-soft); }
.ks-row:last-child { border-bottom: 0; }
.ks-keys { flex: 0 0 96px; display: flex; align-items: center; gap: 4px; }
.ks-label { flex: 1; min-width: 0; font-size: .85rem; color: var(--aim-text); }
.ks-hint { display: block; font-size: .72rem; color: var(--aim-muted); }
.ks-foot { margin: 10px 0 0; font-size: .75rem; color: var(--aim-muted); }
kbd { display: inline-block; min-width: 20px; padding: 1px 6px; font-family: var(--font-mono); font-size: .74rem; font-weight: 600; text-align: center; color: var(--aim-text); background: var(--aim-chip-bg); border: 1px solid var(--aim-border); border-bottom-width: 2px; border-radius: 5px; }

/* "g" is armed and waiting for the second key */
body.ks-armed::after { content: "g …"; position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 2200; padding: 5px 14px; border-radius: 999px; background: #1c1208; color: #fff; font-size: .8rem; font-weight: 600; letter-spacing: .06em; box-shadow: 0 8px 22px rgba(0,0,0,.28); pointer-events: none; }

@media (max-width: 767.98px) { .ks-sheet { grid-template-columns: 1fr; gap: 18px; } }

/* ---------- Timeline view: a sticky task column beside a horizontally scrolling day grid */
.timeline-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.timeline-scroll {
  position: relative; overflow: auto; background: var(--aim-surface);
  border: 1px solid var(--aim-border); border-radius: var(--aim-radius); max-height: calc(100vh - 250px);
}
.timeline-inner { display: inline-block; min-width: 100%; }
.timeline-head { display: flex; position: sticky; top: 0; z-index: 5; background: var(--aim-surface-alt); border-bottom: 1px solid var(--aim-border); }
.timeline-cell {
  flex: 0 0 240px; width: 240px; position: sticky; left: 0; z-index: 2; overflow: hidden;
  background: var(--aim-surface); border-right: 1px solid var(--aim-border);
  padding: 5px 10px; display: flex; flex-direction: column; justify-content: center;
}
.timeline-head .timeline-cell { background: var(--aim-surface-alt); z-index: 6; font-size: .76rem; font-weight: 600; color: var(--aim-muted); text-transform: uppercase; letter-spacing: .04em; }
.timeline-head-lane { position: relative; height: 46px; }
.timeline-months, .timeline-ticks { position: relative; height: 23px; }
.timeline-months { border-bottom: 1px solid var(--aim-border-soft); }
.timeline-month, .timeline-tick {
  position: absolute; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center;
  gap: 3px; font-size: .68rem; color: var(--aim-muted); border-left: 1px solid var(--aim-border-soft); white-space: nowrap; overflow: hidden;
}
.timeline-month { font-weight: 600; color: var(--aim-text); }
.timeline-tick b { font-weight: 600; color: var(--aim-text); }
.timeline-tick.weekend { color: var(--aim-muted); background: var(--aim-surface-alt); }
.timeline-rows { position: relative; }
.timeline-grid { position: absolute; top: 0; bottom: 0; left: 240px; pointer-events: none; z-index: 0; }
.timeline-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--aim-border-soft); }
.timeline-weekend { position: absolute; top: 0; bottom: 0; background: var(--aim-surface-alt); }
.timeline-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--aim-primary); opacity: .75; }
.timeline-row { display: flex; align-items: stretch; min-height: 34px; border-bottom: 1px solid var(--aim-border-soft); position: relative; z-index: 1; }
.timeline-row:hover .timeline-cell { background: var(--aim-hover); }
.timeline-row.muted .timeline-title { color: var(--aim-muted); }
.timeline-row.timeline-sep { min-height: 28px; background: var(--aim-surface-alt); }
.timeline-row.timeline-sep .timeline-cell { background: var(--aim-surface-alt); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--aim-muted); }
.timeline-title { font-size: .84rem; color: var(--aim-text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline-title:hover { color: var(--aim-primary-fg); }
.timeline-title.done { text-decoration: line-through; color: var(--aim-muted); }
.timeline-sub { font-size: .68rem; color: var(--aim-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline-lane { position: relative; flex: 0 0 auto; }
.timeline-bar {
  position: absolute; top: 6px; height: 22px; border-radius: 6px; cursor: pointer;
  background: var(--bar-color); border: 1px solid rgba(0, 0, 0, .12); overflow: hidden;
  display: flex; align-items: center; box-shadow: 0 1px 2px rgba(61, 39, 18, .12);
}
.timeline-bar.editable { cursor: grab; }
.timeline-bar.dragging { cursor: grabbing; opacity: .85; }
.timeline-bar.point { border-radius: 4px; }
.timeline-bar.done { opacity: .55; }
.timeline-bar.overdue { border-color: var(--aim-accent-red); box-shadow: 0 0 0 1px var(--aim-accent-red); }
.timeline-progress { position: absolute; inset: 0 auto 0 0; background: rgba(0, 0, 0, .22); pointer-events: none; }
.timeline-bar-label { position: relative; z-index: 1; padding: 0 8px; font-size: .72rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 1px rgba(0, 0, 0, .35); }
.timeline-nodate { position: sticky; left: 248px; display: inline-block; margin-top: 8px; font-size: .74rem; white-space: nowrap; }
.timeline-out-label { position: absolute; top: 9px; font-size: .74rem; color: var(--aim-text); white-space: nowrap; pointer-events: none; }
.timeline-handle { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; z-index: 2; }
.timeline-handle.start { left: 0; }
.timeline-handle.end { right: 0; }
.timeline-bar.editable:hover .timeline-handle { background: rgba(255, 255, 255, .45); }
@media (max-width: 767.98px) {
  .timeline-cell { flex-basis: 150px; width: 150px; }
  .timeline-grid { left: 150px; }
  .timeline-nodate { left: 158px; }
  .timeline-scroll { max-height: calc(100vh - 220px); }
  .timeline-sub { display: none; }
}

/* Timeline grouping: a band heading per project/list with a bar spanning its children */
.timeline-row.timeline-group { min-height: 30px; background: var(--aim-surface-alt); border-bottom: 1px solid var(--aim-border); }
.timeline-row.timeline-group .timeline-cell { background: var(--aim-surface-alt); padding: 3px 6px; }
.timeline-group-toggle {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 2px 4px; border: 0; background: none;
  color: var(--aim-text); font-size: .8rem; font-weight: 600; text-align: left; border-radius: 6px;
}
.timeline-group-toggle:hover { background: var(--aim-hover); }
.timeline-group-toggle .bi { font-size: .7rem; color: var(--aim-muted); flex: 0 0 auto; }
.timeline-group-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-group-count {
  margin-left: auto; flex: 0 0 auto; font-size: .68rem; font-weight: 600; color: var(--aim-muted);
  background: var(--aim-chip-bg); border-radius: 10px; padding: 0 6px;
}
.timeline-group-bar {
  position: absolute; top: 12px; height: 7px; border-radius: 3px; background: var(--aim-muted); opacity: .45;
}
.timeline-group-bar::before, .timeline-group-bar::after {
  content: ""; position: absolute; top: 0; width: 3px; height: 12px; background: inherit; border-radius: 1px;
}
.timeline-group-bar::before { left: 0; }
.timeline-group-bar::after { right: 0; }
.timeline-row.timeline-group.collapsed .timeline-group-bar { opacity: .7; }

/* Finish-to-Start dependency arrows and the task detail's blocked-by chips */
.timeline-deps { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none; overflow: visible; }
.timeline-deps .dep-path { fill: none; stroke: var(--aim-muted); stroke-width: 1.5; opacity: .75; }
.timeline-deps polygon.dep-path { fill: var(--aim-muted); stroke: none; }
.timeline-deps .dep-path.violated { stroke: var(--aim-accent-red); opacity: 1; stroke-dasharray: 4 3; }
.timeline-deps polygon.dep-path.violated { fill: var(--aim-accent-red); stroke: none; stroke-dasharray: none; }
.dep-chip { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: .82rem; min-width: 0; }
.dep-chip .bi { font-size: .72rem; color: var(--aim-muted); flex: 0 0 auto; }
.dep-chip.done .bi { color: var(--aim-accent-green); }
.dep-chip > a { color: var(--aim-text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-chip > a:hover { color: var(--aim-primary-fg); }
.dep-chip.done > a { text-decoration: line-through; color: var(--aim-muted); }
.dep-due { margin-left: auto; flex: 0 0 auto; font-size: .7rem; color: var(--aim-muted); }
.dep-results { max-height: 320px; overflow: auto; }
.dep-result {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--aim-border-soft); color: var(--aim-text); font-size: .86rem;
}
.dep-result:hover { background: var(--aim-hover); }
.dep-result span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-result small { margin-left: auto; flex: 0 0 auto; }

/* Color pickers (project/list/team/status color) - a circle, diameter = the old control height */
.form-control-color {
  width: 38px;
  height: 38px;
  padding: 2px;
  border-radius: 50%;
  overflow: hidden;
  /* inside a flex row (the statuses list) the swatch was being squeezed narrower
     than it is tall, so the "circle" came out an oval - hold the square */
  flex: 0 0 38px;
  min-width: 38px;
  aspect-ratio: 1 / 1;
}
.form-control-color::-webkit-color-swatch-wrapper { padding: 0; border-radius: 50%; }
.form-control-color::-webkit-color-swatch { border-radius: 50%; }
.form-control-color::-moz-color-swatch { border-radius: 50%; }

/* Task form "Assign to": who is on the task already, and where the defaults come from */
.assignee-current { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-bottom: 6px; }
.assignee-current .chip { color: var(--aim-text); }
.assignee-current .chip.inherited { background: transparent; border: 1px dashed var(--aim-border-hover); color: var(--aim-muted); }
/* the same dashed look for an inherited person sitting in a picker: there, fixed,
   and without the x - they are changed where they come from, not here */
.ts-wrapper.multi .ts-control > .item.is-locked { background: transparent; border: 1px dashed var(--aim-border-hover); color: var(--aim-muted); cursor: default; }
.ts-wrapper.multi .ts-control > .item.is-locked .remove { display: none; }

/* Task labels display - a tag/ribbon shape (flat left, pointed right), like a price tag.
   .task-labels wraps a block-level group of them (cards, task detail); inline usages
   (the list-view row) drop the wrapper and place each .label-badge among the row's own items. */
.task-labels { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; margin-bottom: 4px; }
.label-badge {
  position: relative;
  display: inline-flex; align-items: center;
  height: 20px;
  padding: 0 14px 0 10px;
  margin-right: 10px;
  background: var(--aim-label-bg);
  color: var(--aim-label-fg);
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
  border-radius: 4px 0 0 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.label-badge::after {
  content: "";
  position: absolute;
  top: 0;
  right: -8px;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 8px solid var(--aim-label-bg);
}

/* ---------- "Schedule to create / post": date & time picker, split buttons, scheduled lists */
.dtp { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; }
.dtp-cal { min-width: 0; }
.dtp-head { display: flex; align-items: center; margin-bottom: 10px; }
.dtp-month { font-weight: 600; font-size: 1.05rem; }
.dtp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.dtp-dow { font-size: .78rem; color: var(--aim-muted); padding: 4px 0; }
.dtp-day { border: 0; background: transparent; border-radius: 50%; aspect-ratio: 1; width: 100%; max-width: 44px; margin: 0 auto; font-size: .92rem; color: var(--aim-text); }
.dtp-day:hover:not(:disabled) { background: var(--aim-hover); }
.dtp-day.other { color: var(--aim-muted); }
.dtp-day.today { box-shadow: inset 0 0 0 1px var(--aim-primary); }
.dtp-day.sel { background: var(--aim-primary); color: #fff; font-weight: 600; }
.dtp-day:disabled { opacity: .35; cursor: default; }
.dtp-fields { min-width: 0; }
@media (max-width: 575.98px) { .dtp { grid-template-columns: 1fr; gap: 18px; } }

.btn-split .dropdown-toggle-split { padding-left: .55rem; padding-right: .55rem; border-left: 1px solid rgba(255, 255, 255, .35); }
.btn-split .dropdown-menu { min-width: 13rem; padding: 6px; display: none; flex-direction: column; gap: 6px; }
.btn-split .dropdown-menu.show { display: flex; }
/* the split menu's options ("Schedule to create…", "Schedule to post…") read as primary buttons */
.btn-split .dropdown-item { background: var(--aim-primary); color: var(--aim-on-primary); border-radius: var(--bs-border-radius, 8px); padding: .45rem .8rem; font-weight: 500; }
.btn-split .dropdown-item:hover, .btn-split .dropdown-item:focus { background: var(--aim-primary-dark); color: var(--aim-on-primary); }
.btn-split .dropdown-item:active { background: var(--aim-primary-dark); color: var(--aim-on-primary); }
.sched-list { display: flex; flex-direction: column; gap: 8px; }
.sched-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px dashed var(--aim-border); border-radius: 10px; background: var(--aim-surface-alt); }
.sched-item .sched-when { font-size: .8rem; color: var(--aim-primary); font-weight: 600; white-space: nowrap; }
.sched-item .sched-body { flex: 1 1 auto; min-width: 0; }
.sched-item .sched-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-item .sched-excerpt { font-size: .85rem; color: var(--aim-muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sched-item .sched-acts { display: flex; gap: 2px; flex-shrink: 0; }
.td-scheduled { margin-top: 18px; }
.td-scheduled .td-sched-head { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--aim-muted); margin-bottom: 8px; }
