:root {
  color-scheme: light;
  --bg: #f3eadc;
  --surface: #fff8ef;
  --surface-2: #ffffff;
  --ink: #29251f;
  --text: #342d25;
  --muted: #756b5e;
  --line: #dfcfb7;
  --line-strong: #c8b89f;
  --copper: #c75b12;
  --copper-dark: #8f3d12;
  --hermes: #c75b12;
  --hermes-soft: #f3a45f;
  --jade: #27656c;
  --moss: #66795c;
  --success: #1f8a5b;
  --gold: #b79a5b;
  --warn: #8e6520;
  --shadow: 0 14px 34px rgba(51, 39, 23, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 84% 0, rgba(199, 91, 18, 0.18), transparent 250px),
    linear-gradient(180deg, rgba(255, 250, 242, 0.92), transparent 340px),
    linear-gradient(135deg, rgba(39, 101, 108, 0.07), transparent 360px),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

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

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 12px 14px 104px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--jade);
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: 25px;
  line-height: 1.2;
  color: var(--ink);
}

h2 {
  margin-bottom: 6px;
  font-size: 18px;
}

.status-pill,
.tag,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid rgba(183, 154, 91, 0.35);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

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

.section-title p,
.publish-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.flow-lens {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 14px;
  border: 1px solid rgba(223, 207, 183, 0.94);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 246, 232, 0.88)),
    var(--surface);
  box-shadow: 0 20px 44px rgba(82, 55, 24, 0.12);
  padding: 15px;
}

.flow-lens span {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  grid-column: 1;
  grid-row: 3;
  min-height: 34px;
  margin-bottom: 0;
  color: var(--hermes);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.flow-hint {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
}

.icon-entry {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  min-height: 48px;
  border: 1px solid rgba(199, 91, 18, 0.25);
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.98), rgba(247, 230, 212, 0.82)),
    #fff;
  color: var(--hermes);
  padding: 0;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 10px 22px rgba(82, 55, 24, 0.08);
}

.flow-tools {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.reset-entry {
  color: var(--jade);
  font-size: 20px;
  font-weight: 900;
  -webkit-text-stroke: 2.1px currentColor;
  transform: scaleX(-1);
}

.settings-entry {
  color: var(--hermes);
  font-size: 25px;
  font-weight: 900;
  -webkit-text-stroke: 0.35px currentColor;
}

.step-dots {
  position: relative;
  grid-column: 1;
  grid-row: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(310px, 100%);
}

.flow-lens .mini {
  grid-column: 2;
  grid-row: 3;
}

.step-dots::before {
  content: "";
  position: absolute;
  left: 17px;
  right: 17px;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(199, 91, 18, 0.55), rgba(39, 101, 108, 0.38));
  z-index: 0;
}

.step-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border: 1px solid var(--line);
  box-shadow: 0 0 0 5px rgba(255, 248, 239, 0.96);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  padding: 0;
  font-size: 14px;
  font-weight: 900;
}

.material-input-shell {
  position: relative;
  width: 100%;
}

.material-input-shell textarea {
  width: 100%;
  height: 116px;
  min-height: 116px;
  resize: none;
}

.choice-title {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.soft-tip {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.soft-tip:empty {
  display: none;
}

.reference-upload {
  display: grid;
  gap: 10px;
}

.reference-upload-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.reference-upload-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border: 1px dashed rgba(199, 91, 18, 0.42);
  border-radius: 10px;
  background: rgba(255, 250, 242, 0.78);
  color: var(--hermes);
  font-weight: 900;
  overflow: hidden;
}

.reference-upload-button span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(199, 91, 18, 0.36);
  border-radius: 50%;
  font-size: 19px;
  line-height: 1;
}

.reference-upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.reference-library-empty {
  border: 1px dashed rgba(39, 101, 108, 0.24);
  border-radius: 10px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  font-size: 14px;
}

.reference-library-strip {
  min-width: 0;
}

.reference-strip-scroll {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding: 2px 2px 8px;
  -webkit-overflow-scrolling: touch;
}

.reference-strip-scroll::-webkit-scrollbar {
  height: 0;
}

.reference-library-thumb {
  position: relative;
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  margin: 0;
  border: 2px solid rgba(223, 207, 183, 0.88);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
  scroll-snap-align: start;
}

