:root {
  --bg-page: #f6f7f9;
  --bg-app: #f1f3f6;
  --bg-rail: #e9edf2;
  --bg-surface: #ffffff;
  --bg-surface-soft: #f8fafc;
  --bg-surface-muted: #eef2f7;
  --bg-overlay: rgba(15, 23, 42, 0.28);
  --line: #dbe2ea;
  --line-soft: #e7edf3;
  --line-strong: #c8d2de;
  --text: #1f2937;
  --text-soft: #475569;
  --muted: #7b8794;
  --primary: #4A90E2;
  --primary-hover: #3d7fcd;
  --primary-soft: rgba(74, 144, 226, 0.14);
  --primary-soft-strong: rgba(74, 144, 226, 0.24);
  --sand: #edf1f5;
  --danger: #cf5f5f;
  --danger-soft: #fbecec;
  --success: #2f7d5c;
  --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.045);
  --shadow-card: 0 16px 30px rgba(15, 23, 42, 0.06);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; min-height: 0; }
body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
textarea { resize: none; }

.app-shell {
  height: 100%;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  background: var(--bg-app);
  overflow: hidden;
}
.workspace {
  min-height: 0;
  overflow: hidden;
}
.panel { display: none; height: 100%; min-height: 0; overflow: hidden; }
.panel.is-active { display: block; }
.workspace-panel {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  gap: 14px;
}
.workspace-panel--chat {
  grid-template-columns: 316px minmax(0, 1fr);
}
.workspace-content {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.app-rail {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 10px;
  background: var(--bg-rail);
  border: 1px solid var(--line);
  border-radius: 26px;
  overflow: hidden;
}
.rail-brand {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: var(--primary);
  margin: 0 auto;
}
.rail-user {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 6px 0 2px;
}
.rail-user__avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--primary);
  background: var(--bg-surface);
  border: 1px solid var(--line-soft);
}
.rail-user__meta {
  display: grid;
  gap: 2px;
  text-align: center;
}
.rail-user__meta strong {
  font-size: 12px;
  line-height: 1.2;
}
.rail-user__meta span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}
.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rail-btn {
  width: 100%;
  min-height: 60px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  color: var(--text-soft);
  display: grid;
  gap: 5px;
  justify-items: center;
  align-content: center;
  padding: 8px 6px;
}
.rail-btn:hover {
  background: var(--bg-surface-soft);
  border-color: var(--line-soft);
}
.rail-btn.is-active {
  background: var(--bg-surface);
  color: var(--primary);
  border-color: rgba(74, 144, 226, 0.16);
  box-shadow: var(--shadow-soft);
}
.rail-btn__icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--bg-surface-muted);
  font-size: 13px;
  font-weight: 800;
}
.rail-btn.is-active .rail-btn__icon {
  background: var(--primary-soft);
}
.rail-btn__label {
  font-size: 11px;
  font-weight: 700;
}
.rail-footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
}
.rail-utility {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-surface);
  color: var(--text-soft);
}
.rail-utility:hover { background: var(--bg-surface-muted); }

.card,
.sidebar,
.thread,
.placeholder,
.admin-card {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
}
.sidebar,
.thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.sidebar--context {
  background: var(--bg-surface-soft);
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-surface-soft);
}
.panel-body {
  min-height: 0;
  overflow: auto;
  padding: 12px;
}
.sidebar-card {
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--bg-surface);
  overflow: hidden;
}
.sidebar-card__title {
  padding: 12px 14px 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sidebar-card__body {
  padding: 0 14px 14px;
}
.sidebar-card__list {
  display: grid;
  gap: 10px;
}
.sidebar-card__list > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}
.sidebar-card__list > div strong {
  color: var(--text);
  font-size: 13px;
}

.brand,
.topbar,
.tabs,
.chat-rail,
.detail { display: none; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--bg-surface-muted);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}
.badge.accent { background: var(--primary-soft); color: var(--primary); }
.badge.status-live { background: rgba(47, 138, 93, 0.11); color: var(--success); }
.badge.status-offline { background: var(--sand); color: var(--muted); }
.btn {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--bg-surface);
  color: var(--text-soft);
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.btn:hover {
  background: var(--bg-surface-soft);
  border-color: var(--line);
  color: var(--text);
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-danger {
  background: var(--bg-surface);
  border-color: rgba(201, 106, 98, 0.24);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger-soft); border-color: rgba(201, 106, 98, 0.32); color: var(--danger); }
.spacer { flex: 1; }
.main,
.tools { display: none; }

.home-card,
.placeholder,
.admin-wrap {
  height: 100%;
  overflow: auto;
}
.home-card {
  display: grid;
  gap: 18px;
  padding: 4px;
  background: transparent;
  box-shadow: none;
  border: 0;
}
.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) 320px;
  gap: 22px;
  padding: 26px;
  border-radius: 22px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}
