* {
  box-sizing: border-box;
}

/* Токены раскладки/темы; числа USTAV_* / SPOT_MAX согласованы с frontend/constants.js и main (nav, gallery). */
:root {
  --bg: #eef0f6;
  --surface: #ffffff;
  --text: #1a1d26;
  --muted: #5c6478;
  --border: #d5dae6;
  --accent: #2f4cb8;
  --accent-hover: #243c96;
  --nav-active: #e8ecfb;
  --shadow: 0 8px 28px rgba(26, 29, 38, 0.08);
  --radius: 12px;
  --sidebar-w: 220px;
  --sidebar-collapsed-w: 72px;
  --ustav-page-img-w: 480px;
  --ustav-page-img-h: 280px;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

code {
  font-size: 0.9em;
  background: #f0f2f8;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.hidden {
  display: none !important;
}

/* ——— Login ——— */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  width: 100%;
  max-width: 380px;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 20px;
  font-size: 1.45rem;
}

label,
input,
select,
button {
  font: inherit;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: #333;
}

input,
select {
  display: block;
  width: 100%;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

select {
  cursor: pointer;
}

#primary-action {
  display: block;
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
}

#primary-action:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.login-reset-row {
  margin: 8px 0 0;
  text-align: center;
}

.login-reset-row .linkish {
  margin-top: 0;
}

.login-resend-row {
  margin: 8px 0 0;
  text-align: center;
}

.login-resend-row .linkish {
  margin-top: 0;
}

.login-resend-row #resend-hint {
  display: block;
  margin-top: 6px;
}

button.linkish {
  background: transparent;
  color: var(--accent);
  padding: 0;
  margin-top: 8px;
  text-decoration: underline;
  width: auto;
  display: inline;
  border: none;
  cursor: pointer;
  font: inherit;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.error {
  color: #b42318;
  margin-top: 12px;
}

/* ——— App shell: 12 columns ——— */

#app-shell {
  min-height: 100vh;
}

.shell-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 22px 32px;
  align-items: start;
}

.nav-col {
  grid-column: 1 / span 2;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 12px 12px;
  position: sticky;
  top: 16px;
  align-self: start;
  min-width: 0;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  padding: 4px 10px 14px;
  letter-spacing: 0.02em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  border: 1px solid transparent;
}

.nav-link:hover {
  background: #f4f6fb;
}

.nav-link.is-active {
  background: var(--nav-active);
  border-color: #c9d4f5;
  color: var(--accent);
  font-weight: 600;
}

.nav-ico {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.88;
}

.nav-link.is-active .nav-ico {
  opacity: 1;
}

.nav-collapse-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: #fafbff;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.nav-collapse-toggle:hover {
  border-color: #b8c2dc;
  color: var(--text);
}

.nav-collapse-icon {
  font-size: 1.1rem;
  width: 1.25rem;
  text-align: center;
}

html.nav-collapsed .nav-text,
html.nav-collapsed .nav-brand,
html.nav-collapsed .nav-collapse-label {
  display: none;
}

html.nav-collapsed .nav-col {
  grid-column: 1 / span 1;
  padding-inline: 8px;
}

html.nav-collapsed .nav-link {
  justify-content: center;
  padding-inline: 6px;
}

html.nav-collapsed .content-col {
  grid-column: 2 / span 8;
}

html.nav-collapsed .aside-col {
  grid-column: 10 / span 3;
}

html.nav-collapsed .nav-collapse-toggle {
  justify-content: center;
}

.content-col {
  grid-column: 3 / span 7;
  min-width: 0;
}

.aside-col {
  grid-column: 10 / span 3;
  position: sticky;
  top: 16px;
  align-self: start;
}

.aside-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  border: 1px dashed var(--border);
}

.aside-col .aside-panel-after {
  margin-top: 14px;
}

.aside-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 600;
}

.aside-note {
  margin: 0;
}

.page-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 26px 28px;
  min-height: 200px;
}

.page-title {
  margin: 0 0 16px;
  font-size: 1.35rem;
}

.lead {
  font-size: 1.05rem;
  margin-top: 0;
}

.page-card p {
  margin: 0 0 14px;
}

.stub {
  font-size: 1.1rem;
  color: var(--muted);
  font-style: italic;
}

.chairman-block {
  margin-top: 18px;
}

