:root {
  /* Claude-inspired warm palette: deep warm neutrals + coral accent */
  --surface: #f5f1e8;                  /* warm cream background */
  --surface-container-lowest: #fbf8f1; /* card body */
  --surface-container-low: #efeadd;    /* subtle warm surface */
  --surface-container: #e6dfce;        /* deeper warm */
  --surface-variant: #d8d0bc;          /* dividers / chips bg */
  --on-surface: #1a1814;               /* deep warm near-black text */
  --on-surface-variant: #58524a;       /* warm muted text */
  --outline: #8a8276;                  /* warm border */
  --outline-variant: #c4bba9;          /* light warm border */
  --primary: #1f1d18;                  /* deep warm-black primary CTA */
  --primary-hover: #0f0e0b;            /* darker on hover */
  --primary-container: #efe0d2;        /* coral-tinged container */
  --secondary-container: #e9e0cb;      /* warm secondary */
  --accent: #c96442;                   /* Claude coral / burnt sienna */
  --accent-hover: #a94f30;
  --accent-soft: #f4ddcd;              /* coral wash */
  --danger: #b91c1c;
  --danger-bg: #f7d9d3;
  --warn: #92400e;
  --warn-bg: #f7e7c4;
  --success-bg: #d8e7c8;
  --success-text: #2d4a1e;
  --shadow-soft: 0 8px 30px rgba(60, 40, 20, 0.06);
  --shadow-md: 0 4px 16px rgba(60, 40, 20, 0.08);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --container: 1200px;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  color: var(--on-surface);
  background-color: var(--surface);
  background-image:
    linear-gradient(to right, rgba(120, 95, 60, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(120, 95, 60, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  font-family: "Inter", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

ol,
ul {
  padding-left: 1.2em;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface-container-lowest);
  border-bottom: 1px solid var(--surface-variant);
}

.topbar-inner {
  max-width: var(--container);
  min-height: 72px;
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--on-surface);
  font-size: 22px;
  font-weight: 800;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  color: var(--primary);
  background: var(--surface-container-low);
  font-weight: 800;
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-link {
  min-height: 72px;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  color: var(--on-surface-variant);
  font-size: 15px;
  font-weight: 600;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.account-icon {
  color: var(--on-surface-variant);
  display: inline-flex;
}

.container {
  width: min(100% - 48px, var(--container));
  margin: 0 auto;
  padding: 32px 0 80px;
}

.page-upload .container {
  min-height: calc(100vh - 160px);
  display: grid;
  place-items: center;
}

.generator-card,
.card {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.generator-card {
  position: relative;
  overflow: hidden;
  width: min(100%, 680px);
  padding: 56px 64px;
}

.card-accent {
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--primary);
}

.hero-copy,
.page-header {
  text-align: center;
}

.page-header {
  max-width: 780px;
  margin: 0 auto 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.page-title {
  margin: 0 0 12px;
  color: var(--on-surface);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.25;
}

.page-desc {
  margin: 0;
  color: var(--on-surface-variant);
  font-size: 18px;
}

.upload-form {
  margin-top: 40px;
}

.upload-zone {
  min-height: 344px;
  padding: 48px 32px;
  border: 2px dashed var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: #f5f1e8;
}

.upload-zone.file-ready {
  border-color: var(--primary);
  background: #efe0d2;
}

.upload-zone.pdf-ready {
  border-style: solid;
}

.upload-zone.pdf-ready .material-symbols-outlined {
  color: var(--primary);
}

.upload-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
  border: 0;
  padding: 0;
}

.upload-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-lg);
  background: var(--primary-container);
  color: var(--primary);
  font-size: 36px;
}

.upload-title {
  margin-top: 16px;
  color: var(--on-surface);
  font-size: 20px;
  font-weight: 600;
}

.upload-subtitle,
.file-name,
.hint {
  color: var(--on-surface-variant);
}

.file-name {
  margin-top: 8px;
  font-size: 14px;
}

.info-callout {
  margin: 32px 0;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--surface-variant);
  border-radius: var(--radius-sm);
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
}

.info-callout p {
  margin: 0;
}

.info-callout .material-symbols-outlined {
  color: #27496d;
  margin-top: 2px;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.field {
  display: grid;
  gap: 8px;
  margin: 0;
}

.field-label {
  color: var(--on-surface);
  font-size: 14px;
  font-weight: 700;
}

.field select,
.field-textarea {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  background: var(--surface-container-lowest);
  color: var(--on-surface);
  padding: 12px 14px;
}

.field select:focus,
.field-textarea:focus {
  border-color: var(--primary);
  outline: 2px solid rgba(201, 100, 66, 0.12);
}

.field-textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

.field-error {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  border: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  border: 1px solid var(--outline-variant);
  background: var(--surface-container-lowest);
  color: var(--on-surface);
}

.btn-secondary:hover {
  background: var(--surface-container-low);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-lg {
  width: 100%;
  min-height: 72px;
  font-size: 20px;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 14px;
}

.preview-wrap {
  margin-top: 24px;
  text-align: center;
}

.preview-wrap img {
  max-width: 100%;
  max-height: 50vh;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  transition: transform 180ms ease;
}

.preview-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.flash {
  width: min(100% - 48px, 760px);
  list-style: none;
  padding: 0;
  margin: 18px auto 0;
}

.flash li {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.flash-info { background: #f4ddcd; color: #7a3520; }
.flash-success { background: var(--success-bg); color: var(--success-text); }
.flash-warning { background: #fef3c7; color: #854d0e; }
.flash-error { background: var(--danger-bg); color: #93000a; }

.result-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.result-head .page-desc,
.result-head .page-title {
  max-width: 820px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.chip-mini {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-weight: 700;
}

.chip {
  padding: 6px 12px;
  background: var(--primary-container);
  color: #1a1814;
  font-size: 13px;
}

.chip-mini {
  padding: 4px 8px;
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
  font-size: 12px;
}

.tabs {
  position: sticky;
  top: 72px;
  z-index: 10;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px;
  margin-bottom: 18px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface-container-lowest);
  box-shadow: var(--shadow-soft);
}

.tab {
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--on-surface-variant);
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  min-height: 42px;
  padding: 9px 14px;
  white-space: nowrap;
}

.tab.active {
  background: var(--primary);
  color: #ffffff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.content-card {
  padding: 32px;
  margin-bottom: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.section-heading .material-symbols-outlined {
  color: var(--primary);
}

.section-title,
.subsection-title {
  margin: 0;
  color: var(--on-surface);
}

.section-title {
  font-size: 22px;
  font-weight: 800;
}

.subsection-title {
  margin: 22px 0 8px;
  font-size: 15px;
  font-weight: 800;
}

.worksheet-box,
.answer-box,
.muted-box {
  border: 1px solid var(--surface-variant);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: var(--surface);
}

.answer-box {
  color: #7f1d1d;
  background: #fff7f7;
}

.muted-box {
  color: var(--on-surface-variant);
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.clean-list {
  margin: 0;
  padding-left: 20px;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.qlist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.qitem {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 18px 0;
  border-bottom: 1px dashed var(--outline-variant);
}

.qitem:last-child {
  border-bottom: 0;
}

.qno {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
}

.qbody {
  min-width: 0;
}

.solution-card {
  padding: 22px 0;
  border-bottom: 1px dashed var(--outline-variant);
}

.solution-card:last-child {
  border-bottom: 0;
}

.solution-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.solution-topline h3 {
  margin: 0;
  font-size: 18px;
}

.question-text {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.student-guide {
  display: grid;
  gap: 10px;
}

.student-guide p {
  margin: 0;
}

.answer-inline {
  color: #991b1b;
  font-weight: 800;
}

.steps {
  margin: 8px 0 0;
  padding-left: 22px;
}

.steps li {
  margin-bottom: 6px;
}

.easy-steps li {
  padding: 8px 0;
}

.simple-solution-list {
  display: grid;
  gap: 0;
}

.simple-solution-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 18px;
  padding: 20px 0;
  border-bottom: 1px solid var(--surface-variant);
}

.simple-solution-card:last-child {
  border-bottom: 0;
}

.simple-no {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface-container-low);
  color: var(--primary);
  font-size: 18px;
  font-weight: 900;
}

.simple-main {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.simple-question {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.simple-answer {
  color: #991b1b;
  font-size: 16px;
  font-weight: 900;
}

.simple-steps {
  margin: 0;
  padding-left: 0;
  display: grid;
  gap: 4px;
}

.simple-steps div {
  margin: 0;
}

.note,
.warn {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}

.note {
  border-left: 4px solid var(--primary);
  background: var(--surface-container-low);
}

.warn {
  border-left: 4px solid #f97316;
  background: var(--warn-bg);
  color: #7c2d12;
}

.pdf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.pdf-link {
  min-height: 126px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface-container-lowest);
}

.pdf-link:hover {
  border-color: var(--primary);
  background: #fbf8f1;
}

.pdf-link.featured {
  border-color: var(--primary);
  background: #f5f1e8;
}

.pdf-link .material-symbols-outlined {
  color: var(--primary);
}

.pdf-link strong {
  font-size: 16px;
}

.pdf-link small {
  color: var(--on-surface-variant);
}

.empty {
  padding: 56px 24px;
  text-align: center;
}

.empty-icon {
  margin-bottom: 12px;
  color: var(--outline);
  font-size: 44px;
}

.hist-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.hist-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.hist-thumb {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface-container-low);
  color: var(--outline);
}

.hist-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hist-body {
  min-width: 0;
}

.hist-title {
  margin-bottom: 8px;
  font-size: 19px;
  font-weight: 800;
}

.hist-meta,
.hist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hist-date {
  margin: 10px 0 14px;
  color: var(--on-surface-variant);
  font-size: 14px;
}

.inline {
  display: inline;
}

.page-library {
  background: #e6dfce;
  background-image: none;
}

.page-library .container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.page-library .site-footer {
  display: none;
}

.mathsecr-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 44px;
  padding: 0 18px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  background: #ffffff;
  border-bottom: 1px solid #dccfb6;
  box-shadow: 0 1px 0 rgba(26, 24, 20, 0.03);
}

.mathsecr-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #7a3520;
  font-size: 19px;
  font-weight: 900;
  white-space: nowrap;
}

.logo-shape {
  width: 26px;
  height: 28px;
  display: inline-block;
  border-radius: 5px 13px 5px 13px;
  background:
    linear-gradient(135deg, #c96442 0 44%, transparent 45%),
    linear-gradient(135deg, transparent 0 34%, #1f1d18 35% 100%);
  transform: skew(-8deg);
}

.teacher-point {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #1a1814;
  font-size: 13px;
  white-space: nowrap;
}

.teacher-point > span:last-child {
  color: #c96442;
  font-weight: 900;
}

.teacher-badge {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f4ddcd;
  color: #c96442;
  font-size: 11px;
  font-weight: 900;
}

.mathsecr-menu {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 17px;
  overflow-x: auto;
  scrollbar-width: none;
}

.mathsecr-menu::-webkit-scrollbar {
  display: none;
}

.mathsecr-menu a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-bottom: 2px solid transparent;
  color: #25211d;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.mathsecr-menu a:hover,
.mathsecr-menu a.active {
  color: #c96442;
  border-bottom-color: #c96442;
}

.mathsecr-menu .material-symbols-outlined {
  color: #c96442;
  font-size: 19px;
}

.mathsecr-menu a:nth-child(2) .material-symbols-outlined,
.mathsecr-menu a:nth-child(6) .material-symbols-outlined {
  color: #c96442;
}

.mathsecr-menu a:nth-child(6) .material-symbols-outlined {
  color: #ffb703;
}

.mathsecr-menu a:nth-child(9) .material-symbols-outlined {
  color: #f59e0b;
}

.top-profile {
  color: #8eb6e5;
  font-size: 24px;
}

.library-shell {
  min-height: calc(100vh - 44px);
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
}

.library-sidebar {
  position: sticky;
  top: 44px;
  height: calc(100vh - 44px);
  overflow-y: auto;
  background: #ffffff;
  border-right: 1px solid #c4bba9;
  color: #1a1814;
}

.library-side-head {
  min-height: 68px;
  padding: 0 18px 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.library-side-head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #58524a;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-button:hover {
  background: #f1f5f9;
}

.library-search {
  padding: 18px 14px 20px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #edf0f4;
}

.library-search .material-symbols-outlined {
  color: #6f6a60;
  font-size: 20px;
}

.library-search input {
  width: 100%;
  border: 0;
  border-bottom: 2px solid #1a1814;
  padding: 8px 4px 7px;
  color: #1a1814;
  outline: none;
  font-size: 14px;
}

.library-search input::placeholder {
  color: #94a3b8;
}

.search-mode {
  height: 30px;
  display: inline-flex;
  border: 1px solid #9ca3af;
  border-radius: 4px;
  overflow: hidden;
}

.search-mode button {
  min-width: 46px;
  border: 0;
  background: #ffffff;
  color: #3f3a32;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.search-mode button.active {
  background: #c96442;
  color: #ffffff;
}

.folder-tree {
  padding: 12px 0 28px;
}

.folder-row,
.folder-section-title {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 22px;
  color: #1a1814;
  font-size: 14px;
  font-weight: 800;
}

.folder-row {
  border-radius: 0 18px 18px 0;
}

.folder-row:hover,
.folder-row.active {
  background: #d9d9d9;
}

.folder-label {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.folder-label .material-symbols-outlined {
  font-size: 20px;
}

.folder-icon {
  color: #efbfa3;
}

.folder-section-title {
  margin-top: 10px;
}

.folder-section-title strong,
.folder-row > span:last-child {
  color: #1a1814;
  font-size: 13px;
  font-weight: 900;
}

.folder-caret {
  color: #94a3b8;
  font-size: 18px;
  line-height: 1;
}

.folder-caret.open {
  color: #6f6a60;
}

.free-badge {
  padding: 1px 4px;
  border-radius: 4px;
  background: #c96442;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
}

.library-main {
  min-width: 0;
  padding: 20px 32px 64px;
}

.library-hero {
  position: relative;
  min-height: 194px;
  overflow: hidden;
  border-radius: 12px;
  background: #f4f2ff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: center;
  padding: 32px 54px;
}

.library-hero-copy {
  text-align: center;
}

.library-hero h2 {
  margin: 0 0 10px;
  color: #7a3520;
  font-size: 40px;
  font-weight: 900;
  line-height: 1.2;
}

.library-hero p:not(.eyebrow) {
  margin: 0;
  color: #7a3520;
  font-size: 19px;
  font-weight: 700;
}

.hero-visual {
  position: relative;
  height: 160px;
}

.hero-person {
  position: absolute;
  bottom: 0;
  width: 82px;
  height: 120px;
  border-radius: 42px 42px 14px 14px;
  background: #b7a7e8;
  box-shadow: inset 0 -42px 0 rgba(74, 58, 153, 0.18);
}

.hero-person::before {
  content: "";
  position: absolute;
  top: -26px;
  left: 19px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f3c8a8;
  box-shadow: 0 -10px 0 #3f2d2a;
}

.person-a { left: 96px; background: #bcb0eb; }
.person-b { left: 178px; height: 142px; background: #ffffff; box-shadow: inset 0 -54px 0 rgba(44, 62, 116, 0.22); }
.person-c { left: 262px; background: #c96442; }

.hero-chart {
  position: absolute;
  right: 24px;
  top: 20px;
  width: 54px;
  height: 54px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.12);
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 4px;
  padding: 10px;
}

.hero-chart span {
  width: 7px;
  border-radius: 4px 4px 0 0;
  background: #c96442;
}

.hero-chart span:nth-child(1) { height: 16px; }
.hero-chart span:nth-child(2) { height: 26px; }
.hero-chart span:nth-child(3) { height: 36px; }

.hero-check {
  position: absolute;
  top: 12px;
  left: 48px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #7a3520;
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.12);
  font-size: 34px;
  font-weight: 800;
}

.hero-dots {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}

.hero-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a3a3a3;
}

.hero-dots .active {
  background: #c96442;
}

.library-path-row {
  margin: 54px 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.library-path {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: #1a1814;
  font-size: 16px;
}

.library-path strong {
  font-size: 18px;
  font-weight: 900;
}

.library-path .separator {
  color: #1a1814;
  font-size: 18px;
}

.db-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e6f6ff;
  color: #c96442;
}

.library-green-cta {
  min-height: 54px;
  padding: 0 18px;
  border-radius: 10px;
  background: #68bb5a;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.2);
}

.library-green-cta:hover {
  background: #57a74b;
}

.folder-empty-strip {
  min-height: 72px;
  margin-bottom: 32px;
  border-radius: 12px;
  background: #ffffff;
  color: #9ca3af;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}

.db-panel {
  min-height: 460px;
  border-radius: 12px;
  background: #ffffff;
  padding: 42px 76px 54px;
  box-shadow: 0 1px 0 rgba(26, 24, 20, 0.03);
}

.db-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 24px;
  margin-bottom: 66px;
}

.db-create-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: #c96442;
  font-size: 14px;
  font-weight: 900;
}

.db-create-btn {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 4px;
  background: #c96442;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  font-weight: 900;
}

.db-create-btn:hover {
  background: #7a3520;
}

.db-filter-group {
  display: flex;
  gap: 24px;
}

.db-filter-group label {
  display: grid;
  gap: 6px;
  color: #5a544a;
  font-size: 13px;
  font-weight: 900;
}

.db-filter-group select {
  min-width: 132px;
  height: 46px;
  border: 1px solid #dccfb6;
  border-radius: 4px;
  background: #ffffff;
  color: #1a1814;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 800;
}

.db-section-title {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #dccfb6;
  margin-bottom: 24px;
}

.db-section-title h2 {
  margin: 0;
  color: #5a544a;
  font-size: 18px;
  font-weight: 900;
}

.db-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 26px 28px;
}

.db-card {
  min-height: 132px;
  position: relative;
  padding: 20px 20px 16px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(26, 24, 20, 0.08);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.db-card:hover,
.db-card.selected {
  border-color: #c96442;
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.13);
  transform: translateY(-2px);
}

.db-card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.pro-badge {
  height: 22px;
  min-width: 38px;
  padding: 0 6px;
  border-radius: 999px;
  background: #c96442;
  color: #fff44f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
}

.db-thumb {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #dff3ff;
  color: #e2a78a;
}

.db-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.db-card-title {
  min-height: 42px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #1a1814;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.35;
}

.db-card-title:hover {
  color: #c96442;
}

.db-card-sub {
  margin: 6px 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: #6f6a60;
  font-size: 12px;
  font-weight: 700;
}

.db-card-sub span {
  max-width: 100%;
}

.db-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c96442;
  font-size: 14px;
  font-weight: 900;
}

.progress-dots {
  display: inline-flex;
  gap: 7px;
}

.progress-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d0d0d0;
}

.progress-dots i.active {
  background: #c96442;
}

.db-card-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #eef2f7;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.db-card-actions a,
.db-card-actions button {
  border: 0;
  background: transparent;
  color: #c96442;
  padding: 0;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.db-card-actions button {
  color: #dc2626;
}

.db-empty-state {
  min-height: 280px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: #6f6a60;
  text-align: center;
}

.db-empty-state .material-symbols-outlined {
  font-size: 48px;
  color: #9ccff7;
}

.db-empty-state strong {
  color: #1a1814;
  font-size: 18px;
}

.db-empty-state p {
  margin: 0 0 8px;
}

.question-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
}

.question-detail-overlay:target {
  display: block;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
}

.question-detail-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(540px, 100%);
  height: 100%;
  overflow-y: auto;
  background: #ffffff;
  box-shadow: -24px 0 48px rgba(26, 24, 20, 0.18);
  padding: 38px 38px 56px;
}

.question-detail-panel h2 {
  margin: 0 0 34px;
  color: #333333;
  font-size: 28px;
  font-weight: 900;
}

.detail-close {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #6f6a60;
}

.detail-close:hover {
  background: #f1f5f9;
  color: #1a1814;
}

.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.detail-section-head h3 {
  margin: 0;
  color: #7a3520;
  font-size: 21px;
  font-weight: 900;
}

.detail-section-head a,
.detail-section-head span {
  color: #c65a5a;
  font-size: 15px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.detail-section-head span {
  color: #7a3520;
}

.detail-paper-card {
  margin-bottom: 36px;
  padding: 24px 28px;
  border-radius: 9px;
  background: #ffffff;
  box-shadow: 0 5px 18px rgba(26, 24, 20, 0.14);
  color: #25211d;
  line-height: 1.75;
}

.detail-paper-card p {
  margin: 0 0 14px;
}

.detail-paper-card ol {
  margin: 8px 0 18px;
  padding-left: 22px;
}

.detail-paper-card li {
  margin-bottom: 7px;
}

.detail-source {
  margin-top: 20px !important;
  color: #1a1814;
}

.question-detail-panel hr {
  border: 0;
  border-top: 1px solid #dccfb6;
  margin: 4px 0 34px;
}

.answer-info-list {
  margin: 0;
  display: grid;
  gap: 11px;
}

.answer-info-list div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.answer-info-list dt {
  color: #1a1814;
  font-size: 17px;
  font-weight: 900;
}

.answer-info-list dd {
  margin: 0;
  color: #1a1814;
  font-size: 17px;
  line-height: 1.45;
}

.site-footer {
  width: min(100%, var(--container));
  min-height: 88px;
  margin: 0 auto;
  padding: 24px 32px;
  border-top: 1px solid var(--surface-variant);
  background: var(--surface-container-lowest);
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a:hover {
  color: var(--primary);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(25, 28, 30, 0.84);
  color: #ffffff;
}

.overlay[hidden] {
  display: none !important;
}

.overlay-text {
  text-align: center;
  margin: 20px 0 0;
  font-size: 17px;
}

.overlay-text small {
  color: #d8dadc;
  font-size: 13px;
}

.spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, 0.25);
  border-top-color: #ffffff;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.page-dashboard {
  background: var(--surface);
  background-image: none;
}

.page-dashboard .container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.page-dashboard .site-footer {
  display: none;
}

.dashboard-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  background: var(--surface);
}

.dashboard-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--surface-variant);
  background: #f3f6fa;
}

.dashboard-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

.dashboard-brand-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--primary-container);
  color: var(--primary);
  font-size: 30px;
}