.reference-library-thumb.active {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(31, 138, 91, 0.14);
}

.reference-library-thumb.active::after {
  content: "✓";
  position: absolute;
  right: 5px;
  bottom: 5px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.reference-pick {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.reference-pick img,
.reference-library-thumb > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-upload-thumb {
  margin-top: 8px;
}

.remove-library-reference,
.remove-reference-image {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  min-height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: rgba(42, 35, 28, 0.72);
  color: #fff;
  padding: 0;
  font-size: 13px;
  line-height: 1;
}

.action-image-upload {
  position: relative;
  display: grid;
  place-items: center;
  grid-column: 1;
  justify-self: center;
  width: 52px;
  height: 52px;
  min-height: 52px;
  border: 1px solid rgba(199, 91, 18, 0.38);
  border-radius: 50%;
  background: linear-gradient(180deg, #fffaf2, #f7e6d4);
  color: var(--hermes);
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(199, 91, 18, 0.14);
  cursor: pointer;
  overflow: hidden;
}

.action-image-upload input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 52px;
  height: 52px;
  cursor: pointer;
}

.image-chip-row {
  display: grid;
  grid-template-columns: repeat(4, 64px);
  gap: 7px;
}

.image-thumb {
  position: relative;
  margin: 0;
  border: 1px solid rgba(199, 91, 18, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.image-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.remove-image {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  min-height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  background: rgba(42, 35, 28, 0.72);
  color: #fff;
  padding: 0;
  font-size: 15px;
  line-height: 1;
}

.remove-moment-reference {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  min-height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  background: rgba(42, 35, 28, 0.72);
  color: #fff;
  padding: 0;
  font-size: 15px;
  line-height: 1;
}

.step-dot.done {
  border-color: var(--success);
  color: var(--success);
}

.step-dot.active {
  border-color: var(--hermes);
  background: var(--hermes);
  color: #fff;
}

.flow-track {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #ead9c2;
}

.flow-track i {
  display: block;
  width: 25%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--hermes), var(--jade));
  transition: width 0.22s ease;
}

.mini {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 13px;
}

.wizard-progress {
  display: none;
  grid-template-columns: 1fr;
  gap: 9px;
  margin-bottom: 18px;
}

.wizard-progress.open {
  display: grid;
}

.progress-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 4px 10px;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--muted);
  padding: 10px 12px;
  text-align: left;
}

.progress-step span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #efe5d4;
  color: var(--jade);
  font-size: 12px;
}

.progress-step strong {
  font-size: 14px;
  font-weight: 700;
}

.progress-step em {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.progress-step.active {
  border-color: rgba(168, 95, 61, 0.5);
  background: linear-gradient(180deg, #fff8eb, #fffdf8);
  color: var(--ink);
  box-shadow: 0 16px 34px rgba(78, 56, 32, 0.16);
}

.progress-step.active span {
  background: var(--copper);
  color: #fff;
}

.progress-step.done span {
  background: var(--jade);
  color: #fff;
}

.stack {
  display: grid;
  gap: 14px;
  padding-bottom: 16px;
}

.wizard-stage {
  display: none;
}

.wizard-stage.active {
  display: grid;
  gap: 18px;
  animation: rise 0.22s ease;
}

.wizard-stage.current .step-heading {
  border-color: rgba(199, 91, 18, 0.42);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid rgba(200, 184, 159, 0.8);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(251, 246, 236, 0.86)),
    var(--surface);
  padding: 16px;
}

.step-heading > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ink);
  color: #f8ead3;
  font-size: 13px;
  font-weight: 800;
  flex: 0 0 auto;
}

.step-heading h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 19px;
}

.step-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 8px;
}

label {
  color: #4a4036;
  font-size: 15px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--copper);
  box-shadow: 0 0 0 3px rgba(168, 95, 61, 0.14);
}

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

.wizard-stage[data-step="2"] .option-grid {
  gap: 7px;
  padding-bottom: 214px;
}

.wizard-stage[data-step="2"] .option {
  min-height: 44px;
  padding-block: 9px;
}

.wizard-stage[data-step="2"] .option strong {
  margin-bottom: 0;
}

.option {
  position: relative;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  padding: 12px 40px 12px 12px;
  text-align: left;
}

