/* ===== Gantt Chart Application ===== */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --text-2: #64748b;
    --muted: #94a3b8;
    --border: #e2e8f0;
    --border-2: #cbd5e1;

    --proj: #2563eb;
    --sub: #7c3aed;
    --mile: #06b6d4;
    --task: #f59e0b;

    --st-pending: #94a3b8;
    --st-inprogress: #f59e0b;
    --st-completed: #10b981;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 12px 28px rgba(0,0,0,.12);
    --font: 'Inter','Segoe UI',system-ui,-apple-system,sans-serif;

    --sidepanel-w: 280px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

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

.app { display: flex; flex-direction: column; min-height: 100vh; }

/* ===== Header ===== */
.header {
    background: linear-gradient(135deg,#1e3a5f 0%,#2563eb 55%,#7c3aed 100%);
    color: #fff;
    padding: 0 1.25rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 200;
    box-shadow: 0 2px 14px rgba(37,99,235,.25);
}
.header-left { display: flex; align-items: center; gap: .85rem; }
.logo { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; letter-spacing: -.01em; }
.logo-icon {
    width: 30px; height: 30px; background: rgba(255,255,255,.18);
    border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .95rem;
}
.header-right { display: flex; align-items: center; gap: .6rem; }
.last-updated { font-size: .72rem; opacity: .8; margin-right: .25rem; }

/* ===== User menu ===== */
.user-menu { display: flex; align-items: center; gap: .45rem; margin-left: .25rem; padding-left: .75rem; border-left: 1px solid rgba(255,255,255,.25); }
.user-avatar-badge {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,.25);
    color: #fff; font-size: .7rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.user-name { font-size: .8rem; font-weight: 500; opacity: .9; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-logout {
    background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25);
    color: #fff; font-size: .72rem; padding: .28rem .65rem; border-radius: 6px; cursor: pointer;
    transition: background .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.28); }

/* ===== Auth overlay ===== */
.auth-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 55%, #7c3aed 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.auth-card {
    background: #fff; border-radius: 16px;
    padding: 2.25rem 2.5rem; width: 100%; max-width: 400px;
    box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.auth-logo {
    font-size: 1.2rem; font-weight: 800; color: var(--primary);
    display: flex; align-items: center; gap: .55rem;
    margin-bottom: 1.75rem; justify-content: center;
}
.auth-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.auth-tab {
    flex: 1; padding: .6rem; background: none; border: none; cursor: pointer;
    font-size: .9rem; font-weight: 600; color: var(--text-2);
    border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s;
}
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-field { display: flex; flex-direction: column; gap: .35rem; }
.auth-field label { font-size: .82rem; font-weight: 600; color: var(--text); }
.auth-field input {
    border: 1.5px solid var(--border-2); border-radius: 8px;
    padding: .6rem .85rem; font-size: .9rem; outline: none; transition: border-color .15s;
}
.auth-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.auth-submit {
    background: var(--primary); color: #fff; border: none; border-radius: 8px;
    padding: .72rem; font-size: .95rem; font-weight: 600; cursor: pointer;
    transition: background .15s; margin-top: .25rem;
}
.auth-submit:hover { background: var(--primary-hover); }
.auth-submit:disabled { opacity: .6; cursor: not-allowed; }
.auth-error {
    background: #fef2f2; border: 1px solid #fecaca; color: #dc2626;
    border-radius: 7px; padding: .55rem .8rem; font-size: .82rem;
}
.auth-hint { font-size: .78rem; color: var(--text-2); text-align: center; margin-top: .25rem; }
.auth-hint-inline { font-size: .75rem; color: var(--text-2); font-weight: 400; }

.icon-btn {
    background: rgba(255,255,255,.15);
    border: none; color: #fff; cursor: pointer;
    width: 38px; height: 38px; border-radius: 8px;
    font-size: 1.2rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.28); }
.icon-btn-sm { width: 28px; height: 28px; font-size: 1rem; background: transparent; color: var(--text-2); }
.icon-btn-sm:hover { background: var(--bg); color: var(--text); }

/* ===== Body layout ===== */
.body { flex: 1; display: flex; min-height: 0; }

/* ===== Side panel ===== */
.sidepanel {
    width: var(--sidepanel-w);
    flex-shrink: 0;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width .2s ease, margin .2s ease;
}
.app.sidepanel-collapsed .sidepanel {
    width: 0;
    margin-left: 0;
    border-right: none;
}
.sidepanel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: .85rem 1rem; border-bottom: 1px solid var(--border);
    font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2);
}
.sidepanel-search { padding: .65rem .85rem; border-bottom: 1px solid var(--border); }
.sidepanel-search input {
    width: 100%; padding: .45rem .6rem; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: .8rem; font-family: inherit;
}
.sidepanel-search input:focus { outline: none; border-color: var(--primary); }

