/* The four writing fields share the published note's typography and tables. */
#seca-clarte .editor,
.note-preview,
.rich-dialog {
  --note-blue: #10275e;
  --note-ink: #162652;
  --note-muted: #5d6a82;
  --note-line: #c7d4e7;
  color: var(--note-ink);
}

#seca-clarte .editor,
#seca-clarte .editor form,
#seca-clarte .four-fields,
#seca-clarte .rich-section,
#seca-clarte .rich-field,
#seca-clarte .editor-meta > *,
.note-preview *,
.rich-dialog * {
  min-width: 0;
  box-sizing: border-box;
}

#seca-clarte .editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

#seca-clarte .editor-heading h2 { margin: 0; }
#seca-clarte .editor-heading button { flex: none; }

#seca-clarte .editor-meta {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

#seca-clarte .editor-meta label {
  display: grid;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
}

#seca-clarte .editor-meta input,
#seca-clarte .editor-meta select {
  width: 100%;
  max-width: 100%;
  min-height: 46px;
  background: #fff;
  border: 1px solid #a9b8ce;
  border-radius: 8px;
  padding: 11px 12px;
  color: #162652;
  font-size: 16px;
  font-weight: 400;
}

#seca-clarte .editor-meta > button { min-height: 46px; }
#seca-clarte .editor-reference {
  padding: 12px 14px;
  margin: 2px 0 4px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f7f9fc;
}
#seca-clarte .editor-reference > summary {
  cursor: pointer;
  color: #526280;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}
#seca-clarte .editor-reference[open] > summary { margin-bottom: 14px; }
#seca-clarte .editor-reference p { overflow-wrap: anywhere; }

#seca-clarte .four-fields { display: grid; gap: 24px; }
#seca-clarte .rich-section { display: grid; gap: 8px; }
#seca-clarte .rich-section > label,
#seca-clarte .rich-section > h3,
#seca-clarte .rich-section > .rich-label {
  display: block;
  margin: 0;
  color: #10275e;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}
#seca-clarte .rich-section > .muted { margin: 0; }

#seca-clarte .rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px;
  border: 1px solid #c7d4e7;
  border-radius: 10px;
  background: #f4f7fc;
}
#seca-clarte .rich-toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}
#seca-clarte .rich-toolbar-group + .rich-toolbar-group {
  border-left: 1px solid #d4deed;
  padding-left: 8px;
}
#seca-clarte .rich-toolbar button,
#seca-clarte .rich-toolbar select {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  min-width: 36px;
  min-height: 38px;
  max-width: 100%;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid #c7d4e7;
  border-radius: 6px;
  background: #fff;
  color: #10275e;
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
}
#seca-clarte .rich-toolbar select { font-size: 16px; }
#seca-clarte .rich-toolbar button:hover { background: #e6eefb; }
#seca-clarte .rich-toolbar button[aria-pressed="true"],
#seca-clarte .rich-toolbar button.is-active {
  border-color: #10275e;
  background: #10275e;
  color: #fff;
}
#seca-clarte .rich-toolbar button:disabled { opacity: .45; cursor: default; }
#seca-clarte .rich-toolbar svg { width: 17px; height: 17px; flex: none; }
#seca-clarte .rich-table-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
  border-top: 1px solid #d4deed;
  padding-top: 8px;
}
#seca-clarte .rich-table-tools[hidden] { display: none; }
#seca-clarte .rich-table-tools small,
#seca-clarte .rich-table-tools span { color: #526280; font-size: 12px; }