.select-mark {
  position: absolute;
  top: 11px;
  right: 11px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(31, 138, 91, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  color: transparent;
  font-style: normal;
  font-size: 13px;
  font-weight: 900;
}

.option strong {
  display: block;
  margin-bottom: 3px;
  font-size: 16px;
}

.option-inline-note {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.image-mode-option strong {
  display: block;
  max-width: calc(100% - 4px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-mode-option small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.option span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.option.active {
  border-color: var(--hermes);
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.98), rgba(255, 255, 255, 0.94)),
    #fff;
  box-shadow: inset 0 0 0 1.5px rgba(199, 91, 18, 0.58), 0 12px 26px rgba(199, 91, 18, 0.15);
}

.option.active .select-mark {
  border-color: var(--hermes);
  background: var(--hermes);
  color: #fff;
}

.option.disabled,
.option:disabled {
  cursor: not-allowed;
  border-color: rgba(143, 132, 115, 0.22);
  background: rgba(245, 241, 233, 0.72);
  color: rgba(39, 38, 34, 0.44);
  box-shadow: none;
}

.option.disabled span,
.option:disabled span,
.option.disabled strong,
.option:disabled strong {
  color: rgba(39, 38, 34, 0.44);
}

.option.disabled .select-mark,
.option:disabled .select-mark {
  border-color: rgba(143, 132, 115, 0.22);
  background: rgba(255, 255, 255, 0.52);
  color: transparent;
}

.step-dot.skipped,
.progress-step.skipped {
  opacity: 0.62;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toolbar > input {
  min-width: 0;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  min-height: 42px;
  padding: 10px 13px;
  font-weight: 700;
}

.primary {
  background: linear-gradient(180deg, #dc7932, var(--copper-dark));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.secondary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--jade);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.danger {
  color: #9a3f1f;
}

.ghost {
  background: transparent;
  color: var(--jade);
  padding-inline: 6px;
}

.wizard-actions {
  position: sticky;
  bottom: 70px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 9px;
  width: min(100%, 420px);
  margin: 4px 0 0 auto;
  border: 1px solid rgba(217, 205, 187, 0.84);
  border-radius: 12px;
  background: rgba(251, 246, 236, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  padding: 9px;
}

.wizard-actions #submitGenerate {
  grid-column: 2;
}

.wizard-actions #nextStep {
  grid-column: 2;
  width: 100%;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.material-picker,
.list,
.result-area {
  display: grid;
  gap: 10px;
}

#materialPicker,
#materialList {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-area {
  margin-top: 18px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(251, 246, 236, 0.88)),
    var(--surface);
  box-shadow: var(--shadow);
  padding: 14px;
}

.moment-feed-card {
  padding: 12px;
  background: rgba(255, 255, 255, 0.82);
}

.day-section {
  display: grid;
  gap: 12px;
}

.day-title {
  margin: 8px 2px 2px;
  color: var(--jade);
  font-size: 16px;
  font-weight: 800;
}

.day-switcher {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: none;
}

.day-switcher::-webkit-scrollbar {
  display: none;
}

.day-chip {
  min-width: 76px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  border-radius: 999px;
  min-height: 38px;
  white-space: nowrap;
}

.day-chip.active {
  border-color: var(--jade);
  background: var(--jade);
  color: #fff;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.feed-head {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: start;
  margin-bottom: 8px;
}

.feed-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--jade), #1d4548);
  color: #fff7ea;
  font-size: 18px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.feed-meta {
  display: grid;
  gap: 2px;
}

.feed-meta strong {
  color: #244f55;
  font-size: 15px;
  line-height: 1.2;
}

.feed-meta span {
  color: var(--muted);
  font-size: 12px;
}

.publish-status {
  min-height: 24px;
  padding: 3px 8px;
  font-weight: 800;
}

button.publish-status {
  cursor: pointer;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
}

.publish-state-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: max-content;
}

.publish-status.pending {
  border-color: rgba(183, 154, 91, 0.42);
  background: rgba(255, 248, 233, 0.86);
  color: #8e6520;
}

.publish-status.published {
  border-color: rgba(31, 138, 91, 0.32);
  background: rgba(232, 246, 239, 0.86);
  color: var(--success);
}

