:root {
  --bg: #f7f9fb;
  --surface: rgba(255, 255, 255, 0.74);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --surface-soft: rgba(242, 244, 246, 0.72);
  --surface-deep: #252c37;
  --surface-deep-soft: rgba(37, 44, 55, 0.9);
  --text: #191f2d;
  --muted: #69758d;
  --line: rgba(135, 148, 177, 0.18);
  --line-strong: rgba(135, 148, 177, 0.28);
  --primary: #004be4;
  --primary-deep: #0038af;
  --primary-soft: rgba(0, 75, 228, 0.1);
  --secondary-soft: rgba(202, 230, 255, 0.52);
  --success: #19814f;
  --warning: #d49a1d;
  --danger: #c2415a;
  --radius-xl: 2rem;
  --radius-lg: 1.5rem;
  --radius-md: 1rem;
  --radius-sm: 0.8rem;
  --shadow-lg: 0 32px 90px rgba(23, 41, 72, 0.12);
  --shadow-md: 0 18px 46px rgba(23, 41, 72, 0.08);
  --shadow-sm: 0 10px 24px rgba(23, 41, 72, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 10%, rgba(220, 225, 255, 0.9), transparent 24%),
    radial-gradient(circle at 88% 18%, rgba(202, 230, 255, 0.88), transparent 22%),
    radial-gradient(circle at 70% 78%, rgba(182, 196, 255, 0.28), transparent 22%),
    linear-gradient(180deg, #f8fafc 0%, #f2f5f9 100%);
  color: var(--text);
  font-family: "Manrope", sans-serif;
}

body.body-lock {
  overflow: hidden;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.04em;
  color: var(--text);
}

p {
  margin: 0;
}

a {
  color: inherit;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 1rem;
  outline: none;
  background: rgba(242, 244, 246, 0.86);
  color: var(--text);
  padding: 0.95rem 1rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

input::placeholder,
textarea::placeholder {
  color: #93a0b7;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 75, 228, 0.28);
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    inset 0 -2px 0 rgba(0, 75, 228, 0.18),
    0 14px 34px rgba(0, 75, 228, 0.08);
}

textarea {
  resize: vertical;
}

select[multiple] {
  min-height: 10rem;
}

.bg-shape {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(8px);
}

.bg-shape-a {
  width: 26rem;
  height: 26rem;
  top: -10rem;
  left: -9rem;
  background: radial-gradient(circle, rgba(182, 196, 255, 0.46), rgba(182, 196, 255, 0));
}

.bg-shape-b {
  width: 28rem;
  height: 28rem;
  right: -12rem;
  bottom: -10rem;
  background: radial-gradient(circle, rgba(202, 230, 255, 0.62), rgba(202, 230, 255, 0));
}

.qb-app-shell {
  position: relative;
  z-index: 1;
}

.qb-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 5.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 0 1.4rem 0 1.6rem;
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 24px 60px rgba(18, 34, 63, 0.06);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

.qb-topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.qb-brand-mark {
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3467ff, #004be4);
  color: #ffffff;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  box-shadow: 0 16px 34px rgba(0, 75, 228, 0.26);
}

.qb-topbar-brand strong {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 700;
}

.qb-topbar-brand span:last-child {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.qb-topbar-nav,
.qb-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.qb-topbar-link,
.qb-side-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.qb-topbar-link {
  border-radius: 999px;
  padding: 0.7rem 0.95rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.qb-topbar-link:hover,
.qb-topbar-link.is-active {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 -2px 0 rgba(0, 75, 228, 0.18);
}

.qb-sidebar {
  position: fixed;
  top: 5.5rem;
  left: 0;
  bottom: 0;
  width: 18rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.1rem 1rem 1.2rem 1.15rem;
  overflow: auto;
}

.qb-sidebar-panel,
.glass-panel,
.hero-panel,
.status-card {
  position: relative;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.6)),
    linear-gradient(180deg, rgba(242, 244, 246, 0.58), rgba(255, 255, 255, 0.2));
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

.qb-sidebar-panel {
  padding: 1.2rem 1.05rem;
}

.qb-sidebar-panel--profile {
  display: grid;
  gap: 0.85rem;
}

.qb-sidebar-kicker,
.qb-kicker {
  color: var(--primary);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.qb-sidebar-panel h2,
.section-headline h2,
.section-head h2 {
  font-size: 1.55rem;
}

.qb-sidebar-copy,
.hero-copy,
.rename-note,
.editor-note,
.section-head p,
.sync-status-copy span,
.card-meta,
.answer-content,
.recent-empty {
  color: var(--muted);
  line-height: 1.65;
}

.qb-user-chip,
.soft-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 0.55rem 0.8rem;
  background: rgba(242, 244, 246, 0.76);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
}

.soft-badge {
  color: var(--primary);
  background: rgba(0, 75, 228, 0.08);
}

.qb-sidebar-nav {
  display: grid;
  gap: 0.55rem;
}

.qb-side-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 1rem;
  padding: 0.95rem 1rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  text-decoration: none;
}

.qb-side-link .material-symbols-outlined {
  font-size: 1.2rem;
}

.qb-side-link:hover,
.qb-side-link.is-active {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 26px rgba(0, 75, 228, 0.08);
  transform: translateX(2px);
}

.qb-sidebar-status-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.7rem;
}

.qb-sidebar-status-head h3 {
  font-size: 1.05rem;
}

.qb-main {
  margin-left: 18rem;
  padding: 6.55rem 1.4rem 1.5rem;
}

.qb-view {
  display: grid;
  gap: 1.25rem;
  min-height: calc(100vh - 8rem);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.24fr) minmax(17rem, 0.76fr);
  gap: 1.25rem;
  padding: 1.6rem;
  overflow: hidden;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 10%, rgba(220, 225, 255, 0.7), transparent 26%),
    radial-gradient(circle at 90% 18%, rgba(202, 230, 255, 0.78), transparent 24%);
  pointer-events: none;
}

