:root {
  --bg: #f5f7fb;
  --ink: #272338;
  --muted: #716981;
  --subtle: #9b92aa;
  --line: #e3dce9;
  --line-strong: #c8bad8;
  --paper: #fcfdff;
  --panel: #ffffff;
  --control: #fbfcff;
  --accent: #ffbd45;
  --accent-strong: #cf8615;
  --accent-soft: #fff4cc;
  --ok: #2f8f57;
  --ok-soft: #e9f6ef;
  --warn: #b97518;
  --warn-soft: #fff3d6;
  --bad: #bd3f32;
  --bad-soft: #fff1ef;
  --info: #edf7fb;
  --info-line: #91c9d8;
  --focus: rgba(255, 189, 69, 0.32);
  --shadow: 0 16px 38px rgba(51, 43, 72, 0.08);
  --soft-shadow: 0 8px 20px rgba(51, 43, 72, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(247, 249, 253, 0.88), rgba(236, 247, 250, 0.72) 52%, rgba(255, 247, 230, 0.58)),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  letter-spacing: 0;
}

.hidden {
  display: none;
}

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

button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  line-height: 1.2;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, color 0.16s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.upload-picker:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

button.primary {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: #241e31;
  box-shadow: 0 2px 0 var(--accent-strong);
}

button.primary:hover:not(:disabled) {
  background: #ffc763;
}

button.secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--ink);
}

button.secondary:hover:not(:disabled) {
  border-color: #a88cbc;
  background: #fbf8ff;
}

button.danger {
  border-color: #efc2ba;
  background: var(--bad-soft);
  color: var(--bad);
}

button.danger:hover:not(:disabled) {
  border-color: #d98678;
  background: #ffe8e3;
}

button.link-btn {
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6c5aa8;
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

button.link-btn:hover:not(:disabled) {
  background: transparent;
  color: #4f3c91;
  transform: none;
}

button:disabled,
button.is-busy {
  border-color: #ddd7e4;
  background: #efecf2;
  color: #9a91a8;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cfc6da;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--control);
  color: #171321;
  box-shadow: inset 0 1px 2px rgba(43, 37, 58, 0.05);
}

textarea {
  min-height: 82px;
  resize: vertical;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--line-strong);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-strong);
  outline: 0;
  background: #fff;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.16;
}

h2 {
  margin-bottom: 14px;
  font-size: 20px;
  line-height: 1.2;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--ink);
  font-weight: 800;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(245, 247, 251, 0.94);
}

.login-overlay.hidden {
  display: none;
}