#seca-clarte .rich-field[contenteditable] {
  display: block;
  width: 100%;
  min-height: 128px;
  max-width: 100%;
  padding: 16px 18px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid #a9b8ce;
  border-radius: 9px;
  background: #fff;
  color: #162652;
  font-family: Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal;
  outline-offset: 2px;
  cursor: text;
}
#seca-clarte .rich-field[data-rich-field="body"] { min-height: 300px; }
#seca-clarte .rich-field[contenteditable]:focus {
  border-color: #3f75cf;
  outline: 2px solid #d3e4ff;
}
#seca-clarte .rich-field[contenteditable]:empty::before {
  content: attr(data-placeholder);
  color: #7a879e;
  pointer-events: none;
}
#seca-clarte .rich-field > :first-child { margin-top: 0; }
#seca-clarte .rich-field > :last-child { margin-bottom: 0; }
#seca-clarte .rich-field p { margin: 0 0 .8em; color: inherit; font-size: inherit; line-height: inherit; }
#seca-clarte .rich-field :is(ul, ol) { margin: .5em 0 1em; padding-left: 1.5em; }
#seca-clarte .rich-field li { margin: .25em 0; }
#seca-clarte .rich-field blockquote,
.note-preview .sc-detail blockquote,
#seca-clarte .sc-detail blockquote {
  margin: 16px 0;
  padding: 10px 16px;
  border-left: 3px solid #ee7b34;
  background: #fff6ed;
  color: #42516b;
}
#seca-clarte .rich-field a,
#seca-clarte .sc-detail a,
.note-preview .sc-detail a { color: #2459a5; text-underline-offset: 3px; overflow-wrap: anywhere; }
#seca-clarte .rich-field :is(h1, h2, h3, h4, h5, h6),
#seca-clarte .sc-detail .rich-content :is(h1, h2, h3, h4, h5, h6),
.note-preview .rich-content :is(h1, h2, h3, h4, h5, h6) {
  margin: 1.1em 0 .5em;
  color: #10275e;
  font-weight: 600;
  letter-spacing: -.2px;
  line-height: 1.35;
}
#seca-clarte .rich-field h1,
#seca-clarte .sc-detail .rich-content h1,
.note-preview .sc-detail .rich-content h1 { font-size: 26px; }
#seca-clarte .rich-field h2,
#seca-clarte .sc-detail .rich-content h2,
.note-preview .sc-detail .rich-content h2 { font-size: 23px; }
#seca-clarte .rich-field h3,
#seca-clarte .sc-detail .rich-content h3,
.note-preview .sc-detail .rich-content h3 { font-size: 20px; }
#seca-clarte .rich-field :is(h4, h5, h6),
#seca-clarte .sc-detail .rich-content :is(h4, h5, h6),
.note-preview .sc-detail .rich-content :is(h4, h5, h6) { font-size: 18px; }
.rt-normal,
#seca-clarte .rich-field .rt-normal,
#seca-clarte .sc-detail .rt-normal,
.note-preview .sc-detail .rt-normal { font-size: 1em; }
.rt-small,
#seca-clarte .rich-field .rt-small,
#seca-clarte .sc-detail .rt-small,
.note-preview .sc-detail .rt-small { font-size: .875em; }
.rt-large,
#seca-clarte .rich-field .rt-large,
#seca-clarte .sc-detail .rt-large,
.note-preview .sc-detail .rt-large { font-size: 1.25em; }

/* Table decoration is common to writing, reading, previewing and printing. */
.seca-note-table,
.article-table table,
#seca-clarte .seca-note-table,
#seca-clarte .article-table table {
  width: 100%;
  max-width: 100%;
  border: 0 !important;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  margin: 16px 0;
  background: #fff;
  color: #162652;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.seca-note-table :is(th, td),
.article-table table :is(th, td),
#seca-clarte .seca-note-table :is(th, td),
#seca-clarte .article-table table :is(th, td) {
  padding: 12px 14px;
  border: 0 !important;
  outline: 0;
  text-align: left;
  vertical-align: top;
  min-width: 0;
  background: #fff;
  color: #162652;
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal;
}
.seca-note-table :is(thead th, thead td),
.article-table table th,
#seca-clarte .seca-note-table :is(thead th, thead td),
#seca-clarte .article-table table th {
  background: #10275e;
  color: #fff;
  font-weight: 600;
}
.seca-note-table tbody tr:nth-child(even) > :is(td, th),
.article-table table tr:nth-child(even) > td,
#seca-clarte .seca-note-table tbody tr:nth-child(even) > :is(td, th),
#seca-clarte .article-table table tr:nth-child(even) > td { background: #edf3fc; color: #162652; }
.seca-note-table tbody tr > :first-child,
.article-table table tr > td:first-child,
#seca-clarte .seca-note-table tbody tr > :first-child,
#seca-clarte .article-table table tr > td:first-child { background: #e8eff9; color: #162652; }
.seca-note-table tbody tr:nth-child(even) > :first-child,
.article-table table tr:nth-child(even) > td:first-child,
#seca-clarte .seca-note-table tbody tr:nth-child(even) > :first-child,
#seca-clarte .article-table table tr:nth-child(even) > td:first-child { background: #dfe9f8; }
.seca-note-table tbody th,
#seca-clarte .seca-note-table tbody th { color: #10275e; font-weight: 600; }
/* Pasted paragraphs and headings inherit their cell's header/body contrast. */
.seca-note-table :is(th, td) :is(p, h1, h2, h3, h4, h5, h6, ul, ol, li, figcaption, a),
.article-table table :is(th, td) :is(p, h1, h2, h3, h4, h5, h6, ul, ol, li, figcaption, a),
#seca-clarte :is(.rich-field, .rich-content) .seca-note-table :is(th, td) :is(p, h1, h2, h3, h4, h5, h6, ul, ol, li, figcaption, a),
#seca-clarte :is(.rich-field, .rich-content) .article-table table :is(th, td) :is(p, h1, h2, h3, h4, h5, h6, ul, ol, li, figcaption, a),
.note-preview .sc-detail .seca-note-table :is(th, td) :is(p, h1, h2, h3, h4, h5, h6, ul, ol, li, figcaption, a),
.note-preview .sc-detail .article-table table :is(th, td) :is(p, h1, h2, h3, h4, h5, h6, ul, ol, li, figcaption, a) { color: inherit; }
.seca-note-table :is(th, td) > :first-child,
.article-table :is(th, td) > :first-child { margin-top: 0; }
.seca-note-table :is(th, td) > :last-child,
.article-table :is(th, td) > :last-child { margin-bottom: 0; }
.seca-note-table caption,
.article-table table caption { padding: 0 0 9px; color: #526280; text-align: left; font-size: 13px; }
.seca-note-table a,
.article-table table a { color: inherit; }

.article-table,
#seca-clarte .article-table {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 18px 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 0;
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}
.article-table table,
#seca-clarte .article-table table,
#seca-clarte .rich-field table {
  min-width: 30rem;
  max-width: none;
  margin: 0;
}
#seca-clarte .rich-field table { margin: 12px 0; }
#seca-clarte .rich-field .article-table { margin: 12px 0; }
#seca-clarte .rich-field .article-table table { margin: 0; }
#seca-clarte .rich-field .rich-selected-cell,
#seca-clarte .rich-field :is(td, th):focus {
  box-shadow: inset 0 0 0 2px #ee7b34;
}