.dashboard-brand strong {
  display: block;
  color: #1a1814;
  font-size: 21px;
  font-weight: 900;
  line-height: 1.2;
}

.dashboard-brand small {
  display: block;
  margin-top: 2px;
  color: #3f3a32;
  font-size: 15px;
}

.dashboard-nav,
.dashboard-folders,
.dashboard-sidebar-footer {
  display: grid;
  gap: 7px;
}

.dashboard-nav a,
.dashboard-folders a,
.dashboard-sidebar-footer a {
  min-height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 6px;
  color: #3f3a32;
  font-size: 16px;
  font-weight: 600;
}

.dashboard-nav a:hover,
.dashboard-folders a:hover,
.dashboard-sidebar-footer a:hover {
  background: #eaf0fb;
  color: var(--primary);
}

.dashboard-nav a.active {
  position: relative;
  background: #eaf1ff;
  color: #1f1d18;
}

.dashboard-nav a.active::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 0;
  bottom: 8px;
  width: 3px;
  border-radius: 99px 0 0 99px;
  background: #1f1d18;
}

.dashboard-folders {
  margin-top: 34px;
}

.dashboard-folders p {
  margin: 0 0 6px;
  padding: 0 16px;
  color: #58524a;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-folders a {
  padding-left: 18px;
  font-weight: 500;
}

