:root {
  color-scheme: light;
  --ink: #211c2a;
  --muted: #706a7b;
  --line: #e4dfea;
  --panel: #fff;
  --wash: #f6f3f9;
  --purple: #65429a;
  --purple-dark: #4e307d;
  --purple-pale: #eee7f7;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #f8f7fa; font-size: 14px; }
button, input { font: inherit; }
button, a, summary, input[type="checkbox"], input[type="color"] { -webkit-tap-highlight-color: transparent; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 clamp(18px, 4vw, 56px); background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: var(--purple); font-weight: 800; font-size: 22px; box-shadow: 0 4px 12px #65429a30; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.top-note { margin: 0; color: var(--muted); font-size: 12px; }
.page-shell { max-width: 1540px; margin: 0 auto; padding: 30px clamp(14px, 3vw, 44px) 20px; }
.connection-card { max-width: 880px; margin: 4vh auto 0; padding: clamp(24px, 4vw, 42px); border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: 0 12px 44px #3120470b; }
.section-eyebrow { color: var(--purple); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
h1, h2, p { margin-top: 0; }
.connection-card h1, .editor-heading h1 { margin: 8px 0 8px; font-size: clamp(23px, 3vw, 30px); letter-spacing: -.04em; }
.muted { color: var(--muted); line-height: 1.6; }
.connection-card > .muted { max-width: 680px; font-size: 13px; }
.connection-grid { display: grid; grid-template-columns: 1fr 1fr 120px; gap: 14px; margin-top: 26px; }
.connection-grid label, .metadata-grid > label, .background-field { display: flex; flex-direction: column; gap: 7px; color: #423a4d; font-size: 12px; font-weight: 700; }
.token-field { grid-column: 1 / -1; }
input:not([type="checkbox"]):not([type="color"]) { min-width: 0; width: 100%; height: 42px; padding: 0 12px; border: 1px solid #dcd5e5; border-radius: 9px; outline: none; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus { border-color: #8867b6 !important; box-shadow: 0 0 0 3px #8867b61c; }
input:disabled { cursor: not-allowed; opacity: .55; }
.connection-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 17px; margin-top: 22px; }
.connection-actions a { color: var(--purple); text-decoration: none; font-size: 12px; font-weight: 700; }
.connection-actions a:hover { text-decoration: underline; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 7px; padding: 0 16px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-weight: 750; font-size: 12px; transition: background .15s, border-color .15s, transform .15s; }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .6; }
.button.primary { color: #fff; background: var(--purple); }
.button.primary:hover:not(:disabled) { background: var(--purple-dark); }
.button.secondary { color: #493d58; background: #fff; border-color: #dcd5e5; }
.button.secondary:hover:not(:disabled) { background: #f7f3fb; }
.button.danger { color: #8f2a2a; background: #fff; border-color: #edc5c2; }
.button.danger:hover:not(:disabled) { background: #fff1f0; }
.button.compact { min-height: 34px; padding: 0 12px; }
.help-note { margin-top: 24px; padding-top: 17px; border-top: 1px solid #f0edf3; color: var(--muted); font-size: 12px; }
.help-note summary { color: #5c5269; font-weight: 700; cursor: pointer; }
.help-note p { margin: 12px 0 0; line-height: 1.7; }
code { border-radius: 4px; padding: 2px 4px; background: #f0edf4; }
.status { margin: 0 0 18px; padding: 12px 15px; border: 1px solid #d9c9ee; border-radius: 10px; color: #4b3470; background: #f1eafb; line-height: 1.5; }
.status.error { border-color: #f0c6c4; color: #8f2a2a; background: #fff1f0; }
.status.success { border-color: #c8e3d3; color: #216641; background: #effaf3; }
.workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); align-items: start; gap: 20px; }
.sidebar, .editor-panel { min-width: 0; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); box-shadow: 0 5px 24px #31204708; }
.sidebar { position: sticky; top: 14px; padding: 18px 12px 0; overflow: hidden; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 4px 15px; }
.sidebar-actions { display: flex; align-items: center; gap: 6px; }
.sidebar h2 { margin: 5px 0 0; font-size: 22px; letter-spacing: -.035em; }
.search-label { display: block; margin: 0 4px 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.search-input { height: 37px !important; font-size: 12px !important; }
.section-count { margin: 14px 4px 8px; color: #827a8d; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.section-list { max-height: min(66vh, 780px); overflow: auto; margin: 0 -1px; padding: 0 0 10px; }
.section-row { display: flex; align-items: center; gap: 3px; }
.section-choice { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; color: #433b4e; }
.section-row .section-choice { flex: 1; min-width: 0; }
.section-choice:hover { background: #f8f5fb; }
.section-choice[aria-current="true"] { color: #4d2e7a; background: var(--purple-pale); }
.section-reorder { flex: 0 0 25px; width: 25px; height: 28px; padding: 0; border: 1px solid transparent; border-radius: 6px; color: #6c5c7f; background: transparent; cursor: pointer; }
.section-reorder:hover:not(:disabled) { border-color: #e4dbea; background: #f8f5fb; }
.section-reorder:disabled { cursor: not-allowed; opacity: .3; }
.section-index { flex: 0 0 24px; display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid #e4dbea; border-radius: 7px; color: #80738d; background: #fff; font-size: 10px; font-weight: 800; }
.section-choice[aria-current="true"] .section-index { border-color: #d9c9ee; color: #4d2e7a; background: #fff; }
.section-choice-copy { min-width: 0; flex: 1; }
.section-choice-title { display: block; overflow-wrap: anywhere; font-size: 12px; font-weight: 750; line-height: 1.4; }
.section-choice-parent { display: block; margin-top: 2px; color: #6a4e8d; font-size: 10px; }
.section-choice-kind { display: block; margin-top: 3px; color: #968da0; font-size: 10px; }
.sidebar-footer { display: flex; align-items: center; gap: 7px; margin: 0 -12px; padding: 13px 14px; border-top: 1px solid #f0edf3; background: #fcfbfd; color: #777080; font-size: 10px; }
.connection-dot { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: #33a366; }
#connected-repo { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-button { margin-left: auto; padding: 2px 0 2px 5px; border: 0; color: var(--purple); background: transparent; cursor: pointer; font-size: 10px; font-weight: 700; }
.editor-panel { padding: clamp(18px, 2.4vw, 30px); }
.editor-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 21px; border-bottom: 1px solid #f0edf3; }
.editor-heading h1 { margin-bottom: 5px; overflow-wrap: anywhere; }
.editor-subtitle, .editor-heading .muted { margin-bottom: 0; font-size: 12px; }
.dirty-indicator { flex-shrink: 0; margin-top: 6px; padding: 6px 9px; border: 1px solid #eadbb0; border-radius: 99px; color: #755715; background: #fff9e8; font-size: 10px; font-weight: 800; }
.metadata-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; padding: 22px 0 26px; }
.title-field, .description-field { grid-column: auto; }
.metadata-grid input:not([type="checkbox"]):not([type="color"]) { font-weight: 500; }
.metadata-grid select { width: 100%; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid #dcd5e5; border-radius: 9px; background: #fff; color: var(--ink); font: inherit; }
.field-hint { color: #827a8d; font-size: 10px; font-weight: 500; line-height: 1.4; }
.background-field { min-width: 0; }
.background-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.inline-check { display: inline-flex; align-items: center; gap: 7px; color: #5f566b; font-size: 11px; font-weight: 650; cursor: pointer; }
.inline-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--purple); }
.color-control { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-height: 42px; }
.color-control input[type="color"] { width: 47px; height: 36px; padding: 3px; border: 1px solid #dcd5e5; border-radius: 8px; background: white; cursor: pointer; }
.color-control .hex-input { width: 112px !important; height: 36px !important; padding: 0 9px !important; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
#background-value { color: #70677b; font-size: 11px; overflow-wrap: anywhere; }
.menu-check { align-self: center; padding-top: 22px; }
.writing-label-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 0 11px; }
.writing-label-row h2 { margin: 0 0 4px; font-size: 16px; letter-spacing: -.02em; }
.writing-label-row p { margin: 0; font-size: 11px; }
.writing-tag { flex-shrink: 0; margin-bottom: 3px; padding: 5px 7px; border-radius: 5px; color: #6a4e8d; background: #f3edf9; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.canvas-frame { overflow: hidden; border: 1px solid #d9d2e2; border-radius: 10px; background: #fff; }
.tox-tinymce { border: 0 !important; border-radius: 0 !important; }
.tox .tox-editor-header { box-shadow: 0 1px 0 #e7e1ed !important; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 20px; }
.form-footer p { max-width: 330px; margin: 0; font-size: 11px; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
.page-footer { padding: 28px 0 8px; color: #8a8293; text-align: center; font-size: 10px; }
[hidden] { display: none !important; }
@media (max-width: 1000px) {
  .workspace { grid-template-columns: 235px minmax(0, 1fr); gap: 13px; }
  .metadata-grid { grid-template-columns: 1fr; gap: 13px; }
  .title-field, .description-field { grid-column: auto; }
  .menu-check { padding-top: 0; }
  .form-footer { align-items: flex-start; flex-direction: column; }
  .form-actions { width: 100%; }
}
@media (max-width: 700px) {
  .topbar { height: 65px; padding: 0 16px; }
  .top-note { display: none; }
  .page-shell { padding: 16px 10px; }
  .connection-card { margin-top: 12px; padding: 22px 16px; border-radius: 14px; }
  .connection-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .connection-grid label:nth-child(3) { grid-column: 1 / -1; }
  .token-field { grid-column: 1 / -1; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: static; padding-bottom: 0; }
  .section-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; max-height: 245px; }
  .section-choice { padding: 8px 5px; gap: 7px; }
  .section-index { flex-basis: 21px; width: 21px; height: 21px; }
  .section-choice-title { font-size: 11px; }
  .sidebar-footer { margin-top: 8px; }
  .editor-panel { padding: 16px 12px; }
  .editor-heading { gap: 8px; }
  .editor-heading h1 { font-size: 24px; }
  .writing-label-row { align-items: flex-start; flex-direction: column; }
  .writing-tag { margin-bottom: 0; }
  .form-actions { display: grid; grid-template-columns: 1fr; }
  .button { width: 100%; }
}