.publish-status.toggle-publish-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.publish-status.toggle-publish-status small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  opacity: 0.76;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 9px;
}

.moment-text {
  margin: 0 0 10px;
  color: #383028;
  font-size: 17px;
  line-height: 1.66;
  letter-spacing: 0;
}

.moment-text p {
  margin: 0 0 12px;
}

.moment-text p:last-child {
  margin-bottom: 0;
}

.matrix-doc-body {
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
  color: #383028;
}

.matrix-doc-title {
  margin: 0;
  color: #0f5f5b;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.45;
}

.matrix-week {
  display: grid;
  gap: 7px;
  padding: 13px 14px;
  border: 1px solid rgba(205, 175, 130, 0.42);
  border-radius: 8px;
  background: rgba(255, 252, 246, 0.76);
}

.matrix-week-title {
  margin: 0;
  color: #b35a12;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.45;
}

.matrix-week-focus,
.matrix-week-plan p,
.matrix-doc-notice {
  margin: 0;
  color: #61594f;
  font-size: 14px;
  line-height: 1.72;
}

.matrix-week-plan {
  display: grid;
  gap: 5px;
}

.matrix-doc-notice {
  padding: 10px 12px;
  border-left: 3px solid #c7661a;
  background: rgba(244, 231, 210, 0.52);
}

.moment-content-row,
.moment-content-stack {
  display: grid;
  gap: 10px;
  margin-left: 0;
}

.moment-content-main {
  min-width: 0;
}

.moment-field-row {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.moment-copy-block,
.moment-image-shell {
  position: relative;
  min-width: 0;
}

.moment-copy-block.is-working {
  padding: 10px;
  border: 1px solid rgba(199, 91, 18, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 250, 244, 0.92), rgba(248, 235, 218, 0.72)),
    rgba(255, 255, 255, 0.58);
  box-shadow: 0 10px 26px rgba(65, 42, 20, 0.08);
}

.inline-working {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 11px;
  border: 1px solid rgba(39, 101, 108, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.inline-working strong {
  display: block;
  color: var(--jade);
  font-size: 14px;
  font-weight: 900;
}

.inline-working p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.moment-image-row {
  align-items: start;
}

.regen-moment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 62px;
  height: 34px;
  min-height: 34px;
  border: 1px solid rgba(39, 101, 108, 0.18);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 249, 240, 0.78)),
    rgba(255, 255, 255, 0.72);
  color: var(--jade);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(39, 101, 108, 0.08);
}

.regen-moment b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1;
}

.regen-moment span {
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.regen-moment:hover {
  border-color: rgba(199, 91, 18, 0.32);
  color: var(--hermes);
}

.regen-moment:disabled {
  opacity: 0.62;
  cursor: wait;
}

.regen-moment.is-loading {
  opacity: 0.72;
  pointer-events: none;
  animation: spin 0.9s linear infinite;
}

.visual-card {
  width: min(54vw, 210px);
  margin: 0 0 12px;
  border: 1px solid rgba(200, 184, 159, 0.78);
  border-radius: 6px;
  overflow: hidden;
  background: #f8efe0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.moment-image-shell {
  width: min(54vw, 210px);
}

.moment-image-shell .visual-card {
  width: 100%;
}

.image-working-layer {
  position: absolute;
  inset: 0 0 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px solid rgba(199, 91, 18, 0.22);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(255, 250, 244, 0.86), rgba(244, 226, 207, 0.78)),
    rgba(255, 255, 255, 0.78);
  color: var(--jade);
  text-align: center;
  backdrop-filter: blur(8px);
}

.image-working-layer strong {
  font-size: 14px;
  font-weight: 900;
}

