:root {
    color-scheme: dark;
    --bg: #090a0c;
    --sidebar: #0c0d0f;
    --surface: #121417;
    --surface-2: #191b1f;
    --surface-3: #22252a;
    --border: #30343a;
    --border-strong: #474c54;
    --text: #f2f3f5;
    --muted: #a8acb3;
    --quiet: #747982;
    --primary: #f0f1f3;
    --on-primary: #121315;
    --accent: #c9b5ff;
    --accent-ink: #201837;
    --danger: #ffaaa3;
    --danger-deep: #7f2328;
    --success: #78d6a5;
    --warning: #f0c777;
    --ease-out: cubic-bezier(.23, 1, .32, 1);
    --ease-in-out: cubic-bezier(.77, 0, .175, 1);
    --sidebar-width: 260px;
    --topbar-height: 68px;
    font-family: "Hanken Grotesk", system-ui, sans-serif;
    font-size: 16px;
    letter-spacing: 0;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
svg { width: 19px; height: 19px; stroke-width: 1.8; }
code { color: #d7dae0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .84rem; }

.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar-width); display: flex; flex-direction: column;
    padding: 24px 16px 18px; background: var(--sidebar); border-right: 1px solid var(--border);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; margin-bottom: 28px; }
.sidebar-brand strong { display: block; font-size: 1.18rem; line-height: 1.2; }
.sidebar-brand small { display: block; margin-top: 3px; color: var(--quiet); font-size: .75rem; }
.brand-mark { width: 36px; height: 36px; display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: var(--primary); color: var(--on-primary); }
.brand-mark svg { width: 20px; height: 20px; }
.sidebar-create { margin-bottom: 22px; }
.sidebar-nav { display: grid; gap: 4px; }
.nav-link { position: relative; min-height: 46px; display: flex; align-items: center; gap: 13px; padding: 0 13px; color: var(--muted); border-radius: 6px; transition: color 160ms ease, background-color 160ms ease, transform 140ms var(--ease-out); }
.nav-link::before { content: ""; position: absolute; left: -16px; width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: transparent; transition: background-color 160ms ease, height 180ms var(--ease-out); }
.nav-link b { min-width: 22px; height: 20px; display: inline-grid; place-items: center; margin-left: auto; border-radius: 999px; background: rgba(255,170,163,.12); color: var(--danger); font-size: .72rem; }
.nav-link.is-active { background: var(--surface-3); color: var(--text); }
.nav-link.is-active::before { height: 30px; background: var(--primary); }
.nav-link:active { transform: scale(.98); }
.sidebar-footer { display: grid; gap: 8px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.demo-badge { display: flex; align-items: center; gap: 8px; margin: 0 12px 4px; color: var(--accent); font-size: .76rem; }
.demo-badge svg { width: 15px; }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between; padding: 0 30px; background: rgba(9,10,12,.94); border-bottom: 1px solid var(--border); backdrop-filter: blur(14px); }
.topbar-left, .topbar-right, .user-menu, .person-cell, .date-cell { display: flex; align-items: center; }
.topbar-left { gap: 10px; }
.topbar-right { gap: 22px; }
.global-search { width: min(360px, 36vw); height: 40px; position: relative; display: flex; align-items: center; }
.global-search svg { position: absolute; left: 13px; color: var(--quiet); pointer-events: none; }
.global-search input { width: 100%; height: 100%; padding: 0 14px 0 42px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); outline: none; transition: border-color 160ms ease, box-shadow 160ms ease; }
.global-search input:focus { border-color: var(--border-strong); box-shadow: 0 0 0 3px rgba(201,181,255,.1); }
.today { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .82rem; }
.user-menu { gap: 10px; }
.user-menu__copy strong, .user-menu__copy small { display: block; }
.user-menu__copy strong { font-size: .86rem; }
.user-menu__copy small { margin-top: 1px; color: var(--quiet); font-size: .7rem; }
.avatar { width: 34px; height: 34px; display: inline-grid; place-items: center; flex: 0 0 auto; border: 1px solid #515761; border-radius: 50%; background: #2a2e35; color: var(--text); font-size: .75rem; font-weight: 600; }
.avatar--small { width: 29px; height: 29px; font-size: .66rem; }
.avatar-stack { display: flex; align-items: center; min-width: 110px; }
.avatar-stack .avatar + .avatar { margin-left: -7px; }
.mobile-menu { display: none !important; }

.content { width: min(100%, 1500px); margin: 0 auto; padding: 38px 38px 56px; }
.page-heading { min-height: 80px; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 4px 0 2px; font-size: clamp(2rem, 3vw, 2.65rem); line-height: 1.1; letter-spacing: 0; }
.page-heading p, .panel-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--quiet); font-size: .66rem; font-weight: 700; letter-spacing: .08em; }
.page-actions { display: flex; gap: 10px; flex: 0 0 auto; }

