/* ══════════════════════════════════════════════════════════════════════
   Morozovka Platform — общие стили
   Все шаблоны подключают <link rel="stylesheet" href="/static/main.css">
   ══════════════════════════════════════════════════════════════════════ */

* { box-sizing: border-box; }

:root {
  --bg: #0d1117;
  --bg-elev: #161b22;
  --bg-elev-2: #21262d;
  --bg-elev-3: #1c2128;
  --border: #30363d;
  --border-subtle: #21262d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #6e7681;
  --accent: #58a6ff;
  --accent-hover: #388bfd;
  --green: #3fb950;
  --green-bg: #238636;
  --green-bg-hover: #2ea043;
  --yellow: #d29922;
  --red: #f85149;
  --red-bg: #da3633;
  --red-bg-hover: #f85149;
  --purple: #a371f7;
  --blue: #1f6feb;
  --radius: 6px;
  --radius-lg: 12px;
}

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.no-flex { display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ══ TOP NAV ═══════════════════════════════════════════════════════════ */
.topnav {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 12px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topnav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}
.topnav-logo:hover { color: var(--text); text-decoration: none; }
.topnav-logo svg { color: var(--accent); }
.topnav-links { display: flex; gap: 20px; flex: 1; }
.topnav-links a {
  color: #c9d1d9;
  font-weight: 500;
  font-size: 14px;
}
.topnav-links a:hover { color: var(--accent); text-decoration: none; }
.topnav-links a.active { color: var(--accent); }
.topnav-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-right: 80px; /* место под колокольчик */
}

/* ══ CONTAINER / LAYOUT ════════════════════════════════════════════════ */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 32px;
  flex: 1;
  width: 100%;
}
.container-narrow { max-width: 800px; }
.container-wide { max-width: 1400px; }
.layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
.breadcrumbs {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent); }