.hero-panel > * {
  position: relative;
  z-index: 1;
}

.hero-panel__content,
.hero-panel__aside {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.hero-panel__aside--actions {
  justify-items: end;
  align-content: center;
}

.hero-panel h1 {
  font-size: clamp(2.3rem, 4vw, 4rem);
  line-height: 0.95;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-side-card {
  display: grid;
  gap: 0.75rem;
  padding: 1.1rem 1.15rem;
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.58);
}

.hero-side-list {
  display: grid;
  gap: 0.75rem;
}

.hero-side-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.hero-side-list span {
  color: var(--muted);
  font-size: 0.88rem;
}

.hero-side-list strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
}

.audio-note {
  padding: 0.95rem 1rem;
  border-radius: 1.15rem;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.dashboard-grid,
.dashboard-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(18rem, 0.66fr);
  gap: 1.25rem;
}

.dashboard-panel {
  padding: 1.4rem;
}

.dashboard-side {
  display: grid;
  gap: 1.1rem;
}

.dashboard-performance {
  padding: 1.4rem;
  background: linear-gradient(180deg, rgba(37, 44, 55, 0.92), rgba(37, 44, 55, 0.86));
  color: rgba(255, 255, 255, 0.9);
}

.dashboard-performance h2,
.dashboard-performance p,
.dashboard-performance span,
.dashboard-performance strong {
  color: inherit;
}

.dashboard-performance-metrics {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.dashboard-performance-metrics div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.8rem;
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.2rem;
  background: linear-gradient(135deg, #3467ff, #004be4);
  color: #ffffff;
}

.status-card h3,
.status-card p,
.status-card .material-symbols-outlined {
  color: inherit;
}

.status-card .material-symbols-outlined {
  font-size: 2.2rem;
}

.section-headline,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

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

.library-stats {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.library-stats article {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: 1.35rem;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.library-stats h3 {
  font-size: clamp(1.7rem, 3vw, 2.65rem);
}

.library-stats p {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.recent-list,
.dashboard-shortcuts {
  margin-top: 1rem;
  display: grid;
  gap: 0.85rem;
}

.recent-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.95rem 1rem;
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.48);
}

.recent-item-icon {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 75, 228, 0.1);
  color: var(--primary);
}

.recent-item-copy {
  min-width: 0;
}

.recent-item-copy strong {
  display: block;
  font-size: 0.96rem;
  color: var(--text);
}

.recent-item-copy span {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.recent-item-badge {
  justify-self: end;
}

.recent-empty {
  padding: 1rem;
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.6);
}

.shortcut-card {
  display: grid;
  gap: 0.5rem;
  border: 0;
  cursor: pointer;
  text-align: left;
  padding: 1rem;
  border-radius: 1.4rem;
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.48);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.shortcut-card:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.58),
    0 16px 34px rgba(0, 75, 228, 0.08);
}

.shortcut-card .material-symbols-outlined {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 75, 228, 0.1);
  color: var(--primary);
}