.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 16px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-size: .87rem; font-weight: 600; transition: transform 140ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease; }
.button:active, .icon-button:active { transform: scale(.97); }
.button--primary { background: var(--primary); color: var(--on-primary); }
.button--primary:hover { background: #dfe1e5; }
.button--secondary { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.button--secondary:hover { background: var(--surface-3); }
.button--ghost { border-color: transparent; background: transparent; color: var(--muted); }
.button--ghost:hover { color: var(--text); background: var(--surface-2); }
.button--danger-ghost { border-color: rgba(255,170,163,.25); background: rgba(255,170,163,.06); color: var(--danger); }
.button--small { min-height: 33px; padding: 0 11px; font-size: .76rem; }
.button--wide { width: 100%; }
.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; transition: transform 140ms var(--ease-out), background-color 160ms ease, color 160ms ease; }
.icon-button:hover { background: var(--surface-3); color: var(--text); }
.icon-button--danger { color: var(--danger); }
.icon-button--danger:hover { background: rgba(255,170,163,.09); color: #ffc5c0; }
.icon-button:disabled { opacity: .3; pointer-events: none; }
.inline-form { display: inline-flex; margin: 0; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 3px; white-space: nowrap; }

.metrics-grid { display: grid; gap: 16px; margin-bottom: 22px; }
.metrics-grid--five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metrics-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-card { min-height: 148px; padding: 20px; border: 1px solid var(--border); border-radius: 8px; background: linear-gradient(155deg, var(--surface-2), var(--surface)); }
.metric-card > div { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .76rem; font-weight: 600; text-transform: uppercase; }
.metric-card > div svg { color: var(--quiet); }
.metric-card strong { display: block; margin-top: 18px; font-size: 2.25rem; line-height: 1; }
.metric-card small { display: block; margin-top: 10px; color: var(--muted); font-size: .77rem; }
.metric-card--danger { border-left: 4px solid var(--danger); }
.metric-card--danger strong, .metric-card--danger > div svg { color: var(--danger); }
.metric-card__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.45rem !important; line-height: 1.2 !important; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .8fr); gap: 18px; }
.panel, .data-panel { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; }
.panel-heading { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-heading h2 { margin: 0 0 3px; font-size: 1rem; }
.panel-heading p { font-size: .78rem; }
.text-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .78rem; transition: color 160ms ease; }
.text-link:hover { color: var(--text); }
.text-link svg { width: 15px; }
.project-progress-list, .compact-list { padding: 2px 20px; }
.progress-row { min-height: 82px; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, .7fr); align-items: center; gap: 24px; border-bottom: 1px solid var(--border); }
.progress-row:last-child, .compact-task:last-child { border-bottom: 0; }
.progress-row__main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.progress-row__main strong, .progress-row__main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-row__main small { margin-top: 4px; color: var(--muted); font-size: .76rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--quiet); }
.status-dot--in_progress { background: var(--accent); box-shadow: 0 0 0 4px rgba(201,181,255,.09); }
.status-dot--blocked { background: var(--danger); box-shadow: 0 0 0 4px rgba(255,170,163,.09); }
.status-dot--completed { background: var(--success); }
.progress-block { display: flex; align-items: center; gap: 12px; }
.progress-block b { width: 38px; text-align: right; font-size: .77rem; }
.progress-track { height: 7px; flex: 1; overflow: hidden; border-radius: 999px; background: #292c31; }
.progress-track span { display: block; width: var(--progress); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--success)); transition: width 240ms var(--ease-out); }
.compact-task { min-height: 71px; display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.compact-task strong, .compact-task small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-task small { margin-top: 3px; color: var(--muted); font-size: .73rem; }
.compact-task time { color: var(--muted); font-size: .72rem; }

.priority-line { width: 4px; height: 42px; display: inline-block; border-radius: 999px; background: var(--quiet); }
.priority-line--low { background: #7896ad; }
.priority-line--medium { background: var(--accent); }
.priority-line--high { background: var(--warning); }
.priority-line--urgent { background: var(--danger); }
.filter-bar { min-height: 66px; display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.filter-bar label { display: flex; align-items: center; gap: 8px; }
.filter-bar label > span { color: var(--quiet); font-size: .69rem; font-weight: 600; text-transform: uppercase; }
.filter-bar select { min-width: 150px; }
.filter-summary { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; padding-right: 8px; color: var(--muted); font-size: .78rem; }
.filter-summary svg { width: 17px; }
.segmented-control { display: inline-flex; height: 38px; padding: 3px; border: 1px solid var(--border); border-radius: 7px; background: #0e1012; }
.segmented-control button { min-width: 82px; padding: 0 10px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; font-size: .75rem; transition: color 150ms ease, background-color 150ms ease, transform 140ms var(--ease-out); }
.segmented-control button:active { transform: scale(.97); }
.segmented-control button.is-active { background: var(--surface-3); color: var(--text); }
.timeline-toolbar { gap: 10px; }
.timeline-save-state { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; padding-right: 8px; color: var(--quiet); font-size: .75rem; }
.timeline-save-state svg { width: 15px; }
.timeline-save-state[data-tone="saving"] { color: var(--accent); }
.timeline-save-state[data-tone="success"] { color: var(--success); }
.timeline-save-state[data-tone="error"] { color: var(--danger); }

.gantt-panel { --meta-width: 310px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; }
.gantt-scroll { max-height: calc(100vh - 285px); overflow: auto; overscroll-behavior: contain; }
.gantt-grid { width: calc(var(--meta-width) + var(--timeline-width)); min-width: 100%; display: grid; grid-template-columns: var(--meta-width) var(--timeline-width); grid-auto-rows: 66px; position: relative; }
.gantt-corner { position: sticky; z-index: 8; top: 0; left: 0; display: flex; flex-direction: column; justify-content: center; padding: 0 18px; border-right: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); background: #17191c; }
.gantt-corner strong { font-size: .8rem; }
.gantt-corner small { margin-top: 3px; color: var(--quiet); font-size: .66rem; }
.gantt-calendar { position: sticky; z-index: 7; top: 0; width: var(--timeline-width); border-bottom: 1px solid var(--border-strong); background: #17191c; }
.gantt-day { position: absolute; left: calc(var(--day) * var(--day-width)); top: 0; width: var(--day-width); height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-right: 1px solid rgba(71,76,84,.42); color: var(--muted); }
.gantt-day b { font-size: .72rem; font-weight: 600; }
.gantt-day small { min-height: 12px; margin-top: 3px; color: var(--quiet); font-size: .57rem; }
.gantt-day.is-weekend { background: rgba(255,255,255,.022); }
.gantt-day.is-today { color: var(--text); background: rgba(201,181,255,.09); }
.gantt-day.is-today::after { content: ""; position: absolute; bottom: 0; width: 18px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.gantt-meta { grid-column: 1; position: sticky; z-index: 5; left: 0; min-width: 0; display: grid; grid-template-columns: 4px minmax(0, 1fr) 34px; align-items: center; gap: 11px; padding: 9px 12px 9px 16px; border-right: 1px solid var(--border-strong); border-bottom: 1px solid var(--border); background: var(--surface); }
.gantt-meta .priority-line { height: 38px; }
.gantt-meta strong, .gantt-meta small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-meta strong { font-size: .79rem; }
.gantt-meta small { margin-top: 4px; color: var(--quiet); font-size: .67rem; }
.gantt-track { grid-column: 2; position: relative; width: var(--timeline-width); border-bottom: 1px solid var(--border); background-color: #101215; background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(var(--day-width) - 1px), rgba(71,76,84,.32) calc(var(--day-width) - 1px), rgba(71,76,84,.32) var(--day-width)); }
.gantt-meta.is-hidden, .gantt-track.is-hidden { display: none; }
.gantt-today-line { position: absolute; z-index: 1; top: 0; bottom: 0; left: calc((var(--today) + .5) * var(--day-width)); width: 1px; background: rgba(201,181,255,.55); pointer-events: none; }
.gantt-bar { position: absolute; z-index: 2; top: 16px; left: calc(var(--offset) * var(--day-width) + 3px); width: max(24px, calc(var(--duration) * var(--day-width) - 6px)); height: 34px; display: grid; grid-template-columns: 10px minmax(0, 1fr) 10px; align-items: center; border: 1px solid rgba(201,181,255,.35); border-left-width: 3px; border-radius: 5px; background: #302a40; color: #eee9ff; box-shadow: 0 4px 14px rgba(0,0,0,.2); cursor: grab; touch-action: none; user-select: none; transition: box-shadow 160ms ease, opacity 160ms ease, background-color 160ms ease; }
.gantt-bar--completed { border-color: rgba(120,214,165,.4); background: #20382c; color: #dcf8e8; }
.gantt-bar--blocked { border-color: rgba(255,170,163,.48); background: #44262a; color: #ffddda; }
.gantt-bar--todo { background: #292d35; border-color: rgba(159,184,202,.42); color: #e1e6ea; }
.gantt-bar.priority-border--high { border-left-color: var(--warning); }
.gantt-bar.priority-border--urgent { border-left-color: var(--danger); }
.gantt-bar.priority-border--medium { border-left-color: var(--accent); }
.gantt-bar.priority-border--low { border-left-color: #7896ad; }
.gantt-bar.is-dragging { z-index: 6; cursor: grabbing; box-shadow: 0 10px 28px rgba(0,0,0,.45), 0 0 0 2px rgba(201,181,255,.18); }
.gantt-bar.is-saving { opacity: .72; }
.gantt-bar__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .7rem; font-weight: 600; pointer-events: none; }
.gantt-handle { width: 10px; height: 22px; position: relative; cursor: ew-resize; }
.gantt-handle::after { content: ""; position: absolute; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: currentColor; opacity: .38; }
.gantt-handle--start::after { left: 3px; }
.gantt-handle--end::after { right: 3px; }
.gantt-date-popover { position: absolute; z-index: 8; left: 50%; bottom: calc(100% + 8px); width: max-content; max-width: 240px; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 5px; background: #070809; color: var(--text); box-shadow: 0 8px 24px rgba(0,0,0,.4); opacity: 0; pointer-events: none; transform: translate(-50%, 4px) scale(.98); transform-origin: center bottom; transition: opacity 140ms ease, transform 160ms var(--ease-out); font-size: .68rem; }
.gantt-bar.is-dragging .gantt-date-popover { opacity: 1; transform: translate(-50%, 0) scale(1); }
.field small b { color: var(--muted); }

.detail-toolbar { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: -10px 0 16px; }
.detail-toolbar > div { display: flex; align-items: center; gap: 8px; }
.project-overview { display: grid; grid-template-columns: minmax(0, 1fr) 280px; min-height: 290px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; }
.project-summary { padding: 30px; }
.project-summary__status { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .76rem; }
.project-summary h2 { max-width: 800px; margin: 22px 0 8px; font-size: 1.75rem; letter-spacing: 0; }
.project-summary > p { max-width: 760px; margin: 0; color: var(--muted); line-height: 1.55; }
.project-meta { display: flex; flex-wrap: wrap; gap: 30px; margin-top: 34px; }
.project-meta > span { display: grid; grid-template-columns: 20px auto; column-gap: 8px; align-items: center; }
.project-meta svg { grid-row: 1 / 3; color: var(--quiet); }
.project-meta small { color: var(--quiet); font-size: .68rem; text-transform: uppercase; }
.project-meta strong { margin-top: 2px; font-size: .82rem; }
.project-score { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; border-left: 1px solid var(--border); background: #101215; }
.progress-ring { --angle: calc(var(--value) * 3.6deg); width: 150px; aspect-ratio: 1; display: grid; place-content: center; position: relative; border-radius: 50%; background: conic-gradient(var(--success) var(--angle), #2a2d32 0); }
.progress-ring::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface); }
.progress-ring strong, .progress-ring small { position: relative; z-index: 1; text-align: center; }
.progress-ring strong { font-size: 2rem; }
.progress-ring small { margin-top: 2px; color: var(--muted); }
.project-score > p { margin: 15px 0 12px; color: var(--muted); font-size: .78rem; }
.avatar-stack--center { justify-content: center; }
.project-detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(330px, .65fr); gap: 18px; align-items: start; }
.project-task-panel { min-width: 0; }
.project-side { display: grid; gap: 18px; }
.comment-form { display: grid; gap: 10px; padding: 16px; border-bottom: 1px solid var(--border); }
.comment-form textarea { min-height: 88px; }
.comment-form .button { justify-self: end; }
.comment-list { max-height: 370px; overflow: auto; padding: 2px 16px; }
.comment { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment > div > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.comment strong { font-size: .8rem; }
.comment time, .activity-list time { color: var(--quiet); font-size: .67rem; }
.comment p { margin: 6px 0 0; color: #cdd0d5; font-size: .82rem; line-height: 1.5; }
.activity-list { padding: 5px 16px; }
.activity-list article { display: grid; grid-template-columns: 27px 1fr; gap: 9px; padding: 12px 0; }
.activity-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--muted); }
.activity-icon svg { width: 13px; height: 13px; }
.activity-list p { margin: 2px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.4; }
.activity-list p strong { color: var(--text); }
.activity-list time { display: block; margin-top: 4px; }
.empty-copy { margin: 0; padding: 24px 0; color: var(--quiet); text-align: center; font-size: .78rem; }

.table-scroll { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { height: 51px; padding: 0 20px; border-bottom: 1px solid var(--border-strong); color: var(--muted); background: #17191c; font-size: .7rem; font-weight: 600; text-transform: uppercase; white-space: nowrap; }
.data-table td { height: 78px; padding: 12px 20px; border-bottom: 1px solid var(--border); color: #d7d9dd; font-size: .87rem; vertical-align: middle; }
.data-table tbody tr { transition: background-color 150ms ease, opacity 160ms ease; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr.is-hidden { display: none; }
.data-table tbody tr.is-completed { opacity: .55; }
.data-table tbody tr.is-completed .title-cell strong { text-decoration: line-through; }
.data-table tbody tr.is-disabled { opacity: .52; }
.title-cell { min-width: 230px; display: flex; align-items: center; gap: 13px; }
.title-cell strong, .title-cell small { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-cell small { margin-top: 3px; color: var(--muted); font-size: .75rem; }
.person-cell { gap: 9px; white-space: nowrap; }
.date-cell { gap: 7px; white-space: nowrap; }
.date-cell svg { width: 16px; color: var(--quiet); }
.is-overdue, .danger-text { color: var(--danger) !important; }
.muted { color: var(--quiet); font-size: .78rem; }
.progress-block--table { min-width: 155px; }
.priority, .status, .role, .block-reason { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; white-space: nowrap; font-size: .71rem; font-weight: 600; }
.priority { padding: 5px 9px; background: #292c32; color: #c9ccd2; text-transform: uppercase; }
.priority--urgent { background: rgba(255,170,163,.13); color: var(--danger); }
.priority--high { background: rgba(240,199,119,.12); color: var(--warning); }
.priority--low { color: #9fb8ca; }
.status, .role { padding: 5px 9px; border: 1px solid var(--border-strong); }
.status svg, .role svg { width: 12px; height: 12px; }
.status--blocked { border-color: rgba(255,170,163,.4); color: var(--danger); }
.status--completed, .status--active { border-color: rgba(120,214,165,.3); background: rgba(120,214,165,.08); color: var(--success); }
.status--inactive { color: var(--quiet); }
.role { color: #d9dbe0; }
.block-reason { max-width: 245px; padding: 7px 10px; border-radius: 5px; background: rgba(255,170,163,.09); color: #ffc0bb; white-space: normal; }
.block-reason svg { width: 15px; flex: 0 0 auto; }
.status-select { min-width: 128px; height: 34px; padding: 0 30px 0 10px; border: 1px solid var(--border-strong); border-radius: 999px; background: #191b1f; color: var(--text); font-size: .71rem; cursor: pointer; }
.status-select--blocked { border-color: rgba(255,170,163,.45); color: var(--danger); }
.status-select--completed { border-color: rgba(120,214,165,.35); color: var(--success); }

input, select, textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: 6px; background: #111316; color: var(--text); outline: none; transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease; }
input, select { height: 42px; padding: 0 12px; }
textarea { min-height: 80px; padding: 11px 12px; resize: vertical; }
select { cursor: pointer; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,181,255,.1); }
input::placeholder, textarea::placeholder { color: #646971; }
.field { display: grid; gap: 7px; align-content: start; }
.field > span:first-child { color: var(--muted); font-size: .76rem; font-weight: 600; }
.field small { color: var(--quiet); font-size: .69rem; }
.form-stack { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field--full { grid-column: 1 / -1; }
.bulk-task-body { display: grid; gap: 18px; }
.bulk-project-field { width: min(430px, 100%); }
.bulk-task-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 2px; }
.bulk-task-toolbar > div { display: grid; gap: 2px; }
.bulk-task-toolbar strong { font-size: .9rem; }
.bulk-task-toolbar small, .bulk-footer-count { color: var(--quiet); font-size: .72rem; }
.bulk-task-list { display: grid; gap: 12px; }
.bulk-task-row { padding: 14px; border: 1px solid var(--border); border-radius: 7px; background: #0f1114; opacity: 1; transform: translateY(0) scale(1); transition: transform 180ms var(--ease-out), opacity 150ms ease, border-color 160ms ease; }
.bulk-task-row.is-entering, .bulk-task-row.is-leaving { opacity: 0; transform: translateY(-6px) scale(.99); }
.bulk-task-row__header { min-height: 30px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.bulk-task-row__header strong { color: var(--accent); font-size: .74rem; }
.bulk-task-row__grid { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(150px, 1.15fr) repeat(2, minmax(125px, 1fr)) minmax(115px, .85fr) minmax(125px, 1fr); gap: 12px; }
.bulk-task-row__grid .field > span:first-child { font-size: .69rem; }
.bulk-field--reason { grid-column: 1 / -1; }
.bulk-add-row { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px dashed var(--border-strong); border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; transition: transform 140ms var(--ease-out), border-color 160ms ease, background-color 160ms ease, color 160ms ease; }
.bulk-add-row:hover { border-color: var(--accent); background: rgba(201,181,255,.05); color: var(--text); }
.bulk-add-row:active { transform: scale(.99); }
.bulk-add-row svg { width: 17px; }
.bulk-footer-count { margin-right: auto; }
.is-hidden { display: none !important; }

.modal { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 24px; border: 0; background: rgba(0,0,0,.7); color: var(--text); opacity: 0; transition: opacity 180ms ease; }
.modal[open] { display: grid; place-items: center; opacity: 1; }
.modal::backdrop { background: transparent; }
.modal-card { width: min(680px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); box-shadow: 0 24px 80px rgba(0,0,0,.55); transform: translateY(0) scale(1); transition: transform 220ms var(--ease-out), opacity 180ms ease; }
.modal-card--small { width: min(500px, 100%); }
.modal-card--wide { width: min(1180px, 100%); }
.modal.is-entering .modal-card { opacity: 0; transform: translateY(12px) scale(.98); }
.modal-header { min-height: 78px; display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 3px 0 0; font-size: 1.25rem; }
.modal-header p { margin: 4px 0 0; color: var(--muted); font-size: .76rem; }
.modal-body { overflow-y: auto; padding: 22px; }
.modal-footer { min-height: 68px; display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding: 12px 22px; border-top: 1px solid var(--border); background: #101215; }

.toast { position: fixed; z-index: 60; top: 82px; right: 22px; width: min(420px, calc(100vw - 32px)); min-height: 56px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 9px 10px 9px 15px; border: 1px solid rgba(120,214,165,.3); border-radius: 8px; background: #14201a; color: #d8f6e5; box-shadow: 0 18px 50px rgba(0,0,0,.35); transition: transform 220ms var(--ease-out), opacity 180ms ease; }
.toast.is-leaving { opacity: 0; transform: translateY(-8px) scale(.98); }
.toast--error { border-color: rgba(255,170,163,.3); background: #251416; color: #ffd4d1; }
.alert { display: flex; align-items: center; gap: 9px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: .8rem; }
.alert--error { border-color: rgba(255,170,163,.3); background: rgba(255,170,163,.07); color: #ffd1cd; }
.empty-state { min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; text-align: center; }
.empty-state svg { width: 34px; height: 34px; color: var(--quiet); }
.empty-state h3 { margin: 13px 0 3px; }
.empty-state p { margin: 0 0 14px; color: var(--muted); }
.empty-state--compact { min-height: 220px; }
.empty-state--success svg { color: var(--success); }
#celebration { position: fixed; inset: 0; z-index: 100; width: 100%; height: 100%; pointer-events: none; }

.sidebar-scrim { display: none; }
.login-page { display: grid; place-items: center; padding: 30px 18px; background-color: #070809; background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px); background-size: 42px 42px; }
.login-shell { width: min(450px, 100%); }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand .brand-mark { margin-bottom: 13px; }
.login-brand h1 { margin: 0; font-size: 2.35rem; letter-spacing: 0; }
.login-brand p { margin: 5px 0 0; color: var(--muted); }
.login-card { overflow: hidden; border: 1px solid var(--border-strong); border-radius: 8px; background: linear-gradient(155deg, #181a1e, #0e1012); box-shadow: 0 26px 80px rgba(0,0,0,.5); }
.login-card__body { padding: 30px; }
.login-intro { margin-bottom: 22px; }
.login-intro h2 { margin: 5px 0 3px; font-size: 1.45rem; }
.login-intro p { margin: 0; color: var(--muted); font-size: .88rem; }
.input-icon { position: relative; display: block; }
.input-icon > svg { position: absolute; left: 13px; top: 50%; z-index: 1; width: 17px; color: var(--quiet); transform: translateY(-50%); }
.input-icon input { padding-left: 41px; }
.input-icon:has(.password-toggle) input { padding-right: 44px; }
.input-icon .password-toggle { position: absolute; right: 3px; top: 3px; }
.demo-access { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 15px 30px; border-top: 1px solid var(--border); background: #0c0e10; color: var(--muted); font-size: .76rem; }
.demo-access code { color: var(--accent); }
.login-footnote { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 16px 0 0; color: var(--quiet); font-size: .73rem; }
.login-footnote svg { width: 14px; }

@media (hover: hover) and (pointer: fine) {
    .nav-link:hover { background: var(--surface-2); color: var(--text); }
    .data-table tbody tr:hover { background: #17191c; }
    .gantt-meta:hover { background: #17191c; }
    .gantt-bar:hover { box-shadow: 0 7px 20px rgba(0,0,0,.35); }
}

@media (max-width: 1180px) {
    .metrics-grid--five { grid-template-columns: repeat(3, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .metric-card { min-height: 132px; }
    .project-detail-grid { grid-template-columns: 1fr; }
    .project-side { grid-template-columns: 1fr 1fr; }
    .bulk-task-row__grid { grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) repeat(2, minmax(130px, 1fr)); }
    .bulk-task-row__grid .field:nth-child(5), .bulk-task-row__grid .field:nth-child(6) { grid-column: span 2; }
}

@media (max-width: 820px) {
    :root { --topbar-height: 62px; }
    .sidebar { transform: translateX(-100%); transition: transform 240ms var(--ease-out); }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-scrim { position: fixed; inset: 0; z-index: 25; width: 100%; height: 100%; border: 0; background: rgba(0,0,0,.66); }
    body.sidebar-open .sidebar-scrim { display: block; }
    .workspace { margin-left: 0; }
    .mobile-menu { display: inline-grid !important; }
    .topbar { padding: 0 16px; }
    .global-search { width: min(52vw, 360px); }
    .today { display: none; }
    .content { padding: 26px 18px 44px; }
    .metrics-grid--five, .metrics-grid--three { grid-template-columns: repeat(2, 1fr); }
    .page-heading { align-items: flex-start; }
    .page-heading h1 { font-size: 2rem; }
    .filter-bar--wrap { flex-wrap: wrap; }
    .filter-bar--wrap label { flex: 1 1 160px; }
    .project-overview { grid-template-columns: 1fr; }
    .project-score { border-top: 1px solid var(--border); border-left: 0; }
    .gantt-panel { --meta-width: 250px; }
    .gantt-scroll { max-height: calc(100vh - 330px); }
    .timeline-save-state { width: 100%; margin-left: 0; }
    .bulk-task-row__grid { grid-template-columns: 1fr 1fr; }
    .bulk-field--title, .bulk-field--reason { grid-column: 1 / -1; }
    .bulk-task-row__grid .field:nth-child(5), .bulk-task-row__grid .field:nth-child(6) { grid-column: auto; }
}

@media (max-width: 560px) {
    .user-menu__copy { display: none; }
    .global-search { width: calc(100vw - 104px); }
    .content { padding-inline: 14px; }
    .page-heading { display: grid; gap: 16px; margin-bottom: 22px; }
    .page-actions, .page-actions .button { width: 100%; }
    .metrics-grid--five, .metrics-grid--three { grid-template-columns: 1fr 1fr; gap: 10px; }
    .metric-card { min-height: 122px; padding: 15px; }
    .metric-card strong { margin-top: 15px; font-size: 1.85rem; }
    .metric-card small { font-size: .68rem; }
    .metric-card > div { font-size: .67rem; }
    .metrics-grid--five .metric-card:last-child { grid-column: 1 / -1; }
    .progress-row { grid-template-columns: 1fr; gap: 11px; padding: 15px 0; }
    .filter-bar { align-items: stretch; flex-wrap: wrap; }
    .filter-bar label { flex: 1 1 100%; justify-content: space-between; }
    .filter-bar select { width: 65%; min-width: 0; }
    .filter-summary { width: 100%; margin-left: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .field--full { grid-column: auto; }
    .modal { padding: 10px; }
    .modal-card { max-height: calc(100vh - 20px); }
    .modal-header, .modal-body, .modal-footer { padding-left: 17px; padding-right: 17px; }
    .bulk-task-toolbar { align-items: flex-start; }
    .bulk-task-toolbar .button { width: auto; }
    .bulk-task-row { padding: 12px; }
    .bulk-task-row__grid { grid-template-columns: 1fr; }
    .bulk-field--title, .bulk-field--reason { grid-column: auto; }
    .bulk-footer-count { display: none; }
    .login-card__body { padding: 24px 20px; }
    .demo-access { grid-template-columns: 1fr auto; padding: 14px 20px; }
    .demo-access code { grid-column: 2; }
    .detail-toolbar { align-items: flex-start; flex-direction: column; }
    .detail-toolbar > div { width: 100%; }
    .detail-toolbar .button { flex: 1; }
    .project-summary { padding: 22px 18px; }
    .project-meta { display: grid; gap: 16px; margin-top: 25px; }
    .project-side { grid-template-columns: 1fr; }
    .timeline-toolbar .segmented-control { flex: 1 1 auto; }
    .timeline-toolbar .segmented-control button { min-width: 0; flex: 1; }
    .gantt-panel { --meta-width: 210px; }
    .gantt-meta { padding-left: 10px; grid-template-columns: 4px minmax(0, 1fr); }
    .gantt-meta .icon-button { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; }
    .sidebar, .modal-card, .toast, .progress-track span, .gantt-date-popover { transition-duration: 1ms !important; }
    #celebration { display: none; }
}