.dashboard-folders a:nth-of-type(n + 2) {
  padding-left: 42px;
}

.dashboard-sidebar-footer {
  margin-top: auto;
  padding-top: 28px;
  border-top: 1px solid var(--surface-variant);
}

.dashboard-upgrade {
  justify-content: center;
  min-height: 46px !important;
  background: #1f1d18 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
}

.dashboard-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dashboard-topbar {
  min-height: 88px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--surface-variant);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

.dashboard-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #3f3a32;
  font-size: 15px;
  white-space: nowrap;
}

.dashboard-breadcrumb strong {
  color: #1a1814;
}

.dashboard-breadcrumb .material-symbols-outlined {
  color: #6f6a60;
  font-size: 18px;
}

.dashboard-tools {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dashboard-search {
  width: min(320px, 34vw);
  min-height: 42px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--outline-variant);
  border-radius: 14px;
  background: #f5f1e8;
}

.dashboard-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #3f3a32;
}

.dashboard-tools button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #6f6a60;
  cursor: pointer;
}

.dashboard-tools button:hover {
  background: var(--surface-container-low);
  color: var(--primary);
}

.dashboard-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--outline-variant);
  border-radius: 999px;
  background: #ffffff;
  color: #3f3a32;
  font-size: 30px;
}

.dashboard-canvas {
  width: min(100%, 1280px);
  padding: 42px 40px 72px;
}

.dashboard-page-head {
  margin-bottom: 26px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.dashboard-page-head h1 {
  margin: 0 0 8px;
  color: #1a1814;
  font-size: 42px;
  font-weight: 900;
  line-height: 1.15;
}

.dashboard-page-head p {
  margin: 0;
  color: #58524a;
  font-size: 19px;
}

.dashboard-create-btn {
  min-height: 50px;
  padding: 0 28px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 5px;
  background: #1f1d18;
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(201, 100, 66, 0.18);
}

.dashboard-create-btn:hover {
  background: var(--primary-hover);
}

.dashboard-stats {
  margin: 0 0 26px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.dashboard-stats div {
  min-height: 92px;
  padding: 20px;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  align-items: center;
  border: 1px solid var(--outline-variant);
  border-radius: 8px;
  background: #ffffff;
}

.dashboard-stats .material-symbols-outlined {
  grid-row: span 2;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-container);
  color: var(--primary);
}

.dashboard-stats strong {
  color: #1a1814;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.1;
}

.dashboard-stats small {
  color: #6f6a60;
  font-size: 13px;
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

.dashboard-db-card,
.dashboard-create-card {
  min-height: 300px;
  padding: 30px;
  border: 1px solid var(--outline-variant);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 26px rgba(26, 24, 20, 0.04);
}

.dashboard-db-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dashboard-db-card.featured {
  border-top: 4px solid #1f1d18;
}

.dashboard-card-top {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #6f6a60;
}

.dashboard-badge {
  min-height: 30px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 5px;
  background: var(--primary-container);
  color: #1a1814;
  font-size: 13px;
  font-weight: 800;
}

.dashboard-badge.muted {
  background: var(--surface-container);
  color: #58524a;
}

.dashboard-badge .material-symbols-outlined {
  font-size: 16px;
}

.dashboard-db-card h2 {
  margin: 0 0 18px;
  color: #1a1814;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.35;
}

.dashboard-db-card p {
  margin: 0;
  color: #6f6a60;
}

.dashboard-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.dashboard-chip-row span {
  min-height: 32px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 4px;
  background: var(--surface-container-low);
  color: #3f3a32;
  font-size: 13px;
  font-weight: 700;
}

.dashboard-chip-row .material-symbols-outlined {
  font-size: 16px;
}

.dashboard-card-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--surface-variant);
}

.dashboard-status {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #c96442;
}

.dashboard-progress {
  margin-left: auto;
  display: inline-flex;
  gap: 5px;
}

.dashboard-progress i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--primary);
}

.dashboard-progress i:last-child {
  background: var(--surface-dim);
}

.dashboard-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: #58524a;
  font-size: 14px;
  font-weight: 700;
}

.dashboard-card-actions a:hover {
  color: var(--primary);
}

.dashboard-create-card {
  display: grid;
  gap: 16px;
  border: 2px dashed var(--outline-variant);
  background: #f8fafc;
}

.dashboard-upload-zone {
  min-height: 188px;
  padding: 28px 18px;
  border: 0;
  background: transparent;
}

.dashboard-upload-zone .material-symbols-outlined {
  color: #58524a;
  font-size: 44px;
}

.dashboard-upload-zone strong {
  color: #58524a;
  font-size: 22px;
  font-weight: 900;
}

.dashboard-upload-zone small {
  color: #6f6a60;
  font-size: 14px;
}

.dashboard-preview-wrap {
  margin-top: 0;
}

.dashboard-preview-wrap img {
  max-height: 220px;
}

.dashboard-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-form-grid .field {
  gap: 5px;
}

.dashboard-form-grid .field-label {
  font-size: 12px;
}

.dashboard-form-grid select,
.dashboard-form-grid input {
  min-height: 42px;
  padding: 0 10px;
  font-size: 14px;
}

.dashboard-submit {
  width: 100%;
  min-height: 48px;
}

.archive-shell {
  background: #f5f7fb;
}

.archive-sidebar .dashboard-nav a.active {
  background: #eaf1ff;
}

.archive-folders a {
  justify-content: flex-start;
}

.archive-folders a strong {
  margin-left: auto;
  color: var(--primary);
  font-size: 13px;
}

.archive-folders a.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 0 rgba(26, 24, 20, 0.04);
}

.archive-side-summary {
  margin-top: 24px;
  padding: 18px;
  display: grid;
  gap: 5px;
  border: 1px solid var(--outline-variant);
  border-radius: 8px;
  background: #ffffff;
}

.archive-side-summary .material-symbols-outlined {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-container);
  color: var(--primary);
}

.archive-side-summary strong {
  color: #1a1814;
  font-size: 20px;
  font-weight: 900;
}

.archive-side-summary small {
  color: #6f6a60;
  font-size: 13px;
  font-weight: 700;
}

.archive-canvas {
  width: min(100%, 1360px);
  padding: 36px 40px 72px;
}

.archive-hero {
  min-height: 184px;
  position: relative;
  overflow: hidden;
  padding: 34px 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 260px;
  align-items: center;
  gap: 28px;
  border: 1px solid #dbe3f3;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(239, 224, 210, 0.95), rgba(255, 255, 255, 0.82)),
    #ffffff;
  box-shadow: 0 12px 34px rgba(26, 24, 20, 0.06);
}

.archive-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(201, 100, 66, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(201, 100, 66, 0.05) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.archive-hero-copy,
.archive-hero-actions,
.archive-hero-visual {
  position: relative;
  z-index: 1;
}

.archive-hero-copy h1 {
  margin: 0 0 10px;
  color: #1a1814;
  font-size: 42px;
  font-weight: 950;
  line-height: 1.1;
}

.archive-hero-copy p:not(.eyebrow) {
  margin: 0;
  color: #58524a;
  font-size: 18px;
}

.archive-hero-visual {
  min-height: 116px;
  display: grid;
  place-items: center;
}

.archive-hero-visual .material-symbols-outlined {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: #ffffff;
  color: var(--primary);
  font-size: 46px;
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.14);
}

.archive-hero-visual i {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(201, 100, 66, 0.16);
}

.archive-hero-visual i:nth-of-type(1) {
  transform: translate(-78px, -28px);
}

.archive-hero-visual i:nth-of-type(2) {
  transform: translate(74px, -8px);
}

