/* =============================================================================
   Innova Track Base Theme
   Modern, clean, responsive enterprise admin shell. Framework-free.
   ========================================================================== */

:root {
    --color-primary: #1a3c5e;
    --color-primary-600: #234d76;
    --color-secondary: #0ea5e9;
    --color-bg: #F5F7FB;
    --color-card: #FFFFFF;
    --color-text: #1F2937;
    --color-muted: #6B7280;
    --color-success: #22C55E;
    --color-warning: #F59E0B;
    --color-danger: #EF4444;
    --color-border: #E5E7EB;

    /* TTS accent system (sidebar + active states) — sky blue on deep navy */
    --tts-primary: #1a3c5e;
    --tts-accent: #0ea5e9;
    --sidebar-bg: #0f2035;
    --sidebar-text: #cbd5e1;
    --indigo-400: #0ea5e9;
    --indigo-500: #0ea5e9;
    --indigo-600: #0ea5e9;
    --violet-500: #0284c7;
    --cyan-500: #0ea5e9;

    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow: 0 4px 16px rgba(16, 24, 40, 0.08);
    --transition: 0.2s ease;

    --font: "Inter", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

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

/* ---------------------------------------------------------------- Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: rgba(255, 255, 255, 0.55);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar::after {
    display: none;
}

.sidebar__brand {
    height: var(--header-height);
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.sidebar__brand .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--tts-accent), #0284c7);
    display: grid;
    place-items: center;
    font-size: 1rem;
    color: #fff;
    flex: 0 0 auto;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

.sidebar__brand-text { display: flex; flex-direction: column; overflow: hidden; line-height: 1.2; }
.sidebar__brand-name { font-weight: 700; font-size: 0.95rem; color: #fff; letter-spacing: 0; white-space: nowrap; }
.sidebar__brand-sub { font-size: 0.65rem; color: #64748b; font-weight: 400; white-space: nowrap; }

.sidebar__nav {
    padding: 0.5rem 0;
    overflow-y: auto;
    flex: 1;
    position: relative;
    z-index: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.sidebar__nav::-webkit-scrollbar { width: 4px; }
.sidebar__nav::-webkit-scrollbar-track { background: transparent; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 4px; }
.sidebar__nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

.sidebar__section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    padding: 12px 22px 4px;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.3s ease;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 2px 8px;
    border-radius: 6px;
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.5;
    text-decoration: none;
    white-space: nowrap;
    overflow: visible;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
    position: relative;
}

.nav-item:hover { background: rgba(14, 165, 233, 0.15); color: var(--tts-accent); }

.nav-item.is-active {
    background: rgba(14, 165, 233, 0.15);
    color: var(--tts-accent);
}

.nav-item.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-item .nav-icon {
    width: 18px;
    text-align: center;
    flex: 0 0 auto;
    font-size: 0.95rem;
}
.nav-item .nav-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s;
}
.nav-item.is-active .nav-icon { opacity: 1; }

.nav-item .nav-badge {
    margin-left: auto;
    font-size: 10px;
    background: rgba(14, 165, 233, 0.25);
    color: var(--tts-accent);
    padding: 2px 7px;
    border-radius: 999px;
}
.nav-tooltip {
    display: none;
    position: absolute;
    left: 72px;
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}
.nav-tooltip::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #1e293b;
    border-left: 0;
}

/* Sidebar footer (user) */
.sidebar__footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}
.sidebar__user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--indigo-500), var(--cyan-500));
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex: 0 0 auto;
}
.sidebar__user-info { display: flex; flex-direction: column; overflow: hidden; line-height: 1.25; }
.sidebar__user-info .name { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-info .role { font-size: 11.5px; color: rgba(255, 255, 255, 0.4); }
.sidebar__logout {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    transition: color var(--transition);
}
.sidebar__logout:hover { color: var(--rose-400, #fb7185); }

/* ------------------------------------------------------------------- Main */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left var(--transition);
}

.app-shell.sidebar-collapsed .sidebar { width: 72px; }
.app-shell.sidebar-collapsed .main { margin-left: 72px; }
.app-shell.sidebar-collapsed .sidebar__brand { justify-content: center; padding: 0; }
.app-shell.sidebar-collapsed .sidebar__brand-text,
.app-shell.sidebar-collapsed .sidebar__section,
.app-shell.sidebar-collapsed .sidebar__user-info,
.app-shell.sidebar-collapsed .sidebar__footer form,
.app-shell.sidebar-collapsed .nav-item .nav-label,
.app-shell.sidebar-collapsed .nav-item .nav-badge { display: none; }
.app-shell.sidebar-collapsed .sidebar__nav { padding: 10px 0; }
.app-shell.sidebar-collapsed .nav-item { justify-content: center; padding: 10px; }
.app-shell.sidebar-collapsed .nav-item:hover .nav-tooltip { display: block; }
.app-shell.sidebar-collapsed .nav-item.is-active::before { display: none; }
.app-shell.sidebar-collapsed .sidebar__footer { justify-content: center; padding: 12px 8px; }

/* ----------------------------------------------------------------- Header */
.header {
    height: var(--header-height);
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: var(--shadow-sm);
}

.header__toggle {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: none;
    border: 1px solid transparent;
    font-size: 20px;
    cursor: pointer;
    color: var(--color-muted);
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.header__toggle:hover { background: var(--color-bg); color: var(--color-text); border-color: var(--color-border); }

.header__title { display: flex; flex-direction: column; justify-content: center; line-height: 1.25; }
.header__title-text { font-size: 16px; font-weight: 700; letter-spacing: 0.1px; }
.header__title small { display: block; font-weight: 400; color: var(--color-muted); font-size: 12px; }
/* Breadcrumb relocated into the header, shown directly under the title */
.header__breadcrumb { font-size: 12px; color: var(--color-muted); display: none; }
.header__breadcrumb.is-filled { display: block; }
.header__breadcrumb a { color: var(--color-muted); text-decoration: none; }
.header__breadcrumb a:hover { text-decoration: underline; }
.header__breadcrumb span { color: var(--color-secondary); font-weight: 700; }

.header__spacer { flex: 1; }

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    background: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    position: relative;
    color: var(--color-muted);
    transition: background var(--transition);
}
.icon-btn:hover { background: var(--color-bg); }
.icon-btn .dot {
    position: absolute;
    top: 9px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--color-danger);
    border-radius: 50%;
    border: 2px solid #fff;
}

/* User dropdown */
.user-menu { position: relative; }
.user-menu__trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 10px;
}
.user-menu__trigger:hover { background: var(--color-bg); }

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--indigo-500), var(--violet-500));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    flex: 0 0 auto;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-menu__meta { text-align: left; line-height: 1.2; }
.user-menu__meta .name { font-weight: 600; font-size: 13px; }
.user-menu__meta .role { font-size: 11px; color: var(--color-muted); }

.user-menu__dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 210px;
    padding: 8px;
    display: none;
}
.user-menu.is-open .user-menu__dropdown { display: block; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    cursor: pointer;
    width: 100%;
    background: none;
    border: none;
    font: inherit;
    text-align: left;
}
.dropdown-item:hover { background: var(--color-bg); }
.dropdown-item.is-danger { color: var(--color-danger); }
.dropdown-divider { height: 1px; background: var(--color-border); margin: 6px 4px; }

/* --------------------------------------------------------------- Content */
.content { padding: 15px 14px; flex: 1; }

.page-head { margin-bottom: 22px; }
.page-head h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.breadcrumbs { color: var(--color-muted); font-size: 12px; }
.breadcrumbs a { color: var(--color-muted); }
.breadcrumbs span { color: var(--color-secondary); font-weight: 700; }

/* --------------------------------------------------------------- Footer */
.footer {
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

/* ---------------------------------------------------------------- Cards */
.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card__body { padding: 20px; }
.card__head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
}

.grid { display: grid; gap: 18px; }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.stat {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat__icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 22px;
    flex: 0 0 auto;
}
.stat__icon.is-primary { background: rgba(79, 141, 245, 0.12); color: var(--color-secondary); }
.stat__icon.is-success { background: rgba(34, 197, 94, 0.12); color: var(--color-success); }
.stat__icon.is-warning { background: rgba(245, 158, 11, 0.12); color: var(--color-warning); }
.stat__icon.is-danger { background: rgba(239, 68, 68, 0.12); color: var(--color-danger); }
.stat__value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat__label { color: var(--color-muted); font-size: 13px; margin-top: 4px; }

.two-col { grid-template-columns: 2fr 1fr; }

