:root { --bg:#0b0f14; --fg:#e7e9ee; --muted:#9aa4b2; --card:#121923; --accent:#4da3ff; --border:#203044; }
* { box-sizing: border-box; }
body { margin:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial; background:var(--bg); color:var(--fg); }
a { color: var(--accent); text-decoration: none; }
.topbar { display:flex; justify-content: space-between; align-items:center; padding:12px 16px; border-bottom:1px solid var(--border); position:sticky; top:0; background:rgba(11,15,20,0.9); backdrop-filter: blur(6px); }
.brand { font-weight:700; font-size:18px; }
.topbar .right a, .topbar .right span { margin-left: 12px; }
.container { max-width: 1024px; margin: 24px auto; padding: 0 16px; }
.footer { border-top:1px solid var(--border); padding:12px 16px; color:var(--muted); text-align:center; }
.cards { display:grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap:16px; }
.card { background: var(--card); padding:16px; border:1px solid var(--border); border-radius:12px; display:block; }
.card h3 { margin:0 0 8px; }
.card .desc { color:var(--muted); min-height: 40px; }
.card .meta { display:flex; gap:8px; flex-wrap: wrap; color:var(--muted); margin-top:8px; font-size: 13px; }
h1,h3 { margin-top:0; }
.form, .form-inline { background: var(--card); border:1px solid var(--border); padding:16px; border-radius:12px; margin:12px 0; }
.form label { display:block; margin-bottom:8px; }
.form input[type="text"], .form input[type="password"], .form textarea, .form input[type="number"], .form select { width:100%; padding:10px; border-radius:8px; border:1px solid var(--border); background:#0e1520; color:var(--fg); }
.form button, .form-inline button { padding:10px 14px; border-radius:8px; border:1px solid var(--border); background:#142131; color:var(--fg); cursor:pointer; }
.form-inline { display:flex; gap:8px; align-items:center; flex-wrap: wrap; }
.table { width:100%; border-collapse: collapse; background: var(--card); border:1px solid var(--border); border-radius:12px; overflow:hidden; }
.table th, .table td { border-bottom:1px solid var(--border); padding:10px; text-align:left; }
.alert { background:#2a1c1c; border:1px solid #6b2a2a; padding:10px; border-radius:8px; margin-bottom:12px; }
.comment, .app { background: var(--card); border:1px solid var(--border); padding:10px; border-radius:10px; margin:8px 0; }
.ts { color: var(--muted); font-size: 12px; margin-left: 8px; }
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: #121923;
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar .brand {
  font-weight: bold;
  font-size: 18px;
  margin-bottom: 20px;
}

.sidebar nav a {
  display: block;
  margin: 8px 0;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--fg);
}

.sidebar nav a:hover {
  background: #1a2533;
}

.sidebar .user {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
}

.content {
  flex: 1;
  padding: 24px;
}
/* cards with thumbnails */
.card .thumb{
  width:100%;
  aspect-ratio: 16/9;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

.project-header{
  display:flex; gap:16px; align-items:flex-start; margin-bottom: 16px;
}
.project-header .cover img{
  max-width: 360px; border-radius: 12px; border:1px solid var(--border);
}
.block{ margin: 18px 0; }
.md p{ margin: 8px 0; }
.muted{ color: var(--muted); }
/* chips / badges */
.badges { display:flex; flex-wrap:wrap; gap:8px; margin:8px 0; }
.badge  { padding:4px 10px; border:1px solid var(--border); border-radius:999px; font-size:12px; color:var(--fg); background:#0e1520; }

/* direction colors (simple) */
.badge.dir { border-color:#2b4a6a; background:#0f2030; }

/* project detail layout */
.project-hero{
  display:grid;
  grid-template-columns: 1.6fr 1fr;
  gap:20px;
  align-items:start;
}
@media (max-width: 900px){
  .project-hero{ grid-template-columns: 1fr; }
}
.hero-card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:18px;
}
.cover img{
  width:100%; height:auto;
  border-radius:12px; border:1px solid var(--border);
}
.meta-row{
  display:flex; flex-wrap:wrap; gap:12px; margin-top:8px; color:var(--muted); font-size:14px;
}

/* content sections as cards grid */
.sections{
  margin-top:18px;
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:16px;
}
@media (max-width: 900px){
  .sections{ grid-template-columns: 1fr; }
}
.section-card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px;
}
.section-card h3{ margin:0 0 8px; }
.section-card .md p{ margin:6px 0; }

/* action bar */
.action-bar{
  display:flex; gap:8px; flex-wrap:wrap; margin:14px 0;
}
.button{
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 14px; border-radius:10px;
  background:#142131; border:1px solid var(--border);
  color:var(--fg); text-decoration:none;
}
.button:hover{ background:#1a2a3f; }

/* small helper on index cards */
.meta .chip{ border:1px solid var(--border); padding:2px 8px; border-radius:999px; font-size:12px; }
/* Цвета для направлений проектов */
.card.dir-construction {
  border-left: 6px solid #d97706;       /* оранжевый */
  background: #fff7ed;
}
.card.dir-med {
  border-left: 6px solid #dc2626;       /* красный */
  background: #fef2f2;
}
.card.dir-bio {
  border-left: 6px solid #16a34a;       /* зелёный */
  background: #f0fdf4;
}
.card.dir-bas {
  border-left: 6px solid #2563eb;       /* синий */
  background: #eff6ff;
}
.card.dir-energy {
  border-left: 6px solid #eab308;       /* жёлтый */
  background: #fefce8;
}
.dir-robotics {
  border-left: 6px solid #4b0082;
  background: #8a2be2; /* фиолетово-индиговый */
}
/* Чуть приподнять на hover */
.card.dir-construction:hover,
.card.dir-med:hover,
.card.dir-bio:hover,
.card.dir-bas:hover,
.card.dir-energy:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.badge.dir-construction { background:#d97706; color:#fff; }
.badge.dir-med { background:#dc2626; color:#fff; }
.badge.dir-bio { background:#16a34a; color:#fff; }
.badge.dir-bas { background:#2563eb; color:#fff; }
.badge.dir-energy { background:#eab308; color:#fff; }
.dir-robotics { background:#4b0082; color:#fff; }
/* filter bar */
.filter-bar{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 16px;
}
.f-row{ display:flex; gap:14px; flex-wrap:wrap; }
.f-col{ display:flex; flex-direction:column; min-width: 240px; }
.f-label{ font-size:13px; color:var(--muted); margin-bottom:6px; }
.f-input{
  padding:10px; border-radius:8px; border:1px solid var(--border);
  background:#0e1520; color:var(--fg);
}
.f-actions{ margin-top:10px; display:flex; align-items:center; gap:8px; }

.tags-wrap{
  display:flex; flex-wrap:wrap; gap:8px; max-height: 180px; overflow:auto;
  padding:8px; border:1px solid var(--border); border-radius:8px; background:#0e1520;
}
.tag-check{
  display:inline-flex; gap:6px; align-items:center;
  background:#121923; padding:6px 10px; border:1px solid var(--border); border-radius:999px;
}
.tag-check input{ accent-color: var(--accent); }
/* Размеры диаграммы на аналитике */
.chart-wrap{
  position: relative;
  width: 360px;     /* базовая ширина */
  height: 240px;    /* управляет фактической высотой канвы */
}
@media (max-width: 900px){
  .chart-wrap{ width: 280px; height: 200px; }
}
.attach-list{ list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:10px; }
.attach-item{
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  padding:10px; border:1px solid var(--border); border-radius:10px; background: var(--card);
}
.attach-actions{ display:flex; gap:8px; }
.attach-item strong{ display:block; }
.table-wrap{ overflow:auto; }
.table{
  width:100%; border-collapse: collapse;
}
.table th, .table td{
  border:1px solid var(--border);
  padding:8px 10px; text-align:left;
}
.table thead th{
  background: #0e1520; color: var(--muted);
}
.table tbody tr:nth-child(odd){
  background: #0b111a;
}
.alert{
  background:#331a1a; color:#ffb3b3;
  border:1px solid #5a2a2a; padding:8px 10px; border-radius:8px;
}
.journal-item { border:1px solid var(--border); border-radius:12px; padding:10px; margin:10px 0; background: var(--card); }
.ji-head { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.ji-title { margin-left:4px; }
.ji-actions { margin-top:6px; }
.ji-checklist ul { margin:6px 0; padding-left:1.2em; }
.linklike { background:none; border:none; cursor:pointer; padding:0 4px; }
.linklike:disabled { cursor:default; opacity:.6; }

.news-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.news-card {
    border: 1px solid #ccc;
    padding: 1rem;
    background: #fafafa;
    border-radius: 6px;
}

.news-title a {
    font-weight: bold;
    color: #3366cc;
    text-decoration: none;
}

.news-summary {
    margin-top: 0.5rem;
    color: #444;
    line-height: 1.4;
    max-height: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-meta {
    font-size: 0.8rem;
    color: #777;
    margin-top: 0.3rem;
}

.news-actions {
    margin-top: 0.8rem;
    display: flex;
    gap: 1rem;
}
/* Контейнер */
.news-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Заголовок секции (#AI, #Робототехника) */
.news-section-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-top: 1.2rem;
    margin-bottom: -0.5rem;
    color: #4c91e2;
}

/* Основной блок */
.news-item {
    background: #fff;
    border-radius: 12px;
    padding: 0.8rem 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Заголовок */
.news-title a {
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    color: #222;
    line-height: 1.3;
}
.news-title a:hover {
    color: #3478f6;
}

/* Краткий текст */
.news-summary {
    font-size: 0.9rem;
    color: #555;
    margin-top: 0.4rem;
    line-height: 1.4;
}

/* Метаданные */
.news-meta {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #888;
}

/* Кнопки */
.news-actions {
    margin-top: 0.6rem;
    display: flex;
    gap: 0.5rem;
}

.tg-small {
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
    background: #e8e8e8;
    border: none;
    cursor: pointer;
    text-decoration: none;
    color: #333;
}

.tg-green {
    background: #d4f6da;
    color: #1d7d2d;
}

.tg-disabled {
    background: #cccccc;
    cursor: default;
}

.tg-button {
    padding: 6px 12px;
    border-radius: 6px;
    background: #4c91e2;
    border: none;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
}
.tg-button:hover {
    background: #3478f6;
}