.archive-hero-visual i:nth-of-type(3) {
  transform: translate(12px, 62px);
  background: rgba(16, 185, 129, 0.18);
}

.archive-stat-row {
  margin: 22px 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.archive-stat-row div {
  min-height: 92px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 12px;
  align-items: center;
  border: 1px solid var(--outline-variant);
  border-radius: 8px;
  background: #ffffff;
}

.archive-stat-row .material-symbols-outlined {
  grid-row: span 2;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-container);
  color: var(--primary);
}

.archive-stat-row strong {
  color: #1a1814;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
}

.archive-stat-row small {
  color: #6f6a60;
  font-size: 13px;
  font-weight: 700;
}

.archive-control-panel {
  margin-bottom: 20px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--outline-variant);
  border-radius: 8px;
  background: #ffffff;
}

.archive-path {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  color: #58524a;
  font-weight: 700;
}

.archive-path strong {
  color: #1a1814;
}

.archive-filter-group {
  display: flex;
  align-items: end;
  gap: 14px;
}

.archive-filter-group label {
  display: grid;
  gap: 5px;
  color: #58524a;
  font-size: 12px;
  font-weight: 900;
}

.archive-filter-group select {
  min-width: 136px;
  min-height: 42px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--outline-variant);
  border-radius: 6px;
  background: #ffffff;
  color: #1a1814;
  font-weight: 700;
}

.archive-list-panel {
  padding: 28px;
  border: 1px solid #dccfb6;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 12px 36px rgba(26, 24, 20, 0.05);
}

.archive-list-head {
  min-height: 48px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--surface-variant);
}

.archive-list-head h2 {
  margin: 0;
  color: #1a1814;
  font-size: 22px;
  font-weight: 900;
}

.archive-list-head .eyebrow {
  margin-bottom: 5px;
}

.archive-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 20px;
}

.archive-card {
  min-height: 286px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--outline-variant);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 9px 26px rgba(26, 24, 20, 0.04);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.archive-card:hover,
.archive-card.selected {
  border-color: #c96442;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.13);
  transform: translateY(-1px);
}

.archive-card.selected {
  border-top: 4px solid var(--primary);
}

.archive-card-top {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.archive-source-badge {
  min-height: 28px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-container-low);
  color: #58524a;
  font-size: 12px;
  font-weight: 900;
}

.archive-card-title {
  min-height: 62px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #1a1814;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.35;
}

.archive-card-title:hover {
  color: var(--primary);
}

.archive-card-source {
  margin: 8px 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #6f6a60;
  font-size: 13px;
}

.archive-chip-row {
  margin-bottom: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.archive-chip-row span {
  min-height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 5px;
  background: var(--surface-container-low);
  color: #3f3a32;
  font-size: 12px;
  font-weight: 800;
}

.archive-chip-row .material-symbols-outlined {
  font-size: 15px;
}

.archive-card-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--surface-variant);
}

.archive-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  color: #58524a;
  font-size: 14px;
  font-weight: 800;
}

.archive-card-actions a:hover {
  color: var(--primary);
}

.archive-card-actions form {
  margin-left: auto;
}

.archive-card-actions button {
  border: 0;
  background: transparent;
  color: #dc2626;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.archive-empty-state {
  background: var(--surface-container-lowest);
}

.archive-detail-panel {
  box-shadow: -20px 0 60px rgba(26, 24, 20, 0.16);
}

/* Claude-inspired compact archive treatment */
.page-library {
  --archive-bg: #f7f5f0;
  --archive-sidebar: #f3f0e9;
  --archive-surface: #fffdfa;
  --archive-surface-soft: #f0ece3;
  --archive-surface-hover: #fbf8f2;
  --archive-border: #ded6c8;
  --archive-border-strong: #cfc4b3;
  --archive-fg: #282521;
  --archive-muted: #746f66;
  --archive-subtle: #9b9489;
  --archive-accent: #626657;
  --archive-accent-soft: #e8e4da;
  --archive-success: #5f755f;
  --archive-success-bg: #edf2ea;
  background: var(--archive-bg);
}

.archive-shell {
  grid-template-columns: 286px minmax(0, 1fr);
  background: var(--archive-bg);
}

.archive-sidebar {
  padding: 18px 14px;
  border-right-color: var(--archive-border);
  background: var(--archive-sidebar);
}

.archive-sidebar .dashboard-brand {
  gap: 10px;
  margin-bottom: 26px;
}

.archive-sidebar .dashboard-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--archive-accent-soft);
  color: var(--archive-accent);
  font-size: 24px;
}

.archive-sidebar .dashboard-brand strong {
  color: var(--archive-fg);
  font-size: 18px;
}

.archive-sidebar .dashboard-brand small {
  color: var(--archive-muted);
  font-size: 13px;
}

.archive-sidebar .dashboard-nav,
.archive-sidebar .dashboard-folders,
.archive-sidebar .dashboard-sidebar-footer {
  gap: 4px;
}

.archive-sidebar .dashboard-nav a,
.archive-sidebar .dashboard-folders a,
.archive-sidebar .dashboard-sidebar-footer a {
  min-height: 36px;
  padding: 0 10px;
  gap: 10px;
  border-radius: 10px;
  color: var(--archive-muted);
  font-size: 14px;
  font-weight: 650;
}

.archive-sidebar .dashboard-nav a:hover,
.archive-sidebar .dashboard-folders a:hover,
.archive-sidebar .dashboard-sidebar-footer a:hover {
  background: rgba(255, 253, 250, 0.72);
  color: var(--archive-fg);
}

.archive-sidebar .dashboard-nav a.active {
  background: var(--archive-surface);
  color: var(--archive-fg);
  box-shadow: inset 0 0 0 1px var(--archive-border);
}

.archive-sidebar .dashboard-nav a.active::after {
  display: none;
}

.archive-sidebar .dashboard-nav .material-symbols-outlined,
.archive-sidebar .dashboard-folders .material-symbols-outlined,
.archive-sidebar .dashboard-sidebar-footer .material-symbols-outlined {
  color: currentColor;
  font-size: 19px;
}

.archive-folders {
  margin-top: 24px;
}

.archive-folders p {
  margin-bottom: 8px;
  padding: 0 10px;
  color: var(--archive-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.archive-folders a.active {
  background: var(--archive-surface);
  color: var(--archive-fg);
  box-shadow: inset 0 0 0 1px var(--archive-border);
}

.archive-folders a strong {
  color: var(--archive-accent);
}

.archive-side-summary {
  margin-top: 18px;
  padding: 12px;
  gap: 2px;
  border-color: var(--archive-border);
  border-radius: 12px;
  background: rgba(255, 253, 250, 0.76);
}

.archive-side-summary .material-symbols-outlined {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--archive-accent-soft);
  color: var(--archive-accent);
  font-size: 18px;
}

.archive-side-summary strong {
  color: var(--archive-fg);
  font-size: 17px;
}

.archive-side-summary small {
  color: var(--archive-muted);
  font-size: 12px;
  font-weight: 600;
}

.archive-sidebar .dashboard-sidebar-footer {
  padding-top: 18px;
  border-top-color: var(--archive-border);
}

.archive-sidebar .dashboard-upgrade {
  min-height: 40px !important;
  border-radius: 10px;
  background: var(--archive-fg) !important;
  color: #fffdfa !important;
  font-size: 13px !important;
  box-shadow: 0 1px 2px rgba(40, 37, 33, 0.08);
}

.page-library .dashboard-topbar {
  min-height: 64px;
  padding: 0 28px;
  border-bottom-color: var(--archive-border);
  background: rgba(255, 253, 250, 0.84);
}

.page-library .dashboard-breadcrumb {
  color: var(--archive-muted);
  font-size: 14px;
}

.page-library .dashboard-breadcrumb strong {
  color: var(--archive-fg);
}

.page-library .dashboard-search {
  min-height: 36px;
  width: min(320px, 30vw);
  border-color: var(--archive-border);
  border-radius: 12px;
  background: var(--archive-surface);
}

.page-library .dashboard-tools {
  gap: 10px;
}

.page-library .dashboard-tools button,
.page-library .dashboard-avatar {
  width: 36px;
  height: 36px;
  color: var(--archive-muted);
}

.page-library .dashboard-tools button:hover {
  background: var(--archive-surface-soft);
  color: var(--archive-fg);
}

.archive-canvas {
  width: min(100%, 1320px);
  padding: 28px 32px 56px;
}

.archive-hero {
  min-height: 118px;
  padding: 22px 24px;
  grid-template-columns: minmax(0, 1fr) auto 112px;
  gap: 18px;
  border-color: var(--archive-border);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(240, 236, 227, 0.76), rgba(255, 253, 250, 0.94)),
    var(--archive-surface);
  box-shadow: none;
}

.archive-hero::before {
  background-image:
    linear-gradient(to right, rgba(98, 102, 87, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(98, 102, 87, 0.045) 1px, transparent 1px);
  background-size: 24px 24px;
}

.archive-hero-copy .eyebrow,
.archive-list-head .eyebrow {
  color: var(--archive-accent);
}

.archive-hero-copy h1 {
  margin-bottom: 6px;
  color: var(--archive-fg);
  font-size: 30px;
  font-weight: 760;
}

.archive-hero-copy p:not(.eyebrow) {
  color: var(--archive-muted);
  font-size: 14px;
}

.page-library .dashboard-create-btn {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(40, 37, 33, 0.08);
  border-radius: 11px;
  background: var(--archive-fg);
  color: #fffdfa;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(40, 37, 33, 0.08);
}

.page-library .dashboard-create-btn:hover {
  background: #39352f;
}

.archive-hero-visual {
  min-height: 76px;
}

.archive-hero-visual .material-symbols-outlined {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  color: var(--archive-accent);
  font-size: 31px;
  box-shadow: 0 8px 22px rgba(40, 37, 33, 0.06);
}

.archive-hero-visual i {
  width: 26px;
  height: 26px;
  background: rgba(98, 102, 87, 0.13);
}

.archive-hero-visual i:nth-of-type(1) {
  transform: translate(-48px, -18px);
}

.archive-hero-visual i:nth-of-type(2) {
  transform: translate(44px, -5px);
}

.archive-hero-visual i:nth-of-type(3) {
  transform: translate(8px, 38px);
  background: rgba(95, 117, 95, 0.15);
}

.archive-stat-row {
  margin: 14px 0;
  gap: 10px;
}

.archive-stat-row div {
  min-height: 66px;
  padding: 12px 14px;
  column-gap: 10px;
  border-color: var(--archive-border);
  border-radius: 14px;
  background: var(--archive-surface);
}

.archive-stat-row .material-symbols-outlined {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--archive-accent-soft);
  color: var(--archive-accent);
  font-size: 18px;
}