/* ------------------------------------------------------- Misc components */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
}
.badge.is-success { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.badge.is-muted { background: var(--color-bg); color: var(--color-muted); }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-muted);
}
.empty-state .emoji { font-size: 32px; display: block; margin-bottom: 8px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition);
    white-space: nowrap;
}
.btn-primary { background: var(--color-secondary); color: #fff; }
.btn-primary:hover { background: #3c7ce8; }
.btn-light { background: #fff; border-color: var(--color-border); color: var(--color-text); }
.btn-light:hover { background: var(--color-bg); }
.btn-block { width: 100%; }

/* --------------------------------------------------------------- Alerts */
.alert {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 14px;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid transparent;
}
.alert.is-danger { background: rgba(239, 68, 68, 0.08); color: #b91c1c; border-color: rgba(239, 68, 68, 0.2); }
.alert.is-success { background: rgba(34, 197, 94, 0.08); color: #15803d; border-color: rgba(34, 197, 94, 0.2); }
.alert ul { margin: 0; padding-left: 18px; }

/* ============================================================ Login page */
.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    background: var(--color-bg);
}
.auth__aside {
    background: linear-gradient(160deg, #31374D 0%, #232a3d 60%, #1c2440 100%);
    color: #fff;
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.auth__aside::after {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 141, 245, 0.35), transparent 70%);
    bottom: -120px;
    right: -80px;
}
.auth__brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; margin-bottom: 36px; }
.auth__brand .brand-mark {
    width: 40px; height: 40px; border-radius: 10px; background: var(--color-secondary);
    display: grid; place-items: center; font-size: 20px;
}
.auth__headline { font-size: 30px; font-weight: 700; line-height: 1.25; margin: 0 0 14px; max-width: 460px; }
.auth__sub { color: #b9c1d6; max-width: 420px; font-size: 15px; }
.auth__points { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 12px; max-width: 420px; }
.auth__points li { display: flex; align-items: center; gap: 10px; color: #d4dae9; }
.auth__points .tick {
    width: 22px; height: 22px; border-radius: 50%; background: rgba(79, 141, 245, 0.25);
    display: grid; place-items: center; font-size: 12px; color: #fff; flex: 0 0 auto;
}

.auth__main { display: grid; place-items: center; padding: 40px; }
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 40px 34px;
    text-align: center;
}
.auth-card__logo {
    width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 18px;
    background: var(--color-primary); color: #fff; display: grid; place-items: center; font-size: 26px;
}
.auth-card h1 { font-size: 22px; margin: 0 0 6px; }
.auth-card .tagline { color: var(--color-muted); font-size: 13px; margin: 0 0 26px; }

.btn-microsoft {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: #fff;
    color: #1f2937;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: box-shadow var(--transition), border-color var(--transition);
}
.btn-microsoft:hover { box-shadow: var(--shadow); border-color: #c7ccd6; }
.ms-logo { width: 20px; height: 20px; display: inline-grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.ms-logo span { width: 9px; height: 9px; display: block; }
.ms-logo .r1 { background: #f25022; }
.ms-logo .r2 { background: #7fba00; }
.ms-logo .r3 { background: #00a4ef; }
.ms-logo .r4 { background: #ffb900; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--color-muted); font-size: 12px; }
.auth-divider::before,
.auth-divider::after { content: ""; height: 1px; background: var(--color-border); flex: 1; }
.auth-form { text-align: left; display: grid; gap: 12px; }
.auth-form .field { margin: 0; }
.auth-remember { margin: 0 0 2px; padding: 0; }

.auth-card__foot { margin-top: 24px; font-size: 12px; color: var(--color-muted); }

/* ------------------------------------------------------------ Responsive */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.45);
    z-index: 35;
}

@media (max-width: 1024px) {
    .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .app-shell.sidebar-open .sidebar { transform: translateX(0); }
    .app-shell.sidebar-open .sidebar-backdrop { display: block; }
    .app-shell.sidebar-collapsed .sidebar { width: var(--sidebar-width); }
    .app-shell.sidebar-collapsed .sidebar__brand { justify-content: flex-start; padding: 0 22px; }
    .app-shell.sidebar-collapsed .sidebar__brand span:not(.brand-mark),
    .app-shell.sidebar-collapsed .sidebar__section,
    .app-shell.sidebar-collapsed .nav-item .nav-label,
    .app-shell.sidebar-collapsed .nav-item .nav-badge { display: inline; }
    .app-shell.sidebar-collapsed .nav-item .nav-tooltip { display: none; }
    .main { margin-left: 0; }
    .app-shell.sidebar-collapsed .main { margin-left: 0; }
}

@media (max-width: 820px) {
    .auth { grid-template-columns: 1fr; }
    .auth__aside { display: none; }
}

@media (max-width: 560px) {
    .content { padding: 20px 16px; }
    .header { padding: 0 16px; }
    .user-menu__meta { display: none; }
}

/* =============================================================================
   Sprint 02 — Admin & Project UI components
   ========================================================================== */

/* Page header with actions */
.page-head--row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 13px; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--color-success); color: #fff; }
.btn-warning { background: var(--color-warning); color: #fff; }

/* Filter bar */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.filter-bar .field { margin: 0; }
.filter-bar .field--check { display: flex; align-items: flex-end; }
.filter-actions { display: flex; gap: 8px; align-items: end; justify-content: flex-end; flex-wrap: wrap; }
.filter-actions--icons {
    flex-wrap: nowrap;
    align-self: end;
}
.filter-bar .input,
.filter-bar .select,
.filter-bar .btn {
    height: 40px;
    min-height: 40px;
}
.filter-bar .check-pill {
    height: 40px;
    min-height: 40px;
    margin: 0;
}
.filter-check {
    width: 100%;
}
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}
.btn__icon {
    display: inline-grid;
    place-items: center;
    width: 15px;
    min-width: 15px;
    line-height: 1;
    font-size: 13px;
    font-weight: 700;
}
.btn-icon-only {
    width: 40px;
    min-width: 40px;
    padding: 0;
}
.btn-icon-only .btn__icon {
    width: auto;
    min-width: 0;
    font-size: 15px;
}
.filter-bar input[type="date"].input,
.filter-bar input[type="search"].input,
.filter-bar input[type="text"].input {
    line-height: 20px;
}
.filter-drawer-launcher {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 14px;
}
.filter-drawer-btn {
    min-width: 40px;
}
.filter-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    justify-content: flex-end;
    background: rgba(15, 23, 42, 0.38);
}
.filter-drawer-overlay.is-open {
    display: flex;
}
.filter-drawer {
    width: min(420px, calc(100vw - 28px));
    height: 100%;
    background: #fff;
    box-shadow: -18px 0 35px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
}
.filter-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 700;
}
.filter-drawer__close {
    border: none;
    background: none;
    color: var(--color-muted);
    font-size: 22px;
    cursor: pointer;
}
.filter-drawer__body {
    padding: 18px;
    overflow-y: auto;
}
.filter-drawer .filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
.filter-drawer .filter-actions {
    justify-content: flex-end;
}

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 110px; }
.form-grid .field.full { grid-column: 1 / -1; }
/* Three-section upload area (Document / Image / Video) */
.upload-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 760px) { .upload-grid { grid-template-columns: 1fr; } }
.upload-field { display: block; }
.form-grid .field.full.upload-field { display: block; }
.upload-field__title {
    margin: 4px 0 14px;
    text-align: center;
    font-size: 16px;
    font-weight: 800;
    color: var(--color-text);
}
.upload-box {
    border: 1.5px dashed var(--color-border); border-radius: var(--radius); padding: 18px 16px;
    text-align: center; background: var(--color-bg); transition: border-color var(--transition), background var(--transition);
}
.upload-box:hover { border-color: var(--tts-accent); background: #fff; }
.upload-box__icon { font-size: 28px; line-height: 1; }
.upload-box__label { font-weight: 700; font-size: 14px; margin-top: 8px; color: var(--color-text); }
.upload-box__hint { font-size: 11.5px; color: var(--color-muted); margin-top: 2px; }
.upload-box__btn {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; cursor: pointer;
    background: var(--tts-accent); color: #fff; border-radius: var(--radius-sm); padding: 7px 14px;
    font-size: 13px; font-weight: 600;
}
.upload-box__btn:hover { filter: brightness(0.96); }
.upload-box__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-box__files { list-style: none; margin: 12px 0 0; padding: 0; text-align: left; display: grid; gap: 5px; }
.upload-box__file {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    background: #fff; border: 1px solid var(--color-border); border-radius: 6px; padding: 5px 9px; font-size: 12px;
}
.upload-box__file span, .upload-box__file a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-box__file em { color: var(--color-muted); font-style: normal; flex: 0 0 auto; }
.upload-box__file.is-pick { border-color: rgba(14,165,233,0.4); background: rgba(14,165,233,0.06); }
.upload-box__remove { cursor: pointer; color: var(--color-muted); flex: 0 0 auto; }
.upload-box__remove input { display: none; }
.upload-box__remove:has(input:checked) { color: var(--color-danger); }

.split-admin { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 1fr); gap: 18px; align-items: start; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--color-text); }
.form-grid .field { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 1fr); align-items: center; gap: 8px 12px; margin-bottom: 0; }
.form-grid .field label { margin: 0; text-align: left; }
.form-grid .field.field--top { align-items: start; }
.form-grid .field.field--top > label { padding-top: 10px; }
.form-grid .field.full { align-items: start; }
.form-grid .field.full label { padding-top: 10px; }
.form-grid .field .field-error,
.form-grid .field .hint { grid-column: 2; }
.form-check-control {
    min-width: 0;
}
.check-pill--control {
    width: 100%;
    min-height: 40px;
    justify-content: flex-start;
    background: #fff;
}
.check-pill--control input {
    width: 16px;
    height: 16px;
}
.form-grid .task-builder-field { display: block; }
.form-grid .task-builder-field .field-error,
.form-grid .task-builder-field .hint { grid-column: auto; }
.role-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    max-height: 126px;
    overflow-y: auto;
    padding-right: 4px;
}
.field .hint { font-size: 12px; color: var(--color-muted); margin-top: 4px; }
.input, .select, .textarea {
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font: inherit;
    color: var(--color-text);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(79, 141, 245, 0.15);
}
.textarea { min-height: 96px; resize: vertical; }
.field-error { color: var(--color-danger); font-size: 12px; margin-top: 5px; }
.input.is-invalid, .select.is-invalid { border-color: var(--color-danger); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.form-actions--stack { flex-wrap: wrap; align-items: center; }
.form-actions--stack .inline-form { display: inline-flex; }
.form-section-title { font-weight: 700; font-size: 14px; margin: 4px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--color-border); }
.inline-task-builder { width: 100%; display: block; }
.inline-task-builder h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.inline-task-builder kbd { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 4px; padding: 0 5px; font-size: 11px; }