.home-hero__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.home-hero__eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.home-hero__badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}
.home-hero__eyebrow-text {
  font-size: 13px;
  color: var(--muted);
}
.home-hero__title {
  margin: 0;
  font-size: 32px;
  line-height: 1.14;
  letter-spacing: -0.03em;
}
.home-hero__desc,
.muted {
  margin: 0;
  color: var(--muted);
}
.hero-notice {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bg-surface-soft);
  border: 1px solid var(--line-soft);
}
.hero-notice__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.hero-notice__label {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: .03em;
}
.hero-notice__toggle {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
}
.hero-notice__toggle:hover {
  color: var(--text);
}
.hero-notice__body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
}
.hero-notice__body.is-collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.home-hero__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.home-hero__side {
  min-width: 0;
}
.hero-meta-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 18px;
  background: var(--bg-surface-soft);
  border: 1px solid var(--line);
}
.hero-meta-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.hero-meta-card__label {
  font-size: 13px;
  color: var(--muted);
}
.hero-meta-card__value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}
.top-space { margin-top: 14px; }
.top-space-sm { margin-top: 8px; }
.row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stat-list { display: grid; gap: 12px; margin-top: 12px; }
.stat-item {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bg-surface-soft);
  border: 1px solid var(--line-soft);
  display: grid;
  gap: 4px;
}
.stat-item span { color: var(--muted); }
.home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.entry {
  min-height: 136px;
  padding: 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.entry:hover { border-color: var(--line-strong); }
.placeholder,
.admin-wrap { padding: 24px; }
.admin-wrap { display: grid; gap: 16px; }
.admin-card { padding: 18px; }
.kv-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kv-item {
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-surface-soft);
  display: grid;
  gap: 6px;
}
.kv-item span { color: var(--muted); font-size: 12px; }