.archive-stat-row strong {
  color: var(--archive-fg);
  font-size: 20px;
  font-weight: 720;
}

.archive-stat-row small {
  color: var(--archive-muted);
  font-size: 12px;
  font-weight: 600;
}

.archive-control-panel {
  margin-bottom: 14px;
  min-height: 58px;
  padding: 10px 14px;
  border-color: var(--archive-border);
  border-radius: 14px;
  background: var(--archive-surface);
}

.archive-path {
  gap: 7px;
  color: var(--archive-muted);
  font-size: 14px;
}

.archive-path strong {
  color: var(--archive-fg);
}

.archive-path .db-icon {
  width: 28px;
  height: 28px;
  background: var(--archive-accent-soft);
  color: var(--archive-accent);
}

.archive-filter-group {
  gap: 10px;
}

.archive-filter-group label {
  gap: 4px;
  color: var(--archive-muted);
  font-size: 11px;
}

.archive-filter-group select {
  min-width: 120px;
  min-height: 34px;
  padding-left: 10px;
  border-color: var(--archive-border);
  border-radius: 10px;
  background: #fffefa;
  color: var(--archive-fg);
  font-size: 13px;
  font-weight: 650;
}

.archive-list-panel {
  padding: 18px;
  border-color: var(--archive-border);
  border-radius: 16px;
  background: var(--archive-surface);
  box-shadow: none;
}

.archive-list-head {
  min-height: 36px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom-color: var(--archive-border);
}

.archive-list-head h2 {
  color: var(--archive-fg);
  font-size: 19px;
  font-weight: 730;
}

.archive-list-head .eyebrow {
  margin-bottom: 2px;
  font-size: 11px;
}

.archive-card-grid {
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 12px;
}

.archive-card {
  min-height: 198px;
  padding: 14px;
  border-color: var(--archive-border);
  border-radius: 14px;
  background: var(--archive-surface);
  box-shadow: none;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.archive-card:hover,
.archive-card.selected {
  border-color: var(--archive-border-strong);
  background: var(--archive-surface-hover);
  box-shadow: 0 8px 22px rgba(40, 37, 33, 0.055);
  transform: translateY(-1px);
}

.archive-card.selected {
  border-top: 1px solid var(--archive-border-strong);
}

.archive-card-top {
  margin-bottom: 10px;
}

.archive-card .dashboard-badge,
.archive-source-badge {
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--archive-border);
  border-radius: 999px;
  background: var(--archive-surface-soft);
  color: var(--archive-muted);
  font-size: 11px;
  font-weight: 700;
}

.archive-card .dashboard-badge .material-symbols-outlined {
  font-size: 13px;
}

.archive-card-title {
  min-height: 43px;
  color: var(--archive-fg);
  font-size: 15px;
  font-weight: 720;
  line-height: 1.38;
}

.archive-card-title:hover {
  color: #3f4638;
}

.archive-card-source {
  margin: 6px 0 10px;
  color: var(--archive-subtle);
  font-size: 12px;
}

.archive-chip-row {
  margin-bottom: 12px;
  gap: 6px;
}

.archive-chip-row span {
  min-height: 24px;
  padding: 0 7px;
  border-radius: 8px;
  background: #f4f1ea;
  color: var(--archive-muted);
  font-size: 11px;
  font-weight: 650;
}

.archive-chip-row .material-symbols-outlined {
  font-size: 13px;
}

.archive-card-foot {
  padding-top: 10px;
  border-top-color: var(--archive-border);
}

.archive-card .dashboard-status {
  margin-bottom: 9px;
  color: var(--archive-success);
  font-size: 12px;
  font-weight: 700;
}

.archive-card .status-dot {
  width: 7px;
  height: 7px;
  background: var(--archive-success);
}

.archive-card .dashboard-progress {
  gap: 4px;
}

.archive-card .dashboard-progress i {
  width: 5px;
  height: 5px;
  background: var(--archive-accent);
  opacity: 0.65;
}

.archive-card .dashboard-progress i:last-child {
  background: var(--archive-border-strong);
}

.archive-card-actions {
  gap: 8px 12px;
  color: var(--archive-muted);
  font-size: 12px;
  font-weight: 700;
}

.archive-card-actions a:hover {
  color: var(--archive-fg);
}

.archive-card-actions button {
  color: #9f4f43;
  font-size: 12px;
}

.archive-detail-panel {
  box-shadow: -18px 0 48px rgba(40, 37, 33, 0.14);
}

@media (max-width: 1180px) {
  .dashboard-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .dashboard-sidebar {
    padding: 24px 16px;
  }

  .dashboard-grid,
  .dashboard-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-create-card {
    grid-column: span 2;
  }

  .archive-hero {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .archive-hero-visual {
    display: none;
  }

  .archive-card-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (max-width: 860px) {
  .dashboard-shell {
    display: block;
  }

  .dashboard-sidebar {
    position: relative;
    height: auto;
    padding: 18px;
  }

  .dashboard-brand {
    margin-bottom: 18px;
  }

  .dashboard-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-folders,
  .dashboard-sidebar-footer {
    display: none;
  }

  .dashboard-topbar {
    min-height: auto;
    padding: 16px 18px;
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-tools {
    justify-content: space-between;
  }

  .dashboard-search {
    width: 100%;
  }

  .dashboard-canvas {
    padding: 28px 18px 48px;
  }

  .dashboard-page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-page-head h1 {
    font-size: 34px;
  }

  .dashboard-create-btn {
    justify-content: center;
  }

  .dashboard-grid,
  .dashboard-stats,
  .dashboard-form-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-create-card {
    grid-column: auto;
  }

  .archive-canvas {
    padding: 22px 18px 46px;
  }

  .archive-hero,
  .archive-control-panel {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .archive-hero {
    padding: 28px 22px;
  }

  .archive-hero-copy h1 {
    font-size: 32px;
  }

  .archive-stat-row,
  .archive-card-grid {
    grid-template-columns: 1fr;
  }

  .archive-filter-group {
    align-items: stretch;
    flex-direction: column;
  }

  .archive-filter-group select {
    width: 100%;
  }

  .archive-list-panel {
    padding: 20px 16px;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .topbar,
  .tabs,
  .pdf-actions,
  .overlay,
  .site-footer {
    display: none !important;
  }

  .container {
    width: 100%;
    padding: 0;
  }

  .tab-panel {
    display: block !important;
  }

  .card {
    border: 0;
    box-shadow: none;
  }
}

@media (max-width: 760px) {
  .topbar-inner {
    min-height: 64px;
    padding: 0 18px;
    grid-template-columns: 1fr auto;
    gap: 14px;
  }

  .brand {
    font-size: 18px;
  }

  .nav {
    grid-column: 1 / -1;
    order: 3;
    gap: 18px;
    overflow-x: auto;
  }

  .nav-link {
    min-height: 42px;
  }

  .account-icon {
    justify-self: end;
  }

  .container {
    width: min(100% - 28px, var(--container));
    padding-top: 22px;
  }

  .page-upload .container {
    display: block;
  }

  .generator-card {
    padding: 36px 22px;
  }

  .page-title {
    font-size: 25px;
  }

  .page-desc {
    font-size: 16px;
  }

  .upload-zone {
    min-height: 280px;
    padding: 32px 18px;
  }

  .control-grid,
  .analysis-grid,
  .pdf-grid,
  .hist-item {
    grid-template-columns: 1fr;
  }

  .qitem {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .qitem .chip-mini {
    grid-column: 2;
  }

  .qno {
    width: 36px;
    height: 36px;
  }

  .content-card {
    padding: 22px;
  }

  .tabs {
    top: 106px;
  }

  .hist-thumb {
    width: 100%;
    height: 180px;
  }

  .site-footer {
    width: 100%;
    padding: 22px 18px;
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 1500px) {
  .db-panel {
    padding: 34px 48px 46px;
  }

  .db-card-grid {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
  }
}

@media (max-width: 1180px) {
  .page-library .nav::before {
    display: none;
  }

  .library-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .library-main {
    padding: 18px 22px 48px;
  }

  .library-hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 32px;
  }

  .hero-visual {
    display: none;
  }

  .db-toolbar,
  .library-path-row {
    align-items: stretch;
    flex-direction: column;
  }

  .db-card-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 820px) {
  .page-library .topbar-inner {
    grid-template-columns: 1fr auto;
  }

  .page-library .nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .library-shell {
    display: block;
  }

  .library-sidebar {
    position: relative;
    top: auto;
    height: auto;
    max-height: 340px;
    border-right: 0;
    border-bottom: 1px solid #c4bba9;
  }

  .library-main {
    padding: 16px 14px 42px;
  }

  .library-hero h2 {
    font-size: 28px;
  }

  .library-hero p:not(.eyebrow) {
    font-size: 16px;
  }

  .db-panel {
    padding: 24px 18px 32px;
  }

  .db-filter-group {
    flex-direction: column;
    gap: 12px;
  }

  .db-filter-group select {
    width: 100%;
  }

  .db-card-grid {
    grid-template-columns: 1fr;
  }
}

/* Unified warm workspace treatment */
.page-dashboard,
.page-library,
.page-result-workspace {
  --archive-bg: #f7f5f0;
  --archive-sidebar: #f3f0e9;
  --archive-surface: #fffdfa;
  --archive-surface-soft: #f0ece3;
  --archive-surface-strong: #e9e2d5;
  --archive-surface-hover: #fbfaf7;
  --archive-border: #ded6c8;
  --archive-border-strong: #cfc4b4;
  --archive-fg: #282521;
  --archive-muted: #6f6a60;
  --archive-subtle: #989185;
  --archive-accent: #25211d;
  --archive-success: #60745f;
  --archive-success-bg: #e8efe5;
  background: var(--archive-bg);
  background-image: none;
  color: var(--archive-fg);
}

.page-dashboard .container,
.page-library .container,
.page-result-workspace .container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.page-dashboard .site-footer,
.page-library .site-footer,
.page-result-workspace .site-footer {
  display: none;
}

.page-dashboard .flash,
.page-library .flash,
.page-result-workspace .flash {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 100;
  width: min(560px, calc(100% - 32px));
  margin: 0;
  transform: translateX(-50%);
}

.dashboard-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  background: var(--archive-bg);
}

.dashboard-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--archive-border);
  background: var(--archive-sidebar);
}

.dashboard-brand {
  gap: 10px;
  margin-bottom: 26px;
}

.dashboard-brand-mark {
  width: 40px;
  height: 40px;
  border: 1px solid var(--archive-border);
  border-radius: 10px;
  background: var(--archive-surface-strong);
  color: #4f584d;
  font-size: 24px;
}

.dashboard-brand strong {
  color: var(--archive-fg);
  font-size: 20px;
  font-weight: 800;
}

.dashboard-brand small {
  color: var(--archive-muted);
  font-size: 13px;
}

.dashboard-nav,
.dashboard-folders,
.dashboard-sidebar-footer {
  gap: 6px;
}

.dashboard-nav a,
.dashboard-folders a,
.dashboard-sidebar-footer a {
  min-height: 36px;
  padding: 0 10px;
  gap: 10px;
  border-radius: 10px;
  color: var(--archive-muted);
  font-size: 14px;
  font-weight: 650;
}

.dashboard-nav a .material-symbols-outlined,
.dashboard-folders a .material-symbols-outlined,
.dashboard-sidebar-footer a .material-symbols-outlined {
  color: #756e62;
  font-size: 19px;
}

.dashboard-nav a:hover,
.dashboard-folders a:hover,
.dashboard-sidebar-footer a:hover {
  background: rgba(255, 253, 250, 0.74);
  color: var(--archive-fg);
}

.dashboard-nav a.active,
.dashboard-folders a.active {
  background: var(--archive-surface);
  color: var(--archive-fg);
  box-shadow: inset 0 0 0 1px var(--archive-border);
}

.dashboard-nav a.active::after {
  display: none;
}

.dashboard-folders {
  margin-top: 28px;
}

.dashboard-folders p {
  margin: 0 0 8px;
  padding: 0 10px;
  color: var(--archive-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.dashboard-folders a {
  padding-left: 10px;
}

.dashboard-folders a:nth-of-type(n + 2) {
  padding-left: 10px;
}

.archive-folders a strong {
  margin-left: auto;
  color: var(--archive-muted);
  font-size: 13px;
}

.archive-side-summary {
  margin-top: 26px;
  padding: 14px;
  min-height: 92px;
  border: 1px solid var(--archive-border);
  border-radius: 14px;
  background: rgba(255, 253, 250, 0.76);
  box-shadow: none;
}

.archive-side-summary .material-symbols-outlined {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--archive-surface-strong);
  color: #687263;
  font-size: 18px;
}

.archive-side-summary strong {
  margin-top: 10px;
  color: var(--archive-fg);
  font-size: 19px;
  font-weight: 800;
}

.archive-side-summary small {
  color: var(--archive-muted);
  font-size: 13px;
}

.dashboard-sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--archive-border);
}

.dashboard-upgrade {
  min-height: 42px !important;
  justify-content: center;
  border-radius: 10px !important;
  background: var(--archive-accent) !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 800 !important;
}

.dashboard-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dashboard-topbar,
.page-library .dashboard-topbar {
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--archive-border);
  background: rgba(255, 253, 250, 0.84);
  backdrop-filter: blur(12px);
}

.dashboard-breadcrumb,
.page-library .dashboard-breadcrumb {
  gap: 9px;
  color: var(--archive-muted);
  font-size: 14px;
}

.dashboard-breadcrumb strong,
.page-library .dashboard-breadcrumb strong {
  color: var(--archive-fg);
  font-weight: 800;
}

.dashboard-breadcrumb .material-symbols-outlined {
  color: #8b8378;
  font-size: 18px;
}

.dashboard-tools {
  gap: 10px;
}

.dashboard-search,
.page-library .dashboard-search {
  width: min(360px, 34vw);
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--archive-border);
  border-radius: 14px;
  background: var(--archive-surface);
}

