.b20o-shell {
  --b20o-ink: color-mix(in srgb, var(--text, #17212b) 94%, #122d34);
  --b20o-muted: color-mix(in srgb, var(--muted, #687078) 92%, #526067);
  --b20o-line: color-mix(in srgb, var(--border, #d5d9d9) 82%, #aab5b2);
  --b20o-paper: #fffdf8;
  --b20o-canvas: color-mix(in srgb, var(--surface-2, #f3f4f2) 88%, #e9eeeb);
  --b20o-accent: var(--primary);
  --b20o-warm: var(--primary-2);
  display: grid;
  gap: 18px;
  min-width: 0;
  color: var(--b20o-ink);
}

.b20o-shell [hidden] { display: none !important; }
.b20o-shell label { margin: 0; }

.b20o-hero {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--b20o-line);
  border-radius: 3px 24px 3px 24px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--b20o-accent) 9%, transparent) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(color-mix(in srgb, var(--b20o-accent) 7%, transparent) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--surface, #fff);
}

.b20o-hero::after {
  content: "";
  position: absolute;
  right: -56px;
  bottom: -92px;
  width: 220px;
  height: 220px;
  border: 42px solid color-mix(in srgb, var(--b20o-accent) 12%, transparent);
  border-radius: 50%;
  pointer-events: none;
}

.b20o-hero > * { position: relative; z-index: 1; }
.b20o-hero h2 {
  max-width: 16ch;
  margin: 8px 0 6px;
  font: 750 clamp(1.65rem, 4vw, 2.7rem)/1.05 "Iowan Old Style", "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  letter-spacing: -.045em;
}
.b20o-hero p { max-width: 72ch; margin: 0; color: var(--b20o-muted); line-height: 1.7; }
.b20o-kicker,
.b20o-local-note,
.b20o-step,
.b20o-doc-label {
  font: 800 .72rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.b20o-kicker { color: var(--b20o-accent); }
.b20o-local-note {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid var(--b20o-line);
  border-radius: 999px;
  color: var(--b20o-accent);
  background: color-mix(in srgb, var(--surface, #fff) 86%, transparent);
  letter-spacing: .03em;
  white-space: nowrap;
}

.b20o-workspace {
  display: grid;
  grid-template-columns: minmax(320px, .86fr) minmax(400px, 1.14fr);
  gap: 18px;
  min-width: 0;
  align-items: start;
}

.b20o-editor,
.b20o-preview-wrap {
  min-width: 0;
  border: 1px solid var(--b20o-line);
  background: var(--surface, #fff);
}
.b20o-editor {
  display: grid;
  gap: 17px;
  padding: clamp(16px, 3vw, 24px);
  border-radius: 18px 3px 18px 3px;
}
.b20o-preview-wrap {
  position: sticky;
  top: 14px;
  overflow: hidden;
  border-radius: 3px 18px 3px 18px;
}
.b20o-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--b20o-line);
  background: var(--surface-2, #f4f5f3);
  font-size: .78rem;
  font-weight: 800;
}
.b20o-preview-head small { color: var(--b20o-muted); font: inherit; font-weight: 600; }
.b20o-preview {
  min-height: 620px;
  padding: clamp(14px, 2vw, 28px);
  overflow: auto;
  background:
    radial-gradient(circle at 20% 12%, color-mix(in srgb, var(--b20o-accent) 7%, transparent), transparent 30%),
    var(--b20o-canvas);
}

.b20o-editor-head,
.b20o-section-head,
.b20o-entry-head,
.b20o-review-top,
.b20o-resume-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.b20o-editor-head > div:first-child,
.b20o-section-head > div:first-child { display: flex; align-items: center; gap: 9px; }
.b20o-editor-head h3,
.b20o-section-head h3 { margin: 0; font-size: 1rem; }
.b20o-editor-head { align-items: flex-start; flex-wrap: wrap; }
.b20o-editor-head .b20o-actions { flex: 1 1 100%; justify-content: flex-start; }
.b20o-section-head { margin-top: 6px; padding-top: 15px; border-top: 1px solid var(--b20o-line); }
.b20o-step {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--b20o-accent);
  letter-spacing: 0;
}
.b20o-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.b20o-editor button,
.b20o-editor .b20o-file,
.b20o-review-actions button { min-height: 44px; cursor: pointer; }
.b20o-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 6px;
  border: 0;
  color: var(--b20o-warm);
  background: transparent;
  font: inherit;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.b20o-file { position: relative; display: inline-flex; align-items: center; margin: 0; cursor: pointer; }
.b20o-file input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.b20o-fields { display: grid; gap: 11px; min-width: 0; }
.b20o-fields-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.b20o-field,
.b20o-fields label,
.b20o-card-editor label,
.b20o-day-editor label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--b20o-ink);
  font-size: .82rem;
  font-weight: 750;
}
.b20o-editor input,
.b20o-editor select,
.b20o-editor textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--b20o-line);
  border-radius: 8px 2px 8px 2px;
  color: var(--b20o-ink);
  background: color-mix(in srgb, var(--surface, #fff) 96%, var(--b20o-accent));
  font: 500 .9rem/1.55 ui-sans-serif, system-ui, sans-serif;
}
.b20o-editor input,
.b20o-editor select { min-height: 44px; padding: 8px 10px; }
.b20o-editor textarea { min-height: 0; padding: 10px; resize: vertical; }
.b20o-editor input:focus,
.b20o-editor select:focus,
.b20o-editor textarea:focus,
.b20o-flashcard:focus-visible,
.b20o-editor button:focus-visible,
.b20o-review-actions button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--b20o-accent) 34%, transparent);
  outline-offset: 2px;
}
.b20o-code {
  font: 600 .76rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
  white-space: pre;
}
.b20o-stack { display: grid; gap: 11px; }
.b20o-entry,
.b20o-card-editor,
.b20o-day-editor {
  display: grid;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--b20o-line);
  border-radius: 12px 3px 12px 3px;
  background: color-mix(in srgb, var(--surface-2, #f5f6f4) 65%, transparent);
}
.b20o-empty,
.b20o-hint { margin: 0; color: var(--b20o-muted); font-size: .78rem; line-height: 1.6; }
.b20o-callout {
  padding: 11px 13px;
  border-left: 4px solid var(--b20o-warm);
  background: color-mix(in srgb, var(--b20o-warm) 8%, transparent);
  color: color-mix(in srgb, var(--b20o-warm) 78%, var(--b20o-ink));
  font-size: .8rem;
  line-height: 1.55;
}
.b20o-status {
  min-height: 24px;
  margin: 0;
  padding: 10px 14px;
  border-left: 3px solid var(--b20o-accent);
  color: var(--b20o-muted);
  background: color-mix(in srgb, var(--b20o-accent) 6%, transparent);
  font-size: .82rem;
  line-height: 1.5;
}
.b20o-status[data-tone="error"] { border-color: var(--danger); color: var(--danger); }
.b20o-status[data-tone="success"] { color: var(--success); }
.b20o-status[data-tone="error"],
.b20o-status[data-tone="success"] {
  position: sticky;
  top: calc(var(--sticky-header-offset, 112px) + 6px);
  z-index: 4;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--text) 10%, transparent);
}

.b20o-table-scroll { max-width: 100%; overflow: auto; border: 1px solid var(--b20o-line); border-radius: 10px 2px 10px 2px; }
.b20o-table-scroll:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--b20o-accent) 34%, transparent);
  outline-offset: 2px;
}
.b20o-input-table { width: 100%; min-width: 580px; border-collapse: collapse; }
.b20o-input-table th,
.b20o-input-table td { padding: 8px; border-bottom: 1px solid var(--b20o-line); text-align: left; vertical-align: top; }
.b20o-input-table th { color: var(--b20o-muted); background: var(--surface-2, #f4f5f3); font-size: .75rem; }
.b20o-input-table tr:last-child > * { border-bottom: 0; }
.b20o-input-table td:nth-last-child(1) { width: 54px; }
.b20o-input-table th:last-child,
.b20o-input-table td:last-child {
  position: sticky;
  inset-inline-end: 0;
  z-index: 2;
  background: var(--surface);
}
.b20o-planner-input { min-width: 980px; }
.b20o-planner-input th:first-child { width: 88px; }
.b20o-planner-input textarea { min-width: 94px; }
.b20o-days-editor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.b20o-days-editor .b20o-day-editor:last-child { grid-column: 1 / -1; }

.b20o-paper {
  box-sizing: border-box;
  width: min(100%, 210mm);
  min-height: 297mm;
  margin: 0 auto;
  padding: clamp(26px, 5vw, 56px);
  color: #17212b;
  background: var(--b20o-paper);
  box-shadow: 0 20px 55px rgba(24, 38, 42, .16);
  font-family: "Iowan Old Style", "Songti SC", "Noto Serif CJK SC", Georgia, serif;
}
.b20o-paper h1,
.b20o-paper h2,
.b20o-paper p { overflow-wrap: anywhere; }

.b20o-resume-paper > header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 22px;
  border-bottom: 3px solid #0b6b65;
}
.b20o-resume-paper h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1; letter-spacing: -.06em; }
.b20o-resume-paper header p { margin: 8px 0 0; color: #53646d; font-size: 1rem; }
.b20o-resume-monogram {
  display: grid;
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #0b6b65;
  font-size: 1.7rem;
  font-weight: 800;
}
.b20o-resume-contact { display: flex; flex-wrap: wrap; gap: 7px; margin: 15px 0 4px; color: #52636b; font-size: .78rem; }
.b20o-resume-contact span { color: #0b6b65; }
.b20o-resume-section { margin-top: 25px; }
.b20o-resume-section > h2 {
  margin: 0 0 12px;
  color: #0b6b65;
  font: 800 .76rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .14em;
}
.b20o-resume-section p { margin: 5px 0; color: #344650; font-size: .88rem; line-height: 1.7; }
.b20o-resume-section article { margin-top: 16px; break-inside: avoid; }
.b20o-resume-row strong { font-size: 1rem; }
.b20o-resume-row span { color: #68747b; font-size: .74rem; }
.b20o-resume-sub { margin-top: 3px; color: #0b6b65; font-size: .82rem; font-weight: 700; }
.b20o-chip-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.b20o-chip-list li { padding: 5px 9px; border: 1px solid #b7c6c1; border-radius: 999px; background: #eff5f2; font-size: .74rem; }

.b20o-invoice-paper > header,
.b20o-planner-paper > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid #17212b;
}
.b20o-doc-label { margin-bottom: 7px; color: #b14b32; }
.b20o-invoice-paper h1,
.b20o-planner-paper h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.45rem); letter-spacing: -.045em; }
.b20o-invoice-paper dl { display: grid; gap: 7px; margin: 0; min-width: 150px; }
.b20o-invoice-paper dl div { display: flex; justify-content: space-between; gap: 12px; }
.b20o-invoice-paper dt { color: #6a7479; font-size: .74rem; }
.b20o-invoice-paper dd { margin: 0; font-size: .78rem; font-weight: 750; }
.b20o-bill-to { display: grid; gap: 5px; margin: 26px 0; }
.b20o-bill-to span { color: #6c777d; font: 750 .68rem/1.2 ui-monospace, monospace; letter-spacing: .12em; }
.b20o-bill-to strong { font-size: 1.05rem; }
.b20o-document-table { width: 100%; border-collapse: collapse; }
.b20o-document-table th,
.b20o-document-table td { padding: 11px 8px; border-bottom: 1px solid #d5dad7; text-align: left; font-size: .78rem; }
.b20o-document-table th { border-bottom: 2px solid #17212b; color: #59656c; font: 750 .67rem/1.2 ui-monospace, monospace; letter-spacing: .06em; }
.b20o-document-table th:not(:first-child),
.b20o-document-table td:not(:first-child) { text-align: right; }
.b20o-totals { display: grid; width: min(100%, 320px); margin: 26px 0 0 auto; }
.b20o-totals > div { display: flex; justify-content: space-between; gap: 18px; padding: 7px 0; border-bottom: 1px solid #d7dcd9; font-size: .8rem; }
.b20o-totals .is-grand { margin-top: 4px; padding-top: 13px; border-bottom: 0; color: #0b6b65; font-size: 1.05rem; }
.b20o-doc-note { margin-top: 30px; padding-top: 15px; border-top: 1px solid #d5dad7; font-size: .78rem; }
.b20o-doc-note p { margin: 6px 0 0; line-height: 1.65; }
.b20o-legal-note { margin-top: 30px; padding: 9px 11px; border: 1px solid #d8b6aa; color: #8d3c2d; background: #fff7f3; font-size: .68rem; line-height: 1.55; }

.b20o-signature-stage { min-height: 420px; padding: 24px; background: #fff; box-shadow: 0 16px 42px rgba(24, 38, 42, .12); }
.b20o-mail-meta { display: flex; justify-content: space-between; margin-bottom: 55px; padding-bottom: 12px; border-bottom: 1px solid #e0e4e5; color: #6a7479; font: 700 .72rem/1.2 ui-monospace, monospace; }
.b20o-signature-render { padding: 18px; border-left: 1px solid #e3e7e6; }
.b20o-preview-error { max-width: 420px; margin: 80px auto; padding: 20px; border: 1px solid #d8b6aa; color: #8d3c2d; background: #fff7f3; }
.b20o-preview-error p { margin-bottom: 0; }

.b20o-review-empty,
.b20o-review-paper { display: grid; align-content: center; justify-items: center; text-align: center; }
.b20o-review-empty h1 { margin: 16px 0 5px; }
.b20o-review-empty p { margin: 0; color: #627078; }
.b20o-review-mark { display: grid; width: 76px; height: 76px; place-items: center; border: 2px solid #0b6b65; border-radius: 50%; color: #0b6b65; font-size: 2rem; }
.b20o-review-paper { align-content: start; }
.b20o-review-top { width: 100%; margin-bottom: 42px; color: #69747a; font: 700 .75rem/1.2 ui-monospace, monospace; }
.b20o-flashcard {
  display: grid;
  width: min(100%, 520px);
  min-height: 310px;
  place-items: center;
  align-content: center;
  gap: 22px;
  padding: 36px;
  border: 2px solid #0b6b65;
  border-radius: 4px 28px 4px 28px;
  color: #17212b;
  background: #f2f8f5;
  box-shadow: 12px 12px 0 #c7dcd5;
  cursor: pointer;
  font: inherit;
}
.b20o-flashcard.is-flipped { border-color: #b14b32; background: #fff7f1; box-shadow: 12px 12px 0 #ead0c5; }
.b20o-flashcard small { color: #0b6b65; font: 800 .72rem/1.2 ui-monospace, monospace; letter-spacing: .12em; }
.b20o-flashcard.is-flipped small { color: #b14b32; }
.b20o-flashcard span { font-size: clamp(1.2rem, 3vw, 1.8rem); font-weight: 700; line-height: 1.55; }
.b20o-flashcard em { color: #758086; font-size: .72rem; font-style: normal; }
.b20o-review-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 35px; }

.b20o-planner-meta { display: grid; gap: 5px; text-align: right; font-size: .76rem; }
.b20o-planner-meta span { color: #68747b; }
.b20o-planner-goal { display: grid; grid-template-columns: auto 1fr; gap: 18px; margin: 20px 0; padding: 13px 15px; border-left: 4px solid #b14b32; background: #fff4ef; font-size: .8rem; line-height: 1.6; }
.b20o-week-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid #ccd4d0; border-left: 1px solid #ccd4d0; }
.b20o-week-grid section { min-height: 135px; padding: 14px; border-right: 1px solid #ccd4d0; border-bottom: 1px solid #ccd4d0; }
.b20o-week-grid section:last-child { grid-column: 1 / -1; }
.b20o-week-grid h2 { margin: 0 0 10px; color: #0b6b65; font-size: .83rem; }
.b20o-week-grid strong { font-size: .82rem; }
.b20o-week-grid p { margin: 8px 0 0; color: #44555e; font-size: .76rem; line-height: 1.65; }
.b20o-planner-paper.is-landscape { width: min(100%, 297mm); min-height: 210mm; padding: 30px; page: b20o-landscape; }
.b20o-timetable { width: 100%; margin-top: 22px; border-collapse: collapse; table-layout: fixed; }
.b20o-timetable th,
.b20o-timetable td { height: 54px; padding: 7px; border: 1px solid #c9d2ce; overflow-wrap: anywhere; font-size: .68rem; line-height: 1.45; vertical-align: top; }
.b20o-timetable thead th { height: auto; color: #fff; background: #0b6b65; text-align: center; }
.b20o-timetable tbody th { width: 70px; color: #0b6b65; background: #edf5f2; }

@media (max-width: 1040px) {
  .b20o-workspace { grid-template-columns: 1fr; }
  .b20o-preview-wrap { position: static; }
}

@media (max-width: 680px) {
  .b20o-hero,
  .b20o-editor-head,
  .b20o-section-head { display: grid; }
  .b20o-editor-head,
  .b20o-section-head { justify-content: stretch; }
  .b20o-local-note { justify-self: start; }
  .b20o-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }
  .b20o-actions > * { width: 100%; }
  .b20o-actions > :only-child,
  .b20o-actions > :first-child:nth-last-child(n + 3) { grid-column: 1 / -1; }
  .b20o-fields-2,
  .b20o-days-editor { grid-template-columns: 1fr; }
  .b20o-days-editor .b20o-day-editor:last-child { grid-column: auto; }
  .b20o-preview { height: min(64vh, 520px); min-height: 360px; padding: 9px; }
  .b20o-paper { min-height: 0; padding: 25px 20px; }
  .b20o-resume-paper > header,
  .b20o-invoice-paper > header,
  .b20o-planner-paper > header { display: grid; }
  .b20o-resume-row { align-items: flex-start; }
  .b20o-week-grid { grid-template-columns: 1fr; }
  .b20o-week-grid section:last-child { grid-column: auto; }
  .b20o-flashcard { min-height: 240px; padding: 24px; box-shadow: 7px 7px 0 #c7dcd5; }
}

@media (prefers-reduced-motion: no-preference) {
  .b20o-flashcard { transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease; }
  .b20o-flashcard:hover { transform: translate(-2px, -2px); }
}

@page { size: A4 portrait; margin: 8mm; }
@page b20o-landscape { size: A4 landscape; margin: 8mm; }

@media print {
  body * { visibility: hidden !important; }
  .b20o-preview,
  .b20o-preview * { visibility: visible !important; }
  .b20o-preview {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    min-height: 0;
    padding: 0;
    overflow: visible;
    background: #fff;
  }
  .b20o-preview-wrap { position: static; overflow: visible; border: 0; }
  .b20o-paper {
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 8mm;
    box-shadow: none;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .b20o-planner-paper.is-landscape { width: 100%; min-height: 0; padding: 6mm; }
  .b20o-preview-head,
  .b20o-editor,
  .b20o-hero,
  .b20o-status { display: none !important; }
  .b20o-resume-section article,
  .b20o-document-table tr,
  .b20o-week-grid section,
  .b20o-timetable tr { break-inside: avoid; }
}
