:root {
  color-scheme: dark;
  --bg: #071412;
  --panel: #0f211e;
  --panel2: rgba(255,255,255,.045);
  --text: #edf7f3;
  --muted: #a8bbb5;
  --green: #4de0a3;
  --blue: #75b7ff;
  --gold: #f3c969;
  --line: rgba(255,255,255,.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at top left, #123c35, var(--bg) 44%); color: var(--text); overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(34px, 6vw, 66px); line-height: .96; letter-spacing: -.055em; }
h2 { font-size: clamp(24px, 3vw, 38px); letter-spacing: -.035em; }
h3 { letter-spacing: -.02em; }
.eyebrow { color: var(--green); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 900; }
.lead, li, .tiny, .message { color: var(--muted); line-height: 1.55; }
.tiny { font-size: 12px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.04); color: var(--text); cursor: pointer; font: inherit; }
.button.primary { background: var(--green); color: #062018; border: 0; font-weight: 900; }
.button.small { padding: 8px 12px; font-size: 13px; }
.hidden { display: none !important; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.auth-card { width: min(760px, 100%); border: 1px solid var(--line); border-radius: 30px; background: linear-gradient(150deg, rgba(77,224,163,.13), rgba(117,183,255,.07)); padding: clamp(26px, 5vw, 52px); box-shadow: 0 30px 90px rgba(0,0,0,.25); }
.auth-actions { display: grid; gap: 16px; margin: 28px 0; }
details { border: 1px solid var(--line); border-radius: 20px; padding: 16px; background: rgba(255,255,255,.04); }
summary { cursor: pointer; font-weight: 900; }
.email-form { display: grid; gap: 12px; margin-top: 16px; }
label { display: grid; gap: 7px; color: var(--muted); }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 16px; background: rgba(0,0,0,.22); color: var(--text); padding: 12px 14px; font: inherit; }
.portal-screen { min-height: 100vh; display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 22px; border-right: 1px solid var(--line); background: rgba(7,20,18,.82); backdrop-filter: blur(18px); display: flex; flex-direction: column; gap: 18px; }
.brand { font-size: 24px; font-weight: 950; color: var(--text); }
.module-nav { display: grid; gap: 8px; }
.nav-item { text-align: left; border: 1px solid transparent; border-radius: 16px; background: transparent; color: var(--muted); padding: 12px 13px; cursor: pointer; font: inherit; }
.nav-item:hover, .nav-item.active { border-color: var(--line); background: rgba(77,224,163,.11); color: var(--text); }
.user-box { margin-top: auto; border-top: 1px solid var(--line); padding-top: 18px; }
.workspace { padding: clamp(22px, 4vw, 54px); min-width: 0; max-width: 100vw; }
.workspace-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 28px; }
.module-content { display: grid; gap: 20px; min-width: 0; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card, .panel { border: 1px solid var(--line); border-radius: 24px; background: var(--panel2); padding: 22px; }
.card strong { color: var(--gold); }
.status-row { display: grid; grid-template-columns: 1.2fr .8fr .8fr; gap: 12px; align-items: center; border-top: 1px solid var(--line); padding: 14px 0; }
.status-row:first-child { border-top: 0; }
.badge { display: inline-flex; width: fit-content; padding: 5px 10px; border-radius: 999px; background: rgba(77,224,163,.12); color: var(--green); font-size: 12px; font-weight: 900; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.template { border: 1px dashed var(--line); border-radius: 18px; padding: 16px; }
textarea { min-height: 130px; resize: vertical; }
@media (max-width: 1000px) {
  .portal-screen { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .cards, .template-grid { grid-template-columns: 1fr; }
  .workspace-header { display: block; }
  .status-row { grid-template-columns: 1fr; }
}
.user-table { display: grid; gap: 12px; margin-top: 18px; }
.user-row { display: grid; grid-template-columns: minmax(220px, 1fr) 120px 150px auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 18px; padding: 16px; background: rgba(255,255,255,.035); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.badge.danger { color: #ffaaa5; background: rgba(255,90,84,.12); }
.access-panel { max-width: 820px; }
@media (max-width: 900px) { .user-row { grid-template-columns: 1fr; } .row-actions { justify-content: flex-start; } }
/* Project Management working page */
.workspace, input, textarea, select, button { font-size: 12px; }
.workspace h1 { font-size: clamp(26px, 3.4vw, 42px); }
.workspace h2 { font-size: 18px; }
.pm-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; min-width: 0; }
.pm-main { min-width: 0; overflow: hidden; }
.dense-panel { padding: 14px; border-radius: 16px; }
.pm-toolbar { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 10px; }
.pm-toolbar h2, .agent-head h2 { margin-bottom: 4px; }
.zoom-control { display: flex; align-items: center; gap: 8px; min-width: 170px; }
.task-add-form { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 8px 0 12px; background: rgba(255,255,255,.035); }
.task-modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 18px; }
.task-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.62); backdrop-filter: blur(10px); }
.task-modal-card { position: relative; z-index: 1; width: min(920px, calc(100vw - 36px)); max-height: calc(100vh - 36px); overflow: auto; margin: 0; padding: 18px; box-shadow: 0 28px 90px rgba(0,0,0,.45); background: #0d211d; }
.task-modal-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.task-modal-head h2 { margin: 6px 0 0; }
#closePmTaskModal { min-width: 38px; font-size: 20px; line-height: 1; }
.task-form-grid { display: grid; grid-template-columns: 120px 1fr 160px 160px 1fr; gap: 10px; align-items: end; }
.task-code-field { grid-column: 1; }
.task-desc-field { grid-column: 2 / -1; }
.task-add-form label { font-size: 12px; color: var(--muted); }
.task-add-form input, .task-add-form select { margin-top: 5px; width: 100%; }
.task-add-form select[multiple] { min-height: 150px; padding: 8px; }
.task-add-form select[multiple] option { padding: 5px 7px; }
.task-form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.gantt-wrap { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: auto; overscroll-behavior-inline: contain; border: 1px solid var(--line); border-radius: 12px; max-height: calc(100vh - 245px); background: rgba(0,0,0,.16); }
.gantt-grid { display: grid; grid-template-columns: 72px 320px 120px 90px 96px 96px calc(var(--units) * var(--day-width)); min-width: calc(794px + var(--units) * var(--day-width)); width: max-content; }
.gantt-head { position: sticky; top: 0; z-index: 4; background: #10231f; color: var(--green); font-weight: 900; border-bottom: 1px solid var(--line); }
.task-head, .meta-head, .gantt-cell { padding: 7px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid rgba(255,255,255,.07); min-height: 30px; }
.gantt-grid > :nth-child(7n + 1),
.gantt-grid > :nth-child(7n + 2),
.gantt-grid > :nth-child(7n + 3),
.gantt-grid > :nth-child(7n + 4),
.gantt-grid > :nth-child(7n + 5),
.gantt-grid > :nth-child(7n + 6) { position: sticky; z-index: 2; background: #0e211d; }
.gantt-grid > :nth-child(7n + 1) { left: 0; }
.gantt-grid > :nth-child(7n + 2) { left: 72px; }
.gantt-grid > :nth-child(7n + 3) { left: 392px; }
.gantt-grid > :nth-child(7n + 4) { left: 512px; }
.gantt-grid > :nth-child(7n + 5) { left: 602px; }
.gantt-grid > :nth-child(7n + 6) { left: 698px; box-shadow: 8px 0 14px rgba(0,0,0,.20); }
.gantt-grid > .gantt-head:nth-child(-n + 6) { z-index: 6; background: #10231f; }
.gantt-timeline-head { position: sticky; top: 0; z-index: 3; display: grid; grid-template-rows: 27px 36px; background: #10231f; border-bottom: 1px solid var(--line); }
.week-row, .day-row { display: grid; grid-template-columns: repeat(var(--units), var(--day-width)); }
.week-head { border: 0; border-right: 1px solid rgba(255,255,255,.10); border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(77,224,163,.08); color: var(--green); font-size: 11px; font-weight: 900; cursor: pointer; }
.week-head.collapsed-week { background: rgba(243,201,105,.09); color: var(--gold); }
.day-head { display: grid; place-items: center; padding: 3px 0; text-align: center; color: var(--muted); border-right: 1px solid rgba(255,255,255,.06); font-size: 11px; line-height: 1.05; }
.day-head small { display: block; font-size: 9px; opacity: .72; }
.week-summary { color: var(--gold); font-size: 9px; }
.number-head { text-align: left; font-variant-numeric: tabular-nums; }
.number-cell { display: flex; align-items: center; justify-content: space-between; gap: 4px; text-align: left; color: var(--gold); font-weight: 900; font-variant-numeric: tabular-nums; }
.outline-number { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.task-cell { display: flex; gap: 4px; align-items: center; white-space: nowrap; color: var(--text); }
.level-0 { font-weight: 900; background: rgba(77,224,163,.045); }
.meta-cell { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.collapse-btn { width: 18px; height: 18px; border: 0; border-radius: 4px; background: rgba(77,224,163,.14); color: var(--green); cursor: pointer; }
.collapse-spacer { width: 18px; display: inline-block; }
.mini-badge { display: inline-flex; padding: 2px 7px; border-radius: 999px; color: var(--green); background: rgba(77,224,163,.11); font-size: 11px; }
.gantt-cell[data-task-edit], .gantt-row-line[data-task-edit] { cursor: pointer; }
.gantt-cell[data-task-edit]:hover { background: rgba(77,224,163,.08); }
.gantt-row-line { position: relative; min-height: 30px; border-bottom: 1px solid rgba(255,255,255,.07); background-image: repeating-linear-gradient(to right, rgba(255,255,255,.05) 0 1px, transparent 1px var(--day-width)); }
.gantt-bar { position: absolute; top: 7px; height: 15px; border-radius: 999px; background: rgba(117,183,255,.28); overflow: hidden; border: 1px solid rgba(117,183,255,.42); }
.gantt-bar.parent { height: 17px; background: rgba(77,224,163,.25); border-color: rgba(77,224,163,.45); }
.gantt-progress-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--blue)); opacity: .9; }
.gantt-bar em { position: absolute; inset: 0; display: grid; place-items: center; color: #062018; font-size: 10px; font-style: normal; font-weight: 950; text-shadow: 0 1px 7px rgba(255,255,255,.45); pointer-events: none; }
.collapsed { display: none !important; }
body.pm-fullscreen { overflow: hidden; }
body.pm-fullscreen .portal-screen { grid-template-columns: minmax(0, 1fr); width: 100vw; max-width: 100vw; height: 100vh; overflow: hidden; }
body.pm-fullscreen .sidebar, body.pm-fullscreen .pm-agent { display: none !important; }
body.pm-fullscreen .workspace { width: 100vw; max-width: 100vw; height: 100vh; padding: 12px; overflow: hidden; }
body.pm-fullscreen .workspace-header { display: none; }
body.pm-fullscreen .pm-layout { grid-template-columns: minmax(0, 1fr); width: 100%; max-width: 100%; }
body.pm-fullscreen .pm-main { max-width: 100%; }
body.pm-fullscreen .gantt-wrap { max-height: calc(100vh - 130px); max-width: 100%; }
.pm-agent { position: sticky; top: 18px; max-height: calc(100vh - 120px); display: grid; grid-template-rows: auto 1fr auto; }
.chat-log { overflow: auto; display: grid; gap: 10px; padding: 8px 0; max-height: 55vh; }
.chat-msg { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: rgba(255,255,255,.035); }
.chat-msg p { margin: 4px 0 0; color: var(--muted); line-height: 1.4; }
.chat-msg.user { background: rgba(77,224,163,.08); }
.chat-msg.sample { background: rgba(243,201,105,.07); }
.chat-msg.thinking { background: linear-gradient(135deg, rgba(77,224,163,.10), rgba(117,183,255,.06)); }
.chat-msg.thinking p { display: inline-flex; align-items: center; gap: 8px; }
.typing-dots { display: inline-flex; gap: 4px; align-items: center; transform: translateY(1px); }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); opacity: .35; animation: typingPulse 1.05s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typingPulse { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-4px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing-dots i { animation: none; opacity: .85; } }
.chat-box { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.chat-box textarea { min-height: 82px; border-radius: 12px; }
@media (max-width: 1150px) { .pm-layout { grid-template-columns: 1fr; } .pm-agent { position: static; max-height: none; } .task-form-grid { grid-template-columns: 1fr 1fr; } .task-code-field, .task-desc-field { grid-column: auto; } }

/* Requirements workspace */
.requirements-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; align-items: start; }
.requirements-side { display: grid; gap: 16px; position: sticky; top: 18px; max-height: calc(100vh - 120px); }
.story-form { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 12px; background: rgba(255,255,255,.035); }
.story-form-grid { display: grid; grid-template-columns: 1fr 170px; gap: 10px; }
.story-list { display: grid; gap: 10px; max-height: calc(100vh - 270px); overflow: auto; padding-right: 4px; }
.story-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: rgba(255,255,255,.035); }
.story-card p { color: var(--muted); line-height: 1.45; }
.story-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 6px; }
.req-row { padding: 0; overflow: hidden; }
.req-row-summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px; cursor: pointer; list-style: none; }
.req-row-summary::-webkit-details-marker { display: none; }
.req-row-summary::before { content: '▸'; color: var(--green); font-weight: 900; align-self: start; }
.req-row[open] .req-row-summary::before { content: '▾'; }
.req-row-main { display: grid; gap: 4px; min-width: 0; }
.req-row-main.single-line { display: block; }
.req-row-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.req-preview, .req-line { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.req-preview, .req-line, .plain-second-line { color: var(--muted); font-weight: 400; }
.req-row-details { border-top: 1px solid var(--line); padding: 0 12px 12px; background: rgba(0,0,0,.08); }
.primary-detail { border-top: 0; margin-top: 0; padding-top: 12px; }
.criteria { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.upload-box { display: grid; gap: 8px; }
.reference-list { display: grid; gap: 8px; margin-top: 10px; max-height: 180px; overflow: auto; }
.reference-item { display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 12px; padding: 9px; background: rgba(255,255,255,.035); }
.reference-item span { color: var(--muted); font-size: 11px; }
.requirements-chat { position: static; max-height: none; }
.requirements-chat .chat-log { max-height: 36vh; }
@media (max-width: 1150px) { .requirements-layout { grid-template-columns: 1fr; } .requirements-side { position: static; max-height: none; } .story-list { max-height: none; } }
@media (max-width: 700px) { .story-form-grid { grid-template-columns: 1fr; } }
.req-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.req-tab { border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.035); color: var(--muted); padding: 8px 11px; cursor: pointer; font: inherit; font-weight: 800; }
.req-tab:hover, .req-tab.active { background: rgba(77,224,163,.13); color: var(--green); border-color: rgba(77,224,163,.35); }
.req-persona-group { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: rgba(0,0,0,.10); }
.req-persona-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; background: rgba(77,224,163,.08); border-bottom: 1px solid var(--line); }
.req-persona-head h3 { margin: 0; font-size: 14px; }
.req-persona-stories { display: grid; gap: 8px; padding: 10px; }
.req-persona-stories .story-card { background: rgba(255,255,255,.03); }