.dashboard-search input {
  color: var(--archive-fg);
  font-size: 14px;
}

.dashboard-tools button,
.dashboard-avatar,
.page-library .dashboard-tools button,
.page-library .dashboard-avatar {
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  color: var(--archive-muted);
}

.dashboard-avatar,
.page-library .dashboard-avatar {
  border-color: var(--archive-border);
  background: var(--archive-surface);
  font-size: 26px;
}

.dashboard-tools button:hover,
.page-library .dashboard-tools button:hover {
  background: var(--archive-surface-soft);
  color: var(--archive-fg);
}

.dashboard-canvas,
.archive-canvas,
.studio-canvas,
.result-canvas {
  width: min(100%, 1570px);
  padding: 28px 34px 56px;
}

.archive-hero,
.studio-hero {
  min-height: 118px;
  margin-bottom: 14px;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 116px;
  align-items: center;
  gap: 18px;
  overflow: hidden;
  border: 1px solid var(--archive-border);
  border-radius: 16px;
  background:
    linear-gradient(to right, rgba(222, 214, 200, 0.3) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(222, 214, 200, 0.3) 1px, transparent 1px),
    linear-gradient(135deg, #fffdfa, #f5f1e8);
  background-size: 32px 32px, 32px 32px, auto;
  box-shadow: none;
}

.archive-hero::before {
  display: none;
}

.archive-hero-copy,
.archive-hero-actions,
.archive-hero-visual {
  position: relative;
  z-index: 1;
}

.archive-hero-copy .eyebrow,
.studio-section-head .eyebrow,
.result-hero .eyebrow {
  margin-bottom: 4px;
  color: #646a5d;
  font-size: 11px;
  font-weight: 800;
}

.archive-hero-copy h1 {
  margin: 0 0 4px;
  color: var(--archive-fg);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0;
}

.archive-hero-copy p:not(.eyebrow) {
  margin: 0;
  color: var(--archive-muted);
  font-size: 14px;
}

.dashboard-create-btn,
.page-library .dashboard-create-btn {
  min-height: 38px;
  padding: 0 17px;
  border-radius: 10px;
  background: var(--archive-accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(40, 37, 33, 0.12);
}

.dashboard-create-btn:hover,
.page-library .dashboard-create-btn:hover {
  background: #181511;
  transform: translateY(-1px);
}

.archive-hero-visual {
  width: 96px;
  height: 86px;
  border-radius: 18px;
  background: rgba(255, 253, 250, 0.62);
}

.archive-hero-visual .material-symbols-outlined {
  color: #66715f;
  font-size: 36px;
}

.archive-hero-visual i {
  background: rgba(198, 191, 178, 0.58);
}

.dashboard-stats,
.archive-stat-row {
  margin: 0 0 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-stats div,
.archive-stat-row div {
  min-height: 66px;
  padding: 12px 14px;
  border: 1px solid var(--archive-border);
  border-radius: 14px;
  background: var(--archive-surface);
  box-shadow: none;
}

.dashboard-stats .material-symbols-outlined,
.archive-stat-row .material-symbols-outlined {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--archive-surface-strong);
  color: #687263;
  font-size: 19px;
}

.dashboard-stats strong,
.archive-stat-row strong {
  color: var(--archive-fg);
  font-size: 22px;
  font-weight: 800;
}

.dashboard-stats small,
.archive-stat-row small {
  color: var(--archive-muted);
  font-size: 12px;
  font-weight: 650;
}

.studio-section,
.archive-control-panel,
.archive-list-panel {
  border: 1px solid var(--archive-border);
  border-radius: 16px;
  background: var(--archive-surface);
  box-shadow: none;
}

.studio-section {
  padding: 18px;
}

.studio-section-head {
  min-height: 44px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--archive-border);
}

.studio-section-head h2 {
  margin: 0;
  color: var(--archive-fg);
  font-size: 19px;
  font-weight: 800;
}

.studio-section-head a,
.result-top-action {
  min-height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--archive-border);
  border-radius: 10px;
  background: var(--archive-surface);
  color: var(--archive-muted);
  font-size: 13px;
  font-weight: 750;
}

.studio-section-head a:hover,
.result-top-action:hover {
  background: var(--archive-surface-soft);
  color: var(--archive-fg);
}

.dashboard-grid,
.studio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(278px, 1fr));
  gap: 12px;
}

.dashboard-db-card,
.dashboard-create-card {
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--archive-border);
  border-radius: 14px;
  background: var(--archive-surface);
  box-shadow: none;
}

.dashboard-db-card:hover,
.dashboard-create-card:hover {
  border-color: var(--archive-border-strong);
  background: var(--archive-surface-hover);
  box-shadow: 0 8px 22px rgba(40, 37, 33, 0.055);
  transform: translateY(-1px);
}

.dashboard-db-card.featured {
  border-top: 1px solid var(--archive-border-strong);
}

.dashboard-card-top {
  margin-bottom: 10px;
}

.dashboard-badge,
.archive-card .dashboard-badge {
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--archive-border);
  border-radius: 999px;
  background: #f3efe6;
  color: var(--archive-muted);
  font-size: 11px;
  font-weight: 750;
}

.dashboard-badge .material-symbols-outlined {
  color: #756e62;
  font-size: 14px;
}

.dashboard-db-card h2 {
  margin: 0 0 10px;
  color: var(--archive-fg);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dashboard-db-card p {
  margin: 0 0 10px;
  color: var(--archive-subtle);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-chip-row {
  margin-bottom: 12px;
  gap: 6px;
}

.dashboard-chip-row span {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--archive-surface-soft);
  color: var(--archive-muted);
  font-size: 11px;
  font-weight: 650;
}

.dashboard-chip-row .material-symbols-outlined {
  color: #756e62;
  font-size: 14px;
}

.dashboard-card-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--archive-border);
}

.dashboard-status {
  margin-bottom: 10px;
  color: #5f755e;
  font-size: 12px;
  font-weight: 750;
}

.archive-card .dashboard-status {
  min-height: 7px;
  margin-bottom: 8px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: #6f866b;
}

.dashboard-progress {
  gap: 4px;
}

.dashboard-progress i {
  width: 6px;
  height: 6px;
  background: #a6a094;
}

.dashboard-progress i:last-child {
  background: #5d8068;
}

.dashboard-card-actions {
  gap: 8px 13px;
  color: var(--archive-muted);
  font-size: 12px;
  font-weight: 700;
}

.dashboard-card-actions a:hover {
  color: var(--archive-fg);
}

.dashboard-create-card {
  display: grid;
  gap: 12px;
  border-style: dashed;
  background: rgba(255, 253, 250, 0.58);
}