.shortcut-card strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.shortcut-card span:last-child {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(19rem, 0.65fr);
  gap: 1.25rem;
  align-items: start;
}

.workspace-main,
.workspace-side,
.add-form-main,
.add-form-sidebar {
  display: grid;
  gap: 1rem;
}

.workspace-panel,
.selection-summary-panel,
.selection-list-panel,
.editor-stage,
.add-meta-card,
.add-actions-panel,
.rename-box {
  padding: 1.25rem;
}

.workspace-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.workspace-search {
  position: relative;
  flex: 1 1 auto;
  gap: 0;
}

.workspace-search .material-symbols-outlined {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  color: #8ea0ba;
  font-size: 1.2rem;
}

.workspace-search input {
  padding-left: 3rem;
  text-transform: none;
  letter-spacing: 0;
}

.filters {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.workspace-results-head {
  display: flex;
  justify-content: flex-end;
}

.result-list {
  display: grid;
  gap: 1rem;
}

.question-card {
  border-radius: 1.8rem;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.62)),
    linear-gradient(180deg, rgba(242, 244, 246, 0.52), rgba(255, 255, 255, 0.2));
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem 0.85rem;
}

.card-head h3 {
  font-size: 1.22rem;
}

.card-meta {
  margin-top: 0.28rem;
  font-size: 0.82rem;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 15rem;
}

.mini-btn {
  border: 0;
  border-radius: 999px;
  background: rgba(0, 75, 228, 0.08);
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.mini-btn:hover {
  background: rgba(0, 75, 228, 0.14);
  transform: translateY(-1px);
}

.card-body,
.answer-block {
  padding: 0 1.1rem 1rem;
}

.card-body {
  max-height: 28rem;
  overflow: auto;
  color: var(--text);
  line-height: 1.7;
}

.card-body img,
.answer-block img {
  max-width: 100%;
  height: auto;
  border-radius: 1rem;
}

.card-body table,
.answer-block table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0;
}

.card-body td,
.card-body th,
.answer-block td,
.answer-block th {
  border: 1px solid rgba(135, 148, 177, 0.32);
  padding: 0.5rem;
}

.answer-block {
  display: none;
  border-top: 1px dashed rgba(135, 148, 177, 0.4);
}

.answer-block.visible {
  display: block;
}

.answer-title {
  margin-bottom: 0.55rem;
  font-size: 0.95rem;
  color: var(--primary);
}

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.6rem;
}

.workspace-side {
  position: sticky;
  top: 6.85rem;
}

.selection-controls {
  margin-top: 1rem;
  display: grid;
  gap: 0.7rem;
}

.selection-controls .btn {
  width: 100%;
  justify-content: center;
}

.selected-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.selected-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 0.95rem;
  border-radius: 1.15rem;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.selected-item span {
  font-size: 0.84rem;
  color: var(--text);
}

.empty-state {
  padding: 1rem;
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
}

.add-stage {
  display: grid;
  gap: 1rem;
}