.aside-col .aside-chairman-line.chairman-block {
  margin-top: 4px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.aside-col .aside-chairman-line a {
  word-break: break-all;
}

.aside-self-profile {
  font-size: 0.95rem;
  line-height: 1.5;
}

.aside-self-name {
  margin: 0 0 8px;
}

.aside-self-line {
  margin: 0 0 10px;
}

.aside-primary-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.aside-spot-block {
  margin-top: 12px;
}

.aside-spot-title {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 0.92rem;
}

.aside-subcaption {
  margin: 8px 0 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.aside-bullets {
  margin: 0;
  padding-left: 1.15rem;
}

.gallery {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 12px;
}

.figure-static {
  margin: 0;
}

.figure-static img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.external-link {
  color: var(--accent);
  font-weight: 600;
}

.btn-logout {
  padding: 10px 22px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.btn-logout:hover {
  background: var(--accent-hover);
}

.btn-logout:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ——— Mobile topbar & menu ——— */

.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.mobile-brand {
  font-weight: 700;
}

.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.mobile-menu-panel {
  position: fixed;
  left: 0;
  right: 0;
  top: 57px;
  z-index: 35;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  max-height: min(70vh, 420px);
  overflow: auto;
}

.mobile-menu-list {
  display: flex;
  flex-direction: column;
  padding: 8px 12px 16px;
  gap: 2px;
}

.nav-link-mobile {
  padding: 12px 12px;
  font-size: 1rem;
}

@media (max-width: 900px) {
  .shell-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
    padding: 16px;
  }

  .nav-col {
    grid-column: 1 / span 3;
  }

  .content-col {
    grid-column: 4 / span 6;
  }

  .aside-col {
    grid-column: 10 / span 3;
  }

  html.nav-collapsed .nav-col {
    grid-column: 1 / span 2;
  }

  html.nav-collapsed .content-col {
    grid-column: 3 / span 7;
  }

  html.nav-collapsed .aside-col {
    grid-column: 10 / span 3;
  }
}

.section-rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0 22px;
}

.section-title {
  font-size: 1.1rem;
  margin: 0 0 14px;
}

.req {
  color: #b42318;
}

textarea.proposal-textarea {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  line-height: 1.55;
  resize: none;
}

textarea.proposal-textarea-grow {
  min-height: calc(1.55em * 3 + 20px);
  max-height: calc(1.55em * 14 + 20px);
  overflow-y: auto;
}

textarea.proposal-textarea-fixed {
  min-height: calc(1.55em * 5 + 20px);
  max-height: calc(1.55em * 5 + 20px);
  overflow-y: auto;
}

.char-counter {
  margin: 0 0 16px;
  font-size: 0.85rem;
  color: var(--muted);
}

.btn-primary {
  padding: 10px 22px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.btn-secondary {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f7f8fc;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #eef1f8;
}

.btn-secondary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.proposal-card,
.chairman-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 16px 14px;
  margin-bottom: 16px;
  background: #fafbff;
}

.proposal-card-meta,
.chairman-card-meta {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.proposal-card-body {
  white-space: pre-wrap;
  margin-bottom: 10px;
}

.proposal-card-number {
  font-size: 1.2rem;
  font-weight: 700;
  color: #111522;
  margin: 0 0 14px;
  letter-spacing: 0.02em;
}

.proposal-card-footer {
  margin-top: 18px;
  padding: 14px 14px 12px 20px;
  background: #fff;
  border-radius: 8px;
  border: 1px dashed #cfd6ea;
  font-size: 0.95rem;
  line-height: 1.5;
}

.proposal-footer-title {
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text);
}

.proposal-footer-person {
  margin-bottom: 10px;
  white-space: pre-wrap;
}

.proposal-footer-date {
  color: var(--muted);
  font-size: 0.9rem;
}

.proposal-card-body--lead {
  margin-top: 0;
}

.proposal-card-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 14px 0 8px;
  color: var(--text);
}

.proposal-card-section-title--body {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.decision-block-title {
  font-weight: 700;
  margin: 0 0 10px;
  font-size: 1rem;
}

.decision-reason-text {
  margin-bottom: 12px;
}

.decision-outcome-line {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.decision-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.decision-pending {
  color: var(--muted);
  font-style: italic;
}

.chairman-queue .empty-hint {
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 719px) {
  .mobile-topbar {
    display: flex;
  }

  .shell-grid {
    display: flex;
    flex-direction: column;
    padding: 12px 14px 24px;
    gap: 16px;
  }

  .nav-col {
    display: none;
  }

  .content-col,
  .aside-col,
  html.nav-collapsed .content-col,
  html.nav-collapsed .aside-col {
    width: 100%;
    grid-column: unset;
  }

  .nav-collapse-toggle {
    display: none;
  }

  .aside-col {
    position: static;
    order: 3;
  }

  .content-col {
    order: 2;
  }
}

/* ——— Голосование ОС / блок «Начало» ——— */

.home-voting-line {
  margin: 12px 0 16px;
  font-size: 1rem;
}

.home-voting-line--warn {
  color: #b42318;
}

.home-voting-line--ok {
  color: #1b6e3c;
}

.home-voting-link {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

.proposal-card-body--voted-muted {
  color: var(--muted);
}

.voting-your-vote {
  margin: 10px 0 6px;
  font-size: 0.95rem;
}

.voting-btn-row {
  flex-wrap: wrap;
  gap: 8px;
}

.voting-resolved-actions {
  margin-top: 20px;
}

.assembly-pending-note {
  margin: 10px 0 0;
  font-size: 0.95rem;
  color: var(--muted);
  font-style: italic;
}

.assembly-decision-block {
  margin-top: 12px;
}

.assembly-summary {
  margin: 8px 0 0;
  font-size: 0.95rem;
}

.assembly-how-line {
  margin: 10px 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.chairman-gv-stats {
  margin: 12px 0 0;
  font-size: 0.95rem;
  color: var(--text);
}

.chairman-gv-card .btn-primary {
  margin-top: 4px;
}