/* ══ BUTTONS ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  border: 1px solid rgba(240,246,252,0.1);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all .15s;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-elev-2);
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--green-bg); color: #fff; }
.btn-primary:hover { background: var(--green-bg-hover); color: #fff; }
.btn-danger { background: var(--red-bg); color: #fff; }
.btn-danger:hover { background: var(--red-bg-hover); }
.btn-default { background: var(--bg-elev-2); color: #c9d1d9; }
.btn-default:hover { background: var(--border); }
.btn-outline { background: transparent; color: #c9d1d9; border-color: var(--border); }
.btn-outline:hover { background: var(--bg-elev-2); color: var(--text); border-color: var(--text-muted); }
.btn-sm { padding: 2px 8px; font-size: 12px; line-height: 18px; }
.btn-lg { padding: 10px 24px; font-size: 15px; }
.btn-icon {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.btn-icon:hover { background: var(--border); }

/* ══ FORMS ═════════════════════════════════════════════════════════════ */
.form-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.form-group { margin-bottom: 16px; display: flex; flex-direction: column; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { color: var(--text); font-size: 14px; font-weight: 600; margin-bottom: 6px; }
label .req { color: var(--red); }
input, select, textarea {
  padding: 5px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  line-height: 20px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}
textarea { min-height: 100px; resize: vertical; }
.hint { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.checkbox-row, .checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: #c9d1d9;
  font-size: 13px;
  cursor: pointer;
}
.checkbox-row input, .checkbox-line input { width: 15px; height: 15px; }
.checkbox-row label, .checkbox-line label { margin: 0; font-weight: 500; cursor: pointer; }
.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ══ CARDS / SECTIONS ══════════════════════════════════════════════════ */
.section {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.section h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section h2 .counter { color: var(--text-muted); font-size: 13px; font-weight: normal; }
.section-content { color: #c9d1d9; white-space: pre-wrap; line-height: 1.6; }
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ══ PAGE HEADER ═══════════════════════════════════════════════════════ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: 24px; font-weight: 600; margin: 0 0 4px; color: var(--text); }
.page-subtitle { color: var(--text-muted); font-size: 14px; margin: 0; }

/* ══ BADGES ════════════════════════════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: 0 7px;
  border-radius: 2em;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  border: 1px solid;
  white-space: nowrap;
}
.badge-cat-soldering      { background: rgba(88,166,255,0.15);  color: var(--accent); border-color: rgba(88,166,255,0.4); }
.badge-cat-embroidery     { background: rgba(163,113,247,0.15); color: var(--purple); border-color: rgba(163,113,247,0.4); }
.badge-cat-embedded       { background: rgba(63,185,80,0.15);   color: var(--green);  border-color: rgba(63,185,80,0.4); }
.badge-cat-linux          { background: rgba(210,153,34,0.15);  color: var(--yellow); border-color: rgba(210,153,34,0.4); }
.badge-cat-other          { background: rgba(139,148,158,0.15); color: var(--text-muted); border-color: rgba(139,148,158,0.4); }
.badge-status-draft       { background: rgba(139,148,158,0.15); color: var(--text-muted); border-color: rgba(139,148,158,0.4); }
.badge-status-published   { background: rgba(63,185,80,0.15);   color: var(--green);  border-color: rgba(63,185,80,0.4); }
.badge-status-archived    { background: rgba(210,153,34,0.15);  color: var(--yellow); border-color: rgba(210,153,34,0.4); }
.badge-vis-public         { background: rgba(63,185,80,0.15);   color: var(--green);  border-color: rgba(63,185,80,0.4); }
.badge-vis-internal       { background: rgba(210,153,34,0.15);  color: var(--yellow); border-color: rgba(210,153,34,0.4); }
.badge-vis-private        { background: rgba(248,81,73,0.15);   color: var(--red);    border-color: rgba(248,81,73,0.4); }
.badge-difficulty-beginner     { background: rgba(63,185,80,0.15);   color: var(--green);  border-color: rgba(63,185,80,0.4); }
.badge-difficulty-intermediate { background: rgba(210,153,34,0.15);  color: var(--yellow); border-color: rgba(210,153,34,0.4); }
.badge-difficulty-advanced     { background: rgba(248,81,73,0.15);   color: var(--red);    border-color: rgba(248,81,73,0.4); }
.badge-recurrence         { background: rgba(163,113,247,0.15); color: var(--purple); border-color: rgba(163,113,247,0.4); }
.badge-status-in_progress { background: rgba(31,111,235,0.15);  color: var(--blue);   border-color: rgba(31,111,235,0.4); }
.badge-status-idea        { background: rgba(139,148,158,0.15); color: var(--text-muted); border-color: rgba(139,148,158,0.4); }
.badge-status-completed   { background: rgba(35,134,54,0.15);   color: var(--green);  border-color: rgba(35,134,54,0.4); }
.badge-status-frozen      { background: rgba(218,54,51,0.15);   color: var(--red);    border-color: rgba(218,54,51,0.4); }

/* ══ TAGS / FILTERS ════════════════════════════════════════════════════ */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag {
  font-size: 12px;
  background: rgba(88,166,255,0.1);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 12px;
  border: 1px solid rgba(88,166,255,0.3);
}
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  align-items: center;
}
.filter-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  margin-right: 6px;
  align-self: center;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 2em;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: #c9d1d9;
  cursor: pointer;
  transition: all .15s;
}
.filter-chip:hover { background: var(--border); text-decoration: none; color: var(--text); }
.filter-chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.filter-chip.active:hover { background: var(--accent-hover); color: #fff; }
.filter-chip-clear {
  border-color: var(--red);
  color: var(--red);
  background: transparent;
}
.filter-chip-clear:hover { background: rgba(248,81,73,0.1); color: var(--red); }

/* ══ SEARCH ════════════════════════════════════════════════════════════ */
.search-form { display: flex; gap: 8px; align-items: center; }
.search-input {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  min-width: 200px;
}
.search-input:focus { outline: none; border-color: var(--accent); }
.search-btn {
  padding: 6px 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
.search-btn:hover { background: var(--border); }

/* ══ TABS ══════════════════════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab {
  padding: 8px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  font-weight: 600;
  font-size: 14px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .badge-count {
  background: var(--border);
  color: var(--text);
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 4px;
  font-weight: 500;
}

/* ══ POST CARD (общая лента) ═══════════════════════════════════════════ */
.post-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  position: relative;
}
.post-card:last-child { margin-bottom: 0; }
.post-card.pinned { border-color: var(--yellow); background: rgba(210,153,34,0.05); }
.post-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.post-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.4;
}
.post-title .pin-mark { color: var(--yellow); margin-right: 4px; font-size: 12px; }
.post-title a { color: inherit; }
.post-title a:hover { color: var(--accent); text-decoration: none; }
.post-meta { color: var(--text-muted); font-size: 12px; }
.post-meta a { color: var(--accent); }
.post-body {
  color: #c9d1d9;
  line-height: 1.6;
  white-space: pre-wrap;
  margin: 8px 0;
}
.post-attachments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}
.post-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: var(--bg-elev);
  border-radius: 4px;
  font-size: 12px;
  color: #c9d1d9;
}
.post-attachment a { color: var(--accent); }
.post-image-wrap { margin: 6px 0; }
.post-image-wrap img {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
  cursor: zoom-in;
}
.post-image-name { color: var(--text-dim); font-size: 11px; margin-top: 3px; }
.post-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
  opacity: 0;
  transition: opacity .15s;
}
.post-card:hover .post-actions { opacity: 1; }
.post-actions form { display: inline; }
.post-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 12px;
  border-radius: 3px;
}
.post-actions button:hover { background: var(--border); color: var(--text); }
.post-actions .del:hover { color: var(--red); }