.tree { flex: 1; min-height: 0; overflow-y: auto; padding: .5rem 0; }
.tree-node { user-select: none; }
.tree-row {
    display: flex; align-items: center; gap: .35rem;
    padding: .3rem .6rem; cursor: pointer; font-size: .82rem;
    border-left: 3px solid transparent;
}
.tree-row:hover { background: var(--bg); }
.tree-row .twisty { width: 14px; text-align: center; color: var(--muted); font-size: .7rem; flex-shrink: 0; }
.tree-row .tree-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tree-add {
    width: 18px; height: 18px; border: none; border-radius: 5px; cursor: pointer;
    background: var(--bg); color: var(--text-2); font-size: .9rem; line-height: 1;
    display: none; align-items: center; justify-content: center; flex-shrink: 0;
}
.tree-row:hover .tree-add { display: inline-flex; }
.tree-add:hover { background: var(--primary); color: #fff; }
.tree-row .tree-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tree-lvl-project   { font-weight: 600; }
.tree-lvl-project   .tree-dot { background: var(--proj); }
.tree-lvl-subproject .tree-dot { background: var(--sub); }
.tree-lvl-milestone  .tree-dot { background: var(--mile); }
.tree-lvl-task       .tree-dot { background: var(--task); }
.tree-children.collapsed { display: none; }
.tree-empty { padding: 1.5rem 1rem; color: var(--muted); font-size: .8rem; text-align: center; }

/* ===== Main ===== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: .7rem 1.25rem;
    background: var(--card); border-bottom: 1px solid var(--border);
}
.view-switch { display: inline-flex; background: var(--bg); border-radius: 8px; padding: 3px; }
.view-btn {
    border: none; background: none; cursor: pointer;
    padding: .45rem .9rem; border-radius: 6px; font-size: .82rem; font-weight: 600;
    color: var(--text-2); font-family: inherit;
}
.view-btn.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.toolbar-right { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* ===== Views ===== */
.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; flex-direction: column; }
.view-list { padding: 1.1rem 1.25rem; overflow-y: auto; }