.image-working-layer p {
  width: 86%;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.preview-generated-image {
  position: relative;
  cursor: zoom-in;
}

.preview-generated-image:focus-visible {
  outline: 3px solid rgba(199, 91, 18, 0.28);
  outline-offset: 3px;
}

.visual-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.image-creating {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 160px;
  aspect-ratio: 1 / 1;
  color: var(--muted);
  text-align: center;
}

.image-creating strong {
  color: var(--jade);
  font-size: 14px;
}

.image-creating p {
  margin: 0;
  padding-inline: 10px;
  font-size: 12px;
  line-height: 1.4;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.moment-feed-card .button-row {
  margin-left: 52px;
}

.moment-actions {
  display: grid;
  gap: 8px;
  width: min(100%, 420px);
  margin: 4px auto 0;
}

.quick-action-row,
.publish-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quick-action-row .secondary,
.publish-action-row .secondary,
.publish-wide {
  width: 100%;
  min-height: 44px;
}

.quick-action-row .secondary,
.publish-action-row .secondary {
  min-width: 0;
  padding-inline: 8px;
}

.publish-wide {
  justify-content: center;
  font-size: 16px;
}

.action-placeholder {
  display: block;
  min-height: 44px;
}

.generate-moment-image {
  border-color: rgba(199, 91, 18, 0.28);
  color: var(--hermes);
  font-weight: 900;
}

.moment-image-picker-sheet {
  width: min(100%, 520px);
}

.moment-image-picker-body {
  display: grid;
  gap: 12px;
  white-space: normal;
}

.moment-image-picker-body .image-mode-grid {
  grid-template-columns: 1fr;
  gap: 9px;
}

.moment-image-picker-body .image-mode-option {
  min-height: 54px;
}

.moment-image-picker-body .reference-upload-button {
  min-height: 54px;
}

.moment-image-picker-body .reference-library-strip {
  min-width: 0;
}

.moment-image-picker-body .image-chip-row {
  grid-template-columns: repeat(4, 64px);
}

.moment-ref-thumb {
  width: 64px;
}

.moment-image-confirm {
  width: 100%;
  margin-top: 2px;
}

.warning {
  border-left: 4px solid var(--gold);
  background: #fff8e9;
  color: #634513;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
}

.publish-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  padding: 12px;
  margin-bottom: 12px;
}

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

.history-card {
  border: 1px solid rgba(223, 207, 183, 0.94);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 246, 232, 0.86)),
    var(--surface);
  box-shadow: 0 16px 36px rgba(82, 55, 24, 0.1);
  overflow: hidden;
}

.history-card.open {
  border-color: rgba(199, 91, 18, 0.42);
  box-shadow: 0 20px 42px rgba(82, 55, 24, 0.14);
}

.pending-generation-card {
  border-color: rgba(31, 99, 103, 0.28);
}

.pending-generation-card.failed {
  border-color: rgba(159, 67, 48, 0.36);
}

.history-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
}

.history-toggle {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 4px 12px;
  width: 100%;
  min-width: 0;
  min-height: 72px;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 6px 4px;
  text-align: left;
}

.pending-toggle {
  border: 0;
  pointer-events: none;
}

.creating-state {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px;
  padding: 14px;
  border: 1px solid rgba(223, 207, 183, 0.82);
  border-radius: 8px;
  background: rgba(255, 250, 244, 0.74);
}

.creating-state strong {
  display: block;
  margin-bottom: 4px;
  color: var(--jade);
  font-size: 15px;
}

.creating-state p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.loading-ring {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(199, 91, 18, 0.18);
  border-top-color: var(--copper);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.error-dot {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(159, 67, 48, 0.12);
  color: #9f4330;
  font-weight: 900;
}

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

.history-time {
  grid-row: span 3;
  align-self: center;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  width: 88px;
  height: 72px;
  border: 1px solid rgba(199, 91, 18, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 250, 244, 0.94), rgba(247, 230, 212, 0.78)),
    rgba(199, 91, 18, 0.08);
  color: var(--hermes);
}

.history-time span {
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.history-time strong {
  color: var(--copper-dark);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.history-toggle > strong {
  align-self: end;
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-toggle > em {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-card.open .history-toggle::after {
  content: "收起";
}

.history-toggle::after {
  content: "展开";
  grid-column: 2;
  width: max-content;
  margin-top: 3px;
  color: var(--jade);
  font-size: 12px;
  font-weight: 800;
}

.history-body {
  display: grid;
  gap: 12px;
  border-top: 1px solid rgba(223, 207, 183, 0.72);
  padding: 12px;
}

.history-body .card {
  box-shadow: none;
}

.kb-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #fffaf3, #f4e4cf);
  padding: 13px 14px;
  box-shadow: 0 14px 30px rgba(75, 51, 23, 0.09);
}

.panel-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 0.96), rgba(247, 234, 218, 0.72)),
    var(--surface);
  padding: 13px 14px;
  box-shadow: 0 14px 30px rgba(75, 51, 23, 0.09);
}