.login-panel {
  width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.login-record {
  margin: 16px 0 0;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
}

.login-record a,
.site-record-footer a {
  color: #6d647b;
  text-decoration: none;
}

.login-record a:hover,
.site-record-footer a:hover {
  color: #4f3c91;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px;
  border-right: 1px solid rgba(198, 186, 214, 0.72);
  background: rgba(252, 253, 255, 0.96);
  backdrop-filter: blur(14px);
}

.brand-block {
  margin-bottom: 28px;
  padding: 0 2px;
}

.brand-block h1 {
  font-size: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #8a789d;
  font-weight: 900;
}

.side-menu {
  display: grid;
  gap: 8px;
}

.site-record-footer {
  padding: 0 28px 28px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
}

.menu-item {
  width: 100%;
  min-height: 44px;
  justify-content: start;
  border-color: transparent;
  border-left: 4px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.menu-item.active {
  border-color: rgba(207, 134, 21, 0.36);
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 189, 69, 0.22);
}

.menu-item:not(.active):hover {
  border-color: rgba(200, 186, 216, 0.72);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.workspace {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 30px 36px 20px;
  border-bottom: 1px solid rgba(198, 186, 214, 0.72);
  background: rgba(252, 253, 255, 0.86);
  backdrop-filter: blur(14px);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 18px;
  padding: 22px 36px 40px;
}

.panel {
  border: 1px solid rgba(207, 198, 218, 0.9);
  border-radius: 10px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(10px);
}

.panel-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-head h2,
.section-head h2 {
  margin-bottom: 0;
}

.full,
.question-library-panel,
[data-view-panel="stats"] {
  grid-column: 1 / -1;
}

.settings-panel {
  max-width: 920px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.switches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.switches label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.switches input,
.select-question {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.control-field {
  flex: 0 0 92px;
  margin-bottom: 0;
}

.control-field span,
.field-label {
  color: #7d748d;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.1;
}

.control-field.compact input {
  text-align: center;
  font-weight: 900;
}

.system-badge,
.selected-count,
.status,
.picker-file {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.system-badge {
  padding: 7px 9px;
  background: #f0edf4;
  color: var(--muted);
}

.system-badge.ready,
.system-badge.review {
  background: var(--ok-soft);
  color: var(--ok);
}

.system-badge.muted {
  background: #f0edf4;
  color: #8e849a;
}

.selected-count {
  justify-self: start;
  min-height: 38px;
  padding: 0 10px;
  background: #f4f1f7;
  color: var(--muted);
}

.toolbar-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.hint {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--info-line);
  border-radius: 0 8px 8px 0;
  background: var(--info);
  color: #5e6676;
  font-weight: 800;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.upload-picker {
  position: relative;
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 132px;
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #f9fafc;
  cursor: pointer;
}

.upload-picker:hover {
  border-color: var(--accent-strong);
  background: #fffaf0;
}

.picker-title {
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.picker-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.picker-file {
  margin-top: 7px;
  padding: 8px 10px;
  background: #fff;
  color: #5f6574;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-actions {
  margin-top: 14px;
}

.field-guide {
  margin-top: 16px;
  padding-top: 14px;
  border: 0;
  border-top: 1px solid rgba(214, 204, 225, 0.9);
  background: transparent;
}

.field-guide summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 900;
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 18px;
  margin-top: 12px;
  color: #514b5f;
  font-size: 14px;
}

.guide-grid p {
  margin: 0;
}

.upload-report {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafc;
  color: var(--muted);
  font-weight: 800;
  white-space: pre-wrap;
}

.upload-report:empty {
  display: none;
}

.filters {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filters select {
  width: 150px;
}

.summary {
  color: var(--muted);
  font-weight: 800;
}

.question-command-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin: 16px 0;
  padding: 12px;
  border: 1px solid rgba(227, 220, 233, 0.9);
  border-radius: 8px;
  background: #f8fafc;
}

.question-command-bar .control-field {
  flex: 0 0 92px;
}

.status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.status-filter {
  min-height: 36px;
  padding: 8px 12px;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  box-shadow: none;
}

.status-filter.active {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
  color: var(--ink);
}

.question-list {
  display: grid;
  gap: 14px;
}

.question-card {
  display: grid;
  grid-template-columns: 28px 124px minmax(0, 1fr);
  min-width: 0;
  gap: 14px;
  border: 1px solid rgba(198, 186, 214, 0.82);
  border-left: 5px solid #d8d0df;
  border-radius: 10px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--soft-shadow);
}

.question-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 14px 30px rgba(51, 43, 72, 0.08);
}

.question-card.is-pending {
  border-left-color: #e5a43a;
}

.question-card.is-approved {
  border-left-color: #7c6bc8;
}

.question-card.is-published {
  border-left-color: var(--ok);
}

.question-card.is-rejected {
  border-left-color: var(--bad);
}

.question-card.is-draft {
  border-left-color: #a7a0b1;
}

.select-question {
  margin: 9px 0 0;
  justify-self: center;
}

.image-preview-trigger {
  position: relative;
  display: block;
  width: 124px;
  height: 124px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.image-preview-trigger:hover:not(:disabled) {
  transform: none;
}

.image-preview-trigger img {
  width: 124px;
  height: 124px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f2f2;
  object-fit: cover;
}

.image-preview-trigger span {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(39, 35, 56, 0.78);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.image-preview-trigger:hover span,
.image-preview-trigger:focus-visible span {
  opacity: 1;
  transform: translateY(0);
}

.image-empty {
  display: grid;
  width: 124px;
  height: 124px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #f9fafc;
  color: var(--muted);
  font-weight: 800;
}

.card-main {
  display: grid;
  gap: 11px;
  min-width: 0;
}

.card-meta {
  display: grid;
  grid-template-columns: max-content max-content minmax(0, 1fr);
  min-width: 0;
  align-items: center;
  gap: 8px 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(214, 204, 225, 0.74);
}

.status {
  padding: 6px 9px;
  background: #f0edf4;
  color: #4f4561;
}

.status.is-pending {
  background: var(--warn-soft);
  color: var(--warn);
}

.status.is-approved {
  background: #eeeaff;
  color: #6253a6;
}

.status.is-published {
  background: var(--ok-soft);
  color: var(--ok);
}

.status.is-rejected {
  background: var(--bad-soft);
  color: var(--bad);
}

.status-note {
  color: var(--subtle);
  font-size: 13px;
  font-weight: 900;
}

.stats {
  justify-self: end;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 0;
  gap: 12px;
}

.field {
  gap: 7px;
  min-width: 0;
  margin-bottom: 0;
}

.field input,
.field textarea,
.field select {
  min-width: 0;
  background: #fff;
  color: #171321;
  font-weight: 700;
}

.field textarea {
  min-height: 86px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid rgba(214, 204, 225, 0.74);
}

.card-actions button {
  min-height: 38px;
  padding: 8px 12px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(183, 165, 202, 0.48);
}

.pagination span {
  min-width: 160px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.page-jump {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.page-jump input {
  width: 64px;
  min-height: 34px;
  padding: 6px 8px;
  text-align: center;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.metric-card {
  display: grid;
  gap: 7px;
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metric-card span,
.metric-card small,
.question-cell span {
  color: var(--muted);
  font-weight: 800;
}

.metric-card strong {
  font-size: 28px;
  line-height: 1.1;
}

.stats-section {
  margin-top: 24px;
}

.section-head.compact {
  margin-bottom: 10px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.user-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 150px 160px auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafc;
}

.feedback-toolbar {
  display: grid;
  grid-template-columns: 150px 150px minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafc;
}

.feedback-toolbar .control-field {
  flex-basis: auto;
}

.user-toolbar .control-field {
  flex-basis: auto;
}

.admin-account-create {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafc;
}

.admin-account-create .control-field {
  flex: initial;
  margin-bottom: 0;
}

.admin-account-list {
  display: grid;
  gap: 12px;
}

.admin-account-card {
  display: grid;
  gap: 13px;
  border: 1px solid rgba(198, 186, 214, 0.82);
  border-left: 5px solid var(--line-strong);
  border-radius: 10px;
  padding: 16px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.admin-account-head,
.admin-account-actions,
.admin-account-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.admin-account-head {
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(214, 204, 225, 0.74);
}

.admin-account-head div {
  display: grid;
  gap: 4px;
}

.admin-account-head strong {
  font-size: 18px;
  line-height: 1.2;
}

.admin-account-head span,
.admin-account-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.account-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 12px;
  font-weight: 900;
}

.account-status.disabled {
  background: #f0edf4;
  color: #8e849a;
}

.admin-account-grid {
  display: grid;
  grid-template-columns: 1fr 160px 1fr;
  gap: 12px;
}

.admin-account-meta {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f9fafc;
}

.warn-text {
  color: var(--warn);
}

.admin-account-actions {
  justify-content: flex-end;
}

.user-search {
  min-width: 220px;
}

.user-table-wrap table {
  min-width: 1060px;
}

.feedback-table-wrap table {
  min-width: 1180px;
}

.feedback-cell,
.feedback-user-cell,
.feedback-time-cell {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.feedback-cell {
  min-width: 360px;
  max-width: 520px;
  white-space: normal;
}

.feedback-cell strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.feedback-cell small,
.feedback-user-cell small,
.feedback-time-cell small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.feedback-user-cell {
  min-width: 170px;
}

.feedback-user-cell strong,
.feedback-time-cell strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
}

.feedback-image-list {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 130px;
}

.feedback-image-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.feedback-image-thumb.image-preview-trigger {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(47, 42, 36, 0.1);
}

.feedback-image-thumb.image-preview-trigger img {
  width: 58px;
  height: 58px;
  border-radius: 14px;
}

.feedback-image-thumb.image-preview-trigger span {
  right: 5px;
  bottom: 5px;
  left: auto;
  padding: 2px 6px;
  font-size: 10px;
  opacity: 1;
  transform: none;
}

.feedback-type-badge {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 9px;
  background: var(--info);
  color: #406778;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.feedback-type-badge.bug {
  background: var(--bad-soft);
  color: var(--bad);
}

.feedback-type-badge.suggestion {
  background: var(--ok-soft);
  color: var(--ok);
}

.feedback-type-badge.content {
  background: var(--accent-soft);
  color: var(--warn);
}

.feedback-note-input {
  min-width: 220px;
}

.feedback-status-select {
  min-width: 118px;
}

.admin-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}

.admin-user-cell > span:last-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-user-cell strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
}

.admin-user-cell small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.admin-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--accent);
  color: #4e3309;
  font-weight: 900;
  box-shadow: inset 0 -3px 0 rgba(207, 134, 21, 0.18);
}

.admin-avatar img {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.admin-avatar-fallback {
  grid-area: 1 / 1;
}

.admin-avatar.has-image {
  background: #fff;
  box-shadow: 0 0 0 1px var(--line);
}

.admin-avatar.has-image .admin-avatar-fallback {
  display: none;
}

.admin-avatar.large {
  width: 54px;
  height: 54px;
  font-size: 18px;
}

.user-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 6px 9px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 12px;
  font-weight: 900;
}

.user-status.blocked {
  background: var(--warn-soft);
  color: var(--warn);
}

.user-status.deleted {
  background: var(--bad-soft);
  color: var(--bad);
}

.compact-btn {
  min-height: 34px;
  padding: 7px 10px;
}

.user-detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(560px, 100vw);
  border-left: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.98);
  box-shadow: -20px 0 55px rgba(31, 25, 45, 0.14);
}

.user-detail-drawer.hidden {
  display: none;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.drawer-head h2 {
  margin-bottom: 0;
}

.drawer-body {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.drawer-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.drawer-section h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.drawer-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.drawer-section-head h3 {
  margin: 0;
}

.detail-title {
  margin-bottom: 14px;
}

.detail-meta-grid,
.detail-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-meta-grid div,
.detail-stat-grid div {
  display: grid;
  gap: 5px;
  min-height: 74px;
  border-radius: 8px;
  padding: 12px;
  background: #f9fafc;
}

.detail-meta-grid span,
.detail-stat-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.detail-meta-grid strong,
.detail-stat-grid strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

.recent-admin-list {
  display: grid;
  gap: 10px;
}

.interaction-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.interaction-filter {
  min-height: 34px;
  padding: 7px 10px;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  box-shadow: none;
  font-size: 13px;
}

.interaction-filter.active {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
  color: var(--ink);
}

.recent-admin-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(214, 204, 225, 0.72);
  border-radius: 8px;
  padding: 9px;
  background: #fff;
}

.recent-admin-item img,
.recent-empty {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: #edf7fb;
  object-fit: cover;
}

.recent-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
}

.recent-admin-item div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.recent-admin-item strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-admin-item span,
.recent-admin-item small,
.empty-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.interaction-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(214, 204, 225, 0.72);
}

.interaction-pagination span {
  min-width: 96px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(183, 165, 202, 0.42);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.question-cell {
  display: grid;
  gap: 4px;
  min-width: 260px;
  white-space: normal;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 60;
  max-width: min(460px, calc(100vw - 40px));
  padding: 16px 18px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 24px 70px rgba(23, 19, 33, 0.28);
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, calc(-50% + 12px));
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.error {
  background: #9d2f27;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 40px;
  background: rgba(23, 19, 33, 0.72);
  backdrop-filter: blur(10px);
}

.image-preview-overlay.hidden {
  display: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 34px;
  background: rgba(23, 19, 33, 0.5);
  backdrop-filter: blur(8px);
}

.modal-overlay.hidden {
  display: none;
}

.modal-panel {
  width: min(880px, calc(100vw - 48px));
  max-height: calc(100vh - 68px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(23, 19, 33, 0.24);
}

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

.modal-head h2 {
  margin-bottom: 6px;
}

.modal-subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.upload-modal-panel .upload-actions {
  align-items: center;
}

.preview-panel {
  display: grid;
  gap: 14px;
  width: min(900px, calc(100vw - 80px));
  margin: 0;
}

.preview-panel img {
  width: 100%;
  max-height: calc(100vh - 150px);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  object-fit: contain;
}

.preview-panel figcaption {
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  text-align: center;
}

.preview-close {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 41;
  border-color: rgba(255, 255, 255, 0.4);
  background: #fff;
  color: var(--ink);
}

@media (max-width: 1100px) {
  .card-meta {
    grid-template-columns: max-content max-content;
  }

  .stats {
    grid-column: 1 / -1;
    justify-self: start;
    text-align: left;
    white-space: normal;
  }
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid rgba(183, 165, 202, 0.55);
  }

  .brand-block {
    margin-bottom: 14px;
  }

  .side-menu {
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  }

  .topbar {
    padding: 20px 18px;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .upload-grid {
    grid-template-columns: 1fr;
  }

  .question-library-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .question-card {
    grid-template-columns: 28px 1fr;
  }

  .card-main,
  .image-preview-trigger,
  .image-empty {
    grid-column: 2;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .user-toolbar,
  .feedback-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .admin-account-create,
  .admin-account-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 26px;
  }

  .topbar,
  .section-head,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid-2,
  .row,
  .switches,
  .metric-grid,
  .guide-grid,
  .card-meta {
    grid-template-columns: 1fr;
  }

  .question-card {
    grid-template-columns: 1fr;
  }

  .select-question,
  .card-main,
  .image-preview-trigger,
  .image-empty {
    grid-column: 1;
  }

  .select-question {
    justify-self: start;
    margin: 0;
  }

  .image-preview-trigger,
  .image-empty {
    width: min(160px, 100%);
    height: auto;
    aspect-ratio: 1;
  }

  .image-preview-trigger img {
    width: 100%;
    height: 100%;
  }

  .status,
  .status-note,
  .stats {
    justify-self: start;
  }

  .stats {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .filters {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .filters select {
    width: 100%;
  }

  .question-command-bar {
    align-items: stretch;
  }

  .question-command-bar > * {
    flex: 1 1 100%;
  }

  .selected-count {
    justify-content: center;
  }

  .modal-overlay {
    padding: 14px;
  }

  .modal-panel {
    width: 100%;
    max-height: calc(100vh - 28px);
    padding: 16px;
  }

  .modal-head {
    flex-direction: column;
  }

  .user-toolbar,
  .feedback-toolbar,
  .admin-account-create,
  .admin-account-grid,
  .detail-meta-grid,
  .detail-stat-grid {
    grid-template-columns: 1fr;
  }

  .user-detail-drawer {
    width: 100vw;
  }
}