/* ══ SOURCE BADGE (для общей ленты) ═══════════════════════════════════ */
.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  font-weight: 600;
  margin-right: 6px;
}
.source-pill.workshop { background: rgba(163,113,247,0.15); color: var(--purple); }
.source-pill.project  { background: rgba(31,111,235,0.15);  color: var(--blue);   }

/* ══ EMPTY STATE ═══════════════════════════════════════════════════════ */
.empty-state {
  padding: 64px 24px;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-elev);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-state h3 { color: var(--text); margin-bottom: 8px; font-size: 16px; }
.empty-state p { margin-bottom: 16px; }
.empty-small {
  color: var(--text-muted);
  font-size: 13px;
  padding: 12px;
  text-align: center;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ══ GRID ══════════════════════════════════════════════════════════════ */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

/* ══ MISC ══════════════════════════════════════════════════════════════ */
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
code, pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
}
pre { padding: 12px; overflow: auto; }
pre code { background: transparent; border: none; padding: 0; }

/* ══ FOOTER ════════════════════════════════════════════════════════════ */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: auto;
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--accent); }

/* ══ RESPONSIVE ════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .topnav { padding: 12px 16px; gap: 12px; }
  .topnav-links { display: none; }
  .topnav-actions { padding-right: 60px; }
  .container { padding: 16px; }
  .page-title { font-size: 20px; }
  .search-input { min-width: 120px; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ══════════════════════════════════════════════════════════════════════
   1.5: Онбординг, welcome-баннер, hero-grid для главной
   ══════════════════════════════════════════════════════════════════════ */