.panel-topline strong {
  color: var(--ink);
  font-size: 21px;
}

.panel-topline p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.kb-hero-new {
  align-items: flex-start;
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 0.96), rgba(247, 234, 218, 0.72)),
    var(--surface);
}

.kb-hero span {
  display: block;
  margin-bottom: 4px;
  color: var(--hermes);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.kb-hero strong {
  color: var(--ink);
  font-size: 21px;
}

.kb-hero p {
  max-width: 28em;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.source-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 12px;
}

.source-card {
  position: relative;
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 74px;
  border: 1px solid rgba(223, 207, 183, 0.94);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 250, 243, 0.84)),
    var(--surface);
  color: var(--text);
  padding: 11px 6px 10px;
  text-align: center;
  box-shadow: 0 10px 22px rgba(82, 55, 24, 0.06);
  overflow: hidden;
}

.source-card::after {
  content: none;
}

.source-card span {
  color: var(--hermes);
  font-size: 13px;
  font-weight: 900;
}

.source-card i {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(199, 91, 18, 0.18);
  border-radius: 50%;
  background: rgba(199, 91, 18, 0.08);
  color: var(--hermes);
  font-style: normal;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.source-card strong {
  display: none;
}

.source-card em {
  display: none;
}

.source-card input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.primary-source {
  border-color: rgba(199, 91, 18, 0.38);
  background:
    linear-gradient(180deg, #df7b35, var(--copper-dark)),
    var(--hermes);
  color: #fff;
  box-shadow: 0 14px 26px rgba(199, 91, 18, 0.17);
}

.primary-source span {
  color: #fff8ed;
}

.primary-source i {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.18);
  color: #fff8ed;
}

.recommended {
  border-color: rgba(39, 101, 108, 0.32);
}

.kb-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 16px 2px 10px;
}

.kb-section-head span {
  display: block;
  color: var(--hermes);
  font-size: 12px;
  font-weight: 900;
}

.kb-section-head strong {
  color: var(--ink);
  font-size: 18px;
}

.asset-module-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0 10px 12px;
}

.asset-module {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 9px;
  min-height: 74px;
  border: 1px solid rgba(223, 207, 183, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 10px;
}

.asset-module.ready {
  border-color: rgba(39, 101, 108, 0.26);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(246, 251, 246, 0.78)),
    var(--surface);
}

.module-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(199, 91, 18, 0.11);
  color: var(--hermes);
  font-weight: 900;
}

.asset-module.ready .module-icon {
  background: rgba(39, 101, 108, 0.12);
  color: var(--jade);
}

.asset-module strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.asset-module p {
  margin: 4px 0 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.asset-module span {
  color: var(--jade);
  font-size: 12px;
  font-weight: 800;
}

.source-vault {
  border: 1px solid rgba(223, 207, 183, 0.9);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 250, 242, 0.52)),
    var(--surface);
  overflow: hidden;
  margin-top: 10px;
  box-shadow: 0 10px 24px rgba(82, 55, 24, 0.06);
}

.source-vault summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 14px;
  list-style: none;
}

.source-vault summary::after {
  content: "⌄";
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 1px solid rgba(39, 101, 108, 0.18);
  border-radius: 50%;
  color: var(--jade);
  font-size: 16px;
  font-weight: 900;
  transition: transform 0.18s ease;
}

.source-vault[open] summary {
  border-bottom: 1px solid rgba(223, 207, 183, 0.72);
}

.source-vault[open] summary::after {
  transform: rotate(180deg);
}

.source-vault summary::-webkit-details-marker {
  display: none;
}

.source-vault summary span {
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.source-vault summary strong {
  color: var(--muted);
  font-size: 13px;
  margin-left: auto;
}

.source-vault #materialList {
  padding: 0 10px 12px;
}

.upload-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-height: 40px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff4e6;
  padding: 9px 12px;
  font-size: 14px;
  overflow: hidden;
}

.upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.kb-search {
  margin-bottom: 12px;
}

.kb-file {
  position: relative;
  display: grid;
  gap: 8px;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px 8px 9px;
  min-height: 132px;
  text-align: center;
}

