:root {
  color-scheme: light;
  font-family: Inter, system-ui, "Segoe UI", sans-serif;
  color: #18312c;
  background: #f4f7f4;
  font-synthesis: none;
  line-height: 1.5;
  --canvas: #f4f7f4;
  --surface: #fff;
  --ink: #18312c;
  --muted: #52665f;
  --line: #dce6df;
  --blue: #21644f;
  --accent-soft: #e4f2eb;
  --radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled, select:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 3px solid #408b72; outline-offset: 4px; }
[hidden] { display: none !important; }
.skip { position: fixed; z-index: 4; top: 10px; left: 10px; padding: 10px; background: white; transform: translateY(-150%); }
.skip:focus { transform: translateY(0); }
.startup { padding: 2rem; }

.layout { display: grid; min-height: 100dvh; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 22px; overflow: auto; padding: 27px 18px 22px; background: #fcfdfa; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 6px 9px; text-decoration: none; font-size: 1.25rem; letter-spacing: -.035em; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 11px; background: var(--blue); color: white; font-weight: 800; }
.navigation { display: grid; gap: 5px; }
.navigation a { display: flex; gap: 11px; align-items: center; min-height: 44px; border-radius: 9px; padding: 7px 10px; text-decoration: none; font-size: .9rem; font-weight: 550; color: var(--muted); }
.navigation a:hover, .navigation a[aria-current] { background: var(--accent-soft); color: var(--blue); }
.navigation a[aria-current] { font-weight: 700; }
.project-navigation { border-top: 1px solid var(--line); padding-top: 12px; }
.nav-icon { display: inline-grid; place-items: center; width: 22px; color: var(--blue); font-size: 1.11rem; line-height: 1; }
.persona { margin-top: auto; display: grid; gap: 7px; padding: 12px 3px 0; border-top: 1px solid var(--line); }
.persona label { color: var(--muted); font-size: .86rem; }
.select-wrap { position: relative; }
.select-wrap::after { content: ''; pointer-events: none; position: absolute; top: calc(50% - 5px); right: 15px; width: 8px; height: 8px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
select { appearance: none; padding-right: 32px !important; }
.persona select { background: white; color: var(--ink); border-color: var(--line); }
.profile button { justify-self: start; }
.auth-page { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(100%, 440px); padding: 25px; }
.auth-card .brand { margin: 0 0 18px; }
.auth-card h1 { font-size: clamp(1.55rem, 5vw, 2rem); line-height: 1.15; margin-bottom: 17px; }
.auth-card .form-panel button { margin-top: 5px; }
.invite-created { display: grid; gap: 8px; justify-items: start; margin-bottom: 16px; }
.personal-grid { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.personal-project { border-top: 1px solid var(--line); padding-top: 13px; margin-top: 13px; }
.personal-project h3, .chat-panel h2 { overflow-wrap: anywhere; }
.personal-project ul { list-style: none; padding: 0; margin: 7px 0; }
.personal-project details summary { color: var(--blue); font-weight: 650; cursor: pointer; font-size: .9rem; }
.personal-project details .form-panel { margin: 8px 0 0; }
.chat-link { display: block; width: 100%; border: 0; padding: 6px 8px; border-radius: 6px; color: var(--blue); background: none; text-align: left; overflow-wrap: anywhere; }
.chat-link:hover, .chat-link[aria-current] { background: #ebedff; }
.chat-messages { display: grid; gap: 10px; margin: 14px 0; }
.chat-message { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.chat-user { background: #f1f3fc; }
.chat-message h3 { margin-bottom: 6px; }
.chat-message p { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message ul { margin-block: 6px; padding-left: 20px; overflow-wrap: anywhere; }
.chat-message > .text-link { margin-top: 7px; }
.chat-panel .form-panel { margin-bottom: 0; }

.topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px clamp(20px, 4vw, 57px); background: #fff; border-bottom: 1px solid var(--line); }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: end; text-align: right; }
.inbox-link { font-size: .86rem; color: var(--blue); font-weight: 650; text-underline-offset: 3px; }
.notice-count { border-radius: 6px; padding: 1px 5px; background: var(--accent-soft); text-decoration: none; }
.notice-list { list-style: none; padding: 0; margin: 14px 0 0; }
.notice-list li { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 10px; border-top: 1px solid var(--line); }
.notice-list li div { overflow-wrap: anywhere; }
.notice-unread { background: #f2f3ff; }
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .86rem; }
.breadcrumb strong { color: var(--ink); }
.breadcrumb a { color: var(--blue); text-underline-offset: 3px; }
.demo-label { flex: 0 0 auto; padding: 5px 10px; background: var(--accent-soft); color: var(--blue); border-radius: 7px; font-size: .8rem; font-weight: 650; }
.main-inner { width: min(100%, 1300px); margin: 0 auto; padding: 30px clamp(20px, 4vw, 57px) 58px; }
.projects-heading { margin: 8px 0 24px; }
.projects-heading h1 { font-size: clamp(2.3rem, 5vw, 4rem); font-weight: 730; line-height: 1.05; letter-spacing: -.055em; }
.new-project { margin-bottom: 30px; }
.new-project summary { cursor: pointer; width: fit-content; gap: 7px; list-style: none; }
.new-project summary::-webkit-details-marker { display: none; }
.new-project .form-panel { max-width: 560px; margin: 12px 0 0; }
.project-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: clamp(16px, 3vw, 32px); }
.project-group h2 { margin-bottom: 13px; font-size: 1.23rem; letter-spacing: -.025em; }
.project-cards { display: grid; gap: 12px; }
.project-card { display: grid; gap: 9px; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 2.3vw, 24px); background: white; text-decoration: none; overflow-wrap: anywhere; }
.project-card:hover { border-color: #7aa995; box-shadow: 0 5px 14px #18312c0d; }
.project-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.project-card-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--blue); background: var(--accent-soft); font-size: 1.4rem; }
.project-card h3 { font-size: 1.23rem; line-height: 1.2; letter-spacing: -.025em; }
.project-card p, .project-empty { color: var(--muted); }
.project-card-open { margin-top: 7px; color: var(--blue); font-size: .89rem; font-weight: 650; }
.project-card-open span { margin-left: 4px; }
.project-empty { border: 1px dashed #becfc4; border-radius: var(--radius); padding: 22px; }
.project-list-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.project-list-item p { margin-top: 5px; }
.document-filter { display: grid; gap: 6px; max-width: 250px; margin-bottom: 18px; }
.catalog-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.catalog-filters input[type="search"] { margin-top: 0; }
.document > .source-link { margin-top: 6px; }
.document-versions { list-style: none; margin: 8px 0 0; padding: 0; }
.document-versions li { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.document-versions li .form-actions { flex: 0 0 auto; justify-content: end; }
#document-preview { width: min(760px, calc(100% - 28px)); max-height: 88dvh; border: 1px solid var(--line); border-radius: var(--radius); padding: 21px; color: var(--ink); }
#document-preview::backdrop { background: #181c35aa; }
#document-preview h2 { font-size: 1.2rem; overflow-wrap: anywhere; }
#document-preview pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.project-settings { margin-top: 16px; }
.result-link { margin-bottom: 16px; }
.project-settings summary, .result-link summary { color: var(--blue); cursor: pointer; font-weight: 650; }
.project-settings form, .result-link form { margin: 10px 0 0; }
.list-heading { margin-bottom: 12px; }
.material-folders, .audit { margin-top: 16px; }
.material-folder { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.material-folder summary, .audit summary { color: var(--blue); font-weight: 650; cursor: pointer; }
.material-folder .empty, .audit .empty { margin-top: 9px; }
.audit ul { list-style: none; padding: 0; margin: 9px 0 0; }
.audit li { padding: 9px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.document-upload { margin-top: 8px; }
.document-upload summary { cursor: pointer; color: var(--blue); font-size: .9rem; font-weight: 650; }
.document-upload form { margin: 10px 0 0; }
.telegram-import summary { color: var(--blue); cursor: pointer; font-weight: 650; }
.telegram-import + .telegram-import { margin-top: 12px; }
.telegram-import .form-panel { margin: 12px 0 0; }
.project-hero { display: flex; justify-content: space-between; gap: 30px; padding: clamp(24px, 3vw, 36px); color: var(--ink); border: 1px solid #d8e9de; border-radius: var(--radius); background: linear-gradient(120deg, #fcfefb, #e4f2eb); }
.project-hero h1, .section-header h1 { font-size: clamp(1.9rem, 3.1vw, 2.84rem); line-height: 1.1; letter-spacing: -.048em; }
.project-hero p:not(.eyebrow) { color: var(--muted); max-width: 47ch; margin-top: 12px; }
.eyebrow { color: var(--blue); font-weight: 650; font-size: .85rem; margin-bottom: 11px; }
.project-meta { display: grid; flex-shrink: 0; align-content: center; gap: 13px; padding-left: 22px; border-left: 1px solid #bcd2c5; }
.project-meta span, .project-meta strong { display: block; }
.project-meta span { color: var(--muted); font-size: .83rem; }
.project-meta strong { font-size: .96rem; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 17px 0; }
.metrics a { display: grid; align-content: center; gap: 3px; min-height: 77px; padding: 10px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; }
.metrics a:hover { border-color: #8189dc; }
.metrics span { color: var(--muted); font-size: .88rem; }
.metrics strong { font-size: 1.2rem; }

.overview-grid { display: grid; grid-template-columns: 1.18fr 1fr; align-items: start; gap: 16px; }
.panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 2vw, 23px); }
.ai-panel, .result-panel { min-height: 219px; }
.panel-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel-heading > .tag { margin-left: auto; }
.ai-icon, .file-icon { display: grid; place-items: center; width: 43px; height: 43px; flex: 0 0 43px; border-radius: 11px; background: #e9ebff; color: #3d43a8; font-size: 1.4rem; }
.file-icon { background: #e6edf8; color: #37557d; }
.panel h2 { font-size: 1.2rem; letter-spacing: -.025em; line-height: 1.25; }
.panel h3 { font-size: 1.065rem; line-height: 1.3; }
.panel-heading p, .hint, .empty { color: var(--muted); }
.panel-heading p, .hint { font-size: .86rem; }
.panel-description { margin-bottom: 17px; }
.budget-note { margin-top: 7px; }
.panel .text-link { display: inline-flex; }
.text-link, .source-link { color: var(--blue); font-weight: 650; font-size: .89rem; }
.text-link { text-underline-offset: 3px; }
.primary, .secondary, .source-link { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; font-size: .89rem; font-weight: 670; text-align: center; border-radius: 8px; padding: 7px 13px; border: 1px solid transparent; text-decoration: none; }
.primary { color: white; background: var(--blue); }
.primary:hover { background: #194c3d; }
.secondary { background: white; color: var(--blue); border-color: #c7d9cf; }
.secondary:hover, .source-link:hover { background: var(--accent-soft); }
.source-link { min-height: 34px; padding: 4px 7px; background: #f1f7f3; justify-content: start; }
.tag { display: inline-flex; max-width: 100%; align-items: center; border-radius: 6px; padding: 4px 7px; font-size: .76rem; font-weight: 670; overflow-wrap: anywhere; }
.tag-plain { color: #444b69; background: #eef0f7; }
.tag-warning { color: #783e12; background: #ffeedc; }
.tag-success { color: #205842; background: #e2f4eb; }
.summary { margin-top: 12px; }
.finding { display: grid; justify-items: start; gap: 8px; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.refresh-summary { margin-top: 10px; }
.summary-documents { margin-bottom: 12px; }
.summary-documents summary { color: var(--blue); cursor: pointer; font-size: .9rem; font-weight: 650; }
.summary-documents .hint, .summary-documents .check { margin-top: 6px; }
.source-links, .version-actions, .form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.version-compact { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; margin-bottom: 12px; }
.version-top, .topline { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.version-top > .tag, .topline > .tag { flex: 0 0 auto; }
.filename { margin-top: 3px; overflow-wrap: anywhere; }
.version-actions { margin-top: 8px; }
.version .hint { margin-top: 4px; }
.timeline { margin-top: 16px; }
.message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding-top: 14px; margin-top: 13px; border-top: 1px solid var(--line); }
.message-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 9px; }
.message-meta time { color: var(--muted); font-size: .82rem; }
.message-origin-fields { display: grid; gap: 6px; }
.message p, .revision > p { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.message-attachments { margin: 6px 0; padding-left: 20px; overflow-wrap: anywhere; }
.message-settings { margin-top: 7px; }
.message-settings summary { color: var(--blue); cursor: pointer; font-size: .86rem; }
.message-settings form { margin: 7px 0 0; }
.more-messages, .clear-message-filter { margin-top: 9px; }
.route-code { overflow-wrap: anywhere; }
.avatar { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 10px; color: #373e9f; background: #ebedff; font-size: .85rem; font-weight: 700; }

.section-header { margin-bottom: 20px; }
.section-header p { color: var(--muted); margin-top: 9px; }
.form-panel { display: grid; justify-items: start; gap: 9px; margin-bottom: 16px; }
.form-panel h2 { margin-bottom: 5px; }
.brief-edit { margin-bottom: 16px; }
#brief-fields { display: grid; gap: 10px; width: 100%; }
.brief-field { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.brief-field legend { color: var(--muted); padding-inline: 5px; font-size: .88rem; }
.brief-field button { justify-self: start; }
label { font-weight: 620; font-size: .895rem; }
input:not([type="checkbox"]), textarea, select { width: 100%; min-height: 42px; color: var(--ink); background: #fff; border: 1px solid #c6ccdc; border-radius: 8px; padding: 8px 10px; }
textarea { min-height: 93px; resize: vertical; }
input[type="file"] { color: var(--muted); }
input[type="search"] { display: block; margin-top: 8px; }
.check { display: flex; align-items: center; gap: 5px; }
.detail-list > article + article, .detail-list > h2:not(:first-child) { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.detail-list h2 + .requirement { margin: 14px 0 0; }
.detail-list .requirement h3 { margin-bottom: 5px; }
.toast { z-index: 3; position: fixed; right: 18px; bottom: 18px; max-width: min(410px, calc(100% - 36px)); color: #fff; background: #252b65; border-radius: 10px; padding: 11px 16px; box-shadow: 0 8px 22px #13173933; }
.toast.error { background: #862c3c; }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 213px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .overview-grid { grid-template-columns: 1fr; }
  .ai-panel, .result-panel { min-height: 0; }
}

@media (max-width: 720px) {
  .layout { display: block; }
  .sidebar { position: static; height: auto; padding: 12px 16px 9px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
  .brand { margin: 0; }
  .persona { grid-column: 2; grid-row: 1; padding: 0; margin: 0; border: 0; gap: 2px; }
  .persona select { min-height: 34px; padding-block: 4px; }
  .navigation { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .navigation a { padding-inline: 7px; gap: 4px; line-height: 1.2; }
  .project-groups { grid-template-columns: 1fr; }
  .personal-grid { grid-template-columns: 1fr; }
  .document-versions li .form-actions { flex: 0 1 105px; }
  .nav-icon { flex: 0 0 17px; }
  .topbar { min-height: 53px; padding-inline: 16px; }
  .main-inner { padding: 16px 16px 38px; }
  .project-hero { padding: 19px; flex-direction: column; gap: 16px; }
  .project-meta { padding: 12px 0 0; border-left: 0; border-top: 1px solid #bcd2c5; display: flex; flex-wrap: wrap; gap: 12px 24px; }
  .metrics { margin-block: 12px; gap: 6px; }
  .metrics a { padding: 8px; }
  .metrics span { font-size: .79rem; }
  .metrics strong { font-size: 1rem; }
}

@media (max-width: 380px) {
  .topbar { align-items: flex-start; }
  .navigation { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics a:last-child { grid-column: 1 / -1; }
}
