:root {
  --bg: #f4f8fc;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --line: #cbd7e6;
  --line-strong: #9fb3ca;
  --text: #0c1b2a;
  --muted: #5d6d7d;
  --blue: #2f7df6;
  --teal: #16bfa3;
  --orange: #ff9700;
  --red: #ff4d5c;
  --shadow: 0 8px 22px rgba(36, 54, 76, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1024px;
  color: var(--text);
  font: 14px/1.45 Arial, Helvetica, sans-serif;
  background:
    linear-gradient(rgba(164, 187, 212, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(164, 187, 212, 0.16) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
}

button,
.file-button,
input {
  height: 34px;
  border: 1px solid var(--line-strong);
  color: var(--text);
}

button,
.file-button,
.telegram-open-link {
  background: linear-gradient(#ffffff, #edf4fb);
  padding: 0 12px;
  font-weight: 700;
  cursor: pointer;
}

input {
  display: block;
  width: 100%;
  padding: 0 10px;
  background: #fff;
  font: inherit;
}

button:disabled {
  cursor: default;
  opacity: 0.62;
}

button:hover,
.file-button:hover,
.telegram-open-link:hover {
  border-color: var(--blue);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.app-hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 420px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 22px;
}

.auth-brand {
  min-width: 0;
  margin-bottom: 18px;
}

.auth-card h1 {
  font-size: 22px;
  margin-bottom: 6px;
}

.auth-card p {
  margin: 0 0 16px;
  color: var(--muted);
}

.auth-card label {
  display: block;
  margin: 12px 0 8px;
  color: var(--muted);
  font-weight: 700;
}

.auth-card button {
  width: 100%;
  margin-top: 6px;
}

.auth-status {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(25, 44, 64, 0.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal);
}

.brand strong {
  display: block;
  font-size: 15px;
}

.brand span:last-child {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.current-user {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.file-button {
  display: inline-flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 0;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 14px 10px;
}

.sidebar-title {
  padding: 0 10px 10px;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
}

.section-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.role-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.role-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px 4px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.role-head small {
  color: var(--muted);
  font-weight: 400;
}

.section-button {
  width: 100%;
  min-height: 48px;
  height: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  align-items: center;
  text-align: left;
  border-color: transparent;
  background: transparent;
  border-left: 3px solid transparent;
  font-weight: 700;
}

.section-button:hover,
.section-button.active {
  background: var(--panel);
  border-color: var(--line);
  border-left-color: var(--teal);
}

.section-button small {
  color: var(--muted);
  font-weight: 400;
}

.section-button em {
  grid-column: 1 / -1;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 400;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  padding: 18px 22px 36px;
  overflow: auto;
}

.content-head {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.kicker {
  margin: 0 0 5px;
  color: var(--teal);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.summary {
  max-width: 920px;
  margin: 6px 0 0;
  color: var(--muted);
}

.progress-card {
  width: 112px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
}

.progress-card span {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: var(--blue);
}

.progress-card small {
  color: var(--muted);
}

.questions {
  display: grid;
  gap: 12px;
}

.settings-card {
  max-width: 760px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 14px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.project-card {
  min-height: 142px;
  text-align: left;
  display: block;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 14px;
}

.project-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.project-card span {
  display: block;
  color: var(--muted);
  font-weight: 400;
}

.project-card small {
  display: inline-block;
  margin-top: 14px;
  color: var(--teal);
  font-weight: 800;
}

.settings-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.settings-card p {
  color: var(--muted);
}

.trusted-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.telegram-panel {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.integration-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 30px;
}

.integration-row span,
.telegram-link-box small {
  color: var(--muted);
}

.integration-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telegram-link-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.telegram-config-form {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.telegram-config-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-weight: 700;
}

.telegram-config-form .inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.telegram-config-form .inline-check input {
  width: 16px;
  height: 16px;
}

.telegram-link-box small {
  grid-column: 1 / -1;
  font-size: 12px;
}

.telegram-open-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  color: var(--text);
  text-decoration: none;
}

.question-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.question-head {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.question-number {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  color: var(--blue);
  font-weight: 800;
  background: #fff;
}

.question-title {
  font-weight: 800;
}

.question-tag {
  color: var(--muted);
  font-size: 12px;
}

.options {
  padding: 10px 12px 12px;
  display: grid;
  gap: 8px;
}

.option {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 8px;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

.option:hover {
  border-color: var(--blue);
}

.option input {
  margin-top: 2px;
}

.option strong {
  display: block;
  margin-bottom: 2px;
}

.option span {
  color: var(--muted);
}

.note-area {
  margin: 0 12px 12px;
}

.note-area label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 700;
}

.note-area textarea {
  display: block;
  width: 100%;
  min-height: 72px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
  font: inherit;
}

.statusbar {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 16px;
  background: #152233;
  color: #dbe8f5;
  font-size: 12px;
}

#storageHint {
  color: #9fb3ca;
}

.danger {
  color: var(--red);
}