.kb-file.active {
  border-color: var(--success);
  box-shadow: inset 0 0 0 1px rgba(31, 138, 91, 0.24);
}

.file-open {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
  min-height: auto;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
}

.file-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 54px;
  border-radius: 8px 8px 10px 10px;
  background: rgba(199, 91, 18, 0.12);
  color: var(--hermes);
  border: 1px solid rgba(199, 91, 18, 0.22);
  font-weight: 900;
  font-size: 15px;
}

.kb-file.active .file-mark {
  background: var(--success);
  color: #fff;
}

.file-main p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.file-main span,
.kb-file small {
  color: var(--muted);
  font-size: 12px;
}

.file-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  width: 100%;
}

.file-actions .ghost,
.file-actions .secondary {
  min-height: 30px;
  padding: 5px 4px;
  font-size: 12px;
}

#materialList .file-actions {
  grid-template-columns: 1fr 1fr 1fr;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.preview-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  background: rgba(35, 29, 23, 0.34);
  padding: 14px;
}

.preview-mask[hidden] {
  display: none;
}

.preview-sheet {
  width: min(100%, 760px);
  max-height: min(78vh, 760px);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px 12px 8px 8px;
  background: #fffaf3;
  box-shadow: 0 -20px 60px rgba(41, 37, 31, 0.24);
  overflow: hidden;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
}

.preview-head span {
  display: block;
  margin-bottom: 3px;
  color: var(--hermes);
  font-size: 12px;
  font-weight: 800;
}

.preview-head strong {
  color: var(--ink);
  font-size: 17px;
}

.preview-body {
  max-height: calc(78vh - 72px);
  overflow: auto;
  white-space: pre-wrap;
  color: var(--text);
  font-size: 16px;
  line-height: 1.75;
  padding: 14px;
}

.manual-copy-tip {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.manual-copy-text {
  min-height: 240px;
  border-color: rgba(199, 91, 18, 0.28);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  font-size: 17px;
  line-height: 1.72;
}

.image-preview-mask {
  align-items: center;
}

.image-preview-sheet {
  width: min(100%, 760px);
  max-height: min(88vh, 820px);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf3;
  box-shadow: 0 24px 70px rgba(41, 37, 31, 0.28);
  overflow: hidden;
}

.image-preview-body {
  display: grid;
  gap: 10px;
  max-height: calc(88vh - 72px);
  overflow: auto;
  padding: 12px;
}

.image-preview-body p {
  margin: 0;
  border: 1px solid rgba(199, 91, 18, 0.22);
  border-radius: 8px;
  background: rgba(255, 247, 235, 0.88);
  color: var(--hermes);
  padding: 9px 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 900;
}

.image-preview-body img {
  display: block;
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  border: 1px solid rgba(200, 184, 159, 0.74);
  border-radius: 8px;
  background: #f8efe0;
}

.delete-confirm-mask {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  background: rgba(35, 29, 23, 0.42);
  padding: 20px;
}

.delete-confirm-mask[hidden] {
  display: none;
}

.delete-confirm-sheet {
  display: grid;
  gap: 12px;
  width: min(88vw, 360px);
  border: 1px solid rgba(223, 207, 183, 0.9);
  border-radius: 12px;
  background: #fffaf3;
  box-shadow: 0 24px 70px rgba(41, 37, 31, 0.28);
  padding: 20px;
  text-align: center;
}

.delete-confirm-sheet span {
  color: var(--hermes);
  font-size: 12px;
  font-weight: 900;
}

.delete-confirm-sheet strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.3;
}

.delete-confirm-sheet p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.delete-confirm-sheet .primary {
  width: 100%;
  margin-top: 2px;
}

.profile-page {
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 250, 243, 0.98), rgba(247, 235, 219, 0.98)),
    var(--surface);
  box-shadow: 0 16px 36px rgba(82, 55, 24, 0.1);
  overflow: hidden;
}

.profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(223, 207, 183, 0.82);
  padding: 14px;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--jade), #1d4548);
  color: #fff7ea;
  font-size: 20px;
  font-weight: 900;
}

.profile-identity span,
.profile-card > span {
  display: block;
  color: var(--hermes);
  font-size: 12px;
  font-weight: 900;
}

.profile-identity strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.1;
}

