/* ОКБ R&D — локальные стили без CDN. Приоритет: плотность и читаемость. */

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

html { font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f1f5f9;
    color: #0f172a;
    line-height: 1.45;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: #0369a1; text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
    background: #0f172a;
    color: #e2e8f0;
    border-bottom: 1px solid #1e293b;
}
.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    align-items: center;
    justify-content: space-between;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; color: #fff; font-weight: 700; }
.brand-tagline { font-size: 0.75rem; font-weight: 400; color: #cbd5e1; max-width: 25rem; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark {
    background: #0284c7;
    color: #fff;
    padding: 0.2rem 0.45rem;
    border-radius: 0.25rem;
    letter-spacing: 0.06em;
}
.brand-sub { font-size: 0.7rem; color: #38bdf8; font-weight: 500; font-family: ui-monospace, monospace; }
.nav-links { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.nav-link {
    color: #cbd5e1;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.4rem 0.7rem;
    border-radius: 0.375rem;
}
.nav-link:hover { background: #1e293b; color: #fff; text-decoration: none; }
.header-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pill {
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #cbd5e1;
}
.pill-stub { border-color: #854d0e; background: #422006; color: #fde68a; }

main.page {
    flex: 1;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.25rem 1rem 2rem;
}
.site-footer {
    border-top: 1px solid #e2e8f0;
    background: #fff;
    padding: 0.85rem 1rem;
    text-align: center;
    color: #64748b;
    font-size: 0.75rem;
}

h1 { font-size: 1.45rem; letter-spacing: -0.02em; }
h2 { font-size: 1rem; }
.muted { color: #64748b; font-size: 0.8rem; }
.page-head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.85rem;
    margin-bottom: 1rem;
}
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.flash {
    padding: 0.7rem 0.9rem;
    border-radius: 0.4rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}
.flash-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.flash-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 0.35rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    background: #e2e8f0;
    color: #1e293b;
    font-family: inherit;
}
.btn:hover { text-decoration: none; filter: brightness(0.97); }
.btn-primary { background: #0284c7; color: #fff; }
.btn-success { background: #059669; color: #fff; }
.btn-danger { background: #e11d48; color: #fff; }
.btn-ghost { background: #fff; border-color: #cbd5e1; }
.btn-small { padding: 0.25rem 0.5rem; font-size: 0.72rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
    gap: 0.55rem 0.7rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
    align-items: end;
}
.filters label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}
.filters .filter-actions { display: flex; gap: 0.4rem; align-items: end; }

input, select, textarea, button { font-family: inherit; }
input, select, textarea {
    width: 100%;
    padding: 0.4rem 0.55rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.35rem;
    font-size: 0.85rem;
    background: #fff;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.18);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 0.6rem;
    margin-bottom: 1.1rem;
}
.kpi {
    display: block;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #94a3b8;
    border-radius: 0.45rem;
    padding: 0.7rem 0.8rem 0.75rem;
    color: inherit;
    min-width: 0;
}
.kpi:hover { text-decoration: none; border-color: #94a3b8; background: #f8fafc; }
.kpi.is-danger { border-left-color: #e11d48; }
.kpi.is-warning { border-left-color: #d97706; }
.kpi.is-ok { border-left-color: #94a3b8; }
.kpi-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}
.kpi-value { font-size: 1.65rem; font-weight: 800; line-height: 1.15; margin: 0.15rem 0; }
.kpi.is-danger .kpi-value { color: #be123c; }
.kpi.is-warning .kpi-value { color: #b45309; }
.kpi-hint { font-size: 0.7rem; color: #64748b; }

.panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1rem;
}
.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: baseline;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
table.data th {
    text-align: left;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    white-space: nowrap;
}
table.data td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}
table.data tr:hover td { background: #f8fafc; }
table.data tr.is-overdue td { background: #fff1f2; }
table.data tr.is-blocked td { background: #fff7ed; }
.empty { padding: 1.5rem; text-align: center; color: #94a3b8; font-size: 0.875rem; }

.badge {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    background: #e2e8f0;
    color: #334155;
    white-space: nowrap;
}
.badge-draft { background: #fef3c7; color: #92400e; }
.badge-todo { background: #e0f2fe; color: #075985; }
.badge-in_progress { background: #dbeafe; color: #1e40af; }
.badge-blocked { background: #ffedd5; color: #9a3412; }
.badge-done { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #f1f5f9; color: #64748b; }
.badge-critical { background: #ffe4e6; color: #9f1239; }
.badge-high { background: #ffedd5; color: #9a3412; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dcfce7; color: #166534; }
.badge-rejected { background: #f1f5f9; color: #64748b; }

.actions { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.two-col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 900px) {
    .two-col { grid-template-columns: 1fr 1fr; }
}

.stack { display: flex; flex-direction: column; gap: 0.85rem; }
.draft-item, .event-item, .confirm-card, .task-card {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid #f1f5f9;
}
.draft-item:last-child, .event-item:last-child { border-bottom: 0; }
.fact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.85rem;
    padding: 0.9rem;
}
.fact-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; }
.fact-value { margin-top: 0.2rem; font-weight: 600; }

.a3-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin: 0.6rem 0;
}
@media (min-width: 640px) {
    .a3-grid { grid-template-columns: 1fr 1fr; }
}
.a3-box { border: 1px solid #e2e8f0; background: #f8fafc; border-radius: 0.4rem; padding: 0.55rem 0.7rem; font-size: 0.85rem; }
.a3-box.proposed { border-color: #ddd6fe; background: #f5f3ff; }
.quote {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.35rem;
    padding: 0.55rem 0.7rem;
}
.candidates { margin: 0.6rem 0; font-size: 0.85rem; }
.candidates label { display: flex; gap: 0.5rem; align-items: center; margin: 0.3rem 0; font-weight: 500; text-transform: none; letter-spacing: 0; color: inherit; }

.breadcrumb { font-size: 0.75rem; color: #64748b; margin-bottom: 0.4rem; }
.timeline { font-size: 0.8rem; }
.timeline li { padding: 0.45rem 0.9rem; border-bottom: 1px solid #f1f5f9; list-style: none; }

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
    display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 40;
}
.modal {
    background: #fff; border-radius: 0.5rem; padding: 1.1rem; width: 100%; max-width: 26rem;
    border: 1px solid #e2e8f0;
}
.modal h3 { margin-bottom: 0.8rem; }
.form-stack { display: flex; flex-direction: column; gap: 0.65rem; }
.hidden { display: none !important; }
.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 0.5rem;
    padding: 1.4rem 1rem;
    text-align: center;
    background: #fff;
    margin-bottom: 1rem;
}
.upload-status { margin-top: 0.75rem; padding: 0.7rem; border-radius: 0.4rem; font-size: 0.85rem; }
.is-ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.is-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.is-err { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

@media (max-width: 640px) {
    h1 { font-size: 1.2rem; }
    .kpi-value { font-size: 1.35rem; }
    table.data td, table.data th { padding: 0.45rem 0.5rem; }
}

/* Increment 3.5: project-first workspace and deterministic guided forms. */
.eyebrow { font-size:.69rem; letter-spacing:.09em; text-transform:uppercase; color:#64748b; font-weight:650; margin-bottom:.4rem; }
h1 { font-size:1.8rem; }
h3 { font-size:.85rem; }
p { overflow-wrap:anywhere; }
.preserve-lines { white-space:pre-wrap; overflow-wrap:anywhere; }
.portfolio-summary { display:flex; gap:1.6rem; flex-wrap:wrap; margin:1rem 0 1.5rem; font-size:.85rem; }
.portfolio-summary strong { color:#0f172a; font-size:1.2rem; margin-right:.25rem; }
.portfolio-filters { grid-template-columns:repeat(4,minmax(0,1fr)); }
.view-switch { display:flex; border:1px solid #cbd5e1; border-radius:6px; padding:3px; background:white; }
.view-switch a { padding:.35rem 1rem; color:#475569; font-size:.8rem; border-radius:4px; }
.view-switch .selected { background:#0f172a; color:white; }
.project-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1rem; margin-bottom:1.5rem; }
.project-card { min-width:0; display:flex; flex-direction:column; background:white; padding:1.2rem; border:1px solid #dbe3eb; border-radius:8px; }
.project-card h2 { font-size:1.14rem; line-height:1.35; }
.project-card h2 a { color:#0f172a; }
.project-description { font-size:.84rem; margin:.65rem 0; min-height:2.4rem; color:#475569; }
.next-milestone { background:#f2f6f8; border-left:3px solid #447581; padding:.75rem; margin:1rem 0 .65rem; font-size:.85rem; }
.next-milestone span { display:block; color:#475569; margin-top:.3rem; }
.deadline-line { display:flex; justify-content:space-between; gap:.5rem; font-size:.8rem; margin-bottom:1rem; }
.compact-tasks { display:grid; gap:.45rem; font-size:.8rem; margin:.5rem 0 1rem; }
.compact-tasks a { color:#334155; overflow-wrap:anywhere; }
.project-issues { display:flex; flex-wrap:wrap; gap:.5rem .9rem; font-size:.75rem; border-top:1px solid #e2e8f0; padding-top:.75rem; margin-top:auto; }
.decision-links { display:flex; flex-wrap:wrap; gap:.4rem; }
.project-open { font-size:.82rem; margin-top:1rem; font-weight:600; }
.danger-text { color:#b45309; }
.portfolio-table { padding:0; }
.portfolio-table table { min-width:1140px; }
.portfolio-table td:first-child { min-width:210px; max-width:260px; }
.portfolio-table td { min-width:95px; vertical-align:top; }
.portfolio-table td .muted { display:block; }
.technical-metrics { margin-top:1.5rem; }
summary { cursor:pointer; font-weight:600; font-size:.85rem; padding:.3rem 0; }
details[open] summary { margin-bottom:1rem; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
.form-grid .wide { grid-column:1/-1; }
.project-form { max-width:840px; margin:auto; }
.project-form label, .wizard-form label { font-size:.85rem; font-weight:600; display:block; }
.project-form input, .project-form textarea, .project-form select, .wizard-form textarea, .wizard-form input { width:100%; margin-top:.4rem; }
.project-form .page-actions { margin-top:1.25rem; }
.project-form > p { margin-top:1rem; }
textarea { font-family:inherit; resize:vertical; }
.wizard-layout { display:grid; grid-template-columns:280px minmax(0,1fr); gap:1.4rem; align-items:start; }
.wizard-outline { background:#edf2f5; }
.wizard-outline ol { padding-left:1.3rem; margin-top:1rem; color:#64748b; font-size:.8rem; }
.wizard-outline li { padding:.4rem 0 .4rem .25rem; }
.wizard-outline .current { color:#0e5c70; font-weight:700; }
.wizard-form { padding:1.8rem; display:grid; gap:1rem; }
.wizard-form h2 { font-size:1.25rem; }
.wizard-form input[type=date] { max-width:280px; }
.wizard-form textarea { min-height:160px; }
.draft-preview { border:1px solid #dde4e9; padding:1.5rem; background:#fbfcfd; }
.draft-preview section { padding:.8rem 0; border-bottom:1px solid #e2e8f0; }
.draft-preview h3 { color:#475569; margin-bottom:.4rem; }
.draft-preview p { font-size:.9rem; }
.project-tabs { display:flex; flex-wrap:wrap; gap:.3rem; border-bottom:1px solid #cbd5e1; margin-bottom:1.4rem; }
.project-tabs a { color:#475569; padding:.7rem 1rem; font-size:.85rem; }
.project-tabs [aria-current] { color:#0e5c70; border-bottom:3px solid #0e5c70; font-weight:600; }
.empty-project { background:#edf6f5; padding:1rem 1.2rem; border:1px solid #c4ded8; border-radius:6px; margin-bottom:1.25rem; }
.empty-project p { margin-top:.3rem; font-size:.85rem; color:#49665f; }
.guided-actions { margin:1.5rem 0; }
.guided-actions h2 { font-size:1.2rem; }
.action-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.65rem; }
.action-card { border:1px solid #d3dfe5; background:white; padding:1rem; border-radius:6px; color:#243746; display:flex; flex-direction:column; gap:.4rem; }
.action-card:hover { border-color:#327585; background:#f0f8f9; text-decoration:none; }
.action-card strong { font-size:.86rem; }
.action-card strong span { float:right; margin-left:.4rem; }
.action-card > span { font-size:.76rem; color:#64748b; }
.action-primary { border-color:#387685; background:#eef7f8; }
.milestone-note { max-width:480px; font-size:.78rem; color:#475569; text-align:right; }
.overview-grid { display:grid; grid-template-columns:1fr 1fr; gap:1rem; scroll-margin-top:1rem; }
.overview-grid h2 { margin-bottom:.6rem; }
.overview-grid p + h2 { margin-top:1.3rem; }
.overview-grid p { font-size:.85rem; }
.issue-links { display:grid; gap:.5rem; margin:1rem 0 1.5rem; }
.issue-links a { display:flex; justify-content:space-between; padding:.5rem .7rem; background:#f4f6f8; color:#334155; font-size:.82rem; }
.next-task { display:grid; padding:.6rem 0; gap:.2rem; font-size:.82rem; border-top:1px solid #edf2f7; }
.document-row { display:flex; gap:1rem; justify-content:space-between; align-items:center; border-top:1px solid #edf2f7; padding:.85rem 0; font-size:.85rem; }
.document-row a { flex-shrink:0; }
.upload-form { max-width:800px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline:3px solid #0e7490; outline-offset:3px; }
.nav-more { position:relative; }
.nav-more summary { color:#cbd5e1; padding:.4rem .7rem; }
.nav-more[open] > div { position:absolute; z-index:5; background:#0f172a; padding:.75rem; min-width:220px; display:grid; border-radius:6px; }
.header-meta form button { border:1px solid #64748b; border-radius:4px; padding:.2rem .5rem; color:#e2e8f0; background:transparent; cursor:pointer; }
@media(max-width:1050px) { .project-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } .action-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:700px) { .project-grid,.action-grid,.overview-grid,.form-grid,.wizard-layout { grid-template-columns:1fr; } .portfolio-filters { grid-template-columns:1fr 1fr; } .wizard-outline { display:none; } .milestone-note { text-align:left; } .form-grid .wide { grid-column:auto; } }

.project-workspace .panel { padding:1.1rem; }
.project-workspace .panel-head { padding:0 0 .8rem; background:transparent; margin-bottom:.6rem; }
.project-workspace .panel > p + a { display:inline-block; margin-top:.7rem; }
.wizard-outline { padding:1.2rem; }
.project-form { padding:1.5rem; }
details.technical-metrics { padding:.8rem 1rem; }
