:root {
  --bg: #0f1117;
  --bg-elevated: #161922;
  --bg-card: #1a1e28;
  --border: #2a3040;
  --text: #e8eaef;
  --text-muted: #8b93a7;
  --accent: #6b8cff;
  --accent-hover: #849cff;
  --accent-dim: rgba(107, 140, 255, 0.12);
  --success: #3ecf8e;
  --danger: #f07178;
  --warning: #e6b450;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --font: "DM Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.public-body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(107, 140, 255, 0.15), transparent),
    var(--bg);
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.logo-mark {
  color: var(--accent);
  font-size: 1.1rem;
}

.staff-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.staff-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}

.staff-nav a:hover,
.staff-nav a.active {
  color: var(--accent);
}

.nav-muted {
  opacity: 0.7;
}

.main-content {
  flex: 1;
  padding: 2rem 0 3rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.hero-sub {
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.exam-form.card {
  padding: 2rem;
}

.exam-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.exam-section:last-of-type {
  border-bottom: none;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 1.25rem;
  letter-spacing: 0.02em;
}

.form-group {
  margin-bottom: 1.25rem;
}

.question-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.required {
  color: var(--danger);
}

.input,
.select,
.textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.textarea {
  resize: vertical;
  min-height: 100px;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.choice-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.choice-item:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.choice-item input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.ranking-table-wrap {
  overflow-x: auto;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ranking-table th,
.ranking-table td {
  border: 1px solid var(--border);
  padding: 0.65rem;
  text-align: center;
}

.ranking-table th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 500;
}

.ranking-item-label {
  text-align: left !important;
  font-weight: 500;
  min-width: 160px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #0f1117;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
}

.btn-danger {
  background: rgba(240, 113, 120, 0.15);
  color: var(--danger);
  border: 1px solid rgba(240, 113, 120, 0.35);
}

.btn-danger:hover {
  background: rgba(240, 113, 120, 0.25);
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

.form-actions {
  margin-top: 1.5rem;
  text-align: center;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.alert-success {
  background: rgba(62, 207, 142, 0.12);
  border: 1px solid rgba(62, 207, 142, 0.35);
  color: var(--success);
}

.alert-error {
  background: rgba(240, 113, 120, 0.12);
  border: 1px solid rgba(240, 113, 120, 0.35);
  color: var(--danger);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-pending {
  background: rgba(230, 180, 80, 0.15);
  color: var(--warning);
}

.badge-accepted {
  background: rgba(62, 207, 142, 0.15);
  color: var(--success);
}

.badge-refused {
  background: rgba(240, 113, 120, 0.15);
  color: var(--danger);
}

.badge-lg {
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
}

.text-muted {
  color: var(--text-muted);
}

.small {
  font-size: 0.85rem;
}

.auth-card {
  max-width: 400px;
  margin: 3rem auto;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-head h1 {
  margin: 0.25rem 0;
  font-size: 1.5rem;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.back-link:hover {
  color: var(--accent);
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.filter-tabs a {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  transition: all 0.15s;
}

.filter-tabs a:hover,
.filter-tabs a.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.submissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.submission-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.submission-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.submission-note-preview {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.5rem 0;
}

.two-col-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .two-col-layout {
    grid-template-columns: 1fr;
  }
}

.answer-block {
  margin-bottom: 1rem;
}

.answer-item {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.answer-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.answer-item h4 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.answer-text {
  margin: 0;
  white-space: pre-wrap;
}

.answer-list {
  margin: 0;
  padding-left: 1.25rem;
}

.answer-empty {
  color: var(--text-muted);
  font-style: italic;
}

.sticky-panel {
  position: sticky;
  top: 5rem;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.staff-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .staff-grid {
    grid-template-columns: 1fr;
  }
}

.section-admin {
  margin-bottom: 1rem;
}

.section-admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-admin-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.question-edit {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  background: var(--bg-elevated);
}

.question-edit summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.question-edit summary::-webkit-details-marker {
  display: none;
}

.question-edit .meta {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.question-form {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}

/* ——— Page questions staff ——— */
.questions-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.card-highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.15);
  margin-bottom: 1.25rem;
}

.card-title {
  margin: 0 0 1.25rem;
  font-size: 1.15rem;
}

.card-compact {
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.section-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.section-inline-label {
  font-weight: 500;
  margin: 0;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
}

@media (max-width: 640px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

.check-row {
  display: flex;
  align-items: stretch;
}

.check-card {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin: 0;
}

.check-card small {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.form-row-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.btn-lg {
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  margin-top: 0.5rem;
}

.type-picker {
  margin-top: 0.35rem;
}

.type-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}

.type-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.75rem 0.85rem;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.type-pill:hover {
  border-color: var(--accent);
}

.type-pill.is-active {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
}

.type-pill-icon {
  font-size: 1.1rem;
  opacity: 0.9;
}

.type-pill-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.type-pill-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.section-block {
  margin-bottom: 1.5rem;
}

.section-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.section-block-head h2 {
  margin: 0 0 0.2rem;
}

.empty-section {
  color: var(--text-muted);
  margin: 0;
  padding: 0.5rem 0;
}

.question-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  overflow: hidden;
  background: var(--bg-elevated);
}

.question-card-preview {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
}

.question-num {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 600;
}

.question-card-label {
  margin: 0 0 0.5rem;
  line-height: 1.45;
}

.question-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.tag-req {
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.tag-ok {
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

.tag-off {
  opacity: 0.7;
}

.question-card-edit {
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.form-actions-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.delete-question-form {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
}

.q-options-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
}

.q-options-info p {
  margin: 0;
}

.q-options-icon {
  font-size: 1.5rem;
  opacity: 0.6;
}

.q-options-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.q-options-fallback {
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.q-options-fallback summary {
  cursor: pointer;
  color: var(--text-muted);
}

.q-options-fallback textarea {
  margin-top: 0.5rem;
}

.ranking-block {
  background: var(--bg);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.option-drag {
  color: var(--text-muted);
  opacity: 0.4;
  user-select: none;
  font-size: 0.75rem;
}

.q-options-editor {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.q-options-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.option-lines {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.option-line {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.option-line .input {
  flex: 1;
}

.btn-icon {
  min-width: 2.25rem;
  padding: 0.35rem 0.5rem;
  font-size: 1.1rem;
  line-height: 1;
}

.ranking-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 700px) {
  .ranking-options-grid {
    grid-template-columns: 1fr;
  }
}

.check-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.check-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: center;
}

.hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0;
}

.hint code,
.mono {
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.85rem;
}

.inline-form {
  display: inline;
}

.form-actions-inline {
  margin-top: 0.5rem;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
}

.mini-form {
  padding: 0.75rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
}

.user-actions summary {
  list-style: none;
  cursor: pointer;
}