#seca-clarte .rich-field img,
#seca-clarte .sc-detail img,
.note-preview .sc-detail img,
#print-area .article-image img,
#print-area .rich-image img { display: block; max-width: 100%; height: auto; }
#seca-clarte .rich-field :is(figure, .rich-image),
.note-preview .sc-detail :is(figure, .rich-image) { max-width: 100%; margin: 18px 0; }
#seca-clarte .rich-field figcaption,
#seca-clarte .sc-detail figcaption,
.note-preview .sc-detail figcaption { margin-top: 7px; color: #526280; font-size: 13px; line-height: 1.5; }

#seca-clarte footer.editor-savebar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
  padding: 18px 0 0;
  margin-top: 8px;
  border-top: 1px solid #dce4ed;
  background: transparent;
}
#seca-clarte footer.editor-savebar::before { content: none; }
#seca-clarte .editor-savebar .muted { margin: 0; }
#seca-clarte .editor-savebar button { min-height: 44px; }

.note-preview,
.rich-dialog {
  box-sizing: border-box;
  width: min(980px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid #c7d4e7;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 18px 70px #10275e30;
  font-family: Arial, sans-serif;
}
.note-preview::backdrop,
.rich-dialog::backdrop { background: #10275e80; }
.note-preview[open] { display: flex; flex-direction: column; }
.preview-heading {
  display: flex;
  flex: none;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid #dce4ed;
  background: #f4f7fc;
}
.preview-heading h2 { margin: 0; color: #10275e; font-size: 20px; line-height: 1.3; }
.preview-heading button,
.rich-dialog button {
  flex: none;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #c0cce0;
  border-radius: 8px;
  background: #fff;
  color: #10275e;
  font: inherit;
  font-size: 14px;
}
.preview-content { min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 24px; }
.preview-content > article.sc-detail,
#seca-clarte .preview-content > article.sc-detail {
  width: 100%;
  max-width: 800px;
  min-width: 0;
  padding: 8px;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #162652;
  overflow-wrap: anywhere;
}
.note-preview .sc-detail h3 { color: #10275e; margin: 18px 0; font-size: 24px; line-height: 1.3; }
.note-preview .sc-detail h4 { margin: 22px 0 8px; color: #10275e; font-size: 15px; line-height: 1.4; }
.note-preview .sc-detail h5 { margin: 22px 0 10px; color: #10275e; font-size: 19px; line-height: 1.4; }
.note-preview .sc-detail p { margin: 0 0 14px; color: #5d6a82; font-size: 14px; line-height: 1.7; }
.note-preview .sc-detail :is(ul, ol) { padding-left: 24px; font-size: 14px; line-height: 1.7; }
.note-preview .sc-detail .muted { color: #5d6a82; font-size: 13px; }
.note-preview .detail-text { white-space: pre-wrap; }

.rich-dialog { width: min(520px, calc(100% - 32px)); padding: 24px; overflow: auto; }
.rich-dialog h2 { margin: 0 0 18px; color: #10275e; font-size: 21px; }
.rich-dialog form { display: grid; gap: 16px; }
.rich-dialog label { display: grid; gap: 7px; color: #162652; font-size: 14px; line-height: 1.5; }
.rich-dialog input,
.rich-dialog select,
.rich-dialog textarea {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid #a9b8ce;
  border-radius: 8px;
  background: #fff;
  color: #162652;
  font: inherit;
  font-size: 16px;
}
.rich-dialog input[type="checkbox"] { width: 20px; min-height: 20px; }
.rich-dialog .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.rich-dialog button.primary { border-color: #10275e; background: #10275e; color: #fff; }
.rich-dialog p { margin: 0; color: #5d6a82; font-size: 13px; line-height: 1.5; }

@media (max-width: 700px) {
  #seca-clarte .editor-meta { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  #seca-clarte .editor-meta > button { justify-self: start; }
  #seca-clarte .editor-heading { align-items: flex-start; }
  #seca-clarte .four-fields { gap: 22px; }
  #seca-clarte .rich-toolbar { position: static; gap: 6px; padding: 7px; }
  #seca-clarte .rich-toolbar-group { gap: 4px; }
  #seca-clarte .rich-toolbar-group + .rich-toolbar-group { border-left: 0; padding-left: 0; }
  #seca-clarte .rich-toolbar button { min-width: 40px; min-height: 42px; padding: 8px; font-size: 12px; }
  #seca-clarte .rich-toolbar select { min-height: 42px; padding: 7px; font-size: 16px; }
  #seca-clarte .rich-table-tools { gap: 5px; }
  #seca-clarte .rich-field[contenteditable] { min-height: 124px; padding: 12px; font-size: 16px; }
  #seca-clarte .rich-field[data-rich-field="body"] { min-height: 280px; }
  #seca-clarte footer.editor-savebar { gap: 8px; }
  #seca-clarte .editor-savebar .primary { width: 100%; }
  .note-preview,
  .rich-dialog { width: calc(100% - 16px); max-width: calc(100% - 16px); max-height: calc(100dvh - 16px); border-radius: 10px; }
  .preview-heading { gap: 8px; padding: 12px; }
  .preview-heading h2 { font-size: 17px; }
  .preview-heading button { padding: 9px 11px; font-size: 13px; }
  .preview-content { padding: 14px 10px; }
  .preview-content > article.sc-detail,
  #seca-clarte .preview-content > article.sc-detail { padding: 4px; }
  .rich-dialog { padding: 18px; }
}

@media print {
  .seca-note-table,
  .article-table table,
  #seca-clarte .seca-note-table,
  #seca-clarte .article-table table {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    font-size: 9.5pt;
    line-height: 1.4;
    table-layout: fixed;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .seca-note-table *,
  .article-table table * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .article-table,
  #seca-clarte .article-table { overflow: visible; border-radius: 0; }
  .seca-note-table :is(th, td),
  .article-table table :is(th, td),
  #seca-clarte .seca-note-table :is(th, td),
  #seca-clarte .article-table table :is(th, td) { padding: 7pt 8pt; min-width: 0; font-size: inherit; }
  .seca-note-table thead,
  .article-table table thead { display: table-header-group; }
  .seca-note-table tfoot,
  .article-table table tfoot { display: table-footer-group; }
  .seca-note-table tr,
  .article-table table tr { break-inside: avoid; page-break-inside: avoid; }
  #print-area :is(h2, h3, h4, h5, h6) { break-after: avoid; }
  #print-area :is(.article-image, .rich-image) { break-inside: avoid; }
  #seca-clarte #print-area :is(.article-image, .rich-image) img { max-width: 100%; height: auto; }
  .rich-toolbar,
  .editor-savebar,
  .preview-heading { display: none !important; }
}