/* Tabs */
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab {
    border: none; background: var(--card); cursor: pointer;
    padding: .5rem .9rem; border-radius: 8px; font-size: .82rem; font-weight: 500;
    color: var(--text-2); font-family: inherit; border: 1px solid var(--border);
    display: flex; align-items: center; gap: .4rem;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.count {
    font-size: .68rem; background: rgba(0,0,0,.08); padding: .05rem .4rem; border-radius: 10px; font-weight: 700;
}
.tab.active .count { background: rgba(255,255,255,.25); }

/* List card */
.list-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-card-head h2 { font-size: 1rem; font-weight: 700; }
.items { max-height: calc(100vh - 320px); overflow-y: auto; }

.item {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
    padding: .85rem 1.1rem; border-bottom: 1px solid var(--border);
    border-left: 3px solid transparent; cursor: pointer; transition: background .12s;
}
.item:last-child { border-bottom: none; }
.item:hover { background: #f8fafc; }
.item.type-project    { border-left-color: var(--proj); }
.item.type-subproject { border-left-color: var(--sub); }
.item.type-milestone  { border-left-color: var(--mile); }
.item.type-task       { border-left-color: var(--task); }
.item-main { min-width: 0; flex: 1; }
.item-name { font-weight: 600; font-size: .9rem; }
.item-sub { font-size: .75rem; color: var(--text-2); margin-top: .1rem; }
.item-desc { font-size: .8rem; color: var(--text-2); margin-top: .2rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.item-meta { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; align-items: center; }
.item-actions { display: flex; gap: .35rem; opacity: 0; transition: opacity .12s; flex-shrink: 0; }
.item:hover .item-actions { opacity: 1; }

.tag { font-size: .68rem; font-weight: 600; padding: .12rem .5rem; border-radius: 5px; white-space: nowrap; background: var(--bg); color: var(--text-2); }
.tag.date { background: var(--primary-light); color: var(--primary); }
.tag.status-pending { background: #f1f5f9; color: #64748b; }
.tag.status-in_progress, .tag.status-inprogress { background: #fffbeb; color: #d97706; }
.tag.status-completed { background: #ecfdf5; color: #059669; }
.tag.prio-low { background: #ecfdf5; color: #059669; }
.tag.prio-medium { background: #fffbeb; color: #d97706; }
.tag.prio-high { background: #fef2f2; color: #dc2626; }

.mini-bar { width: 90px; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.mini-bar > span { display: block; height: 100%; background: var(--primary); }

.empty { padding: 3rem 2rem; width: 100%; box-sizing: border-box; display: flex !important; flex-direction: row !important; align-items: center !important; justify-content: center; gap: .85rem; color: var(--muted); }
.empty-inner { display: contents; }
.empty-icon { font-size: 1.4rem; opacity: .45; flex-shrink: 0; }
.empty-text { display: flex; flex-direction: column; gap: .15rem; }
.empty-text p { margin: 0; font-size: .88rem; color: var(--muted); }
.empty-sub { font-size: .8rem !important; opacity: .7; }

/* ===== Buttons ===== */
.btn {
    padding: .5rem .95rem; border: none; border-radius: var(--radius-sm); cursor: pointer;
    font-size: .8rem; font-weight: 600; font-family: inherit;
    display: inline-flex; align-items: center; gap: .35rem; transition: all .14s; line-height: 1.3;
}
.btn:active { transform: scale(.97); }
.btn-sm { padding: .35rem .65rem; font-size: .75rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg); color: var(--text-2); border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--text); }
.btn-white { background: #fff; color: var(--primary); }
.btn-white:hover { background: var(--bg); }
.btn-ghost-light { background: rgba(255,255,255,.15); color: #fff; }
.btn-ghost-light:hover { background: rgba(255,255,255,.28); }
.btn-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-chip { background: var(--card); color: var(--text-2); border: 1px solid var(--border); padding: .35rem .6rem; font-size: .75rem; }
.btn-chip:hover { border-color: var(--border-2); color: var(--text); }
.btn-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== Gantt ===== */
.gantt { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--card); }
.gantt-controls {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    padding: .6rem 1rem; border-bottom: 1px solid var(--border); background: #fafbfc;
}
.gantt-controls .sep { width: 1px; height: 22px; background: var(--border); margin: 0 .25rem; }
.gantt-controls .group-label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

.gantt-scroll { flex: 1; overflow: auto; position: relative; }
.gantt-inner { position: relative; }

.gantt-head-row { display: flex; position: sticky; top: 0; z-index: 30; }
.gantt-corner {
    position: sticky; left: 0; z-index: 40;
    background: #f8fafc; border-right: 2px solid var(--border-2); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 .85rem; font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; color: var(--text-2);
}
.gantt-timeline-head { background: #f8fafc; border-bottom: 1px solid var(--border); }
.gantt-months { display: flex; height: 24px; }
.gantt-month { border-right: 1px solid var(--border); font-size: .72rem; font-weight: 600; color: var(--text); padding: .2rem .4rem; white-space: nowrap; overflow: hidden; box-sizing: border-box; }
.gantt-ticks { display: flex; height: 20px; }
.gantt-tick { border-right: 1px solid var(--border); font-size: .62rem; color: var(--muted); text-align: center; box-sizing: border-box; overflow: hidden; padding-top: 2px; }
.gantt-tick.weekend { background: #f1f5f9; }

.gantt-row { display: flex; border-bottom: 1px solid var(--border); }
.gantt-row:hover .gantt-label { background: #f1f5f9; }
.gantt-row:hover .gantt-track { background: #fafcff; }
.gantt-label {
    position: sticky; left: 0; z-index: 20; background: var(--card);
    border-right: 2px solid var(--border-2);
    display: flex; align-items: center; gap: .35rem;
    padding: 0 .6rem; font-size: .8rem; cursor: pointer; box-sizing: border-box;
}
.gantt-label .twisty { width: 12px; text-align: center; color: var(--muted); font-size: .65rem; flex-shrink: 0; }
.gantt-label .lbl-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-label .lbl-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.lvl-project   .lbl-text { font-weight: 700; }
.lvl-subproject .lbl-text { font-weight: 600; }
.gantt-track { position: relative; box-sizing: border-box; }

.gantt-bar {
    position: absolute; top: 50%; transform: translateY(-50%);
    height: 18px; border-radius: 5px; cursor: pointer;
    display: flex; align-items: center; overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.15); min-width: 4px;
}
.gantt-bar .bar-label { font-size: .68rem; color: #fff; padding: 0 .4rem; white-space: nowrap; text-shadow: 0 1px 1px rgba(0,0,0,.25); pointer-events: none; }
.gantt-bar .bar-progress { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.35); }
.bar-project    { background: var(--proj); height: 22px; }
.bar-subproject { background: var(--sub); height: 20px; }
.bar-task       { background: var(--task); }
.bar-task.status-completed { background: var(--st-completed); }
.bar-task.status-in_progress { background: var(--st-inprogress); }
.bar-task.status-pending { background: #64748b; }

.gantt-milestone {
    position: absolute; top: 50%; width: 14px; height: 14px;
    background: var(--mile); transform: translate(-50%,-50%) rotate(45deg);
    border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); cursor: pointer; z-index: 5;
}

.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #ef4444; z-index: 10; pointer-events: none; }
.gantt-today-flag { position: absolute; top: 0; transform: translateX(-50%); background: #ef4444; color: #fff; font-size: .6rem; padding: 1px 5px; border-radius: 0 0 4px 4px; white-space: nowrap; }

.gantt-empty { padding: 3rem; text-align: center; color: var(--muted); }

/* Gantt project filter dropdown */
.gantt-project-filter { position: relative; }
.gantt-filter-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 200;
    background: var(--card); border: 1px solid var(--border-2); border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    min-width: 180px; max-width: 300px; max-height: 280px; overflow-y: auto;
    padding: .3rem 0;
}
.filter-opt {
    display: flex; align-items: center; gap: .5rem;
    padding: .38rem .75rem; cursor: pointer; font-size: .82rem; color: var(--text);
    transition: background .1s;
}
.filter-opt:hover { background: #f1f5f9; }
.filter-opt input[type="checkbox"] { flex-shrink: 0; cursor: pointer; accent-color: var(--primary); width: 14px; height: 14px; }

/* ===== Modal ===== */
.modal {
    display: none; position: fixed; inset: 0; z-index: 1000;
    background: rgba(15,23,42,.55); backdrop-filter: blur(3px);
    align-items: center; justify-content: center; padding: 1.5rem;
}
.modal.active { display: flex; }
.modal-box { background: #fff; border-radius: var(--radius); width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 1.05rem; font-weight: 700; }
.modal-head .icon-btn { background: var(--bg); color: var(--text-2); }
.modal-head .icon-btn:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 1.2rem 1.3rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.3rem; border-top: 1px solid var(--border); background: #fafbfc; }

.field { margin-bottom: .9rem; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: .78rem; font-weight: 600; margin-bottom: .3rem; }
.field input, .field textarea, .field select {
    width: 100%; padding: .55rem .7rem; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-size: .85rem; font-family: inherit; background: #fff; color: var(--text);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.field textarea { resize: vertical; min-height: 60px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.field-hint { font-size: .72rem; color: var(--muted); margin-top: .25rem; }
.field-context { font-size: .75rem; color: var(--text-2); background: var(--bg); padding: .5rem .65rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }

/* ===== Status: on hold ===== */
.tag.status-on_hold { background: #fef2f2; color: #b91c1c; }
.bar-task.status-on_hold { background: #ef4444; }
.tag.pct { background: #eef2ff; color: #4338ca; }

/* ===== Avatars ===== */
.avatars { display: inline-flex; align-items: center; }
.avatar {
    width: 22px; height: 22px; border-radius: 50%; object-fit: cover;
    border: 2px solid #fff; margin-left: -6px; background: #cbd5e1;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .6rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.avatars .avatar:first-child { margin-left: 0; }
.avatar-initials { background: linear-gradient(135deg,#6366f1,#8b5cf6); }
.avatar-more { background: #64748b; }

/* ===== Assignee picker (in modal) ===== */
.assignee-picker { display: flex; flex-direction: column; gap: .25rem; max-height: 180px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .4rem; }
.assignee-opt { display: flex; align-items: center; gap: .5rem; padding: .3rem .4rem; border-radius: 6px; cursor: pointer; font-size: .82rem; }
.assignee-opt:hover { background: var(--bg); }
.assignee-opt input { width: auto; }
.assignee-empty { font-size: .78rem; color: var(--muted); padding: .4rem; }

/* Avatar upload preview */
.avatar-edit { display: flex; align-items: center; gap: .8rem; }
.avatar-preview { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); background: #e2e8f0; display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 700; color: #fff; flex-shrink: 0; }

/* ===== People view ===== */
.view-people { padding: 1.1rem 1.25rem; overflow-y: auto; flex-direction: column; }
.people-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.people-head h2 { font-size: 1.1rem; font-weight: 700; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: .9rem; }
.person-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; display: flex; gap: .8rem; align-items: center; position: relative; }
.person-card .avatar-lg { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: linear-gradient(135deg,#6366f1,#8b5cf6); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 1.1rem; flex-shrink: 0; }
.person-card .person-name { font-weight: 600; font-size: .9rem; }
.person-card .person-role { font-size: .76rem; color: var(--text-2); }
.person-card .person-count { font-size: .7rem; color: var(--muted); margin-top: .15rem; }
.person-card .person-actions { position: absolute; top: .5rem; right: .5rem; display: flex; gap: .25rem; opacity: 0; transition: opacity .12s; }
.person-card:hover .person-actions { opacity: 1; }

/* ===== Gantt drag handles & meta ===== */
.gantt-bar.draggable { cursor: grab; }
.gantt-bar.dragging { cursor: grabbing; box-shadow: 0 3px 8px rgba(0,0,0,.3); z-index: 8; }
.bar-handle { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; z-index: 2; }
.bar-handle.left { left: 0; }
.bar-handle.right { right: 0; }
.gantt-bar:hover .bar-handle { background: rgba(255,255,255,.45); }
.gantt-milestone.draggable { cursor: grab; }
.gantt-label .lbl-meta { display: inline-flex; align-items: center; gap: .3rem; margin-left: auto; padding-left: .4rem; flex-shrink: 0; }
.gantt-label .lbl-meta .avatar { width: 18px; height: 18px; font-size: .55rem; }
.lbl-pct { font-size: .64rem; font-weight: 700; color: var(--text-2); }

/* ===== Footer ===== */
.footer { text-align: center; padding: .7rem; font-size: .75rem; color: var(--muted); background: var(--card); border-top: 1px solid var(--border); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== Responsive ===== */
@media (max-width: 820px) {
    .sidepanel { position: absolute; z-index: 150; height: calc(100vh - 60px); box-shadow: var(--shadow-lg); }
    .app:not(.sidepanel-collapsed) .sidepanel { width: var(--sidepanel-w); }
    .last-updated { display: none; }
    .field-row { grid-template-columns: 1fr; }
    .header-right .btn { padding: .45rem .6rem; }
}

/* ===== Drill-down navigation ===== */
.list-card-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.list-head-left { min-width: 0; flex: 1; }

.breadcrumb { display: flex; align-items: center; gap: .2rem; margin-top: .3rem; flex-wrap: wrap; }
.bc-sep { font-size: .75rem; color: var(--muted); user-select: none; }
.bc-item { font-size: .72rem; color: var(--text-2); white-space: nowrap; }
.bc-link { color: var(--primary); cursor: pointer; font-weight: 500; }
.bc-link:hover { text-decoration: underline; }
.bc-current { font-weight: 700; color: var(--text); }

/* Edit icon — always visible on left of each item */
.btn-item-edit {
    flex-shrink: 0; width: 30px; height: 30px; border: none; border-radius: 6px;
    background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    transition: background .12s, color .12s; align-self: center;
}
.item:hover .btn-item-edit { color: var(--primary); background: var(--primary-light); }
.btn-item-edit:hover { color: #fff !important; background: var(--primary) !important; }

/* Navigation hint on clickable item body */
.item-main { cursor: pointer; flex: 1; min-width: 0; }
.item.type-task .item-main { cursor: default; }
.item-name .nav-chevron { color: var(--muted); font-size: .8rem; margin-left: .3rem; opacity: 0; transition: opacity .12s; }
.item:not(.type-task):hover .item-name .nav-chevron { opacity: 1; }

/* ===== Files Drawer ===== */
.files-drawer {
    display: none; position: fixed; inset: 0; z-index: 900;
    background: rgba(15,23,42,.45); backdrop-filter: blur(2px);
}
.files-drawer.active { display: block; }
.files-drawer-box {
    position: absolute; right: 0; top: 0; bottom: 0;
    width: 100%; max-width: 500px;
    background: #fff; display: flex; flex-direction: column;
    box-shadow: -6px 0 32px rgba(0,0,0,.16);
    animation: slideInRight .2s ease;
}
@keyframes slideInRight { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.files-drawer-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.files-drawer-head h3 { font-size: 1rem; font-weight: 700; }
.files-drawer-subtitle { font-size: .75rem; color: var(--text-2); margin-top: .2rem; }
.files-drawer-close-btn { background: var(--bg); color: var(--text-2); flex-shrink: 0; margin-left: .5rem; }
.files-drawer-close-btn:hover { background: var(--border); color: var(--text); }

.files-upload-area {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    padding: .85rem 1.3rem; border-bottom: 1px solid var(--border);
    background: #fafbfc; flex-shrink: 0;
}
.files-title-input {
    flex: 1; min-width: 130px; padding: .42rem .65rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: .82rem; font-family: inherit;
}
.files-title-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.files-pick-label { cursor: pointer; }
.files-chosen-name { font-size: .72rem; color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.files-upload-feedback {
    font-size: .78rem; padding: 0 1.3rem; min-height: 0; max-height: 0;
    overflow: hidden; transition: max-height .2s, padding .2s;
}
.files-upload-feedback.visible { max-height: 48px; padding: .5rem 1.3rem; }
.files-upload-feedback.success { color: #059669; background: #ecfdf5; border-bottom: 1px solid #a7f3d0; }
.files-upload-feedback.error   { color: #dc2626; background: #fef2f2; border-bottom: 1px solid #fecaca; }

.files-list { flex: 1; overflow-y: auto; }

.file-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .8rem 1.3rem; border-bottom: 1px solid var(--border);
    transition: background .1s;
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: #f8fafc; }
.file-icon { font-size: 1.55rem; flex-shrink: 0; line-height: 1; }
.file-info { flex: 1; min-width: 0; }
.file-title-text {
    font-weight: 600; font-size: .875rem; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: block;
}
.file-title-text:hover { color: var(--primary); text-decoration: underline; }
.file-name-sub { font-size: .72rem; color: var(--muted); margin-top: .1rem; }
.file-meta { font-size: .7rem; color: var(--muted); margin-top: .1rem; }
.file-title-edit {
    width: 100%; padding: .25rem .45rem; font-size: .875rem; font-weight: 600;
    border: 1.5px solid var(--primary); border-radius: 5px; font-family: inherit;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.file-title-edit:focus { outline: none; }
.file-actions { display: flex; gap: .3rem; flex-shrink: 0; }
.files-empty {
    padding: 3rem 1.5rem; text-align: center; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.files-empty-icon { font-size: 2.4rem; opacity: .4; }
.files-loading { padding: 2rem; text-align: center; color: var(--muted); font-size: .85rem; }

/* Files button in item rows */
.btn-files { background: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd; }
.btn-files:hover { background: #0369a1; color: #fff; border-color: #0369a1; }

/* ===== Shared projects sidebar panel ===== */
.sidepanel-shared {
    flex-shrink: 0;
    border-top: 2px solid var(--border);
    max-height: 42%;
    overflow-y: auto;
}
.sidepanel-shared-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: .65rem 1rem;
    font-size: .7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--text-2);
    position: sticky; top: 0; background: var(--card); z-index: 1;
    border-bottom: 1px solid var(--border);
}
.shared-count {
    font-size: .68rem; background: rgba(0,0,0,.08);
    padding: .05rem .4rem; border-radius: 10px; font-weight: 700;
}
.shared-list { padding: .3rem 0; }
.shared-row {
    display: flex; align-items: center; gap: .4rem;
    padding: .38rem .85rem; cursor: pointer; font-size: .82rem;
    border-left: 3px solid transparent; transition: background .1s;
    position: relative;
}
.shared-row:hover { background: var(--bg); }
.shared-row.active { background: var(--primary-light); border-left-color: var(--primary); }
.shared-dot { width: 7px; height: 7px; border-radius: 50%; background: #7c3aed; flex-shrink: 0; }
.shared-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.shared-owner { font-size: .7rem; color: var(--muted); }
.shared-empty { padding: .85rem 1rem; color: var(--muted); font-size: .78rem; }

/* ===== Permission badge ===== */
.perm-badge {
    font-size: .62rem; font-weight: 700; padding: .1rem .42rem;
    border-radius: 4px; text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0;
}
.perm-view { background: #f1f5f9; color: #64748b; }
.perm-edit { background: #ecfdf5; color: #059669; }

/* ===== Shared view banner ===== */
.shared-view-banner {
    display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
    padding: .6rem 1.25rem;
    background: linear-gradient(90deg, #eff6ff 0%, #f5f3ff 100%);
    border-bottom: 1px solid #c7d2fe;
    font-size: .82rem; color: #3730a3;
}
.shared-view-banner .banner-icon { font-size: 1rem; }
.shared-view-banner strong { color: #1e1b4b; }

/* ===== Share button in item rows ===== */
.btn-share { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }
.btn-share:hover { background: #6d28d9; color: #fff; border-color: #6d28d9; }

/* ===== Share management modal ===== */
.share-section-title {
    font-size: .78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .05em; color: var(--text-2); margin-bottom: .65rem;
}
.share-item {
    display: flex; align-items: center; gap: .6rem;
    padding: .6rem .5rem; border-bottom: 1px solid var(--border);
}
.share-item:last-child { border-bottom: none; }
.share-user-info { flex: 1; min-width: 0; }
.share-user-name { font-weight: 600; font-size: .85rem; }
.share-user-email { font-size: .75rem; color: var(--text-2); }
.share-perm-select {
    border: 1px solid var(--border-2); border-radius: 6px;
    padding: .3rem .45rem; font-size: .78rem; font-family: inherit;
    background: #fff; cursor: pointer; color: var(--text);
}
.share-perm-select:focus { outline: none; border-color: var(--primary); }
.share-none { color: var(--muted); font-size: .83rem; padding: .5rem 0; margin: 0; }
.share-section { margin-bottom: 1.4rem; }
.share-add-row {
    display: flex; gap: .45rem; align-items: center; flex-wrap: wrap;
}
.share-email-field {
    flex: 1; min-width: 150px;
    border: 1.5px solid var(--border-2); border-radius: 7px;
    padding: .45rem .7rem; font-size: .85rem; font-family: inherit;
}
.share-email-field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.share-account-select {
    flex: 1; min-width: 0;
    border: 1.5px solid var(--border-2); border-radius: 7px;
    padding: .42rem .55rem; font-size: .84rem; font-family: inherit;
    background: #fff; color: var(--text); cursor: pointer;
}
.share-account-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.share-feedback {
    font-size: .8rem; margin-top: .5rem; padding: .35rem .6rem;
    border-radius: 6px; display: none;
}
.share-feedback.visible { display: block; }
.share-feedback.error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.share-feedback.success { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.share-loading { padding: 1.5rem; text-align: center; color: var(--muted); font-size: .85rem; }

/* ===== Detail Modal (view-only report view) ===== */
.modal.detail-mode .modal-foot .btn-primary { display: none; }
.detail-section { padding: .8rem 0; border-bottom: 1px solid var(--border); }
.detail-section:last-of-type { border-bottom: none; }
.detail-row { display: flex; align-items: flex-start; gap: .8rem; padding: .35rem 0; font-size: .88rem; }
.detail-label { width: 120px; flex-shrink: 0; color: var(--muted); font-weight: 500; padding-top: .1rem; }
.detail-value { flex: 1; color: var(--text); line-height: 1.5; }
.detail-desc { white-space: pre-wrap; }
.detail-files-section { margin-top: 1.1rem; }
.detail-files-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .6rem; }
.detail-files-list .file-item { padding: .6rem 0; }

/* ===== Print ===== */
@media print {
    .header, .sidepanel, .toolbar, .footer, .item-actions, .tabs { display: none !important; }
    .body, .main, .view { display: block !important; }
    .gantt-scroll { overflow: visible; }
}

/* ===== User menu (with clickable avatar) ===== */
.user-avatar-btn {
    background: none; border: none; cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: opacity .15s;
}
.user-avatar-btn:hover { opacity: .8; }
.user-avatar-img {
    width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
    border: 2px solid rgba(255,255,255,.4);
}
.user-info { display: flex; flex-direction: column; gap: .1rem; }

/* ===== Settings modal ===== */
.settings-modal-box { max-width: 480px; }
.settings-modal-body { padding: 0; }

.settings-section {
    padding: 1.25rem 1.3rem;
    border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; }
.settings-section-title {
    font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    color: var(--text-2); margin-bottom: 1rem;
}
.settings-section-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }

.settings-avatar-row {
    display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1.1rem;
}
.settings-avatar-preview-wrap { flex-shrink: 0; }
.settings-avatar-preview {
    width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
    background: var(--primary-light); color: var(--primary);
    font-size: 1.3rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--border);
}
.settings-avatar-initials { display: flex; }
.settings-avatar-inputs { display: flex; flex-direction: column; gap: .45rem; }

.settings-email-readonly { background: var(--bg) !important; color: var(--text-2) !important; cursor: default; }

.settings-feedback {
    margin: .5rem 1.3rem; padding: .55rem .85rem;
    border-radius: var(--radius-sm); font-size: .83rem; display: none;
}
.settings-feedback.visible.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; display: block; }
.settings-feedback.visible.error   { background: #fef2f2; color: #dc2626;  border: 1px solid #fecaca; display: block; }

/* Danger zone */
.settings-danger-zone { background: #fffbfb; }
.danger-title { color: #dc2626 !important; }
.danger-desc { font-size: .83rem; color: var(--text-2); margin-bottom: 1rem; line-height: 1.5; }
.danger-confirm-label { font-size: .82rem; margin-bottom: .45rem; }
.reset-confirm-row { display: flex; gap: .5rem; align-items: center; }
.reset-confirm-row input {
    flex: 1; padding: .5rem .7rem; border: 1.5px solid #fca5a5; border-radius: var(--radius-sm);
    font-size: .85rem; font-family: inherit; font-weight: 600; letter-spacing: .03em;
}
.reset-confirm-row input:focus { outline: none; border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.12); }

@keyframes shake {
    0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-5px)} 40%,80%{transform:translateX(5px)}
}
.input-shake { animation: shake .35s ease; }

/* ===== Owner badge ===== */
.owner-badge {
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,215,0,.25); border: 1px solid rgba(255,215,0,.6);
    color: #ffd700; font-size: .68rem; font-weight: 700; letter-spacing: .04em;
    padding: .18rem .5rem; border-radius: 20px; text-transform: uppercase;
}

/* ===== Setup overlay ===== */
.setup-badge {
    display: inline-block; background: var(--primary-light); color: var(--primary);
    font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    border-radius: 20px; padding: .25rem .75rem; margin-bottom: 1rem; text-align: center; width: 100%;
}
.setup-intro {
    font-size: .85rem; color: var(--text-2); text-align: center;
    margin-bottom: 1.5rem; line-height: 1.6;
}

/* ===== Documents view ===== */
.view-documents { padding: 1.5rem; flex-direction: column; overflow-y: auto; }
.docs-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 1.5rem; gap: 1rem;
}
.docs-head h2 { font-size: 1.15rem; font-weight: 700; }
.docs-subtitle { font-size: .82rem; color: var(--text-2); margin-top: .2rem; }
.docs-list {
    background: var(--card); border-radius: var(--radius);
    border: 1px solid var(--border); overflow: hidden;
}
.docs-loading, .docs-empty {
    padding: 2.5rem 1.5rem; text-align: center; color: var(--text-2); font-size: .9rem;
    display: flex; align-items: center; justify-content: center; gap: .6rem;
}
.docs-empty-icon { font-size: 1.5rem; }
.doc-item {
    display: flex; align-items: center; gap: 1rem;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.doc-item:last-child { border-bottom: none; }
.doc-icon { font-size: 1.8rem; flex-shrink: 0; }
.doc-info { flex: 1; min-width: 0; }
.doc-title { font-size: .92rem; font-weight: 600; }
.doc-desc { font-size: .8rem; color: var(--text-2); margin-top: .15rem; }
.doc-meta { font-size: .75rem; color: var(--muted); margin-top: .25rem; }
.doc-actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* ===== Admin badge (header) ===== */
.admin-badge {
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(99,102,241,.15); border: 1px solid rgba(99,102,241,.4);
    color: #4338ca; font-size: .65rem; font-weight: 700;
    letter-spacing: .07em; text-transform: uppercase;
    padding: .15rem .45rem; border-radius: 999px; line-height: 1;
}

/* ===== User Management (settings modal) ===== */
.settings-users-list {
    display: flex; flex-direction: column; gap: 0;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    overflow: hidden; max-height: 340px; overflow-y: auto;
}
.settings-users-loading { padding: 1rem; text-align: center; color: var(--text-2); font-size: .85rem; }
.su-row {
    display: flex; align-items: center; gap: .85rem;
    padding: .75rem 1rem; border-bottom: 1px solid var(--border); background: #fff;
}
.su-row:last-child { border-bottom: none; }
.su-avatar {
    width: 2.25rem; height: 2.25rem; border-radius: 50%;
    flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center;
    background: var(--primary-light);
}
.su-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.su-avatar-ini { font-size: .75rem; font-weight: 700; color: var(--primary); line-height: 1; }
.su-info { flex: 1; min-width: 0; }
.su-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-email { font-size: .75rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-stats { font-size: .72rem; color: var(--muted); margin-top: .1rem; }
.su-you { font-size: .72rem; font-weight: 400; color: var(--muted); }
.su-role { flex-shrink: 0; }
.su-role-badge {
    display: inline-block; font-size: .65rem; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase;
    padding: .18rem .5rem; border-radius: 999px; line-height: 1;
}
.su-role-owner { background: rgba(255,215,0,.2); border: 1px solid rgba(255,180,0,.5); color: #92620a; }
.su-role-admin { background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.35); color: #4338ca; }
.su-role-user  { background: var(--bg); border: 1px solid var(--border); color: var(--text-2); }
.su-actions { display: flex; gap: .4rem; flex-shrink: 0; }
.btn-xs { font-size: .72rem !important; padding: .22rem .55rem !important; }

/* ===== Sidepanel resize handle ===== */
.sidepanel { position: relative; }
.sidepanel-resize-handle {
    position: absolute; right: -4px; top: 0; bottom: 0;
    width: 8px; cursor: ew-resize; z-index: 101;
    background: transparent; transition: background .15s;
}
.sidepanel-resize-handle:hover,
.sidepanel-resize-handle.is-resizing {
    background: rgba(37,99,235,.25);
    border-radius: 3px;
}
.app.sidepanel-collapsed .sidepanel-resize-handle { display: none; }

/* ===== Analytics View ===== */
.view-analytics { padding: 1.25rem; overflow-y: auto; flex-direction: column; }
.analytics-wrap { display: flex; flex-direction: column; gap: 1.5rem; max-width: 1300px; width: 100%; }

/* Status cards */
.analytics-status-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.analytics-card {
    border-radius: var(--radius); padding: 1.25rem 1.4rem;
    display: flex; flex-direction: column; gap: .45rem;
    border: 1px solid transparent;
}
.acard-num { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.acard-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.acard-of { font-size: .72rem; color: var(--muted); margin-top: -.1rem; }
.acard-bar { height: 5px; border-radius: 3px; margin-top: .25rem; overflow: hidden; }
.acard-bar-fill { height: 100%; border-radius: 3px; transition: width .5s ease; min-width: 2px; }

/* Section wrapper */
.analytics-section {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.analytics-section-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.analytics-section-title { font-size: 1rem; font-weight: 700; margin: 0 0 .15rem; }
.analytics-section-sub { font-size: .78rem; color: var(--muted); margin: 0; }
.analytics-empty { padding: 2.5rem 1.5rem; text-align: center; color: var(--muted); font-size: .88rem; }

/* Projects summary table */
.at-head, .at-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1.3fr 1.2fr 1.6fr;
    gap: .75rem; padding: .65rem 1.1rem; align-items: center;
}
.at-head {
    font-size: .68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--text-2);
    background: #f8fafc; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 1;
}
.at-row { border-bottom: 1px solid var(--border); font-size: .83rem; }
.at-row:last-child { border-bottom: none; }
.at-row:hover { background: #f8fafc; }
.at-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-creator { color: var(--text-2); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-prog { display: flex; align-items: center; gap: .45rem; }
.at-prog-bar { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; min-width: 40px; }
.at-prog-bar span { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.at-prog-num { font-size: .72rem; color: var(--text-2); white-space: nowrap; flex-shrink: 0; }
.at-milestone-cell { display: flex; flex-direction: column; gap: .1rem; }
.at-mile-name { font-size: .82rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-mile-date { font-size: .7rem; color: var(--muted); }
.at-mile-overdue { color: #dc2626; }
.at-no-mile { color: var(--muted); font-size: .8rem; }

/* Milestone timeline (amt = analytics milestone timeline) */
.amt-scroll { overflow-x: auto; }
.amt-inner { min-width: 500px; }
.amt-head-row, .amt-row { display: flex; border-bottom: 1px solid var(--border); }
.amt-head-row { position: sticky; top: 0; background: #f8fafc; z-index: 2; }
.amt-row:last-child { border-bottom: none; }
.amt-row:hover .amt-track { background: #fafcff; }
.amt-lhd {
    width: 220px; flex-shrink: 0; padding: .55rem .85rem;
    border-right: 2px solid var(--border-2);
    display: flex; flex-direction: column; justify-content: center;
}
.amt-head-lhd { justify-content: center; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.amt-track { flex: 1; position: relative; height: 56px; min-width: 0; }
.amt-head-track { height: 26px; overflow: hidden; }
.amt-month {
    position: absolute; top: 0; height: 100%;
    border-right: 1px solid var(--border);
    font-size: .67rem; color: var(--text-2); padding: .2rem .3rem;
    white-space: nowrap; overflow: hidden; box-sizing: border-box;
    display: flex; align-items: center;
}
.amt-today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: #ef4444; z-index: 3; pointer-events: none; }
.amt-today-line::after {
    content: 'Today'; position: absolute; top: 0; left: 3px;
    font-size: .6rem; color: #ef4444; white-space: nowrap;
    background: rgba(255,255,255,.9); padding: 0 2px; border-radius: 2px;
}
.amt-pname { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amt-owner-info { font-size: .7rem; color: var(--muted); margin-top: .1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amt-diamond {
    position: absolute; top: 50%; width: 13px; height: 13px;
    transform: translate(-50%, -50%) rotate(45deg);
    background: var(--mile); border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
    cursor: pointer; z-index: 2;
    transition: transform .1s, box-shadow .1s;
}
.amt-diamond:hover {
    transform: translate(-50%, -50%) rotate(45deg) scale(1.35);
    box-shadow: 0 2px 6px rgba(0,0,0,.3); z-index: 5;
}
.amt-diamond.amt-past { opacity: .5; }
.amt-diamond.amt-status-completed { background: #10b981; }
.amt-diamond.amt-status-in_progress { background: var(--task); }
.amt-diamond.amt-status-on_hold { background: #ef4444; }
.amt-diamond.amt-status-pending { background: #94a3b8; }
.amt-mlabel {
    position: absolute; top: 13px; left: 50%;
    transform: translateX(-50%) rotate(-45deg);
    font-size: .6rem; white-space: nowrap; color: var(--text);
    background: rgba(255,255,255,.95); padding: 1px 3px; border-radius: 2px;
    max-width: 90px; overflow: hidden; text-overflow: ellipsis;
    pointer-events: none; display: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.15); z-index: 6;
}
.amt-mowner {
    position: absolute; top: 27px; left: 50%;
    transform: translateX(-50%) rotate(-45deg);
    font-size: .58rem; white-space: nowrap; color: var(--primary);
    background: rgba(239,246,255,.97); padding: 1px 3px; border-radius: 2px;
    max-width: 90px; overflow: hidden; text-overflow: ellipsis;
    pointer-events: none; display: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.12); z-index: 6;
}
.amt-diamond:hover .amt-mlabel,
.amt-diamond:hover .amt-mowner { display: block; }

@media (max-width: 820px) {
    .analytics-status-row { grid-template-columns: repeat(2, 1fr); }
    .at-head span:nth-child(3), .at-row span:nth-child(3) { display: none; }
    .at-head, .at-row { grid-template-columns: 2fr 1fr 1.2fr 1.5fr; }
    .amt-lhd { width: 150px; }
}
