:root {
  --bg: #0b0e13;
  --sidebar: #10141a;
  --panel: #141920;
  --panel-2: #181e27;
  --line: #262d37;
  --muted: #8b94a3;
  --text: #f3f5f7;
  --accent: #9bff67;
  --accent-ink: #102008;
  --violet: #8b82ff;
  --orange: #ff9c55;
  --danger: #ff6b6b;
  --radius: 18px;
  --shadow: 0 22px 70px rgba(0, 0, 0, .28);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 30px 22px 24px; background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 4; }
.brand { display: flex; align-items: center; gap: 12px; width: max-content; }
.brand > span:last-child { display: grid; line-height: 1; }
.brand strong { font-size: 18px; letter-spacing: -.04em; }
.brand small { margin-top: 5px; color: var(--muted); font-size: 8px; letter-spacing: .28em; }
.brand-mark { width: 39px; height: 39px; position: relative; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #353c47; border-radius: 12px; background: #171c24; overflow: hidden; }
.brand-mark i { position: absolute; width: 7px; border-radius: 4px; background: var(--accent); transform: rotate(34deg); }
.brand-mark i:nth-child(1) { height: 25px; left: 10px; bottom: -2px; }
.brand-mark i:nth-child(2) { height: 29px; left: 19px; top: 4px; background: var(--violet); }
.brand-mark i:nth-child(3) { height: 18px; right: 4px; top: -2px; background: var(--orange); }

.nav { display: grid; gap: 7px; margin-top: 58px; }
.nav-item { width: 100%; border: 0; border-radius: 11px; padding: 13px 14px; display: grid; grid-template-columns: 23px 1fr auto; align-items: center; gap: 8px; background: transparent; color: #858e9c; text-align: left; cursor: pointer; transition: .18s ease; }
.nav-item:hover { color: var(--text); background: #171c23; }
.nav-item.active { color: var(--text); background: #20262f; box-shadow: inset 3px 0 var(--accent); }
.nav-item span { font-size: 18px; text-align: center; }
.nav-item b { min-width: 23px; height: 20px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; background: #343b46; color: #bac1cb; border-radius: 10px; font-size: 11px; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 22px; }
.system-state { display: flex; align-items: flex-start; gap: 10px; padding-top: 21px; border-top: 1px solid var(--line); }
.system-state > span:last-child { display: grid; gap: 5px; }
.system-state strong { font-size: 12px; font-weight: 600; }
.system-state small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.status-dot { width: 8px; height: 8px; margin-top: 3px; flex: none; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px rgba(155, 255, 103, .55); }
.logout { width: max-content; color: #737c89; font-size: 12px; }
.logout:hover { color: var(--text); }

.main { min-width: 0; padding: 36px clamp(28px, 4vw, 68px) 70px; }
.topbar { min-height: 70px; display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; margin-bottom: 36px; }
.eyebrow, .section-label { margin: 0 0 9px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: clamp(27px, 3vw, 39px); letter-spacing: -.045em; }
.top-actions, .section-toolbar { display: flex; align-items: center; gap: 10px; }
.button { min-height: 42px; padding: 0 18px; border: 1px solid transparent; border-radius: 10px; font-size: 13px; font-weight: 650; cursor: pointer; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: wait; transform: none; }
.button.primary { background: var(--accent); color: var(--accent-ink); }
.button.secondary { background: #171c23; border-color: #2a313b; color: #d7dbe1; }
.button.light { background: #f7f8fa; color: #14171c; }
.button.wide { width: 100%; min-height: 50px; }
.ai-chip { height: 42px; padding: 0 13px; display: inline-flex; align-items: center; gap: 7px; color: #a9b0ba; border: 1px solid var(--line); border-radius: 10px; font-size: 11px; }
.ai-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.ai-chip.enabled i { background: var(--accent); box-shadow: 0 0 11px rgba(155, 255, 103, .6); }

.view { display: none; animation: rise .24s ease; }
.view.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.notice { margin: -16px 0 24px; padding: 12px 15px; border: 1px solid #3d4938; border-radius: 10px; background: #172018; color: #d5e8ca; font-size: 13px; }
.notice.error { border-color: #573737; background: #251718; color: #ffc2c2; }

.hero-card { min-height: 205px; padding: 38px 40px; display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; border-radius: 22px; overflow: hidden; position: relative; background: linear-gradient(125deg, #7c70f8 0%, #755fff 42%, #9e78ee 100%); box-shadow: var(--shadow); }
.hero-card::before { content: ""; position: absolute; width: 420px; height: 420px; right: 9%; top: -270px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; box-shadow: 0 0 0 60px rgba(255,255,255,.035), 0 0 0 120px rgba(255,255,255,.025); }
.hero-card > * { position: relative; }
.kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 10px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.kicker i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.hero-card h2 { max-width: 720px; margin: 18px 0 8px; font-size: clamp(26px, 3.2vw, 43px); letter-spacing: -.05em; line-height: 1.03; }
.hero-card p { margin: 0; color: rgba(255,255,255,.72); font-size: 13px; }

.metric-grid { margin: 22px 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric { min-height: 132px; padding: 22px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.metric > span { color: var(--muted); font-size: 11px; }
.metric strong { margin-top: auto; font-size: 32px; letter-spacing: -.05em; }
.metric small { color: #717a87; font-size: 10px; }
.content-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.content-grid .panel, .brief-preview { padding: 25px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel-head h3 { margin: 0; font-size: 17px; letter-spacing: -.025em; }
.text-button { padding: 0; border: 0; background: none; color: #929ba7; font-size: 11px; cursor: pointer; }
.text-button:hover { color: var(--text); }
.task-list, .project-mini-list { margin-top: 21px; }
.task-row { display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 57px; border-top: 1px solid var(--line); }
.task-row:first-child { border-top: 0; }
.check { width: 20px; height: 20px; padding: 0; border: 1px solid #414955; border-radius: 7px; background: transparent; cursor: pointer; }
.check:hover { border-color: var(--accent); }
.task-row strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; font-weight: 580; }
.task-row small { display: block; margin-top: 4px; color: #747d89; font-size: 10px; }
.priority { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.priority.p1 { background: var(--orange); }
.priority.p3 { background: var(--violet); }
.project-mini { min-height: 67px; display: grid; grid-template-columns: 35px minmax(0,1fr) auto; gap: 12px; align-items: center; border-top: 1px solid var(--line); }
.project-mini:first-child { border-top: 0; }
.project-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--project-color) 18%, #151a21); color: var(--project-color); font-size: 12px; font-weight: 800; }
.project-mini strong { display: block; font-size: 12px; }
.project-mini small { display: block; margin-top: 4px; color: #737b87; font-size: 10px; }
.project-health { color: #98a1ad; font-size: 10px; }
.project-health.good { color: var(--accent); }
.brief-preview { margin-top: 14px; }
.brief-preview .markdown { max-height: 265px; overflow: hidden; }

.section-toolbar { justify-content: space-between; margin-bottom: 20px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 7px; }
.filter { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.filter.active { background: #20262f; color: var(--text); }
.kanban { display: grid; gap: 10px; }
.task-card { padding: 18px 19px; display: grid; grid-template-columns: 7px minmax(0,1fr) auto; gap: 15px; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.task-card.done { opacity: .58; }
.task-card.done h3 { text-decoration: line-through; }
.task-stripe { width: 6px; height: 38px; border-radius: 4px; background: #5f6875; }
.task-card[data-priority="1"] .task-stripe { background: var(--orange); }
.task-card[data-priority="3"] .task-stripe { background: var(--violet); }
.task-card h3 { margin: 0; font-size: 14px; font-weight: 600; }
.task-meta { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 10px; }
.task-actions { display: flex; gap: 6px; }
.icon-button { min-width: 35px; height: 35px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #181e26; color: #aab1bb; font-size: 11px; cursor: pointer; }
.icon-button:hover { border-color: #404955; color: var(--text); }
.icon-button.danger:hover { border-color: #673c3c; color: #ff9a9a; }
.empty { padding: 35px 15px; color: var(--muted); text-align: center; font-size: 12px; }

.section-intro { margin-bottom: 27px; display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; }
.section-intro h2, .assistant-copy h2 { margin: 0 0 8px; font-size: clamp(28px, 3.2vw, 42px); letter-spacing: -.05em; }
.section-intro p, .assistant-copy p { max-width: 650px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.project-card { min-height: 265px; padding: 26px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); position: relative; overflow: hidden; }
.project-card::after { content: ""; position: absolute; width: 140px; height: 140px; top: -60px; right: -45px; border-radius: 50%; background: var(--project-color); opacity: .08; filter: blur(8px); }
.project-card-top { display: flex; align-items: center; gap: 13px; }
.project-card .project-icon { width: 45px; height: 45px; border-radius: 13px; }
.project-card h3 { margin: 0; font-size: 17px; }
.project-card-top small { color: var(--muted); font-size: 10px; }
.project-path { margin: 25px 0 17px; padding: 10px 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; color: #7e8794; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; text-overflow: ellipsis; }
.project-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.project-stats div { padding: 12px; border-radius: 9px; background: #10151b; }
.project-stats span { display: block; color: var(--muted); font-size: 9px; }
.project-stats strong { display: block; margin-top: 5px; font-size: 12px; }
.context-state { margin-top: 16px; color: var(--muted); font-size: 10px; }
.context-state.good { color: var(--accent); }

.report-layout { display: grid; grid-template-columns: 295px minmax(0,1fr); gap: 14px; }
.report-list { display: grid; align-content: start; gap: 8px; }
.report-item { padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); text-align: left; cursor: pointer; }
.report-item:hover, .report-item.active { border-color: #46505c; background: var(--panel-2); }
.report-item strong { display: block; font-size: 12px; }
.report-item small { display: block; margin-top: 7px; color: var(--muted); font-size: 9px; }
.report-reader { min-height: 500px; padding: clamp(25px, 4vw, 46px); }
.report-reader h2 { margin: 10px 0 28px; font-size: 27px; letter-spacing: -.04em; }
.markdown { color: #c0c6cf; font-size: 12px; line-height: 1.75; }
.markdown h1 { color: var(--text); font-size: 22px; }
.markdown h2 { margin: 24px 0 8px; color: var(--text); font-size: 15px; letter-spacing: -.02em; }
.markdown ul { padding-left: 18px; }
.markdown li { margin: 5px 0; }

.assistant-layout { min-height: calc(100vh - 180px); display: grid; grid-template-columns: .75fr 1.25fr; gap: 40px; align-items: center; }
.assistant-copy p { max-width: 440px; }
.prompt-chips { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 8px; }
.prompt-chips button { padding: 10px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: #aeb5bf; font-size: 10px; cursor: pointer; }
.prompt-chips button:hover { border-color: #48525e; color: var(--text); }
.chat-card { min-height: 590px; display: grid; grid-template-rows: auto 1fr auto; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); overflow: hidden; box-shadow: var(--shadow); }
.chat-head { padding: 20px 22px; display: flex; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); }
.agent-avatar { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; background: var(--accent); color: var(--accent-ink); }
.chat-head > span:last-child { display: grid; gap: 3px; }
.chat-head strong { font-size: 12px; }
.chat-head small { color: var(--muted); font-size: 9px; }
.chat-messages { padding: 25px; display: flex; flex-direction: column; gap: 12px; overflow: auto; max-height: 460px; }
.message { max-width: 82%; padding: 13px 15px; border-radius: 13px; font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
.message.assistant { align-self: flex-start; background: #20262f; color: #d1d6dd; border-bottom-left-radius: 4px; }
.message.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.chat-form { padding: 16px; display: flex; gap: 10px; border-top: 1px solid var(--line); }
.chat-form textarea { flex: 1; resize: none; }

dialog { width: min(610px, calc(100vw - 30px)); padding: 0; border: 1px solid #323a45; border-radius: 20px; background: var(--panel); color: var(--text); box-shadow: 0 30px 100px #000; }
dialog::backdrop { background: rgba(4, 6, 9, .76); backdrop-filter: blur(5px); }
.dialog-form { display: grid; gap: 16px; }
dialog .dialog-form { padding: 28px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; }
.dialog-head h2 { margin: 0; font-size: 25px; letter-spacing: -.04em; }
.close-button { border: 0; background: none; color: var(--muted); font-size: 27px; cursor: pointer; }
.dialog-form label { display: grid; gap: 8px; color: #a7aeba; font-size: 10px; font-weight: 650; }
input, textarea, select { width: 100%; border: 1px solid #303844; border-radius: 9px; outline: 0; background: #10151b; color: var(--text); padding: 12px 13px; font-size: 12px; }
input:focus, textarea:focus, select:focus { border-color: #66727f; box-shadow: 0 0 0 3px rgba(155,255,103,.06); }
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dialog-actions { margin-top: 5px; display: flex; justify-content: flex-end; gap: 9px; }

.auth-page { min-height: 100vh; background: #0b0e13; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(330px, 1.15fr) minmax(390px, .85fr); }
.auth-copy { padding: clamp(35px, 6vw, 90px); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; background: radial-gradient(circle at 85% 18%, rgba(139,130,255,.22), transparent 30%), linear-gradient(150deg,#11151d,#0d1015); }
.auth-copy::after { content: ""; width: 480px; height: 480px; position: absolute; right: -230px; bottom: -240px; border: 1px solid #2a303a; border-radius: 50%; box-shadow: 0 0 0 80px rgba(255,255,255,.015), 0 0 0 160px rgba(255,255,255,.01); }
.auth-copy > * { position: relative; z-index: 1; }
.auth-copy h1 { margin: 25px 0 20px; font-size: clamp(43px, 5vw, 75px); line-height: .96; letter-spacing: -.065em; }
.auth-copy p { max-width: 590px; margin: 0; color: #8993a1; font-size: 14px; line-height: 1.7; }
.auth-foot { color: #58616e; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.auth-card { padding: clamp(35px, 7vw, 100px); display: flex; flex-direction: column; justify-content: center; background: #0d1015; }
.auth-card > div:first-child { margin-bottom: 29px; }
.auth-card h2 { margin: 0 0 9px; font-size: 32px; letter-spacing: -.05em; }
.auth-card p { margin: 0; color: var(--muted); font-size: 12px; }
.auth-card .dialog-form { max-width: 420px; }
.form-error:empty { display: none; }
.form-error { max-width: 420px; margin-bottom: 18px; padding: 11px 13px; border: 1px solid #5c3438; border-radius: 8px; background: #241517; color: #ffacb3; font-size: 11px; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 78px minmax(0,1fr); }
  .sidebar { padding: 25px 14px; align-items: center; }
  .brand > span:last-child, .nav-item:not(.active) b, .system-state > span:last-child, .logout { display: none; }
  .nav { width: 100%; margin-top: 45px; }
  .nav-item { grid-template-columns: 1fr; justify-items: center; padding: 13px 0; font-size: 0; }
  .nav-item span { font-size: 18px; }
  .nav-item.active { box-shadow: inset 0 -3px var(--accent); }
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .content-grid, .assistant-layout { grid-template-columns: 1fr; }
  .assistant-layout { align-items: start; }
}

@media (max-width: 700px) {
  .shell { display: block; }
  .sidebar { height: 66px; width: 100%; padding: 11px 16px; position: fixed; top: auto; bottom: 0; flex-direction: row; justify-content: center; border: 0; border-top: 1px solid var(--line); }
  .brand, .sidebar-bottom { display: none; }
  .nav { width: 100%; max-width: 480px; margin: 0; grid-template-columns: repeat(5,1fr); gap: 4px; }
  .nav-item { min-width: 0; }
  .main { padding: 25px 16px 95px; }
  .topbar { align-items: center; margin-bottom: 24px; }
  .top-actions .ai-chip, .top-actions .secondary { display: none; }
  .top-actions .button { padding: 0 12px; font-size: 0; }
  .top-actions .button::after { content: "+"; font-size: 20px; }
  .hero-card { min-height: 240px; padding: 28px; align-items: flex-start; flex-direction: column; }
  .hero-card .button { margin-top: auto; }
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .metric { min-height: 112px; padding: 17px; }
  .content-grid, .project-grid, .report-layout { grid-template-columns: 1fr; }
  .section-intro, .section-toolbar { align-items: flex-start; flex-direction: column; }
  .report-reader { min-height: 350px; }
  .task-card { grid-template-columns: 6px minmax(0,1fr); }
  .task-actions { grid-column: 2; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-copy { min-height: 40vh; padding: 30px; }
  .auth-copy h1 { font-size: 42px; }
  .auth-copy .auth-foot { display: none; }
  .auth-card { padding: 45px 28px 70px; }
  .form-grid { grid-template-columns: 1fr; }
}