/* Inline editable task grid (looks like one clean table; borderless cells) */
.task-grid-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.task-grid { width: 100%; min-width: 980px; border-collapse: collapse; font-size: 13px; }
.task-grid thead th {
    text-align: left;
    padding: 9px 10px;
    background: var(--color-bg);
    color: var(--color-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}
.task-grid tbody td { border-bottom: 1px solid var(--color-border); padding: 0; vertical-align: middle; }
.task-grid tbody tr:last-child td { border-bottom: none; }
.task-grid tbody tr.is-task td { background: #f8fbff; }
.task-grid tbody tr.is-subtask td { background: #fff8ed; }
.task-grid tbody tr.is-subtask .tg-index { color: #b45309; }
.task-grid tbody tr.is-subtask .tg-name { border-left: 3px solid #f59e0b; }
.task-grid tbody tr.is-task .tg-name { border-left: 3px solid #4f8df5; }
.task-grid tbody tr.is-dragging { opacity: 0.4; }
.task-grid tbody tr.drop-before td { box-shadow: inset 0 2px 0 0 var(--tts-accent); }
.task-grid tbody tr.drop-after td { box-shadow: inset 0 -2px 0 0 var(--tts-accent); }
.task-grid tbody tr.drop-child td { background: rgba(14, 165, 233, 0.08); }

/* borderless inline inputs — feel like plain table cells */
.task-grid .tg-input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 8px 9px;
    font-size: 13px;
    font-family: inherit;
    color: var(--color-text);
    border-radius: 5px;
    outline: none;
    box-sizing: border-box;
}
.task-grid .tg-input:hover,
.task-grid .tg-input:focus {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}
.task-grid select.tg-input { cursor: pointer; appearance: auto; }
.task-grid .tg-prog { width: 70px; }

.task-grid .tg-col-drag, .task-grid .tg-drag { width: 30px; text-align: center; }
.task-grid .tg-col-idx, .task-grid .tg-index { width: 52px; text-align: center; color: var(--color-muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.task-grid .tg-col-del { width: 34px; }
.task-grid .tg-col-color { width: 58px; text-align: center; }
.tg-color-dd { position: relative; display: grid; place-items: center; min-height: 34px; }
.tg-color-btn {
    width: 48px; height: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    border: 1px solid transparent; border-radius: 7px; background: transparent; cursor: pointer; color: var(--color-muted);
}
.tg-color-btn:hover { border-color: var(--color-border); background: #fff; }
.tg-color-btn [data-tg-color-swatch] { width: 20px; height: 20px; border-radius: 5px; box-shadow: 0 0 0 1px var(--color-border); }
.tg-color-menu {
    position: absolute; z-index: 80; top: calc(100% + 4px); left: 50%; transform: translateX(-50%);
    display: none; grid-template-columns: repeat(5, 24px); gap: 7px; padding: 8px;
    background: #fff; border: 1px solid var(--color-border); border-radius: 10px; box-shadow: var(--shadow);
}
.tg-color-dd.is-open .tg-color-menu { display: grid; }
.tg-color-opt {
    width: 24px; height: 24px; border-radius: 6px; border: 2px solid transparent; padding: 0; cursor: pointer;
    background: transparent; box-shadow: 0 0 0 1px var(--color-border);
}
.tg-color-opt span { display: block; width: 100%; height: 100%; border-radius: 4px; }
.tg-color-opt:hover { transform: scale(1.08); }
.tg-color-opt.is-active { border-color: #fff; box-shadow: 0 0 0 2px var(--color-secondary); }
.task-grid .tg-drag { color: #b3bcc8; cursor: grab; user-select: none; font-size: 14px; }
.task-grid .tg-drag:active { cursor: grabbing; }
.task-grid .tg-del {
    border: none; background: none; color: var(--color-muted);
    cursor: pointer; font-size: 13px; width: 100%; padding: 8px 4px;
}
.task-grid .tg-del:hover { color: var(--color-danger); }
.task-grid .tg-name { transition: padding-left 0.12s ease; }

/* Per-row multi-assignee picker (team members only) */
.tg-assignee { position: relative; }
.tg-assignee-btn {
    text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; background: transparent;
}
.tg-assignee-menu {
    position: absolute; top: calc(100% + 2px); left: 0; z-index: 60; min-width: 180px;
    max-height: 220px; overflow-y: auto; background: #fff; border: 1px solid var(--color-border);
    border-radius: 8px; box-shadow: var(--shadow); padding: 6px;
}
.tg-assignee.is-open .tg-assignee-menu { display: block; }
.tg-assignee:not(.is-open) .tg-assignee-menu { display: none; }
.tg-assignee-opt {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px;
    font-size: 13px; cursor: pointer;
}
.tg-assignee-opt:hover { background: var(--color-bg); }
.tg-assignee-opt input { accent-color: var(--tts-accent); }
.tg-assignee-empty { padding: 8px; font-size: 12px; color: var(--color-muted); }

/* Inline multi-assignee popover inside the Gantt grid cell */
.gc.is-editing-assignee { position: relative; overflow: visible; }
.gantt-assignee-menu { position: absolute; left: 0; top: 100%; z-index: 80; min-width: 190px; }

/* Floating inline popovers (assignee / colour) appended to <body> so the
   Gantt grid's overflow:hidden scroll containers cannot clip them. */
.gantt-float-menu { position: fixed; z-index: 1300; }

/* Inline colour palette popover (10 fixed colours) inside a grid cell */
.color-inline-menu {
    position: absolute; left: 2px; top: 100%; z-index: 90; display: grid;
    grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 8px;
    background: #fff; border: 1px solid var(--color-border); border-radius: 8px; box-shadow: var(--shadow);
}
.color-inline-swatch {
    width: 22px; height: 22px; border-radius: 5px; cursor: pointer; padding: 0;
    border: 2px solid transparent; box-shadow: 0 0 0 1px var(--color-border);
}
.color-inline-swatch:hover { transform: scale(1.1); }
.color-inline-swatch.is-active { border-color: #fff; box-shadow: 0 0 0 2px var(--tts-accent); }

/* Resource-view group header row + Gantt head filter dropdowns */
.grid-row--group { background: var(--color-bg); display: flex; align-items: center; }
.grid-row--group .gc-group { padding: 0 12px; font-size: 13px; color: var(--color-text); display: flex; align-items: center; gap: 6px; }
.gantt-head__filters { display: flex; gap: 8px; align-items: center; margin-right: 12px; }
.select--sm { height: 32px; padding: 4px 8px; font-size: 12.5px; min-width: 130px; }

/* Column header 3-dot menu (data-grid behaviours) */
.grid-head .gh { display: flex; align-items: center; gap: 4px; position: relative; }
.gh-menu-btn {
    margin-left: auto; background: none; border: none; cursor: pointer; color: var(--color-muted);
    font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 4px; opacity: 1; transition: background var(--transition), color var(--transition);
}
.grid-head .gh:hover .gh-menu-btn { opacity: 1; }
.gh-menu-btn:hover { background: var(--color-bg); color: var(--color-text); }
.col-menu {
    position: fixed; z-index: 1200; background: #fff; border: 1px solid var(--color-border);
    border-radius: 10px; box-shadow: var(--shadow); min-width: 210px; padding: 6px; font-size: 13px;
}
.col-menu__item {
    display: block; width: 100%; text-align: left; background: none; border: none; cursor: pointer;
    font: inherit; font-size: 13px; color: var(--color-text); padding: 8px 10px; border-radius: 6px;
}
.col-menu__item:hover { background: var(--color-bg); }
.col-menu__section { border-top: 1px solid var(--color-border); margin-top: 6px; padding-top: 6px; }
.col-menu__title { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); padding: 2px 10px 4px; font-weight: 700; }
.col-menu__check { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.col-menu__check:hover { background: var(--color-bg); }
.col-menu__check input { accent-color: var(--tts-accent); }
.col-menu__filter { width: calc(100% - 12px); margin: 2px 6px 4px; height: 32px; font-size: 13px; }
.member-select {
    position: relative;
    min-width: 0;
}
.member-select__control {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--color-text);
    font: inherit;
    cursor: pointer;
}
.member-select__control:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(79, 141, 245, 0.15);
}
.member-select__value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}
.member-select__chevron {
    color: var(--color-muted);
    font-size: 11px;
}
.member-select__panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: none;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.14);
}
.member-select.is-open .member-select__panel { display: block; }
.member-select__search {
    height: 36px;
    min-height: 36px;
    margin-bottom: 8px;
}
.member-select__options {
    max-height: 280px;
    overflow-y: auto;
    display: grid;
    gap: 4px;
}
/* Grouped picker: department / sub-department headers with select-all */
.member-group { border-top: 1px solid var(--color-border); padding-top: 4px; margin-top: 2px; }
.member-group:first-child { border-top: none; margin-top: 0; }
.member-group__head {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px;
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-muted);
    font-weight: 700; cursor: pointer;
}
.member-group__head strong { font-size: 12.5px; color: var(--color-text); }
.member-group__head:hover { background: var(--color-bg); }
.member-group__head--sub { text-transform: none; letter-spacing: 0; color: var(--color-muted); padding-left: 16px; font-weight: 600; }
.member-group__head input, .member-group__head--sub input { accent-color: var(--tts-accent); }
.member-subgroup { padding-left: 6px; }
.member-subgroup .member-option { padding-left: 18px; }

/* Nested (dropdown-inside-dropdown) members tree */
.member-tree [data-member-group].is-hidden { display: none; }
.member-tree .member-group__head { cursor: pointer; }
.member-tree .member-group__count { margin-left: auto; font-size: 11px; color: var(--color-muted); font-weight: 600; }
.member-tree .member-group__twisty { font-size: 10px; color: var(--color-muted); transition: transform 0.15s ease; display: inline-block; width: 12px; }
.member-tree [data-member-group].is-expanded > .member-group__head > .member-group__twisty { transform: rotate(90deg); }
/* Collapsed by default: hide the body until the group is expanded */
.member-tree [data-member-group][data-nested] > .member-group__body { display: none; }
.member-tree [data-member-group][data-nested].is-expanded > .member-group__body { display: block; }
.member-option {
    display: grid !important;
    grid-template-columns: 16px minmax(0, 1fr);
    align-items: start;
    gap: 9px;
    margin: 0 !important;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
}
.member-option:hover { background: var(--color-bg); }
.member-option input { margin-top: 2px; }
/* Name + department on the SAME line, department pushed to the right */
.member-option__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}
.member-option__row strong {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.member-option__dept {
    color: var(--color-muted);
    font-size: 11.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left;
    height: 44px;
    padding: 8px 12px;
    color: var(--color-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    vertical-align: middle;
    background: #f1f4f8;
}
.table td {
    height: 44px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.table tbody tr:hover { background: var(--color-bg); }
.table tbody tr.is-selected { background: rgba(79, 141, 245, 0.1); }
.table tbody tr:last-child td { border-bottom: none; }
.table .cell-strong { font-weight: 600; }
.table .cell-muted { color: var(--color-muted); font-size: 12.5px; }

/* Compact table variant (e.g. project members) — tighter cells, centered flags */
.table--projects th,
.table--projects td {
    height: 52px;
    padding: 11px 14px;
    text-align: center;
    vertical-align: middle;
}
.table--projects th[style*="text-align:right"],
.table--projects .row-actions {
    text-align: center !important;
    justify-content: center !important;
}
.table--compact th, .table--compact td { padding: 10px 10px; }
.table--compact .col-center { text-align: center; width: 64px; }
.table--compact .col-role { width: 170px; }
.table--compact .col-actions { text-align: right; width: 90px; white-space: nowrap; }
.table--compact select.select { min-width: 0; width: 100%; }
.table--compact input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--indigo-600); }

/* Badges — extra variants */
.badge.is-info { background: rgba(79, 141, 245, 0.12); color: #2563eb; }
.badge.is-warning { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.badge.is-danger { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.badge.is-primary { background: rgba(49, 55, 77, 0.1); color: var(--color-primary); }
.badge.is-neutral { background: #eef1f6; color: #475569; }
.badge.dot-lead::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.badge.end { margin-left: auto; justify-self: end; }

/* Progress bar */
.progress { background: #eef1f6; border-radius: 999px; height: 8px; overflow: hidden; min-width: 90px; }
.progress__bar { height: 100%; background: var(--color-secondary); border-radius: 999px; transition: width var(--transition); }
.progress__bar.is-complete { background: var(--color-success); }
.progress-label { font-size: 11px; color: var(--color-muted); margin-top: 3px; }

/* Avatar (small, table) */
.avatar-sm { width: 30px; height: 30px; font-size: 12px; border-radius: 50%; background: var(--color-primary); color: #fff; display: inline-grid; place-items: center; }
.avatar-sm:is(img) { object-fit: cover; display: block; }
.user-cell { display: flex; align-items: center; gap: 10px; }

/* Row actions */
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions .icon-link {
    width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--color-border);
    display: grid; place-items: center; color: var(--color-muted); background: #fff; cursor: pointer;
    font-size: 13px;
}
.row-actions .icon-link:hover { background: var(--color-bg); color: var(--color-text); }

/* 10-colour swatch picker (replaces the full colour wheel) */
.swatch-picker { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.swatch {
    width: 24px; height: 24px; border-radius: 6px; cursor: pointer; padding: 0;
    border: 2px solid transparent; box-shadow: 0 0 0 1px var(--color-border);
    transition: transform 0.1s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch.is-active { border-color: #fff; box-shadow: 0 0 0 2px var(--tts-accent); }

/* Colour dropdown (fixed palette, no full wheel) */
.color-dd { position: relative; display: inline-block; min-width: 150px; }
.color-dd__btn {
    display: flex; align-items: center; gap: 8px; width: 100%; cursor: pointer;
    background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    padding: 7px 10px; font: inherit; font-size: 13px; color: var(--color-text);
}
.color-dd__btn:hover { border-color: var(--tts-accent); }
.color-dd__swatch { width: 18px; height: 18px; border-radius: 4px; box-shadow: 0 0 0 1px var(--color-border); flex: 0 0 auto; }
.color-dd__hex { display: none; }
.color-dd__label { color: var(--color-muted); font-size: 12.5px; }
.color-dd__caret { margin-left: auto; color: var(--color-muted); font-size: 11px; }
.color-dd__menu {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 70; min-width: 100%;
    background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow); padding: 6px; display: none; max-height: 260px; overflow-y: auto;
}
.color-dd.is-open .color-dd__menu { display: block; }
.color-dd__opt {
    display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
    background: none; border: none; cursor: pointer; font: inherit; font-size: 12.5px;
    color: var(--color-text); padding: 7px 8px; border-radius: 6px;
}
.color-dd__opt:hover { background: var(--color-bg); }
.color-dd__opt.is-active { background: rgba(14,165,233,0.12); font-weight: 600; }
.color-dd__chip { width: 18px; height: 18px; border-radius: 4px; box-shadow: 0 0 0 1px var(--color-border); flex: 0 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Kebab (3-dot) dropdown menu */
.kebab { position: relative; display: inline-block; }
.kebab__menu {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 50;
    background: #fff; border: 1px solid var(--color-border); border-radius: 10px;
    box-shadow: var(--shadow); min-width: 170px; padding: 6px; display: none;
}
.kebab.is-open .kebab__menu { display: block; }
.kebab__menu form { margin: 0; }
.kebab__item {
    display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
    background: none; border: none; cursor: pointer; font: inherit; font-size: 13px;
    color: var(--color-text); padding: 8px 10px; border-radius: 6px;
}
.kebab__item:hover { background: var(--color-bg); }
.kebab__item.is-danger { color: var(--color-danger); }

.row-actions.row-actions--text { flex-wrap: wrap; }
.row-actions.row-actions--text .icon-link {
    width: auto;
    min-width: 0;
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    text-decoration: none;
    white-space: nowrap;
}

/* Pagination */
.pagination { display: flex; gap: 6px; list-style: none; padding: 0; margin: 18px 0 0; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.pagination a, .pagination span {
    min-width: 34px; height: 34px; padding: 0 10px; display: inline-grid; place-items: center;
    border: 1px solid var(--color-border); border-radius: 8px; background: #fff; color: var(--color-text); font-size: 13px;
}
.pagination .active span { background: var(--color-secondary); border-color: var(--color-secondary); color: #fff; }
.pagination .disabled span { opacity: 0.45; }
.pagination-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    margin-top: 16px; padding: 12px 14px; background: #fff; border: 1px solid var(--color-border);
    border-radius: 12px; box-shadow: var(--shadow-sm); flex-wrap: wrap;
}
.pagination-bar .pagination { margin: 0; justify-content: flex-end; }
.pagination-bar__meta { color: var(--color-muted); font-size: 13px; }
.pagination-size { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pagination-size label { color: var(--color-muted); font-size: 13px; font-weight: 600; }
.pagination-size .select { height: 34px; min-width: 78px; }
.pagination-bar__links { min-width: 0; }

/* Checkbox / radio chips */
.check-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; }
.check-pill {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
    border: 1px solid var(--color-border); border-radius: 8px; cursor: pointer; font-size: 13px;
}
.check-pill:hover { background: var(--color-bg); }

/* Permission matrix */
.perm-module { border: 1px solid var(--color-border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.perm-module__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--color-bg); font-weight: 600; }
.perm-module__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; padding: 14px 16px; }

/* Tabs (project workspace) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin-bottom: 20px; flex-wrap: wrap; }
.tab {
    padding: 11px 16px; font-weight: 600; font-size: 13.5px; color: var(--color-muted);
    border-bottom: 2px solid transparent; cursor: pointer; background: none; border-top: none; border-left: none; border-right: none;
}
.tab:hover { color: var(--color-text); }
.tab.is-active { color: var(--color-secondary); border-bottom-color: var(--color-secondary); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* Definition list (overview) */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 14px; }
.dl dt { color: var(--color-muted); }
.dl dd { margin: 0; font-weight: 500; }

/* Detail metric strip */
.metric-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px; }
.metric .v { font-size: 20px; font-weight: 700; }
.metric .l { font-size: 12px; color: var(--color-muted); margin-top: 3px; }

/* Project discussions */
.discussion-card { margin-top: 18px; }
.discussion-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
    gap: 18px;
    align-items: start;
}
.discussion-form {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg);
}
.discussion-form .field { margin: 0; }
.discussion-form .form-actions { margin-top: 0; }
.discussion-modal { max-width: 980px; }
.discussion-modal-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
    gap: 16px;
    align-items: start;
}
.discussion-page { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.discussion-page__side { position: sticky; top: 78px; }
.stack-form { display: grid; gap: 14px; }
.discussion-table th, .discussion-table td { vertical-align: top; }
.discussion-text { white-space: pre-line; line-height: 1.55; }
.discussion-list {
    display: grid;
    gap: 10px;
}
.discussion-list--modal {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
}
.discussion-item {
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: #fff;
}
.discussion-item__meta,
.discussion-item__by {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--color-muted);
    font-size: 12px;
}
.discussion-item__meta span {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--color-bg);
    font-weight: 600;
}
.discussion-item__meta .discussion-item__date {
    background: #e0edff;
    color: #1d4ed8;
}
.discussion-item__meta .discussion-item__author {
    background: #e7f8ef;
    color: #047857;
}

/* Inline-editable project cells */
td.pe-cell { cursor: pointer; }
td.pe-cell:hover { background: #f1f6ff; }
/* Seamless in-cell editor: no border/box, looks like editing the cell itself. */
.pe-input {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 2px;
    border: 0;
    border-radius: 0;
    font-size: 13px;
    outline: none;
    background: transparent;
    color: inherit;
    font-family: inherit;
}
.pe-input:focus { background: #eef6ff; }

/* Discussion delete button */
.discussion-item__meta .discussion-del {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: #cbd5e1;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 5px;
    border-radius: 6px;
}
.discussion-item__meta .discussion-del:hover { color: #dc2626; background: #fee2e2; }

/* Tracking summary: full-cell status colour (project status) */
.tracking-statuscell { color: #fff !important; font-weight: 700; font-size: 13px; }
.tracking-statuscell.st-start,
.tracking-statuscell.st-planned { background: #ffc33d !important; }
.tracking-statuscell.st-in_progress { background: #2563eb !important; }
.tracking-statuscell.st-on_hold { background: #f59e0b !important; }
.tracking-statuscell.st-completed { background: #10b981 !important; }
.tracking-statuscell.st-cancelled { background: #ef4444 !important; }
.tracking-statuscell.st-draft,
.tracking-statuscell.st-archived { background: #94a3b8 !important; }
.discussion-item h3 {
    margin: 8px 0 5px;
    font-size: 14px;
}
.discussion-item p {
    margin: 0 0 8px;
    color: #374151;
    white-space: pre-line;
}

@media (max-width: 980px) {
    .discussion-grid { grid-template-columns: 1fr; }
    .discussion-modal-grid { grid-template-columns: 1fr; }
    .discussion-page { grid-template-columns: 1fr; }
    .discussion-page__side { position: static; }
}

/* Activity feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--color-border); }
.feed li:last-child { border-bottom: none; }
.feed .feed-dot { width: 30px; height: 30px; border-radius: 50%; background: rgba(79,141,245,0.12); color: var(--color-secondary); display: grid; place-items: center; flex: 0 0 auto; font-size: 13px; }
.feed .feed-body { font-size: 13.5px; }
.feed .feed-meta { font-size: 12px; color: var(--color-muted); margin-top: 2px; }

/* Inline confirm forms */
.inline-form { display: inline; }
.resource-member-grid { display: grid; gap: 10px; }
.resource-member {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
}

@media (max-width: 720px) {
    .form-grid { grid-template-columns: 1fr; }
    .split-admin { grid-template-columns: 1fr; }
    .form-grid .field { grid-template-columns: 1fr; gap: 4px; }
    .form-grid .field label { text-align: left; }
    .form-grid .field .field-error,
    .form-grid .field .hint { grid-column: 1; }
    .dl { grid-template-columns: 1fr; gap: 2px 0; }
    .dl dt { margin-top: 8px; }
}

/* =============================================================================
   Sprint 03 — Gantt planner
   ========================================================================== */

.gantt-page { display: flex; flex-direction: column; gap: 14px; }

.gantt-head {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: var(--color-card); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 14px 18px;
}
.gantt-head .meta { display: flex; flex-direction: column; }
.gantt-head .meta .name { font-weight: 700; font-size: 16px; }
.gantt-head .meta .code { font-size: 12px; color: var(--color-muted); }
.gantt-head .gantt-head__status { display: flex; justify-content: flex-end; }
.gantt-head .head-progress { min-width: 160px; text-align: right; }
.gantt-head .head-progress .progress { margin-left: auto; }
.gantt-head .spacer { flex: 1; }

.gantt-toolbar {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    background: var(--color-card); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 8px 10px; position: sticky; top: 0; z-index: 5;
}
.gantt-toolbar .group { display: flex; gap: 4px; align-items: center; }
.gantt-toolbar .sep { width: 1px; height: 24px; background: var(--color-border); margin: 0 6px; }
.tool-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px;
    border: 1px solid var(--color-border); border-radius: 8px; background: #fff;
    font-size: 13px; font-weight: 500; cursor: pointer; color: var(--color-text); white-space: nowrap;
}
.tool-btn:hover { background: var(--color-bg); }
.tool-btn.is-primary { background: var(--color-secondary); border-color: var(--color-secondary); color: #fff; }
.tool-btn.is-primary:hover { background: #3c7ce8; }
.tool-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.gantt {
    background: var(--color-card); border: 1px solid var(--color-border);
    border-radius: var(--radius); overflow: hidden;
}
.gantt__body { display: flex; max-height: calc(100vh - 250px); align-items: stretch; }
.gantt__grid { flex: 0 0 auto; width: 540px; border-right: 1px solid var(--color-border); overflow: hidden; display: flex; flex-direction: column; }
/* min-width:0 lets the flex item shrink so the timeline scrolls horizontally
   instead of stretching the whole body (classic flexbox overflow fix). */
.gantt__timeline { flex: 1 1 auto; min-width: 0; overflow-x: auto; overflow-y: auto; position: relative; }
.gantt__timeline.is-panning { cursor: grabbing; user-select: none; }
.gantt__timeline .time-body { cursor: grab; }
.gantt__timeline .gantt-bar,
.gantt__timeline .gantt-ms { cursor: pointer; }
.gantt__grid-scroll { overflow: hidden; flex: 1; }

.grid-head, .time-head { height: 56px; background: var(--color-bg); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 3; }
.grid-cols { display: grid; grid-template-columns: var(--grid-cols, 30px 64px minmax(200px, 1fr) 108px 108px 84px 116px 118px 120px 140px 60px); }
.grid-head { display: grid; align-items: center; }
.color-swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.1); vertical-align: middle; }
.grid-head .gh { padding: 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted); font-weight: 700; }

.grid-row { display: grid; height: 40px; align-items: center; border-bottom: 1px solid #eef1f6; cursor: default; }
.grid-row:hover { background: var(--color-bg); }
.grid-row.is-selected { background: rgba(79,141,245,0.10); }
.grid-row .gc { padding: 0 8px; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-row .gc-name { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.grid-row .gc-name .twisty { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex: 0 0 18px; text-align: center; cursor: pointer; color: var(--color-muted); font-size: 9px; line-height: 1; user-select: none; border-radius: 4px; transition: background .12s, color .12s; }
.grid-row .gc-name .twisty:hover { background: rgba(79,141,245,0.14); color: var(--color-primary); }
.grid-row .gc-name .twisty--project { color: var(--color-primary); font-size: 10px; }
.grid-row .gc-name .type-ico { font-size: 13px; }
.grid-row .wbs { color: var(--color-muted); font-size: 12px; }
.grid-row .gc-actions { display: flex; gap: 2px; justify-content: flex-end; }
.grid-row .mini-btn { width: 26px; height: 26px; border: none; background: none; border-radius: 6px; cursor: pointer; color: var(--color-muted); font-size: 13px; }
.grid-row .mini-btn:hover { background: #e6eaf2; color: var(--color-text); }
.grid-row .gc-name > span:last-child { overflow: visible; text-overflow: clip; white-space: nowrap; flex: 1; min-width: 0; }

/* Project summary row + bar */
.grid-row.gantt-project-row { background: #eef2fb; font-weight: 700; }
.grid-row.gantt-project-row:hover { background: #e6ecfa; }
.gantt-bar--project { border-radius: 5px; opacity: 0.96; }
.gantt-bar--project .gantt-bar__label { font-weight: 700; }

/* Inline editable cell affordance + editor */
.gc-edit { display: inline-block; min-width: 16px; border-radius: 0; padding: 0; cursor: text; }
.gc-edit:hover { background: transparent; box-shadow: none; }
/* Inline cell editor — blends into the table cell (no floating bordered box).
   Fills the cell and uses an inset outline so values are never clipped. */
.gantt-inline-input {
    width: 100%;
    height: 100%;
    min-height: 26px;
    box-sizing: border-box;
    font: inherit;
    font-size: inherit;
    line-height: 1.3;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--color-text);
    outline: none;
    box-shadow: none;        /* no internal border — feels like the cell itself */
}
/* Subtle, professional focus: faint tint + soft inset ring, no boxy border. */
.gantt-inline-input:focus {
    background: transparent;
    box-shadow: none;
}

/* Right-click context menu */
.gantt-ctx { position: fixed; z-index: 10001; background: #fff; border: 1px solid var(--color-border); border-radius: 10px; box-shadow: 0 10px 30px rgba(16,24,40,0.22); padding: 6px; min-width: 220px; display: flex; flex-direction: column; }
.gantt-ctx button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 9px 12px; border-radius: 7px; font-size: 14px; cursor: pointer; color: var(--color-text); }
.gantt-ctx button:hover { background: var(--color-bg); }
.gantt-ctx button.is-danger { color: var(--color-danger); }
.gantt-ctx__label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); padding: 8px 12px 4px; border-top: 1px solid var(--color-border); margin-top: 4px; }

/* Split-pane resizer between grid and timeline */
.gantt-resizer {
    flex: 0 0 6px; width: 6px; cursor: col-resize; background: var(--color-border);
    position: relative; z-index: 4; transition: background var(--transition);
}
.gantt-resizer:hover, .gantt-resizer:active { background: var(--color-secondary); }
.gantt-resizer::after {
    content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 2px; height: 26px; border-radius: 2px; background: rgba(255,255,255,0.7);
}

/* Rich Gantt hover tooltip */
.gantt-tip {
    position: fixed; z-index: 10000; display: none; min-width: 200px; max-width: 280px;
    background: #1f2533; color: #fff; border-radius: 10px; padding: 10px 12px;
    box-shadow: 0 8px 24px rgba(16,24,40,0.28); font-size: 12.5px; pointer-events: none;
}
.gantt-tip__title { font-weight: 700; font-size: 15px; margin-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,0.15); padding-bottom: 5px; }
.gantt-tip__row { display: flex; justify-content: space-between; gap: 14px; padding: 3px 0; font-size: 13.5px; }
.gantt-tip__row span { color: #aab3c5; }
.gantt-tip__row b { font-weight: 600; text-align: right; }
.gantt-tip__warn { margin-top: 6px; color: #fca5a5; font-weight: 600; }

/* Multi-group (Global Gantt / Resource Timeline) grid columns */
.mg-cols { display: grid; grid-template-columns: 28px 48px minmax(420px, 2.2fr) 84px 84px 70px 92px 92px 100px 104px 44px; align-items: center; box-sizing: border-box; }
.mg-head { height: 56px; background: var(--color-bg); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 3; }
.mg-head .gh { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted); font-weight: 600; }
.grid-row.mg-cols .gc-name { overflow: visible; text-overflow: clip; white-space: nowrap; font-weight: 500; font-size: 12.5px; min-width: 0; }
.grid-row.mg-cols .gc { font-size: 12px; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-row.mg-cols.is-editable { cursor: pointer; }
.grid-row.mg-group { font-weight: 500; background: #fff; cursor: pointer; }
.grid-row.mg-group:hover { background: #eef1f6; }
.grid-row.mg-group .twisty { width: 14px; text-align: center; cursor: pointer; color: var(--color-muted); font-size: 10px; }
.mg-group__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-group__meta { margin-left: auto; font-size: 11px; flex: 0 0 auto; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.mini-progress { display: inline-block; width: 44px; height: 6px; background: #eef1f6; border-radius: 3px; overflow: hidden; vertical-align: middle; }
.mini-progress > span { display: block; height: 100%; background: var(--color-secondary); }

.time-months { display: flex; height: 28px; border-bottom: 1px solid var(--color-border); }
.time-month { border-right: 1px solid var(--color-border); font-size: 12.5px; font-weight: 600; color: var(--color-muted); display: flex; align-items: center; padding: 0 8px; box-sizing: border-box; white-space: nowrap; }
.time-days { display: flex; height: 28px; }
.time-day { border-right: 1px solid #eef1f6; font-size: 11.5px; color: var(--color-muted); display: flex; align-items: center; justify-content: center; box-sizing: border-box; }
.time-day.is-weekend { background: #fafbfd; }
.time-day.is-today { background: rgba(79,141,245,0.12); color: var(--color-secondary); font-weight: 700; }

.time-body { position: relative; }
.time-row { height: 38px; border-bottom: 1px solid #eef1f6; position: absolute; left: 0; right: 0; }
.time-weekend { position: absolute; top: 0; bottom: 0; background: #fafbfd; pointer-events: none; }
.time-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--color-secondary); z-index: 2; opacity: 0.6; }

.gantt-bar { position: absolute; top: 7px; height: 24px; border-radius: 6px; cursor: grab; box-shadow: var(--shadow-sm); overflow: hidden; user-select: none; z-index: 1; display: flex; align-items: center; }
.gantt-bar:active { cursor: grabbing; }
.gantt-bar__fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(0,0,0,0.18); }
.gantt-bar__label { position: relative; z-index: 1; font-size: 12.5px; color: #fff; padding: 0 8px; white-space: nowrap; text-shadow: 0 1px 1px rgba(0,0,0,0.25); pointer-events: none; }
.gantt-bar__handle { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 2; }
.gantt-bar.is-phase { height: 18px; top: 10px; }
.gantt-bar.has-conflict { outline: 2px solid var(--color-danger); outline-offset: 1px; }
/* Selected task highlight on the multi-project (overview) Gantt. */
.gantt-bar.mg-selected, .gantt-ms.mg-selected { outline: 2px solid var(--color-primary); outline-offset: 1px; box-shadow: 0 0 0 2px rgba(79,141,245,0.25); }
.grid-row.mg-selected { background: rgba(79,141,245,0.10); }
/* Link mode: crosshair over bars while drawing dependencies. */
.gantt.is-linking .gantt-bar, .gantt.is-linking .gantt-ms { cursor: crosshair; }
.gantt.is-linking .gantt-bar:hover { outline: 2px dashed var(--color-primary); outline-offset: 1px; }
/* Resource View bucket header rows. */
.grid-row.mg-group--resource .gc-name strong { color: var(--color-text); }
.grid-row.mg-group--resource { background: rgba(100,116,139,0.06); }
.tool-btn.is-primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.gantt-ms { position: absolute; top: 9px; width: 20px; height: 20px; transform: rotate(45deg); border-radius: 4px; cursor: grab; z-index: 1; box-shadow: var(--shadow-sm); }
.gantt-ms__label { position: absolute; top: 10px; font-size: 11px; white-space: nowrap; color: var(--color-text); }

.dep-layer { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 1; }
.dep-line { stroke: #94A3B8; stroke-width: 1.5; fill: none; }
.dep-arrow { fill: #94A3B8; }

.gantt.is-linking .gantt-bar, .gantt.is-linking .gantt-ms { cursor: crosshair; }
.gantt.is-linking .gantt-bar.link-source, .gantt.is-linking .gantt-ms.link-source { outline: 2px solid var(--color-secondary); outline-offset: 1px; }

.gantt-empty { padding: 60px 20px; text-align: center; color: var(--color-muted); }
.gantt-loading { padding: 50px; text-align: center; color: var(--color-muted); }
.spinner { width: 28px; height: 28px; border: 3px solid #e5e7eb; border-top-color: var(--color-secondary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #fff; border: 1px solid var(--color-border); border-left: 4px solid var(--color-secondary); border-radius: 8px; padding: 12px 16px; box-shadow: var(--shadow); font-size: 13.5px; min-width: 220px; animation: slidein 0.2s ease; }
.toast.is-success { border-left-color: var(--color-success); }
.toast.is-error { border-left-color: var(--color-danger); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-overlay { position: fixed; inset: 0; background: rgba(16,24,40,0.5); z-index: 1000; display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-overlay.is-open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 620px; box-shadow: var(--shadow); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--color-border); }
.modal__head h3 { margin: 0; font-size: 16px; }
.modal__close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--color-muted); }
.modal__body { padding: 20px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--color-border); }

/* Task edit modal — wider, horizontal label/input, two-column compact grid. */
#taskModal .modal { max-width: 920px; }
#taskModal .modal__body { padding: 18px 22px; }
.task-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; }
.task-form-grid .mfield.full { grid-column: 1 / -1; }
.task-form-grid .mfield { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 1fr); align-items: center; gap: 12px; }
.task-form-grid .mfield label { font-size: 13px; font-weight: 600; color: var(--color-text); margin: 0; text-align: left; }
.task-form-grid .mctl { min-width: 0; }
.task-form-grid .mctl .input,
.task-form-grid .mctl .select,
.task-form-grid .mctl .textarea { width: 100%; height: 34px; padding: 4px 10px; font-size: 13.5px; box-sizing: border-box; }
.task-form-grid .mctl .textarea { height: auto; min-height: 56px; padding: 8px 10px; }
.task-form-grid .mctl .input-color { padding: 2px; height: 34px; cursor: pointer; }
.attachment-upload-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.upload-card {
    display: grid; gap: 8px; justify-items: center; text-align: center; padding: 14px;
    border: 1px dashed var(--color-border); border-radius: 12px; background: #f8fafc;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.upload-card:hover { border-color: var(--color-secondary); background: #fff; box-shadow: var(--shadow-sm); }
.upload-card__icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(14,165,233,0.12); font-size: 19px; }
.upload-card__title { font-weight: 700; font-size: 13px; }
.upload-card__file { max-width: 100%; color: var(--color-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-card input[type="file"] { width: 100%; font-size: 12px; }
.attachment-inline-upload {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

@media (max-width: 760px) {
    .task-form-grid { grid-template-columns: 1fr; }
    .task-form-grid .mfield { grid-template-columns: 1fr; gap: 4px; }
    .task-form-grid .mfield label { text-align: left; }
    .attachment-upload-grid { grid-template-columns: 1fr; }
    .attachment-inline-upload { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .gantt__grid { width: 280px; }
    .grid-cols { grid-template-columns: 1fr 70px; }
    .grid-head .gh:not(.gh-name):not(.gh-actions), .grid-row .gc:not(.gc-name):not(.gc-actions) { display: none; }
}

/* Screenshot-style project Gantt view */
.gantt-page {
    gap: 0;
}
.gantt-page .gantt-head {
    border-radius: 3px 3px 0 0;
    border-bottom: 0;
    padding: 10px 14px;
}
.gantt-toolbar {
    gap: 8px;
    border-radius: 3px 3px 0 0;
    border-color: #d8dee6;
    background: #f8fafc;
    padding: 4px 10px;
    top: var(--header-height);
}
.gantt-toolbar__spacer { flex: 1; }
.gantt-toolbar .group { gap: 10px; }
.gantt-toolbar .sep { display: none; }
.tool-btn {
    border: 0;
    border-radius: 3px;
    background: transparent;
    padding: 6px 8px;
    font-size: 14px;
    font-weight: 400;
    color: #243142;
}
.tool-btn:hover { background: #e9eef5; }
.tool-btn.is-primary { background: #0d7df2; color: #fff; }
.gantt-search {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 220px;
}
.gantt-search .input {
    height: 30px;
    border-radius: 3px 0 0 3px;
    padding: 5px 8px;
    font-size: 14px;
}
.gantt-search .tool-btn {
    height: 40px;
    border: 1px solid #cfd7e2;
    border-left: 0;
    border-radius: 0 3px 3px 0;
    background: #fff;
}
.gantt {
    border-color: #d8dee6;
    border-radius: 0 0 3px 3px;
    box-shadow: none;
}
.gantt__body {
    max-height: calc(100vh - 210px);
    min-height: 520px;
    overflow: hidden; /* only the timeline scrolls horizontally, never the page */
}
.gantt__grid {
    border-right: 1px solid #d8dee6;
    /* Keep the task/project name column fixed while the timeline scrolls. */
    position: sticky;
    left: 0;
    z-index: 4;
    background: #fff;
    flex: 0 0 auto;
}
.gantt__timeline {
    min-width: 0; /* allow the timeline to shrink so it scrolls instead of the page */
}
.gantt__grid--overview {
    min-width: 0;
    max-width: none;
}
.grid-cols {
    grid-template-columns: var(--grid-cols, 30px 64px minmax(200px, 1fr) 108px 108px 84px 116px 118px 120px 140px 60px);
}
.grid-head,
.mg-head,
.time-head {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid #d8dee6;
}
.grid-head .gh,
.mg-head .gh,
.grid-row .gc,
.grid-row .gc-name {
    border-right: 1px solid #d8dee6;
}
.grid-head .gh,
.mg-head .gh {
    padding: 0 10px;
    font-size: 14px;
    line-height: 64px;
    color: #000;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}
.grid-row {
    height: 36px;
    border-bottom: 1px solid #d8dee6;
}
.grid-row .gc {
    height: 36px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 14px;
    color: #000;
}
.grid-row.mg-cols .gc-name {
    height: 36px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    box-sizing: border-box;
}
.grid-row .gc-name {
    gap: 7px;
    font-weight: 400;
}
.grid-row .wbs,
.drag-cell {
    color: #aab2bd;
    justify-content: center;
    font-size: 13px;
}
.grid-row.is-selected {
    background: #d9ecff;
}
.grid-row.gantt-project-row {
    background: #fff;
    font-weight: 500;
}
.grid-row:hover,
.grid-row.gantt-project-row:hover {
    background: #eef6ff;
}
.gc-edit {
    width: 100%;
    padding: 0;
    border-radius: 0;
}
.gc-edit:hover {
    background: transparent;
    box-shadow: none;
}
/* (inline editor styling consolidated above; keep this minimal so the cell
   editor stays borderless and fills the cell) */

/* Drag handle + drag/drop reorder feedback */
.drag-cell { color: #b3bcc8; cursor: grab; justify-content: center; user-select: none; font-size: 13px; }
.drag-cell[draggable="true"]:hover { color: var(--color-secondary); }
.grid-row.is-dragging { opacity: 0.45; }
.grid-row.drop-before { box-shadow: inset 0 2px 0 0 var(--color-secondary); }
.grid-row.drop-after { box-shadow: inset 0 -2px 0 0 var(--color-secondary); }
/* Drop ONTO a row = make the dragged task its subtask */
.grid-row.drop-onto { box-shadow: inset 0 0 0 2px var(--color-primary, #2563eb); background: rgba(37,99,235,.10); }

/* Focused (selected) project on the overview Gantt */
.grid-row.mg-group.mg-focus { background: #dbeafe !important; box-shadow: inset 4px 0 0 0 var(--color-primary, #2563eb); }
.grid-row.mg-group.mg-focus .gc-name { font-weight: 700; }
/* Highlight the expanded project's task sub-rows */
.grid-row.mg-focus-row { background: #eff4ff !important; box-shadow: inset 4px 0 0 0 rgba(37,99,235,.45); }

/* Overdue task/project status (past end date, not completed) */
/* Fallback: red chip (browsers without :has) */
.status-chip.is-overdue { background: #ef4444 !important; color: #fff !important; border-color: #ef4444 !important; }
/* Full status cell turns red */
.grid-row .gc:has(.status-chip.is-overdue) { background: #ef4444 !important; }
.grid-row .gc:has(.status-chip.is-overdue) .status-chip { background: transparent !important; border-color: transparent !important; box-shadow: none !important; color: #fff !important; }

/* Status chip + editable color swatch */
.status-chip { display: inline-block; }
.gc .color-swatch { cursor: pointer; }
.gc-edit[data-edit-cell="color"] { width: auto; }
.time-months {
    height: 34px;
    border-bottom: 1px solid #d8dee6;
}
.time-month {
    justify-content: flex-start;
    border-right: 1px solid #d8dee6;
    color: #000;
    font-size: 14px;
    font-weight: 600;
    padding: 0 12px;
    overflow: hidden;
    text-overflow: clip;
}
.time-month.is-compact { padding: 0; }
.time-days {
    height: 30px;
}
.time-day {
    border-right: 1px solid #d8dee6;
    color: #000;
    font-size: 14px;
    font-weight: 600;
}
.time-body {
    background-image: linear-gradient(to right, transparent calc(100% - 1px), #d8dee6 calc(100% - 1px));
    background-size: var(--gantt-day-width, 30px) 100%;
}
.time-row {
    height: 36px;
    border-bottom: 1px solid #d8dee6;
}
.time-weekend {
    background: rgba(248, 250, 252, 0.65);
}
.gantt-bar {
    height: 22px;
    border-radius: 4px;
    box-shadow: none;
}
.gantt-bar.is-phase {
    height: 18px;
}
.gantt-bar--project {
    border-radius: 3px;
}
.gantt-bar__label {
    font-size: 12px;
}
.dep-line {
    stroke: #0d62c9;
    stroke-width: 1.2;
}
.dep-arrow {
    fill: #0d62c9;
}
.gantt-resizer {
    flex-basis: 5px;
    width: 5px;
    background: #d8dee6;
}
.gantt-resizer::after {
    background: #7c8794;
}
.gantt-ctx {
    border-radius: 3px;
    min-width: 202px;
    padding: 0;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}
.gantt-ctx button {
    border-radius: 0;
    padding: 8px 20px;
    font-size: 14px;
}
.gantt-ctx button:hover {
    background: #0d7df2;
    color: #fff;
}
.gantt-ctx button:disabled {
    color: #8a94a3;
    cursor: default;
}
.gantt-ctx button:disabled:hover {
    background: #fff;
    color: #8a94a3;
}

/* Project tracking summary */
.tracking-summary {
    width: 100%;
    margin: 0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #e6ebf2;
    border-radius: 10px;
    padding: 28px 30px 34px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.tracking-summary__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 26px;
}
.tracking-summary h2 {
    margin: 8px 0 0;
    font-size: 24px;
    color: #3f4249;
}
.tracking-summary__stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.tracking-summary__stats span {
    border: 1px solid #dce5f1;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12.5px;
    background: #fff;
    color: #6b7280;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.tracking-summary__stats strong { color: #111827; }
.tracking-summary__filters {
    margin-bottom: 22px;
    padding: 14px;
    /* border: 1px solid #e2e8f0; */
    border-radius: 10px;
    background: #fff;
}
.tracking-section { margin-top: 24px; }
.tracking-section__title {
    margin-bottom: 6px;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1f2937;
}
.tracking-section--blue .tracking-section__title { color: #4f93ff; }
.tracking-section--purple .tracking-section__title { color: #a15be8; }
.tracking-section--slate .tracking-section__title { color: #64748b; }
.tracking-department {
    margin-top: 18px;
    border: 1px solid #dfe7f1;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.035);
}
.tracking-department__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    background: linear-gradient(90deg, #f8fbff 0%, #eef6ff 100%);
    border-bottom: 1px solid #dfe7f1;
}
.tracking-department__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: #64748b;
    font-size: 12px;
}
.tracking-department__meta span {
    padding: 3px 8px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #e5edf7;
}
.tracking-department__progress {
    min-width: 104px;
    text-align: right;
}
.tracking-department__progress strong {
    display: block;
    color: #2563eb;
    font-size: 20px;
    line-height: 1.1;
}
.tracking-department__progress span {
    color: #64748b;
    font-size: 11.5px;
}
.tracking-table {
    display: grid;
    gap: 2px;
    overflow-x: auto;
    padding: 10px;
}
.tracking-row {
    display: grid;
    grid-template-columns: minmax(260px, 1.6fr) minmax(170px, 1fr) 120px 150px minmax(180px, 1fr) 104px 126px;
    align-items: center;
    gap: 3px;
    color: #343842;
    text-decoration: none;
    min-width: 1160px;
}
.tracking-row > div {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #f1f4f8;
    padding: 0 12px;
    font-size: 14px;
}
.tracking-department .tracking-row:not(.tracking-row--head) > div {
    background: #f8fafc;
}
.tracking-department .tracking-row:not(.tracking-row--head):nth-child(odd) > div {
    background: #f2f6fb;
}
.tracking-row:not(.tracking-row--head):hover > div {
    background: #eaf3ff;
}
.tracking-row--head > div {
    min-height: 24px;
    background: transparent;
    padding-top: 0;
    padding-bottom: 4px;
    font-size: 16px;
    color: #3f4249;
    justify-content: center;
}
.tracking-project {
    align-items: center !important;
    justify-content: center;
}
.tracking-project strong {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.tracking-avatar {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #dbeafe, #fce7f3);
    color: #334155;
    font-weight: 700;
    font-size: 11px;
    margin: 0 auto;
}
.tracking-status {
    width: 100%;
    min-height: 46px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 13px;
}
.tracking-status.is-done { background: #08c979; }
.tracking-status.is-working { background: #ffab35; }
.tracking-status.is-stuck { background: #ea405a; }
.tracking-progress {
    width: 100%;
    height: 13px;
    border-radius: 999px;
    background: #c8cbd2;
    overflow: hidden;
}
.tracking-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #4f93ff;
}
.tracking-section--purple .tracking-progress span { background: #a15be8; }
.tracking-stars {
    gap: 1px;
    color: #cbd0d8;
    font-size: 17px !important;
    letter-spacing: 1px;
}
.tracking-stars .is-on { color: #ffc107; }
.tracking-row--empty {
    min-height: 48px;
    padding: 0 12px;
    align-items: center;
    background: #f8fafc;
    color: #64748b;
    font-size: 14px;
}

@media (max-width: 980px) {
    .tracking-department__head { align-items: flex-start; flex-direction: column; }
    .tracking-department__progress { text-align: left; }
    .tracking-row {
        grid-template-columns: minmax(240px, 1fr) 160px 132px 150px 88px 112px;
        min-width: 900px;
    }
    .tracking-table { overflow-x: auto; }
}