.sidebar-search {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  padding: 11px 13px;
}
.session-list-section { padding-top: 4px; }
.session-section-label {
  padding: 8px 12px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.stack { display: flex; flex-direction: column; gap: 10px; }
.session-item {
  position: relative;
  width: 100%;
  padding: 12px 12px 12px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}
.session-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: transparent;
}
.session-item:hover {
  background: var(--bg-surface);
  border-color: var(--line-soft);
}
.session-item.is-active {
  background: var(--bg-surface);
  border-color: rgba(74, 144, 226, 0.16);
  box-shadow: var(--shadow-soft);
}
.session-item.is-active::before { background: var(--primary); }
.session-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 800;
}
.session-meta { min-width: 0; }
.session-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.session-title {
  font-weight: 700;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-subtitle {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-trailing { display: grid; justify-items: end; gap: 6px; }
.session-time { color: var(--muted); font-size: 11px; }
.unread-dot {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.thread {
  background: var(--bg-surface);
}
.thread-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}
.thread-title { font-size: 20px; font-weight: 800; line-height: 1.15; letter-spacing: -0.015em; }
.thread-subtitle { color: var(--muted); font-size: 13px; }
.thread-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.announcement,
.warning-box {
  margin: 14px 18px 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line-soft);
  background: var(--bg-surface-soft);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-direction: column;
}
.warning-box { background: #f4ede3; border-color: #d9c7ad; color: #7a5b0e; }
.message-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-surface-soft);
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}
.message {
  align-self: flex-start;
  width: fit-content;
  max-width: min(72%, 760px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.message.is-self {
  align-self: flex-end;
  margin-left: auto;
  align-items: flex-end;
}
.message-meta {
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.message-bubble {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  padding: 10px 13px;
  border-radius: 18px;
  border: 1px solid var(--line-soft);
  background: var(--bg-surface);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--text);
}
.message.is-self .message-bubble {
  background: var(--primary-soft);
  border-color: rgba(74, 144, 226, 0.16);
}
.message-bubble--vote {
  padding: 0;
  border-radius: 18px;
  background: var(--bg-surface);
  overflow: hidden;
}
.message.is-self .message-bubble--vote { background: var(--bg-surface); }
.vote-card {
  display: flex;
  flex-direction: column;
  min-width: 296px;
  max-width: 420px;
}
.vote-card__header,
.vote-card__footer { background: var(--bg-surface); }
.vote-card__header { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px 8px; }
.vote-card__title-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vote-card__title { font-size: 15px; font-weight: 700; line-height: 1.35; color: var(--text); }
.vote-card__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.vote-card__status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--bg-surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.vote-card__status.is-open { background: rgba(47, 138, 93, 0.1); color: var(--success); }
.vote-card__status.is-closed { background: var(--sand); color: var(--text-soft); }
.vote-card__desc { padding: 0 14px 10px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.vote-card__options { display: flex; flex-direction: column; gap: 6px; padding: 0 14px 10px; }
.vote-option-card {
  display: grid;
  grid-template-columns: 18px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--bg-surface-soft);
}
.vote-option-card.is-selected { border-color: rgba(74, 144, 226, 0.22); background: var(--primary-soft); }
.vote-option-card.is-disabled { opacity: .76; }
.vote-option-check {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--bg-surface);
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 11px;
  line-height: 1;
}
.vote-option-card.is-selected .vote-option-check { border-color: var(--primary); background: var(--primary); color: #fff; }
.vote-option-text { min-width: 0; color: var(--text); font-size: 13px; line-height: 1.35; }
.vote-option-count { color: var(--muted); font-size: 12px; font-weight: 700; }
.vote-option-card.is-selected .vote-option-count { color: var(--primary); }
.vote-card__footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--line-soft);
}
.vote-card__meta { color: var(--muted); font-size: 12px; line-height: 1.4; }
.vote-card__cta { margin-left: auto; }
.vote-card__button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(74, 144, 226, 0.16);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}
.vote-card__button:hover { background: #e7f1fd; }
.composer-wrap {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.composer-shell {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--bg-surface-soft);
  padding: 12px 12px 10px;
}
.composer-grid { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
input, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--text);
  min-width: 0;
}
#draft-input {
  min-height: 88px;
  border: none;
  background: transparent;
  padding: 4px 6px;
}
#draft-input:focus { box-shadow: none; }
input:focus, textarea:focus {
  outline: none;
  border-color: rgba(74, 144, 226, 0.18);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.08);
}
.send-btn {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.send-btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.send-btn svg { width: 20px; height: 20px; }
.toast-root {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  min-width: 280px;
  max-width: 360px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
}
.toast-title { font-weight: 700; margin-bottom: 4px; }
.modal-root {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--bg-overlay);
  z-index: 40;
  padding: 20px;
}
.modal-root.is-open { display: flex; }
.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 30px 60px rgba(28, 37, 52, 0.12);
}
.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: var(--bg-surface-soft);
}
.modal-head { border-bottom: 1px solid var(--line); }
.modal-foot { border-top: 1px solid var(--line); justify-content: flex-end; }
.modal-body { padding: 18px; overflow: auto; }
.modal-title { margin: 0; font-size: 18px; font-weight: 800; }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.field > label { color: var(--text-soft); font-size: 13px; font-weight: 700; }
.field-hint { color: var(--muted); font-size: 12px; }
.vote-builder { display: grid; gap: 14px; }
.vote-options-textarea { min-height: 120px; }
.vote-settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vote-detail { display: grid; gap: 14px; }
.vote-detail__header { display: flex; align-items: flex-start; gap: 10px; padding-bottom: 4px; }
.vote-detail__meta { color: var(--muted); font-size: 12px; }
.vote-detail__options { display: flex; flex-direction: column; gap: 8px; }
.vote-detail-option {
  display: grid;
  grid-template-columns: 20px minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--bg-surface-soft);
  cursor: pointer;
}
.vote-detail-option:hover { border-color: rgba(74, 144, 226, 0.16); }
.vote-detail-option.is-selected { background: var(--primary-soft); border-color: rgba(74, 144, 226, 0.2); }
.vote-detail-option input { width: 18px; height: 18px; margin: 0; }
.inline-alert { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-surface-soft); color: var(--text-soft); }
.inline-alert.is-danger { border-color: rgba(217, 91, 91, 0.2); background: var(--danger-soft); color: #9a3636; }
.device-sheet { display: grid; gap: 12px; }
.recovery-box { padding: 14px; border-radius: 16px; border: 1px solid rgba(74, 144, 226, 0.16); background: var(--primary-soft); }
.recovery-box textarea { min-height: 78px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.floating {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  border: 1px solid rgba(74, 144, 226, 0.2);
  background: var(--bg-surface);
  color: var(--primary);
  font-size: 22px;
  box-shadow: var(--shadow-card);
}
.small { font-size: 12px; }

@media (max-width: 1180px) {
  .workspace-panel,
  .workspace-panel--chat { grid-template-columns: 280px minmax(0, 1fr); }
  .home-hero, .home-grid { grid-template-columns: 1fr; }
  .kv-grid, .vote-settings-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-rail {
    order: 2;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 18px;
  }
  .rail-user { grid-template-columns: 42px 1fr; display: grid; justify-items: start; align-items: center; gap: 8px; }
  .rail-nav { flex-direction: row; flex-wrap: wrap; }
  .rail-btn { width: auto; min-height: 42px; padding: 8px 10px; grid-auto-flow: column; gap: 8px; }
  .rail-btn__label { font-size: 12px; }
  .rail-footer { margin-top: 0; grid-auto-flow: column; }
  .workspace-panel,
  .workspace-panel--chat { grid-template-columns: 1fr; }
  .sidebar { max-height: 320px; }
}
@media (max-width: 720px) {
  .app-shell { gap: 10px; padding: 10px; }
  .message { max-width: 100%; }
  .vote-card { min-width: 0; }
  .composer-grid { grid-template-columns: 1fr; }
  .send-btn { width: 100%; border-radius: 14px; }
  .kv-grid, .vote-settings-row { grid-template-columns: 1fr; }
}


.auth-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(420px, 560px);
  gap: 18px;
  padding: 18px;
  background:
    radial-gradient(circle at top left, rgba(74, 144, 226, 0.08), transparent 34%),
    linear-gradient(180deg, var(--bg-page) 0%, var(--bg-app) 100%);
  overflow: auto;
}
.auth-hero,
.auth-card {
  border-radius: 28px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}
.auth-hero {
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.92));
  padding: 34px;
  display: grid;
  align-content: start;
  gap: 18px;
}
.auth-hero__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.auth-hero h1 {
  margin: 0;
  font-size: 42px;
  line-height: 1.08;
  letter-spacing: -0.04em;
}
.auth-hero p {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
}
.auth-hero__highlights {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}
.auth-highlight {
  display: grid;
  gap: 5px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.82);
  border: 1px solid var(--line-soft);
}
.auth-highlight strong {
  font-size: 15px;
}
.auth-highlight span {
  color: var(--muted);
}
.auth-panel {
  min-height: 0;
  display: grid;
  align-items: center;
}
.auth-card {
  background: rgba(255,255,255,0.94);
  padding: 26px;
  display: grid;
  gap: 18px;
}
.auth-card__head {
  display: grid;
  gap: 8px;
}
.auth-card__eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.auth-card__head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.auth-card__head p,
.auth-card__foot,
.auth-inline-note {
  color: var(--muted);
}
.auth-switch {
  display: flex;
  justify-content: flex-start;
}
.link-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
}
.link-btn:hover { color: var(--primary-hover); }
.auth-form {
  display: grid;
  gap: 14px;
}
.auth-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.auth-field {
  gap: 8px;
}
.auth-password {
  position: relative;
}
.auth-input--password {
  padding-right: 68px;
}
.auth-password__toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  min-width: 52px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-surface-soft);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}
.auth-password__toggle:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.auth-field > span {
  font-weight: 700;
  color: var(--text-soft);
}
.auth-input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.auth-input:focus {
  border-color: rgba(74, 144, 226, 0.52);
  box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.12);
}
.auth-submit {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  font-weight: 800;
}
.auth-card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
  font-size: 12px;
}