.dashboard-upload-zone {
  min-height: 128px;
  padding: 18px 14px;
  border: 1px dashed var(--archive-border-strong);
  border-radius: 14px;
  background: rgba(247, 245, 240, 0.68);
}

.dashboard-upload-zone:hover,
.dashboard-upload-zone.dragover,
.dashboard-upload-zone.file-ready {
  border-color: #a99d8d;
  background: #f4efe5;
}

.dashboard-upload-zone .material-symbols-outlined {
  color: #5e665b;
  font-size: 34px;
}

.dashboard-upload-zone strong {
  color: var(--archive-fg);
  font-size: 21px;
  font-weight: 800;
}

.dashboard-upload-zone small {
  color: var(--archive-muted);
  font-size: 13px;
}

.dashboard-form-grid {
  gap: 10px;
}

.dashboard-form-grid .field-label {
  color: var(--archive-fg);
  font-size: 12px;
}

.dashboard-form-grid select,
.dashboard-form-grid input,
.field select,
.field-textarea {
  min-height: 38px;
  border-color: var(--archive-border);
  border-radius: 10px;
  background: var(--archive-surface);
  color: var(--archive-fg);
  font-size: 13px;
}

.math-textarea {
  font-size: 15px;
  line-height: 1.7;
}

.dashboard-submit,
.btn-primary {
  min-height: 42px;
  border-radius: 10px;
  background: var(--archive-accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
}

.btn-primary:hover {
  background: #181511;
}

.btn-secondary {
  border-color: var(--archive-border);
  border-radius: 10px;
  background: var(--archive-surface);
  color: var(--archive-fg);
}

.result-canvas {
  width: min(100%, 1380px);
}

.result-hero {
  margin-bottom: 14px;
  padding: 22px 24px;
  border: 1px solid var(--archive-border);
  border-radius: 16px;
  background:
    linear-gradient(to right, rgba(222, 214, 200, 0.26) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(222, 214, 200, 0.26) 1px, transparent 1px),
    linear-gradient(135deg, #fffdfa, #f5f1e8);
  background-size: 32px 32px, 32px 32px, auto;
}

.result-hero .page-title {
  margin: 0 0 6px;
  color: var(--archive-fg);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
}

.result-hero .page-desc {
  color: var(--archive-muted);
  font-size: 14px;
}

.meta-row {
  gap: 6px;
}

.chip,
.chip-mini {
  border: 1px solid var(--archive-border);
  background: var(--archive-surface-soft);
  color: var(--archive-muted);
}

.chip {
  min-height: 26px;
  padding: 0 9px;
  font-size: 12px;
}

.chip-mini {
  min-height: 23px;
  padding: 0 8px;
  font-size: 11px;
}

.tabs,
.result-tabs {
  position: sticky;
  top: 64px;
  z-index: 10;
  margin-bottom: 14px;
  padding: 7px;
  gap: 4px;
  border: 1px solid var(--archive-border);
  border-radius: 14px;
  background: rgba(255, 253, 250, 0.92);
  box-shadow: none;
  backdrop-filter: blur(12px);
}

.tab {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 10px;
  color: var(--archive-muted);
  font-size: 14px;
  font-weight: 750;
}

.tab.active {
  background: var(--archive-accent);
  color: #ffffff;
}

.content-card {
  padding: 22px;
  margin-bottom: 14px;
  border-color: var(--archive-border);
  border-radius: 16px;
  background: var(--archive-surface);
  box-shadow: none;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading .material-symbols-outlined {
  color: #5e665b;
}

.section-title {
  font-size: 20px;
  font-weight: 800;
}

.subsection-title {
  margin: 18px 0 8px;
  font-size: 14px;
}

.worksheet-box,
.answer-box,
.muted-box,
.question-text,
.simple-question {
  border-color: var(--archive-border);
  border-radius: 12px;
  background: #f8f6f1;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.latex {
  max-width: 100%;
}

.latex .MathJax,
.latex mjx-container,
.ai-message mjx-container {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.answer-box,
.simple-answer,
.answer-inline {
  color: #9c3028;
}

.analysis-grid {
  gap: 14px;
}

.result-canvas .analysis-grid {
  grid-template-columns: 1fr;
}

.qitem {
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px 0;
  border-bottom-color: var(--archive-border);
}

.qno,
.simple-no {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--archive-surface-soft);
  color: #385b41;
  font-size: 15px;
  font-weight: 800;
}

.solution-card {
  padding: 18px 0;
  border-bottom-color: var(--archive-border);
}

.solution-topline h3 {
  font-size: 17px;
}

.simple-solution-card {
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 0;
  border-bottom-color: var(--archive-border);
}

.simple-main {
  gap: 7px;
}

.simple-steps {
  color: var(--archive-fg);
  font-size: 15px;
}

.note,
.warn {
  border-radius: 12px;
}

.note {
  border-left-color: #65725f;
  background: #f4f1ea;
}

.warn {
  border-left-color: #a1764f;
  background: #f7efe4;
  color: #6c4631;
}

.pdf-grid {
  gap: 12px;
}

.pdf-link {
  min-height: 108px;
  padding: 15px;
  border-color: var(--archive-border);
  border-radius: 14px;
  background: var(--archive-surface);
}

.pdf-link:hover,
.pdf-link.featured {
  border-color: var(--archive-border-strong);
  background: #f8f6f1;
}

.pdf-link .material-symbols-outlined {
  color: #5e665b;
}

.pdf-link small {
  color: var(--archive-muted);
}

@media (max-width: 1180px) {
  .dashboard-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .dashboard-canvas,
  .archive-canvas,
  .studio-canvas,
  .result-canvas {
    padding: 24px 22px 48px;
  }

  .archive-hero,
  .studio-hero {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .archive-hero-visual {
    display: none;
  }

  .dashboard-stats,
  .archive-stat-row,
  .analysis-grid,
  .pdf-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .dashboard-shell {
    display: block;
  }

  .dashboard-sidebar {
    position: relative;
    height: auto;
    padding: 16px;
  }

  .dashboard-brand {
    margin-bottom: 14px;
  }

  .dashboard-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-folders,
  .archive-side-summary,
  .dashboard-sidebar-footer {
    display: none;
  }

  .dashboard-topbar,
  .page-library .dashboard-topbar {
    min-height: auto;
    padding: 14px 16px;
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-tools {
    justify-content: space-between;
  }

  .dashboard-search,
  .page-library .dashboard-search {
    width: 100%;
  }

  .archive-hero,
  .studio-hero,
  .archive-control-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .dashboard-stats,
  .archive-stat-row,
  .dashboard-form-grid,
  .analysis-grid,
  .pdf-grid {
    grid-template-columns: 1fr;
  }

  .result-hero .page-title,
  .archive-hero-copy h1 {
    font-size: 25px;
  }

  .qitem {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .qitem .chip-mini {
    grid-column: 2;
  }
}

/* AI assistant panel */
.assistant-shell {
  grid-template-columns: 286px minmax(0, 1fr) 390px;
}

.assistant-shell .dashboard-canvas,
.assistant-shell .archive-canvas,
.assistant-shell .studio-canvas,
.assistant-shell .result-canvas {
  width: min(100%, 1290px);
}

.ai-assistant {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--archive-border);
  background: var(--archive-surface);
}

.ai-assistant-head {
  min-height: 48px;
  padding: 0 14px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--archive-border);
  background: #f1ead8;
}

.ai-assistant-head strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--archive-fg);
  font-size: 15px;
  font-weight: 800;
}

.ai-assistant-head strong .material-symbols-outlined {
  color: #8d6b21;
  font-size: 18px;
}

.ai-icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--archive-muted);
  cursor: pointer;
}

.ai-icon-btn:hover {
  background: rgba(255, 253, 250, 0.72);
  color: var(--archive-fg);
}

.ai-icon-btn .material-symbols-outlined {
  font-size: 18px;
}

.ai-assistant-body {
  flex: 1;
  min-height: 0;
  padding: 18px 14px;
  overflow-y: auto;
}

.ai-intro {
  width: min(100%, 310px);
  margin: 4px auto 14px;
  color: var(--archive-muted);
  font-size: 13px;
  font-style: italic;
  line-height: 1.45;
  text-align: center;
}

.ai-message {
  max-width: 320px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--archive-border);
  border-radius: 16px;
  color: var(--archive-fg);
  font-size: 14px;
  line-height: 1.55;
  white-space: normal;
}