.profile-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid rgba(223, 207, 183, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  padding: 5px 9px;
  font-size: 13px;
  font-weight: 800;
}

.profile-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.profile-card {
  border: 1px solid rgba(223, 207, 183, 0.92);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 250, 242, 0.72)),
    var(--surface);
  padding: 13px;
}

.profile-card strong {
  color: var(--ink);
}

.install-card {
  display: grid;
  gap: 12px;
}

.install-card strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.install-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.profile-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.profile-action-grid .primary {
  grid-column: 1 / -1;
}

.status-list,
.settings-list,
.help-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.status-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(223, 207, 183, 0.64);
  padding-bottom: 8px;
}

.status-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.status-list strong {
  font-size: 15px;
}

.status-list em {
  border-radius: 999px;
  background: rgba(39, 101, 108, 0.1);
  color: var(--jade);
  padding: 4px 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.status-list em.off {
  background: rgba(159, 67, 48, 0.1);
  color: #9f4330;
}

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

.settings-list button {
  border: 1px solid rgba(223, 207, 183, 0.9);
  background: rgba(255, 255, 255, 0.66);
  color: var(--jade);
  min-height: 42px;
  padding: 9px 10px;
}

.help-list p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.faq-list {
  gap: 8px;
}

.faq-list details {
  border: 1px solid rgba(223, 207, 183, 0.88);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  overflow: hidden;
}

.faq-list summary {
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 900;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary::after {
  content: "+";
  float: right;
  color: var(--hermes);
}

.faq-list details[open] summary::after {
  content: "-";
}

.faq-list p {
  border-top: 1px solid rgba(223, 207, 183, 0.68);
  padding: 10px 12px 12px;
}

.edit-material-form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.edit-material-form label {
  display: grid;
  gap: 7px;
}

.summary-box {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(200, 184, 159, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  padding: 12px;
}

.knowledge-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 14px;
}

.knowledge-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 12px 10px;
}

.knowledge-stats strong {
  display: block;
  color: var(--ink);
  font-size: 21px;
  line-height: 1;
}

.knowledge-stats span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.summary-box div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(217, 205, 187, 0.7);
  padding-bottom: 7px;
}

.summary-box div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.summary-box span {
  color: var(--muted);
  font-size: 13px;
}

.summary-box strong {
  color: var(--ink);
  font-size: 13px;
  text-align: right;
}

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(251, 246, 236, 0.94);
  backdrop-filter: blur(14px);
}

.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  border-color: var(--line);
  background: #fff;
  color: var(--copper);
}

.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 10;
  width: max-content;
  max-width: calc(100% - 32px);
  transform: translate(-50%, -50%) scale(0.96);
  border-radius: 8px;
  background: rgba(46, 42, 36, 0.92);
  color: #fff;
  padding: 12px 16px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  text-align: center;
  line-height: 1.45;
}

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

@media (max-width: 520px) {
  .app-shell {
    padding-inline: 12px;
  }

  h1 {
    font-size: 22px;
  }

  .topbar {
    padding-bottom: 14px;
  }

  .option-grid,
  .two-col {
    grid-template-columns: 1fr;
  }

  .wizard-progress {
    grid-template-columns: 1fr;
  }

  .progress-step {
    min-width: 0;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar button {
    width: 100%;
  }

  .flow-lens {
    grid-template-columns: 1fr auto;
    padding: 14px;
  }

  .flow-hint {
    grid-column: 1;
    grid-row: 1;
  }

  .flow-tools {
    grid-column: 2;
    grid-row: 1;
  }

  .flow-lens > span {
    grid-column: 1;
    grid-row: 3;
    justify-content: flex-start;
  }

  .flow-lens .mini {
    grid-column: 2;
    grid-row: 3;
  }

  .step-dots {
    grid-column: 1 / -1;
    grid-row: 2;
    width: min(236px, 100%);
  }

  .profile-action-grid,
  .settings-list {
    grid-template-columns: 1fr;
  }

  .profile-action-grid .primary {
    grid-column: auto;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  .moment-text {
    font-size: 17px;
  }

  .moment-content-row {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
  }

  #materialPicker,
  #materialList {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .kb-file {
    min-height: 126px;
    padding-inline: 6px;
  }

  .file-actions {
    grid-template-columns: 1fr;
  }
}
