/* =============================================================================
   Online Gantt — Base Theme (Sprint 01)
   Modern, clean, responsive enterprise admin shell. Framework-free.
   ========================================================================== */

:root {
    --color-primary: #31374D;
    --color-primary-600: #3B4263;
    --color-secondary: #4F8DF5;
    --color-bg: #F5F7FB;
    --color-card: #FFFFFF;
    --color-text: #1F2937;
    --color-muted: #6B7280;
    --color-success: #22C55E;
    --color-warning: #F59E0B;
    --color-danger: #EF4444;
    --color-border: #E5E7EB;

    --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(--color-primary);
    color: #cbd2e0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    transition: transform var(--transition);
}

.sidebar__brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px;
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__brand .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--color-secondary);
    display: grid;
    place-items: center;
    font-size: 18px;
    color: #fff;
    flex: 0 0 auto;
}

.sidebar__nav {
    padding: 16px 12px;
    overflow-y: auto;
    flex: 1;
}

.sidebar__section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7b8398;
    margin: 18px 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: #cbd2e0;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background var(--transition), color var(--transition);
    cursor: pointer;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }

.nav-item.is-active {
    background: var(--color-secondary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

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

.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    flex: 0 0 auto;
    font-size: 16px;
}

.nav-item .nav-badge {
    margin-left: auto;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 7px;
    border-radius: 999px;
}

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

/* ----------------------------------------------------------------- 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;
}

.header__toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--color-text);
}

.header__title { font-size: 16px; font-weight: 600; }
.header__title small { display: block; font-weight: 400; color: var(--color-muted); font-size: 12px; }

.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: var(--color-secondary);
    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: 28px 24px; 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 span { color: var(--color-text); }

/* --------------------------------------------------------------- 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;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition);
}
.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-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; }
    .main { margin-left: 0; }
    .header__toggle { display: block; }
}

@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 { padding: 8px 12px; 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-actions { display: flex; gap: 8px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.form-grid .field.full { grid-column: 1 / -1; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--color-text); }
.field .hint { font-size: 12px; color: var(--color-muted); margin-top: 4px; }
.input, .select, .textarea {
    width: 100%;
    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-section-title { font-weight: 700; font-size: 14px; margin: 4px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--color-border); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left;
    padding: 12px 14px;
    color: var(--color-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.table tbody tr:hover { background: var(--color-bg); }
.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; }

/* 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; }

/* 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; }
.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: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--color-border);
    display: grid; place-items: center; color: var(--color-muted); background: #fff; cursor: pointer;
}
.row-actions .icon-link:hover { background: var(--color-bg); color: var(--color-text); }

/* 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; }

/* 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; }

/* 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; }

@media (max-width: 720px) {
    .form-grid { grid-template-columns: 1fr; }
    .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 .head-progress { min-width: 160px; }
.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); }
.gantt__grid { flex: 0 0 auto; width: 540px; border-right: 1px solid var(--color-border); overflow: hidden; display: flex; flex-direction: column; }
.gantt__timeline { flex: 1; overflow: auto; position: relative; }
.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: 56px minmax(150px, 1fr) 110px 104px 104px 48px 96px 110px 130px 52px 84px; }
.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: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted); font-weight: 600; }

.grid-row { display: grid; height: 38px; align-items: center; border-bottom: 1px solid #eef1f6; }
.grid-row:hover { background: var(--color-bg); }
.grid-row.is-selected { background: rgba(79,141,245,0.08); }
.grid-row .gc { padding: 0 8px; font-size: 12.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 { width: 14px; text-align: center; cursor: pointer; color: var(--color-muted); font-size: 10px; user-select: none; }
.grid-row .gc-name .type-ico { font-size: 12px; }
.grid-row .wbs { color: var(--color-muted); font-size: 11px; }
.grid-row .gc-actions { display: flex; gap: 2px; justify-content: flex-end; }
.grid-row .mini-btn { width: 24px; height: 24px; border: none; background: none; border-radius: 6px; cursor: pointer; color: var(--color-muted); font-size: 12px; }
.grid-row .mini-btn:hover { background: #e6eaf2; color: var(--color-text); }
.grid-row { cursor: pointer; }
/* Keep task names readable: truncate the name span (not the whole row). */
.grid-row .gc-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }

/* 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: 13.5px; 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: 2px 0; }
.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: minmax(140px, 1fr) 92px 92px 50px 96px 120px; align-items: center; gap: 6px; padding: 0 10px; 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: hidden; text-overflow: ellipsis; 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 { display: flex; align-items: center; gap: 8px; padding: 0 10px; font-weight: 700; background: var(--color-bg); 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: 11px; 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: 10px; 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: relative; }
.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: 11px; 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; }

.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); }

@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; }
}