.ai-message > div {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-message .MathJax,
.ai-message mjx-container {
  max-width: 100%;
}

.ai-message p {
  margin: 0 0 8px;
}

.ai-message p:last-child {
  margin-bottom: 0;
}

.ai-message ul {
  margin: 8px 0;
  padding-left: 18px;
}

.ai-message-user {
  margin-left: auto;
  border-color: #eadfca;
  background: #f2ead7;
}

.ai-message-bot {
  margin-right: auto;
  background: #f8f7f3;
}

.ai-message-error {
  border-color: #e7c5bd;
  background: #fbefec;
  color: #8f3329;
}

.ai-message-loading {
  color: var(--archive-muted);
}

.ai-source-list {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.ai-source-list a {
  display: block;
  padding: 7px 9px;
  overflow: hidden;
  border: 1px solid var(--archive-border);
  border-radius: 9px;
  background: var(--archive-surface);
  color: var(--archive-muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-source-list a:hover {
  background: var(--archive-surface-soft);
  color: var(--archive-fg);
}

.ai-message-tools {
  margin-top: 9px;
  display: flex;
  gap: 6px;
}

.ai-message-tools button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--archive-border);
  border-radius: 999px;
  background: var(--archive-surface);
  color: var(--archive-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.ai-message-tools button:hover {
  color: var(--archive-fg);
  background: var(--archive-surface-soft);
}

.ai-assistant-form {
  padding: 14px;
  border-top: 1px solid var(--archive-border);
  background: rgba(255, 253, 250, 0.96);
}

.ai-assistant-form textarea {
  width: 100%;
  min-height: 68px;
  max-height: 150px;
  padding: 12px 14px;
  resize: vertical;
  border: 1px solid var(--archive-border);
  border-radius: 12px;
  outline: 0;
  background: var(--archive-surface);
  color: var(--archive-fg);
  font-size: 14px;
  line-height: 1.45;
}

.ai-assistant-form textarea:focus {
  border-color: var(--archive-border-strong);
  box-shadow: 0 0 0 3px rgba(116, 104, 82, 0.09);
}

.ai-form-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 8px;
}

.ai-form-actions select,
.ai-form-actions button {
  min-height: 36px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
}

.ai-form-actions select {
  padding: 0 10px;
  border: 1px solid var(--archive-border);
  background: var(--archive-surface);
  color: var(--archive-fg);
}

.ai-form-actions button {
  border: 0;
  background: #342513;
  color: #ffffff;
  cursor: pointer;
}

.ai-form-actions button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.ai-assistant-form small {
  display: block;
  margin-top: 8px;
  color: var(--archive-subtle);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 1500px) {
  .assistant-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .ai-assistant {
    display: none;
  }
}

/* =====================================================
   DESIGN REFRESH OVERRIDES — Claude-inspired warm theme
   appended last so it wins over earlier rules
   ===================================================== */

/* Primary CTAs: solid deep warm-black with subtle warm shadow */
.btn-primary,
.dashboard-create-btn,
.db-create-btn,
.library-green-cta {
  background: var(--primary) !important;
  color: #fbf8f1 !important;
  border: 1px solid var(--primary) !important;
  box-shadow: 0 1px 0 rgba(255, 253, 248, 0.04) inset, 0 6px 16px rgba(60, 40, 20, 0.10);
  transition: background 160ms ease, transform 80ms ease, box-shadow 160ms ease;
}
.btn-primary:hover,
.dashboard-create-btn:hover,
.db-create-btn:hover,
.library-green-cta:hover {
  background: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
  box-shadow: 0 1px 0 rgba(255, 253, 248, 0.04) inset, 0 8px 22px rgba(60, 40, 20, 0.14);
}
.btn-primary:active {
  transform: translateY(1px);
}

/* Secondary / ghost buttons: warm border + cream hover */
.btn-secondary,
.btn-ghost {
  background: var(--surface-container-lowest) !important;
  color: var(--on-surface) !important;
  border: 1px solid var(--outline-variant) !important;
}
.btn-secondary:hover,
.btn-ghost:hover {
  background: var(--surface-container-low) !important;
  border-color: var(--outline) !important;
}

/* Cards: warm surface, soft warm shadow, slightly larger radius */
.card,
.generator-card,
.dashboard-db-card,
.solution-card,
.simple-solution-card {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

/* Chips: warm tinted */
.chip {
  background: var(--surface-container) !important;
  color: var(--on-surface) !important;
  border: 1px solid var(--outline-variant) !important;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.chip-mini {
  background: var(--surface-container-low) !important;
  color: var(--on-surface-variant) !important;
  border: 1px solid var(--outline-variant) !important;
}

/* Stat tiles: deeper warm container with coral numerals */
.dashboard-stats > div {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}
.dashboard-stats strong {
  color: var(--accent);
  letter-spacing: -0.02em;
}

/* Sidebar / nav: deeper warm with active coral accent */
.dashboard-sidebar,
.library-sidebar {
  background: var(--surface-container-low);
  border-right: 1px solid var(--outline-variant);
}
.dashboard-nav a.active,
.folder-row.active {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  font-weight: 700;
}
.dashboard-nav a.active .material-symbols-outlined {
  color: var(--accent) !important;
}

/* Top bar: cleaner warm divider */
.topbar,
.dashboard-topbar {
  background: var(--surface-container-lowest);
  border-bottom: 1px solid var(--outline-variant);
}

/* Eyebrow: coral micro label */
.eyebrow {
  color: var(--accent) !important;
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* Tabs: underline + coral active */
.tab.active,
.dashboard-tab.active {
  color: var(--accent) !important;
  border-bottom-color: var(--accent) !important;
}

/* Page title: deeper warm with tighter tracking */
.page-title,
h1.page-title,
h2.section-title {
  color: var(--on-surface);
  letter-spacing: -0.02em;
  font-weight: 800;
}

/* Inputs / selects: warmer border + accent focus ring */
.field select,
.field-textarea,
input[type="text"],
input[type="search"],
textarea,
select {
  background: var(--surface-container-lowest) !important;
  border-color: var(--outline-variant) !important;
  color: var(--on-surface) !important;
}
.field select:focus,
.field-textarea:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent) !important;
  outline: 2px solid rgba(201, 100, 66, 0.18) !important;
}

/* Upload zone: warm dashed → solid coral on ready */
.upload-zone {
  background: var(--surface-container-low);
  border: 1.5px dashed var(--outline-variant);
}
.upload-zone:hover,
.upload-zone.dragover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.upload-zone.file-ready {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.upload-icon {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
}

/* AI assistant panel — match Claude side-pane look */
.ai-assistant,
.assistant-panel {
  background: var(--surface-container-lowest) !important;
  border-left: 1px solid var(--outline-variant) !important;
}
.ai-assistant .send-btn,
.assistant-panel .send-btn {
  background: var(--primary) !important;
  color: #fbf8f1 !important;
}

/* Brand mark: coral accent */
.brand-mark,
.dashboard-brand-mark {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  border: 1px solid var(--accent) !important;
  font-weight: 800;
}

/* Footer: warm muted */
.site-footer {
  color: var(--on-surface-variant);
  border-top: 1px solid var(--outline-variant);
}

/* Selection: coral wash */
::selection {
  background: rgba(201, 100, 66, 0.22);
  color: var(--on-surface);
}

/* Scrollbar (WebKit) — warm slim */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb {
  background: var(--surface-variant);
  border-radius: 8px;
  border: 2px solid var(--surface);
}
::-webkit-scrollbar-thumb:hover { background: var(--outline); }

/* Loading overlay — warm, less blue */
.overlay {
  background: rgba(26, 24, 20, 0.78) !important;
}
.overlay .spinner {
  border-color: rgba(244, 221, 205, 0.25);
  border-top-color: var(--accent);
}

/* Folder workspace in archive page */
.archive-folder-panel {
  margin: 14px 0;
  padding: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  border: 1px solid var(--archive-border, var(--outline-variant));
  border-radius: 16px;
  background: var(--archive-surface, var(--surface-container-lowest));
  box-shadow: none;
}

.archive-folder-tabs {
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  border-radius: 12px;
  background: var(--surface-container-low);
}

.archive-folder-tabs a {
  min-width: 106px;
  min-height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 9px;
  color: var(--archive-muted, var(--on-surface-variant));
  font-size: 13px;
  font-weight: 750;
}

.archive-folder-tabs a.active,
.archive-folder-tabs a:hover {
  background: var(--surface-container-lowest);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--outline-variant);
}

.archive-folder-tabs .material-symbols-outlined {
  font-size: 17px;
}

.archive-folder-body {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  align-items: center;
  gap: 8px;
}

.archive-grade-strip {
  flex: 0 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.archive-grade-strip a,
.archive-grade-strip span {
  min-height: 26px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  color: var(--archive-muted, var(--on-surface-variant));
  background: var(--surface-container-low);
  font-size: 12px;
  font-weight: 750;
}

.archive-grade-strip a.active,
.archive-grade-strip a:hover {
  color: var(--archive-fg, var(--on-surface));
  background: var(--accent-soft);
}

.archive-folder-pill {
  min-height: 42px;
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--archive-border, var(--outline-variant));
  border-radius: 12px;
  background: var(--surface-container-lowest);
  color: var(--archive-fg, var(--on-surface));
  transition: background 140ms ease, border-color 140ms ease, transform 120ms ease;
}

.archive-folder-pill:hover,
.archive-folder-pill.active {
  background: var(--accent-soft);
  border-color: rgba(201, 100, 66, 0.45);
  transform: translateY(-1px);
}

.archive-folder-pill .material-symbols-outlined {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-container-low);
  color: var(--archive-muted, var(--on-surface-variant));
  font-size: 16px;
}

.archive-folder-pill strong {
  max-width: 240px;
  overflow: hidden;
  color: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-folder-pill em {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.78);
  color: var(--archive-muted, var(--on-surface-variant));
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
}

.archive-folder-empty {
  color: var(--archive-subtle, var(--on-surface-variant));
  font-size: 13px;
  font-weight: 650;
}

.archive-card-actions .archive-card-move {
  margin-left: 0;
}

.archive-card-move select {
  max-width: 126px;
  min-height: 24px;
  padding: 0 22px 0 7px;
  border: 1px solid var(--archive-border, var(--outline-variant));
  border-radius: 8px;
  background: var(--surface-container-lowest);
  color: var(--archive-muted, var(--on-surface-variant));
  font-size: 11px;
  font-weight: 750;
}

@media (max-width: 980px) {
  .archive-folder-panel {
    grid-template-columns: 1fr;
  }

  .archive-folder-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .archive-folder-tabs a {
    min-width: 0;
    justify-content: center;
  }
}

/* Login page */
.page-login {
  min-height: 100vh;
}

.page-login .container {
  width: 100%;
  max-width: none;
  min-height: calc(100vh - 88px);
  padding: 0;
}

.login-shell {
  min-height: calc(100vh - 88px);
  padding: 40px 20px;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(100%, 420px);
  padding: 28px;
  border: 1px solid var(--outline-variant);
  border-radius: 20px;
  background: var(--surface-container-lowest);
  box-shadow: 0 18px 60px rgba(60, 40, 20, 0.08);
}

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

.login-brand strong {
  display: block;
  color: var(--on-surface);
  font-size: 22px;
  font-weight: 850;
  line-height: 1.05;
}

.login-brand small {
  display: block;
  margin-top: 4px;
  color: var(--on-surface-variant);
  font-size: 13px;
  font-weight: 650;
}

.login-copy {
  margin-top: 34px;
}

.login-copy h1 {
  margin: 4px 0 8px;
  color: var(--on-surface);
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.login-copy p:last-child {
  margin: 0;
  color: var(--on-surface-variant);
  font-size: 14px;
}

.login-form {
  margin-top: 26px;
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--on-surface-variant);
  font-size: 13px;
  font-weight: 750;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--outline-variant);
  border-radius: 12px;
  background: #fffefa;
  color: var(--on-surface);
  font-size: 15px;
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--danger-bg);
  border-radius: 12px;
  background: #fff3ef;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.login-submit {
  min-height: 48px;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  font-weight: 850;
}

.dashboard-sidebar-footer form {
  margin: 0;
}

.dashboard-logout {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--archive-muted, var(--on-surface-variant));
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.dashboard-logout:hover {
  background: rgba(255, 253, 250, 0.74);
  color: var(--archive-fg, var(--on-surface));
}

.dashboard-logout .material-symbols-outlined {
  color: currentColor;
  font-size: 19px;
}