.auth-shell--minimal {
  grid-template-columns: minmax(0, 520px);
  justify-content: center;
  align-items: center;
}
.auth-panel--minimal {
  max-width: 520px;
  width: 100%;
}
.auth-card--minimal {
  gap: 22px;
}
.auth-card__head--minimal {
  gap: 12px;
}
.auth-card__head--minimal h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: -0.03em;
}
.auth-wordmark {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}
.auth-card__dot {
  color: var(--line-strong);
}
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1180px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-hero {
    padding: 26px;
  }
}
@media (max-width: 720px) {
  body { overflow: auto; }
  .auth-shell {
    padding: 12px;
    gap: 12px;
  }
  .auth-hero h1 {
    font-size: 30px;
  }
  .auth-card {
    padding: 20px;
  }
  .home-hero {
    padding: 20px;
  }
  .home-hero__title {
    font-size: 28px;
  }
  .auth-form__grid,
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .app-shell {
    grid-template-columns: 1fr;
    padding: 10px;
  }
  .app-rail {
    min-height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
  .rail-nav {
    width: 100%;
    flex-direction: row;
    overflow: auto;
  }
  .rail-btn {
    min-width: 86px;
    min-height: 54px;
  }
}

.form-grid-3, .form-grid-4 {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field--end { display: flex; align-items: end; }
.checkbox-inline { display: inline-flex; align-items: center; gap: 8px; }
.table-like { display: flex; flex-direction: column; gap: 10px; }
.list-row.admin-list-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line, #d8e0ea);
  border-radius: 12px;
  background: var(--card, #fff);
}
.admin-list-row__main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.admin-actions-wrap { flex-wrap: wrap; justify-content: flex-end; }
.badge-inline {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(47,110,167,.12);
  color: var(--pri, #2f6ea7);
  font-size: 12px;
  font-weight: 600;
  margin-left: 6px;
}
@media (max-width: 980px) {
  .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .list-row.admin-list-row { flex-direction: column; }
}