.add-form {
  display: grid;
  grid-template-columns: minmax(20rem, 22rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.add-card-head {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.85rem;
}

.add-card-head h2 {
  font-size: 1.3rem;
}

.add-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.add-meta-stack {
  display: grid;
  gap: 0.85rem;
}

.full-width {
  grid-column: 1 / -1;
}

.native-multi-select {
  display: none;
}

.multi-pick {
  position: relative;
  display: grid;
  gap: 0.5rem;
}

.multi-pick-toggle {
  width: 100%;
  border: 0;
  border-radius: 1rem;
  background: rgba(242, 244, 246, 0.9);
  color: var(--text);
  cursor: pointer;
  padding: 0.95rem 1rem;
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.multi-pick-toggle::after {
  content: "▾";
  float: right;
  color: #7c8cad;
}

.multi-pick-toggle[aria-expanded="true"]::after {
  content: "▴";
}

.multi-pick-menu {
  position: absolute;
  top: calc(100% + 0.2rem);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  gap: 0.2rem;
  max-height: 16rem;
  overflow: auto;
  padding: 0.45rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 40px rgba(22, 39, 66, 0.12);
}

.multi-pick-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.8rem;
  cursor: pointer;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.multi-pick-option:hover {
  background: rgba(0, 75, 228, 0.06);
}

.multi-pick-option input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.multi-pick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.multi-pick-chips.collapsed {
  max-height: 2.2rem;
  overflow: hidden;
}

.multi-pick-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  border-radius: 999px;
  background: rgba(0, 75, 228, 0.08);
  color: var(--primary);
  padding: 0.45rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.multi-pick-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-pick-chip-remove,
.multi-pick-expand {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.multi-pick-expand {
  justify-self: start;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
}

.multi-pick-empty {
  color: var(--muted);
  font-size: 0.85rem;
}

.rich-editor-block {
  display: grid;
  gap: 0.8rem;
}

.rich-editor-headline {
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rich-editor-shell {
  display: grid;
  gap: 0.75rem;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.55rem;
  border-radius: 1.15rem;
  background: rgba(242, 244, 246, 0.82);
}

.rich-toolbar select,
.rich-toolbar input,
.rich-toolbar button {
  width: auto;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 0.8rem;
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  cursor: pointer;
  box-shadow: none;
}

.rich-toolbar input[type="color"] {
  padding: 0.2rem;
  width: 2.6rem;
  min-width: 2.6rem;
  height: 2.55rem;
}

.rich-editor-canvas,
.test-editor-canvas {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 1.4rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 40px rgba(25, 45, 76, 0.07);
  padding: 18mm 16mm;
  color: var(--text);
  outline: none;
  line-height: 1.75;
}

.rich-editor-canvas--a4 {
  min-height: 68rem;
}

.rich-editor-canvas:empty::before {
  content: attr(data-placeholder);
  color: #98a6bd;
}

.rich-editor-canvas table,
.test-editor-canvas table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
}

.rich-editor-canvas td,
.rich-editor-canvas th,
.test-editor-canvas td,
.test-editor-canvas th {
  border: 1px solid rgba(135, 148, 177, 0.35);
  padding: 0.4rem 0.45rem;
  min-width: 40px;
}

.rich-editor-canvas img,
.test-editor-canvas img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0.5rem auto;
  cursor: pointer;
  border-radius: 0.85rem;
}

.rich-editor-canvas .rich-image-wrapper,
.test-editor-canvas .rich-image-wrapper {
  position: relative;
  display: inline-block;
  width: 70%;
  min-width: 80px;
  max-width: 100%;
  line-height: 0;
}

.rich-editor-canvas .rich-image-wrapper.editor-image-selected,
.test-editor-canvas .rich-image-wrapper.editor-image-selected {
  outline: 2px solid rgba(0, 75, 228, 0.45);
  outline-offset: 4px;
}

.rich-editor-canvas .rich-image-handle,
.test-editor-canvas .rich-image-handle {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 2px solid #ffffff;
  background: var(--primary);
  box-shadow: 0 0 0 1px rgba(0, 75, 228, 0.55);
  cursor: nwse-resize;
  display: none;
}

.rich-editor-canvas .rich-image-wrapper.editor-image-selected .rich-image-handle,
.test-editor-canvas .rich-image-wrapper.editor-image-selected .rich-image-handle {
  display: block;
}

.rich-image-figure {
  margin: 0.55rem 0;
  text-align: center;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.rename-grid {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  align-items: end;
}

.rename-actions {
  display: flex;
}

.inline-check {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.inline-check input {
  width: auto;
  margin: 0;
}

.status {
  font-size: 0.86rem;
  line-height: 1.6;
}

.status.muted {
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 999px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  padding: 0.95rem 1.2rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #3467ff, #004be4);
  color: #ffffff;
  box-shadow: 0 18px 36px rgba(0, 75, 228, 0.24);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-outline,
.btn-muted,
.btn-ghost {
  color: var(--text);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.btn-muted {
  background: rgba(242, 244, 246, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  box-shadow: none;
}

.btn-full {
  width: 100%;
}

.btn-compact {
  padding: 0.8rem 1rem;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  border-radius: 1.15rem;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.76);
}

.sync-status-dot {
  width: 0.75rem;
  height: 0.75rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(212, 154, 29, 0.14);
}

.sync-status-copy {
  display: grid;
  gap: 0.12rem;
}

.sync-status-copy strong {
  font-size: 0.86rem;
}

.sync-status--ok .sync-status-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(25, 129, 79, 0.14);
}

.sync-status--error .sync-status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(194, 65, 90, 0.12);
}

.test-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  padding: 0.85rem;
  background: rgba(18, 27, 42, 0.58);
  backdrop-filter: blur(8px);
}

.test-editor-shell {
  width: min(1320px, 100%);
  height: calc(100vh - 1.7rem);
  margin: 0 auto;
  border-radius: 1.8rem;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.68)),
    linear-gradient(180deg, rgba(242, 244, 246, 0.56), rgba(255, 255, 255, 0.24));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 28px 68px rgba(18, 27, 42, 0.24);
}

.test-editor-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.3rem;
}

.test-editor-top p {
  margin-top: 0.3rem;
  color: var(--muted);
}

.test-editor-actions {
  display: flex;
  gap: 0.6rem;
}

.rich-toolbar--test {
  margin: 0.65rem 1rem 0.8rem;
}

.test-editor-stage {
  flex: 1;
  overflow: auto;
  padding: 0 1rem 1rem;
}

.test-editor-canvas {
  width: min(100%, 820px);
  min-height: 1123px;
  margin: 0 auto;
}

.test-editor-canvas .cover,
.test-editor-canvas .question-page {
  border-radius: 1.1rem;
  border: 1px dashed rgba(135, 148, 177, 0.42);
  padding: 1rem;
  margin-bottom: 0.9rem;
  background: rgba(247, 249, 251, 0.72);
}

.test-editor-canvas .cover-header {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(18, 27, 42, 0.52);
  backdrop-filter: blur(10px);
}

.upload-overlay-card {
  width: min(430px, calc(100% - 2rem));
  padding: 1.2rem 1.3rem;
  border-radius: 1.6rem;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 22px 52px rgba(18, 27, 42, 0.18);
  text-align: center;
}

.upload-state-dot {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  margin-bottom: 0.45rem;
}

.upload-state-dot--loading {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(212, 154, 29, 0.16);
}

.upload-state-dot--ok {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(25, 129, 79, 0.16);
}

.upload-state-dot--error {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(194, 65, 90, 0.14);
}

.upload-spinner {
  width: 48px;
  height: 48px;
  margin: 0.2rem auto 0.7rem;
  border-radius: 50%;
  border: 4px solid rgba(0, 75, 228, 0.12);
  border-top-color: var(--primary);
  animation: spin 0.85s linear infinite;
}

.upload-overlay-card h3 {
  font-size: 1.12rem;
}

.upload-overlay-card p {
  margin-top: 0.45rem;
  color: var(--muted);
  line-height: 1.6;
}

.upload-overlay--ok .upload-spinner,
.upload-overlay--error .upload-spinner {
  display: none;
}

.question-upload-status {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 5000;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  max-width: calc(100% - 1.5rem);
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 36px rgba(18, 27, 42, 0.12);
  backdrop-filter: blur(20px);
  font-size: 0.84rem;
}

.question-upload-status-dot {
  width: 0.66rem;
  height: 0.66rem;
  border-radius: 50%;
  background: var(--warning);
}

.question-upload-status--ok .question-upload-status-dot {
  background: var(--success);
}

.question-upload-status--error .question-upload-status-dot {
  background: var(--danger);
}

#addSection,
#builderSection,
#selectionSection {
  scroll-margin-top: 7rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1380px) {
  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .dashboard-grid,
  .dashboard-lower-grid,
  .workspace-layout,
  .add-form,
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .workspace-side {
    position: static;
  }

  .library-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rename-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .qb-topbar {
    flex-wrap: wrap;
    height: auto;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
  }

  .qb-topbar-nav {
    order: 3;
    width: 100%;
    overflow: auto;
  }

  .qb-sidebar {
    position: static;
    width: auto;
    padding: 6.7rem 1rem 0;
  }

  .qb-main {
    margin-left: 0;
    padding-top: 1rem;
  }

  .qb-view {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .filters,
  .add-meta-grid,
  .rename-grid {
    grid-template-columns: 1fr;
  }

  .library-stats {
    grid-template-columns: 1fr;
  }

  .card-head,
  .selected-item,
  .workspace-search-row,
  .section-headline,
  .test-editor-top {
    flex-direction: column;
    align-items: stretch;
  }

  .card-actions {
    justify-content: flex-start;
    min-width: 0;
  }

  .test-editor-actions {
    width: 100%;
  }

  .test-editor-actions .btn {
    flex: 1;
  }
}

@media (max-width: 560px) {
  .qb-topbar,
  .qb-sidebar,
  .qb-main {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .hero-panel,
  .dashboard-panel,
  .workspace-panel,
  .selection-summary-panel,
  .selection-list-panel,
  .editor-stage,
  .add-meta-card,
  .add-actions-panel,
  .rename-box {
    padding: 1rem;
  }

  .rich-toolbar select,
  .rich-toolbar input,
  .rich-toolbar button {
    font-size: 0.74rem;
  }

  .rich-editor-canvas--a4 {
    min-height: 52rem;
    padding: 14mm 10mm;
  }
}