/* welcome-баннер для новичков */
.welcome-banner {
  background: linear-gradient(135deg, rgba(88,166,255,0.12) 0%, rgba(163,113,247,0.12) 100%);
  border: 1px solid rgba(88,166,255,0.4);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.welcome-banner-icon { font-size: 40px; line-height: 1; }
.welcome-banner-body { flex: 1; min-width: 200px; }
.welcome-banner-title { font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 4px; }
.welcome-banner-text { color: var(--text-muted); font-size: 13px; margin: 0; }
.welcome-banner .btn { flex-shrink: 0; }

/* hero-grid для главной */
.hero-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
}
.hero-main {
  padding: 32px;
  background: linear-gradient(135deg, #161b22 0%, #1c2128 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.hero-main::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(88,166,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.hero-title {
  font-size: 32px; font-weight: 700; margin: 0 0 12px;
  background: linear-gradient(90deg, #58a6ff, #a371f7);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1.2;
}
.hero-subtitle {
  color: var(--text-muted); font-size: 16px; margin: 0 0 24px;
  line-height: 1.6; max-width: 500px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-side { display: flex; flex-direction: column; gap: 16px; }
.status-card {
  padding: 20px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elev);
}
.status-label {
  color: var(--text-muted); font-size: 12px; text-transform: uppercase;
  font-weight: 600; margin-bottom: 8px;
}
.status-value { font-size: 18px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.status-dot-green { background: #3fb950; box-shadow: 0 0 0 3px rgba(63,185,80,0.2); }
.status-dot-yellow { background: #d29922; box-shadow: 0 0 0 3px rgba(210,153,34,0.2); }
.status-dot-red { background: #f85149; box-shadow: 0 0 0 3px rgba(248,81,73,0.2); }
.status-dot-grey { background: #8b949e; box-shadow: 0 0 0 3px rgba(139,148,158,0.2); }
.status-meta { color: var(--text-muted); font-size: 13px; }
.status-link {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 12px; font-size: 13px; font-weight: 500;
}

/* feature cards на главной */
.section-header-row {
  display: flex; justify-content: space-between; align-items: center;
  margin: 32px 0 16px;
}
.section-header-row h2 {
  font-size: 18px; font-weight: 600; color: var(--text); margin: 0;
}
.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.feature-card {
  padding: 20px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elev); transition: all .15s;
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
}
.feature-card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.feature-icon { font-size: 32px; margin-bottom: 12px; }
.feature-title { font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.feature-desc { color: var(--text-muted); font-size: 13px; line-height: 1.5; margin: 0; flex: 1; }
.feature-badge {
  display: inline-block; margin-top: 12px; padding: 0 8px; border-radius: 2em;
  font-size: 11px; font-weight: 500; line-height: 18px; border: 1px solid;
}
.feature-badge-new { background: rgba(63,185,80,0.15); color: #3fb950; border-color: rgba(63,185,80,0.4); }

/* ══ Онбординг ══════════════════════════════════════════════════════════ */
.onboarding-progress {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 24px;
}
.onboarding-progress-label {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; font-size: 14px; color: var(--text-muted);
}
.onboarding-progress-label strong { color: var(--text); font-size: 16px; }
.onboarding-progress-bar {
  height: 10px; background: var(--bg); border-radius: 5px;
  overflow: hidden; border: 1px solid var(--border);
}
.onboarding-progress-fill {
  height: 100%; background: linear-gradient(90deg, #58a6ff, #a371f7);
  transition: width .3s ease; border-radius: 5px;
}
.onboarding-step {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 12px;
  display: flex; gap: 20px; align-items: flex-start;
  transition: all .15s;
}
.onboarding-step.done { border-color: rgba(63,185,80,0.5); background: rgba(63,185,80,0.03); }
.onboarding-step:hover { border-color: var(--accent); }
.onboarding-step-num {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-elev-2); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: var(--text-muted); flex-shrink: 0;
}
.onboarding-step.done .onboarding-step-num {
  background: rgba(63,185,80,0.15); border-color: #3fb950; color: #3fb950;
}
.onboarding-step-body { flex: 1; min-width: 0; }
.onboarding-step-title {
  font-size: 16px; font-weight: 600; color: var(--text);
  margin: 0 0 4px; display: flex; align-items: center; gap: 8px;
}
.onboarding-step-desc { color: var(--text-muted); font-size: 13px; margin: 0 0 12px; line-height: 1.5; }
.onboarding-step-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.onboarding-step-check { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; cursor: pointer; }
.onboarding-step-check input { width: 16px; height: 16px; cursor: pointer; }

@media (max-width: 768px) {
  .hero-main { padding: 20px; }
  .hero-title { font-size: 24px; }
  .section-header-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .onboarding-step { flex-direction: column; gap: 12px; }
}

/* ══════════════════════════════════════════════════════════════════════
   1.6: Auth-страницы (login / register) — центрированная карточка
   ══════════════════════════════════════════════════════════════════════ */
main.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  min-height: calc(100vh - 64px - 100px);
}
.auth-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 30px;
  width: 100%;
  max-width: 380px;
}
.auth-card h2 { color: var(--accent); margin-top: 0; text-align: center; }
.auth-card .form-group { margin-bottom: 15px; display: flex; flex-direction: column; }
.auth-card label { margin-bottom: 5px; color: var(--text-muted); font-size: 0.85rem; }
.auth-card input, .auth-card select {
  padding: 10px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 5px; font-family: inherit;
}
.auth-card input:focus, .auth-card select:focus { outline: none; border-color: var(--accent); }
.auth-card button[type="submit"] {
  width: 100%; padding: 10px; background: var(--green-bg); color: #fff;
  border: none; border-radius: 5px; cursor: pointer; font-weight: bold; margin-top: 10px;
}
.auth-card button[type="submit"]:hover { background: var(--green-bg-hover); }
.auth-card .msg { color: var(--green); text-align: center; margin-bottom: 15px; font-size: 0.9rem; }
.auth-card .error { color: var(--red); text-align: center; margin-bottom: 15px; font-size: 0.9rem; }
.auth-card .gitea-btn {
  background: var(--border); margin-top: 15px; display: block; text-align: center;
  text-decoration: none; padding: 10px; border-radius: 5px; color: var(--text);
  font-weight: bold; font-size: 0.9rem;
}
.auth-card .gitea-btn:hover { background: var(--bg-elev-2); text-decoration: none; }
.auth-card .links { margin-top: 15px; text-align: center; font-size: 0.85rem; }
.auth-card .links a { color: var(--accent); text-decoration: none; display: block; margin-bottom: 5px; }
@media (max-width: 768px) {
  main.auth-page { padding: 20px 12px; min-height: calc(100vh - 60px - 80px); }
  .auth-card { padding: 20px; }
}


/* ══════════════════════════════════════════════════════════════════════
   F: Files v2.0 — красивый редизайн
   ══════════════════════════════════════════════════════════════════════ */

.files-hero {
  background: linear-gradient(135deg, #161b22 0%, #1c2128 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.files-hero-left { flex: 1; min-width: 200px; }
.files-hero h1 { margin: 0 0 4px; font-size: 24px; color: var(--text); }
.files-hero .subtitle { color: var(--text-muted); font-size: 13px; margin: 0; }
.files-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.files-section { margin-bottom: 32px; }
.files-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.files-section-head h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.files-section-head h2 .count {
  background: var(--bg-elev-2);
  color: var(--text-muted);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

.space-grid-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.space-card-v2 {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all .15s;
  position: relative;
  overflow: hidden;
}
.space-card-v2::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #58a6ff, #a371f7);
}
.space-card-v2:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  text-decoration: none;
}
.space-card-v2-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.space-card-v2-icon { font-size: 32px; line-height: 1; }
.space-card-v2-vis {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.space-card-v2-vis.public { background: rgba(63,185,80,0.15); color: #3fb950; }
.space-card-v2-vis.internal { background: rgba(210,153,34,0.15); color: #d29922; }
.space-card-v2-vis.private { background: rgba(248,81,73,0.15); color: #f85149; }
.space-card-v2-title { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.3; }
.space-card-v2-desc {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.space-card-v2-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
  padding-top: 8px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.space-card-v2-meta span { display: inline-flex; align-items: center; gap: 4px; }

.folder-grid-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.folder-tile-v2 {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all .15s;
}
.folder-tile-v2:hover {
  border-color: var(--accent);
  background: var(--bg-elev-2);
  text-decoration: none;
  transform: translateX(2px);
}
.folder-tile-v2-icon { font-size: 24px; flex-shrink: 0; }
.folder-tile-v2-info { flex: 1; min-width: 0; }
.folder-tile-v2-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-tile-v2-meta { font-size: 11px; color: var(--text-dim); }

.file-grid-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.file-tile-v2 {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all .15s;
}
.file-tile-v2:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.3);
}
.file-tile-v2-preview {
  height: 140px;
  background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.file-tile-v2-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.file-tile-v2-icon-big { font-size: 56px; opacity: .5; }
.file-tile-v2-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(88,166,255,0.9);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  z-index: 2;
}
.file-tile-v2-body {
  padding: 10px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.file-tile-v2-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.file-tile-v2-desc {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-tile-v2-meta {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.file-tile-v2-actions {
  display: flex;
  gap: 4px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  justify-content: flex-end;
  opacity: 0;
  transition: opacity .15s;
}
.file-tile-v2:hover .file-tile-v2-actions { opacity: 1; }
.file-tile-v2-actions a,
.file-tile-v2-actions button {
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  text-decoration: none;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.file-tile-v2-actions a:hover { background: var(--bg-elev-2); color: var(--accent); text-decoration: none; }
.file-tile-v2-actions button:hover { background: var(--bg-elev-2); color: var(--text); }
.file-tile-v2-actions .danger:hover { color: var(--red); }

/* Upload zone — flex-центрирование (фикс "сломался дизайн") */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 32px 24px;
  background: var(--bg-elev);
  transition: all .2s;
  margin-bottom: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  user-select: none;
}
.upload-zone:hover { border-color: var(--accent); background: var(--bg-elev-2); }
.upload-zone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(88,166,255,0.08);
  transform: scale(1.005);
}
.upload-zone.uploading {
  border-color: var(--accent);
  background: rgba(88,166,255,0.05);
  cursor: wait;
}
.upload-zone input[type="file"] { display: none; }
.upload-zone-icon {
  font-size: 42px;
  margin-bottom: 10px;
  opacity: .7;
  line-height: 1;
}
.upload-zone-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.upload-zone-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.files-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-elev);
  border: 1px dashed var(--border);
  border-radius: 10px;
}
.files-empty .icon { font-size: 48px; opacity: .4; margin-bottom: 12px; }
.files-empty h3 { color: var(--text); font-size: 16px; margin: 0 0 6px; }
.files-empty p { font-size: 13px; margin: 0 0 16px; }

.breadcrumbs-bar {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  margin-bottom: 20px;
}

.meta-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elev);
  border-radius: 8px;
  overflow: hidden;
}
.meta-table th,
.meta-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.meta-table th {
  background: var(--bg-elev-2);
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 600;
}
.meta-table tr:hover { background: var(--bg-elev-2); }
.meta-table tr:last-child td { border-bottom: none; }

@media (max-width: 768px) {
  .space-grid-v2 { grid-template-columns: 1fr; }
  .folder-grid-v2 { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .file-grid-v2 { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .file-tile-v2-preview { height: 100px; }
  .file-tile-v2-icon-big { font-size: 40px; }
  .files-hero { padding: 16px 20px; }
  .files-hero h1 { font-size: 20px; }
}

/* F2: Кнопки удаления папок/пространств */
.folder-tile-v2-wrap {
  position: relative;
}
.folder-tile-v2-wrap .folder-tile-v2 {
  padding-right: 36px;
}
.folder-delete-form {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  transition: opacity .15s;
  z-index: 2;
}
.folder-tile-v2-wrap:hover .folder-delete-form { opacity: 1; }
.folder-delete-btn {
  background: rgba(248,81,73,0.85);
  color: #fff;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
}
.folder-delete-btn:hover { background: var(--red); }
