:root {
  color-scheme: light;
  --ink: #17233b;
  --ink-soft: #56657c;
  --muted: #5f6e86;
  --line: #dfe6f0;
  --line-strong: #c6d2e2;
  --paper: #fff;
  --canvas: #f4f7fb;
  --accent: #3156d3;
  --accent-dark: #2445b8;
  --accent-soft: #edf2ff;
  --success: #16795a;
  --success-soft: #ebf8f3;
  --warning: #8b5a14;
  --warning-soft: #fff7e8;
  --danger: #b73845;
  --danger-soft: #fff0f1;
  --shadow-sm: 0 8px 24px rgb(29 44 77 / 7%);
  --shadow-lg: 0 24px 70px rgb(27 38 65 / 18%);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --content: 1320px;
  --sidebar: 304px;
  --dock-height: 88px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  margin: 0;
  padding-bottom: calc(var(--dock-height) + 28px);
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgb(222 229 255 / 72%), transparent 24rem),
    radial-gradient(
      circle at 92% 15%,
      rgb(222 245 239 / 64%),
      transparent 25rem
    ),
    var(--canvas);
  line-height: 1.5;
}

body[data-view="workspace"] {
  --content: 1600px;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

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

:focus-visible {
  outline: 3px solid #3156d3;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 300;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

.announcement {
  color: #263868;
  background: #e9eeff;
  border-bottom: 1px solid #d9e1ff;
}

.announcement__inner {
  max-width: var(--content);
  min-height: 42px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
}

.announcement__inner p {
  margin: 0;
}

.announcement__icon,
.preview-tags span {
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.announcement__link {
  color: var(--accent-dark);
  font-weight: 800;
  text-underline-offset: 3px;
}

.site-header {
  position: sticky;
  z-index: 70;
  top: 0;
  min-height: 72px;
  padding: 12px max(24px, calc((100vw - var(--content)) / 2));
  display: flex;
  align-items: center;
  gap: 24px;
  background: rgb(255 255 255 / 88%);
  border-bottom: 1px solid rgb(216 222 234 / 82%);
  backdrop-filter: blur(18px);
}

.announcement-bar {
  position: sticky;
  z-index: 65;
  top: 58px;
  width: 100%;
  min-height: 40px;
  padding: 7px 20px;
  border: 0;
  border-bottom: 1px solid #dce5f7;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #33476f;
  background: #f1f5ff;
  text-align: left;
  cursor: pointer;
}

.announcement-bar:hover {
  background: #eaf0ff;
}

.announcement-bar__label {
  padding: 2px 7px;
  border-radius: 999px;
  flex: 0 0 auto;
  color: #fff;
  background: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.announcement-bar__text {
  min-width: 0;
  overflow: hidden;
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.announcement-bar__more {
  flex: 0 0 auto;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand__mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 13px 13px 13px 5px;
  color: #fff;
  background: linear-gradient(145deg, #395fe0, #203eaa);
  box-shadow: 0 8px 22px rgb(49 86 211 / 25%);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
}

.header-context {
  min-width: 0;
  margin: 0;
  padding: 7px 11px;
  border-radius: 999px;
  overflow: hidden;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.button {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  transition: 0.16s ease;
}

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

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button--primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 6px 16px rgb(49 86 211 / 20%);
}

.button--primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

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

.button--quiet {
  color: var(--ink-soft);
  background: transparent;
}

.button--quiet:hover:not(:disabled) {
  background: #eef1f6;
}

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

.account-chip {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #f1f3f7;
  font-size: 13px;
  font-weight: 800;
}

.account-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #19a67e;
}

main {
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 24px 64px;
}

.hero {
  min-height: 230px;
  margin: 28px 0 34px;
  padding: 44px 50px;
  border: 1px solid rgb(209 218 238 / 80%);
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  background: linear-gradient(
    105deg,
    rgb(255 255 255 / 97%),
    rgb(249 251 255 / 90%)
  );
  box-shadow: var(--shadow-sm);
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.hero h1 {
  max-width: 720px;
  margin-bottom: 14px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.14;
  letter-spacing: -0.035em;
}

.hero p:not(.eyebrow) {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--ink-soft);
}

.hero-privacy {
  flex: 0 0 260px;
  padding: 15px 17px;
  border: 1px solid #ccebd9;
  border-radius: 15px;
  color: var(--success) !important;
  background: var(--success-soft);
  font-size: 13px;
}

.section-library,
.workbook-section {
  margin-bottom: 34px;
}

.section-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(23px, 3vw, 31px);
}

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

.section-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.section-card {
  min-width: 0;
  min-height: 142px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--section-color, #b8c5dd);
  border-radius: var(--radius-md);
  color: var(--ink);
  text-align: left;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 7px 16px rgb(35 55 90 / 5%);
  cursor: pointer;
}

.section-card[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--section-color) 55%, var(--line));
  background: #f8faff;
  box-shadow: 0 0 0 3px rgb(49 86 211 / 8%);
}

.section-card__icon {
  width: 34px;
  height: 34px;
  margin-bottom: 14px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--section-color);
  background: color-mix(in srgb, var(--section-color) 12%, #fff);
  font-weight: 900;
}

.section-card h3 {
  margin-bottom: 7px;
  font-size: 15px;
  line-height: 1.35;
}

.section-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.workbook-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.workbook-card {
  min-width: 0;
  min-height: 178px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 16px;
  color: inherit;
  text-align: left;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 6px 18px rgb(29 44 77 / 4%);
  cursor: pointer;
  transition: 0.18s ease;
}

.workbook-card:hover,
.workbook-card:focus-visible {
  transform: translateY(-3px);
  border-color: #9dadde;
  box-shadow: 0 17px 36px rgb(29 44 77 / 11%);
}

.workbook-card__cover {
  width: 76px;
  min-height: 118px;
  border-radius: 12px 12px 12px 4px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(145deg, var(--section-color, #3156d3), #253c8d);
  box-shadow: inset -6px 0 rgb(0 0 0 / 7%);
  font-size: 28px;
  font-weight: 900;
}

.workbook-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.workbook-card__teacher {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.workbook-card h3 {
  margin-bottom: 7px;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbook-card__description {
  min-height: 38px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.workbook-card__meta {
  margin-top: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workbook-card__meta span,
.preview-tags span {
  padding: 4px 8px;
  border-radius: 999px;
  color: #66758d;
  background: #f1f4fa;
  font-size: 11px;
  font-weight: 800;
}

.workspace-view {
  margin: 24px 0 0;
}

.workspace-layout {
  min-height: calc(100vh - 128px);
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.directory-panel {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 126px);
  padding: 18px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: auto;
  background: rgb(255 255 255 / 96%);
  box-shadow: var(--shadow-sm);
}

.directory-panel__head {
  padding: 3px 5px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.directory-panel__head h2 {
  margin: 0;
  font-size: 18px;
}

.directory-close {
  display: none;
}

.directory-close,
.directory-toggle {
  display: none;
}

.section-navigation {
  padding-top: 10px;
}

.sidebar-section {
  margin-bottom: 4px;
}

.sidebar-section__button {
  width: 100%;
  min-height: 42px;
  padding: 9px 9px;
  border: 0;
  border-radius: 10px;
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  color: #53637b;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.sidebar-section__button[aria-expanded="true"] {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.sidebar-section__rail {
  width: 4px;
  height: 18px;
  border-radius: 4px;
  background: var(--section-color, #b8c5dd);
}

.sidebar-section__name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-section__chevron {
  font-size: 14px;
}

.sidebar-workbooks {
  margin: 3px 0 9px 14px;
  padding: 4px 0 4px 10px;
  border-left: 1px solid #dce4ef;
}

.sidebar-empty {
  padding: 9px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-workbook__button {
  width: 100%;
  padding: 9px;
  border: 0;
  border-radius: 10px;
  color: #627188;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.sidebar-workbook__button.is-current {
  color: #fff;
  background: var(--accent);
}

.sidebar-workbook__button strong,
.sidebar-workbook__button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-workbook__button strong {
  font-size: 12px;
}

.sidebar-workbook__button small {
  margin-top: 2px;
  opacity: 0.78;
  font-size: 10px;
}

.directory-tree {
  margin: 5px 0 3px 7px;
  padding-left: 9px;
  border-left: 1px dashed #bac7db;
}

.tree-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tree-list .tree-list {
  margin-left: 10px;
}

.tree-button {
  width: 100%;
  min-height: 34px;
  padding: 6px;
  border: 0;
  border-radius: 7px;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 5px;
  color: #64738a;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.tree-button:hover,
.tree-button.is-active {
  color: var(--accent-dark);
  background: #edf2ff;
}

.tree-button__name {
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-button__count {
  min-width: 24px;
  padding: 1px 5px;
  border-radius: 999px;
  color: var(--muted);
  background: #f1f4f8;
  font-size: 9px;
  text-align: center;
}

.workspace-content {
  min-width: 0;
  padding-bottom: 40px;
}

.workspace-toolbar {
  min-height: 48px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.breadcrumb {
  min-width: 0;
  margin: 0;
  flex: 1;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-titlebar,
.question-panel {
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 95%);
  box-shadow: var(--shadow-sm);
}

.workspace-titlebar {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.workspace-titlebar h2 {
  margin-bottom: 6px;
  font-size: clamp(23px, 3vw, 34px);
}

.workspace-titlebar p {
  margin-bottom: 0;
}

.privacy-badge {
  padding: 7px 10px;
  border: 1px solid #ccebd9;
  border-radius: 999px;
  flex: 0 0 auto;
  color: var(--success);
  background: var(--success-soft);
  font-size: 12px;
  font-weight: 900;
}

.question-panel__head h3 {
  margin-bottom: 14px;
  font-size: 21px;
}

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

.question-group {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
}

.question-group__head {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.question-group__head h4 {
  margin: 0;
  font-size: 16px;
}

.question-group__head p,
.question-group__note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.group-toggle {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 8px;
  border: 0;
  color: var(--accent);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.question-number-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.question-card {
  position: relative;
  min-width: 0;
}

.question-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.question-card__visual {
  min-height: 48px;
  padding: 8px;
  border: 1px solid #d8e1ed;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #fbfcff;
  cursor: pointer;
}

.question-card strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-card input:checked + .question-card__visual {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgb(49 86 211 / 20%);
}

.question-card input:focus-visible + .question-card__visual {
  outline: 3px solid #3156d3;
  outline-offset: 2px;
}

.state-panel {
  min-height: 150px;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--ink-soft);
  background: rgb(255 255 255 / 65%);
  text-align: center;
}

.state-panel p,
.state-panel small {
  margin: 0;
}

.state-panel__copy {
  min-width: 0;
}

.state-panel--compact {
  min-height: 104px;
}

.state-panel__icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 900;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #d9e1f4;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.selection-dock {
  position: fixed;
  z-index: 80;
  right: max(24px, calc((100vw - var(--content)) / 2));
  bottom: 16px;
  left: max(24px, calc((100vw - var(--content)) / 2));
  min-height: var(--dock-height);
  padding: 12px 16px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 17px;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(180px, auto) auto auto;
  align-items: center;
  gap: 12px;
  color: #fff;
  background: rgb(23 35 59 / 96%);
  box-shadow: 0 18px 45px rgb(21 33 55 / 27%);
  backdrop-filter: blur(16px);
}

body[data-view="workspace"] .selection-dock {
  left: max(
    calc(var(--sidebar) + 46px),
    calc((100vw - var(--content)) / 2 + var(--sidebar) + 22px)
  );
}

.selection-summary {
  min-width: 0;
  padding: 0;
  border: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.selection-count {
  width: 45px;
  height: 45px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--accent);
  font-size: 18px;
  font-weight: 900;
}

.selection-summary strong,
.selection-summary small {
  display: block;
}

.selection-summary small {
  overflow: hidden;
  color: #b8c3d8;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-status {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: #cad2e1;
  font-size: 12px;
  text-align: right;
}

.permission-status.is-allowed {
  color: #87e1c2;
}
.permission-status.is-denied {
  color: #ffc0c6;
}

.permission-action {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 8px;
  color: #fff;
  background: rgb(255 255 255 / 10%);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.drawer-backdrop {
  position: fixed;
  z-index: 89;
  inset: 0;
  background: rgb(20 31 52 / 42%);
  backdrop-filter: blur(2px);
}

.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  overflow: auto;
  color: var(--ink);
  background: transparent;
  box-shadow: var(--shadow-lg);
}

.dialog::backdrop {
  background: rgb(19 29 49 / 50%);
  backdrop-filter: blur(5px);
}

.dialog--wide {
  width: min(780px, calc(100vw - 32px));
}
.dialog--preview {
  width: min(1100px, calc(100vw - 24px));
}

.dialog-card {
  padding: 26px;
  background: #fff;
}

.dialog-card--compact {
  padding-bottom: 22px;
}

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

.dialog-head h2 {
  margin-bottom: 6px;
}
.dialog-head p.muted {
  margin-bottom: 0;
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--ink-soft);
  background: #fff;
  font-size: 20px;
  cursor: pointer;
}

.icon-button--small {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 14px;
}

.icon-button--danger {
  color: var(--danger);
}
.icon-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.field {
  margin-bottom: 16px;
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
}

.field input:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: #f5f6f8;
}

.field-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.form-message {
  min-height: 24px;
  margin-bottom: 10px;
  color: var(--danger);
  font-size: 13px;
}

.form-message[data-state="success"] {
  color: var(--success);
}

.form-message[data-state="pending"] {
  color: var(--muted);
}

.form-message[data-state="info"] {
  color: var(--ink-soft);
}

.dialog-card[aria-busy="true"] {
  cursor: progress;
}

.dialog-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

#loginDialog .dialog-actions {
  flex-wrap: wrap;
}

.dialog-actions--split {
  justify-content: space-between;
}

.selected-list {
  max-height: 50vh;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  overflow: auto;
  list-style: none;
}

.selected-row {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  grid-template-columns: 22px 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  background: #fbfcff;
}

.selected-row.is-dragging {
  opacity: 0.42;
}
.drag-handle {
  color: var(--muted);
  cursor: grab;
}
.selected-row__order {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 900;
}
.selected-row__copy {
  min-width: 0;
}
.selected-row__copy strong,
.selected-row__copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.selected-row__copy small {
  color: var(--muted);
  font-size: 11px;
}
.selected-row__actions {
  display: flex;
  gap: 4px;
}

.choice-group {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  display: grid;
  gap: 8px;
}

.choice-group legend {
  margin-bottom: 8px;
  font-weight: 900;
}
.choice-card {
  position: relative;
}
.choice-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.choice-card > span {
  min-height: 58px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  display: grid;
  gap: 2px;
  background: #fff;
  cursor: pointer;
}
.choice-card strong,
.choice-card small {
  display: block;
}
.choice-card small {
  color: var(--muted);
  font-size: 12px;
}
.choice-card input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px rgb(49 86 211 / 8%);
}
.choice-card input:focus-visible + span {
  outline: 3px solid rgb(49 86 211 / 34%);
  outline-offset: 2px;
}

.workbook-switcher {
  display: grid;
  gap: 16px;
}
.workbook-switcher__section h3 {
  margin-bottom: 8px;
  font-size: 15px;
}
.workbook-switcher__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.workbook-switcher__button {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  cursor: pointer;
}
.workbook-switcher__button.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.workbook-switcher__button strong,
.workbook-switcher__button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workbook-switcher__button small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.pdf-preview-card {
  min-height: min(820px, calc(100vh - 24px));
  display: flex;
  flex-direction: column;
}
.preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.preview-notice {
  margin: -8px 0 12px;
  padding: 10px 12px;
  border: 1px solid #f1d7a5;
  border-radius: 10px;
  color: var(--warning);
  background: var(--warning-soft);
  font-size: 13px;
}
.pdf-preview-frame {
  width: 100%;
  min-height: 600px;
  border: 1px solid var(--line);
  border-radius: 12px;
  flex: 1;
  background: #eef1f6;
}

.pdf-preview-fallback {
  align-items: center;
  gap: 14px;
  justify-content: space-between;
  margin-top: 10px;
}

.pdf-preview-fallback .button {
  flex: 0 0 auto;
}

.toast-region {
  position: fixed;
  z-index: 220;
  top: 88px;
  right: 20px;
  width: min(360px, calc(100vw - 40px));
  display: grid;
  gap: 8px;
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-size: 13px;
}
.toast--success {
  color: var(--success);
  border-color: #bfe3d7;
  background: var(--success-soft);
}
.toast--error {
  color: var(--danger);
  border-color: #f0c9ce;
  background: var(--danger-soft);
}

body.embed-preview .announcement,
body.embed-preview .site-header {
  display: none;
}
body.embed-preview .workspace-view {
  margin-top: 0;
}

@media (max-width: 1100px) {
  .section-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .workbook-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .selection-dock {
    grid-template-columns: minmax(190px, 1fr) minmax(150px, auto) auto;
  }
  .dock-clear {
    display: none;
  }
}

@media (max-width: 860px) {
  :root {
    --content: 100%;
  }
  body,
  body[data-view="workspace"] {
    --content: 100%;
  }
  main {
    padding-right: 18px;
    padding-left: 18px;
  }
  .site-header {
    padding-right: 18px;
    padding-left: 18px;
  }
  .hero {
    padding: 34px;
  }
  .hero-privacy {
    flex-basis: 220px;
  }
  .section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .workspace-layout {
    display: block;
    min-height: calc(100vh - 110px);
  }
  .directory-panel {
    position: fixed;
    z-index: 90;
    inset: 0 auto 0 0;
    width: min(var(--sidebar), calc(100vw - 44px));
    max-height: none;
    border: 0;
    border-radius: 0 20px 20px 0;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 18px 0 40px rgb(21 35 60 / 22%);
  }
  .directory-panel.is-open {
    transform: none;
  }
  .directory-close,
  .directory-toggle {
    display: inline-flex;
  }
  .workspace-toolbar {
    position: sticky;
    z-index: 40;
    top: 76px;
    padding: 8px 0;
    background: rgb(244 247 251 / 92%);
    backdrop-filter: blur(12px);
  }
  .workspace-titlebar,
  .question-panel {
    padding: 20px;
  }
  .selection-dock,
  body[data-view="workspace"] .selection-dock {
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 12px;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .permission-status {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    text-align: left;
  }
  .dock-clear {
    display: none;
  }
  body.drawer-open {
    overflow: hidden;
  }
}

@media (max-width: 560px) {
  :root {
    --dock-height: 106px;
  }
  .announcement__inner {
    padding: 8px 12px;
    flex-wrap: wrap;
    font-size: 12px;
  }
  .site-header {
    min-height: 62px;
    padding: 9px 12px;
    gap: 8px;
  }
  .brand {
    gap: 7px;
  }
  .brand__mark {
    width: 35px;
    height: 35px;
    border-radius: 10px 10px 10px 4px;
  }
  .brand strong {
    font-size: 14px;
  }
  .brand small,
  .header-context,
  .account-chip,
  #logoutButton {
    display: none !important;
  }
  .header-actions {
    gap: 5px;
  }
  .header-actions .button {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 12px;
  }
  main {
    padding: 0 11px 44px;
  }
  .hero {
    min-height: auto;
    margin: 16px 0 24px;
    padding: 25px 21px;
    display: block;
    border-radius: 21px;
  }
  .hero h1 {
    font-size: 30px;
  }
  .hero-privacy {
    margin-top: 20px !important;
  }
  .section-heading {
    align-items: flex-start;
  }
  .section-heading > .muted {
    display: none;
  }
  .section-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }
  .section-card {
    min-height: 88px;
    padding: 13px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    column-gap: 11px;
    align-items: center;
  }
  .section-card__icon {
    margin: 0;
    grid-row: 1 / 3;
  }
  .section-card h3 {
    margin: 0;
  }
  .section-card p {
    grid-column: 2;
  }
  .workbook-grid {
    grid-template-columns: 1fr;
  }
  .workbook-card {
    min-height: 150px;
    grid-template-columns: 64px minmax(0, 1fr);
    padding: 14px;
  }
  .workbook-card__cover {
    width: 64px;
    min-height: 104px;
  }
  .workspace-view {
    margin-top: 12px;
  }
  .workspace-toolbar {
    top: 62px;
    gap: 7px;
  }
  .workspace-toolbar .button {
    min-height: 36px;
    padding: 7px 9px;
    font-size: 11px;
  }
  .breadcrumb {
    font-size: 10px;
  }
  .workspace-titlebar {
    align-items: flex-start;
  }
  .privacy-badge {
    font-size: 10px;
  }
  .workspace-titlebar,
  .question-panel {
    padding: 15px 13px;
    border-radius: 17px;
  }
  .question-group {
    padding: 12px 10px;
  }
  .question-group__head {
    align-items: flex-start;
  }
  .question-number-grid {
    gap: 6px;
  }
  .question-card__visual {
    min-height: 42px;
    padding: 5px;
  }
  .question-card strong {
    font-size: 12px;
  }
  .selection-dock,
  body[data-view="workspace"] .selection-dock {
    right: 8px;
    left: 8px;
    bottom: max(6px, env(safe-area-inset-bottom));
    min-height: 94px;
    padding: 9px 10px;
    gap: 7px;
    border-radius: 14px;
  }
  .selection-count {
    width: 38px;
    height: 38px;
    font-size: 15px;
  }
  .selection-summary small {
    max-width: 160px;
  }
  .permission-status {
    font-size: 10px;
  }
  .dock-generate {
    min-height: 38px;
    padding: 7px 10px;
    font-size: 12px;
  }
  .dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }
  .dialog-card {
    padding: 20px 15px;
  }
  #loginDialog .dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #loginDialog .dialog-actions .button {
    min-width: 0;
    padding-inline: 8px;
    white-space: normal;
  }
  #loginDialog .dialog-actions .button--primary {
    grid-column: 1 / -1;
  }
  .field-action {
    grid-template-columns: 1fr;
  }
  .selected-row {
    grid-template-columns: 22px minmax(0, 1fr) auto;
  }
  .selected-row__order {
    display: none;
  }
  .selected-row__actions {
    flex-direction: column;
  }
  .workbook-switcher__grid {
    grid-template-columns: 1fr;
  }
  .pdf-preview-frame {
    min-height: 420px;
  }
}

/* Keep sticky regions below the optional announcement without changing the
   compact mobile drawer position. */
body {
  --header-sticky-height: 58px;
  --announcement-sticky-height: 0px;
  --workspace-sticky-top: calc(
    var(--header-sticky-height) + var(--announcement-sticky-height)
  );
}

body[data-announcement-visible="true"] {
  --announcement-sticky-height: 40px;
}

.announcement-bar {
  top: var(--header-sticky-height);
}

.workspace-layout {
  min-height: calc(100vh - var(--workspace-sticky-top));
}

.directory-panel {
  top: var(--workspace-sticky-top);
  max-height: calc(100vh - var(--workspace-sticky-top));
  min-height: calc(100vh - var(--workspace-sticky-top));
}

@media (max-width: 860px) {
  .directory-panel {
    top: 0;
    min-height: 100vh;
    max-height: 100vh;
  }

  .workspace-toolbar {
    top: var(--workspace-sticky-top);
  }
}

@media (max-width: 560px) {
  body {
    --header-sticky-height: 56px;
  }

  body[data-announcement-visible="true"] {
    --announcement-sticky-height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .announcement,
  .site-header,
  .selection-dock {
    display: none !important;
  }
  body {
    padding: 0;
    background: #fff;
  }
}

/* Minimal catalog workspace: direct tree navigation with the existing feature set. */
:root {
  --canvas: #f6f7fa;
  --sidebar: 286px;
  --dock-height: 72px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --shadow-sm: none;
}

body,
body[data-view="workspace"] {
  background: var(--canvas);
}

.directory-panel .directory-close {
  display: none;
}

.site-header {
  min-height: 58px;
  padding: 8px 20px;
  gap: 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  backdrop-filter: none;
}

.brand {
  gap: 9px;
}

.brand__mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: none;
}

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

.brand small {
  font-size: 10px;
}

.header-context {
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-weight: 600;
}

.header-actions .button {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 13px;
}

main {
  max-width: none;
  padding: 0 0 36px;
}

.workspace-view {
  margin: 0;
}

.workspace-layout {
  min-height: calc(100vh - 58px);
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
}

.directory-panel {
  position: sticky;
  top: 58px;
  max-height: calc(100vh - 58px);
  min-height: calc(100vh - 58px);
  padding: 14px 10px 96px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.directory-panel__head {
  padding: 3px 9px 12px;
}

.directory-panel__head h2 {
  font-size: 17px;
}

.directory-panel__hint {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.home-nav-button {
  width: 100%;
  min-height: 40px;
  margin: 10px 0 8px;
  padding: 8px 9px;
  border: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #425069;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.home-nav-button:hover,
.home-nav-button.is-active {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.home-nav-button__icon {
  width: 18px;
  color: var(--accent);
  font-size: 16px;
  text-align: center;
}

.home-content {
  max-width: 780px;
  padding: 76px 8vw 120px;
}

.home-content h1 {
  margin-bottom: 10px;
  font-size: clamp(25px, 3vw, 34px);
}

.home-content__intro {
  max-width: 620px;
  margin-bottom: 28px;
  color: var(--ink-soft);
  font-size: 15px;
}

.home-content__notice {
  margin-bottom: 24px;
  padding: 13px 15px;
  border: 1px solid #dce5f7;
  border-radius: 10px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #33476f;
  background: #f5f7ff;
}

.home-content__notice p {
  margin: 2px 0 0;
  font-size: 13px;
}

.home-content__placeholder {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.home-content__link {
  display: inline-flex;
  margin-top: 18px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.home-content__link:hover {
  text-decoration: underline;
}

.section-navigation {
  padding-top: 8px;
}

.sidebar-section__button {
  min-height: 40px;
  padding: 8px 9px;
  border-radius: 8px;
  grid-template-columns: 3px minmax(0, 1fr) auto;
  color: #425069;
}

.sidebar-section__button[aria-expanded="true"] {
  color: var(--ink);
  background: #f2f5fa;
}

.sidebar-section__rail {
  width: 3px;
  height: 16px;
}

.sidebar-section__name {
  font-size: 15px;
  font-weight: 700;
}

.sidebar-workbooks {
  margin: 2px 0 7px 10px;
  padding: 3px 0 3px 10px;
}

.sidebar-workbook__button {
  padding: 8px 9px;
  border-radius: 7px;
}

.sidebar-workbook__button.is-current {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.sidebar-workbook__button strong {
  font-size: 12px;
}

.sidebar-workbook__button small {
  color: var(--muted);
  opacity: 1;
  font-size: 10px;
}

.directory-tree {
  margin-left: 7px;
}

.tree-button {
  min-height: 32px;
  padding: 5px 6px;
}

.tree-button__name {
  font-size: 11px;
  font-weight: 650;
}

.workspace-content {
  padding: 20px 28px 42px;
  background: #fff;
}

.workspace-toolbar {
  min-height: 32px;
  margin-bottom: 14px;
}

.breadcrumb {
  font-size: 12px;
}

.workspace-titlebar,
.question-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.workspace-titlebar {
  margin-bottom: 20px;
  align-items: flex-end;
}

.workspace-titlebar h2 {
  margin: 0 0 2px;
  font-size: 23px;
}

.workspace-titlebar .eyebrow {
  margin-bottom: 3px;
}

.privacy-badge {
  display: none;
}

.question-panel__head h3 {
  margin-bottom: 12px;
  font-size: 19px;
}

.question-panel__head .eyebrow {
  margin-bottom: 3px;
}

.question-groups {
  gap: 12px;
}

.question-group {
  padding: 15px;
  border-radius: 10px;
  background: #fff;
}

.question-number-grid {
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 9px;
}

.question-card__visual {
  min-height: 48px;
  border-radius: 9px;
  background: #fff;
}

.question-card input:checked + .question-card__visual {
  color: var(--accent-dark);
  background: #f2f5ff;
  box-shadow: none;
}

.state-panel,
.state-panel--compact {
  min-height: 210px;
  padding: 36px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.state-panel__icon {
  display: none;
}

.selection-dock,
body[data-view="workspace"] .selection-dock {
  right: 18px;
  bottom: 12px;
  left: calc(var(--sidebar) + 18px);
  min-height: 62px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  grid-template-columns: minmax(190px, 1fr) minmax(150px, auto) auto auto;
  color: var(--ink);
  background: rgb(255 255 255 / 97%);
  box-shadow: 0 10px 26px rgb(25 38 66 / 12%);
  backdrop-filter: blur(10px);
}

.selection-count {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  color: #fff;
  font-size: 15px;
}

.selection-summary small {
  color: var(--muted);
}

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

.permission-status.is-allowed {
  color: var(--success);
}

.permission-status.is-denied {
  color: var(--danger);
}

.permission-action {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: #d7e0ff;
}

.announcement-copy {
  margin-bottom: 16px;
  color: var(--ink-soft);
  white-space: pre-wrap;
}

.dialog--compact {
  width: min(460px, calc(100vw - 32px));
}

@media (max-width: 860px) {
  .directory-panel .directory-close {
    display: inline-flex;
  }

  .workspace-layout {
    display: block;
  }

  .directory-panel {
    position: fixed;
    top: 0;
    width: min(var(--sidebar), calc(100vw - 44px));
    min-height: 100vh;
    max-height: 100vh;
    padding-bottom: 24px;
    border-right: 1px solid var(--line);
    border-radius: 0 12px 12px 0;
  }

  .directory-close {
    display: inline-flex;
  }

  .workspace-content {
    padding: 12px 16px 36px;
  }

  .home-content {
    padding: 48px 12px 100px;
  }

  .announcement-bar {
    top: 58px;
    min-height: 38px;
    padding: 6px 12px;
  }

  .workspace-toolbar {
    top: 58px;
    background: rgb(255 255 255 / 96%);
  }

  .selection-dock,
  body[data-view="workspace"] .selection-dock {
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .permission-status {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  :root {
    --dock-height: 94px;
  }

  .site-header {
    min-height: 56px;
    padding: 8px 10px;
  }

  .brand small,
  .header-context,
  .account-chip,
  #logoutButton {
    display: none !important;
  }

  .header-actions .button {
    padding: 6px 8px;
    font-size: 11px;
  }

  .workspace-content {
    padding: 8px 12px 34px;
  }

  .home-content {
    padding: 40px 2px 96px;
  }

  .home-content h1 {
    font-size: 25px;
  }

  .announcement-bar {
    top: 56px;
    min-height: 36px;
    padding: 6px 10px;
  }

  .announcement-bar__text {
    font-size: 12px;
  }

  .announcement-bar__more {
    font-size: 11px;
  }

  .workspace-toolbar {
    top: 56px;
  }

  .workspace-titlebar {
    margin-bottom: 16px;
    display: block;
  }

  .workspace-titlebar h2 {
    font-size: 20px;
  }

  .privacy-badge {
    display: inline-block;
    margin-top: 8px;
  }

  .question-number-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .selection-dock,
  body[data-view="workspace"] .selection-dock {
    min-height: 76px;
  }

  .permission-status {
    display: none;
  }

  .selection-summary small {
    display: none;
  }
}

/* Final sticky offsets for the minimal workspace overrides above. */
.announcement-bar {
  top: var(--header-sticky-height);
}

.workspace-layout {
  min-height: calc(100vh - var(--workspace-sticky-top));
}

.directory-panel {
  top: var(--workspace-sticky-top);
  max-height: calc(100vh - var(--workspace-sticky-top));
  min-height: calc(100vh - var(--workspace-sticky-top));
}

@media (max-width: 860px) {
  .directory-panel {
    top: 0;
    min-height: 100vh;
    max-height: 100vh;
  }

  .workspace-toolbar {
    top: var(--workspace-sticky-top);
  }
}
