.tpi-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1em 0;
  color: #202122;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.tpi-publication-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  border: 1px solid #a2a9b1;
  background: #fff;
  color: #202122;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}
.tpi-publication-table th,
.tpi-publication-table td {
  border: 1px solid #a2a9b1;
  padding: 0.2em 0.4em;
  vertical-align: middle;
}
.tpi-publication-table thead th {
  background: #eaecf0;
  font-weight: 700;
  text-align: center !important;
  vertical-align: middle;
}
.tpi-publication-table thead tr:nth-child(2) th {
  color: #36c;
}
.tpi-publication-table .tpi-number-head {
  width: 28px;
  min-width: 28px;
}
.tpi-publication-table .tpi-number {
  width: 28px;
  min-width: 28px;
  vertical-align: middle;
}
.tpi-publication-table .tpi-publication-data td {
  padding-top: 0.35em;
  padding-bottom: 0.35em;
}
.tpi-publication-table .tpi-section-title {
  text-align: left !important;
  font-weight: 700;
  background: #fff;
}
.tpi-publication-table .tpi-section-content {
  text-align: left !important;
  vertical-align: top;
  padding: 0.35em 0.75em;
}
.tpi-publication-table .tpi-section-content ul {
  margin: 0.35em 0;
  padding-left: 1.5em;
  list-style-position: outside;
}
.tpi-publication-table .tpi-section-content li {
  margin: 0 0 0.25em 0;
  padding: 0;
}
.tpi-publication-table .tpi-section-content p {
  margin: 0 0 0.5em;
}
.tpi-publication-table a,
.tpi-publication-table .tpi-isbn {
  color: #36c;
  text-decoration: none;
}
.tpi-publication-table a:hover {
  text-decoration: underline;
}
.tpi-error {
  padding: 10px;
  border-left: 4px solid #d63638;
  background: #fff;
}
@media (max-width: 600px) {
  .tpi-table-wrap { margin: 0.75em 0; }
  .tpi-publication-table { min-width: 680px; font-size: 13px; }
}


/* Empty date slots preserve column alignment without visible borders or content. */
.tpi-publication-table .tpi-empty-cell { border-color: transparent !important; background: transparent !important; }

/* Public editing controls. */
.tpi-front-editor { margin: 1em 0; font-family: Arial, Helvetica, sans-serif; color: #202122; }
.tpi-edit-toggle, .tpi-save-public-changes, .tpi-add-front-table, .tpi-cancel-public-changes, .tpi-front-editor button[data-action] {
  border: 1px solid #a2a9b1; border-radius: 4px; padding: 8px 12px; font: inherit; cursor: pointer; background: #f8f9fa; color: #202122;
}
.tpi-edit-toggle { background: #f8f9fa; font-weight: 600; }
.tpi-front-editor button:hover { filter: brightness(.97); }
.tpi-front-editor-panel { margin-top: 12px; padding: 16px; border: 1px solid #a2a9b1; border-radius: 6px; background: #fff; }
.tpi-front-editor-heading h3 { margin: 0 0 6px; font-size: 18px; }
.tpi-front-editor-heading p { margin: 0 0 16px; color: #54595d; }
.tpi-front-editor-table { border: 1px solid #c8ccd1; border-radius: 5px; margin: 0 0 16px; padding: 12px; }
.tpi-front-editor-table-head, .tpi-front-editor-volume-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tpi-front-editor-table-head h4, .tpi-front-editor-volume-head h5 { margin: 0; }
.tpi-front-editor-volume { border-top: 1px solid #eaecf0; padding-top: 12px; margin-top: 12px; }
.tpi-front-editor-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tpi-front-editor-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tpi-front-editor-field label { font-weight: 600; font-size: 13px; }
.tpi-front-editor-field input, .tpi-front-editor-field textarea { width: 100%; max-width: 100%; box-sizing: border-box; border: 1px solid #8c8f94; border-radius: 3px; padding: 8px; font: inherit; color: #202122; background: #fff; }
.tpi-front-editor-field textarea { min-height: 80px; resize: vertical; }
.tpi-front-editor-field-wide { grid-column: 1 / -1; }
.tpi-front-editor-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.tpi-front-editor .tpi-save-public-changes { background: #2271b1; border-color: #2271b1; color: #fff; font-weight: 600; }
.tpi-front-editor .tpi-danger-action { color: #b32d2e; border-color: #d63638; background: #fff; }
.tpi-front-editor-status { margin: 10px 0 0; }
.tpi-front-editor-status.is-error { color: #b32d2e; }
.tpi-front-editor-status.is-success { color: #008a20; }
@media (max-width: 640px) { .tpi-front-editor-fields { grid-template-columns: 1fr; } .tpi-front-editor-field-wide { grid-column: auto; } .tpi-front-editor-panel { padding: 10px; } }

/* Fix hidden panes against theme/page-builder CSS */
.tpi-front-editor [hidden] { display: none !important; }

/* Editor visuale + sorgente wikitesto — interfaccia professionale */
.tpi-front-editor-panel {
  border: 1px solid #d0d7de;
  border-radius: 12px;
  padding: clamp(14px, 2.5vw, 26px);
  background: #fff;
  box-shadow: 0 12px 34px rgba(27, 31, 36, .08);
}
.tpi-front-editor-heading { margin-bottom: 18px; }
.tpi-front-editor-heading h3 { font-size: 21px; letter-spacing: -.02em; color: #172b4d; }
.tpi-front-editor-heading p { max-width: 820px; font-size: 14px; line-height: 1.65; }
.tpi-editor-mode-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  margin: 0 0 18px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid #d8dee7;
  border-radius: 10px;
  background: #f4f7fb;
}
.tpi-front-editor .tpi-mode-tab {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 10px 16px;
  min-height: 40px;
  background: transparent;
  color: #455468;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.tpi-front-editor .tpi-mode-tab:hover { background: #e8eef7; }
.tpi-front-editor .tpi-mode-tab.is-active {
  color: #174ea6;
  background: #fff;
  border-color: #dce4f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .09);
}
.tpi-front-editor button:focus-visible,
.tpi-front-editor input:focus-visible,
.tpi-front-editor textarea:focus-visible {
  outline: 3px solid rgba(34, 113, 177, .25);
  outline-offset: 2px;
}
.tpi-front-editor-table {
  border-color: #d8e0eb;
  border-radius: 10px;
  padding: clamp(12px, 2vw, 20px);
  background: #f8fafd;
}
.tpi-front-editor-table-head h4 { color: #1f3a5c; font-size: 16px; }
.tpi-front-editor-volume {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #e0e6ef;
  border-radius: 9px;
  background: #fff;
}
.tpi-front-editor-volume-head { padding-bottom: 11px; border-bottom: 1px solid #edf1f6; }
.tpi-front-editor-volume-head h5 { color: #233b58; font-size: 14px; }
.tpi-front-editor-field label { color: #34445b; font-size: 13px; }
.tpi-front-editor-field input,
.tpi-front-editor-field textarea {
  min-height: 40px;
  padding: 10px 11px;
  border: 1px solid #c7d0dc;
  border-radius: 7px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.tpi-front-editor-field input:focus,
.tpi-front-editor-field textarea:focus {
  border-color: #4388df;
  box-shadow: 0 0 0 3px rgba(67, 136, 223, .13);
  outline: none;
}
.tpi-front-editor-field textarea { min-height: 112px; line-height: 1.55; }
.tpi-front-editor .tpi-add-front-table {
  padding: 10px 14px;
  border: 1px solid #c5d7ef;
  border-radius: 7px;
  color: #174ea6;
  background: #f3f8ff;
  font-weight: 650;
}
.tpi-front-editor .tpi-save-public-changes {
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid #1b64c8;
  border-radius: 7px;
  background: linear-gradient(180deg, #2879df, #1b64c8);
  box-shadow: 0 2px 4px rgba(27, 100, 200, .18);
  color: #fff;
  font-weight: 700;
}
.tpi-front-editor .tpi-cancel-public-changes {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid #c9d1dc;
  border-radius: 7px;
  background: #fff;
  color: #34445b;
}
.tpi-front-editor-actions { align-items: center; margin-top: 16px; }
.tpi-save-actions { padding-top: 16px; margin-top: 18px; border-top: 1px solid #e7ebf0; }
.tpi-code-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.tpi-code-editor-head strong { display: block; color: #233b58; font-size: 15px; margin-bottom: 4px; }
.tpi-code-editor-head p, .tpi-code-editor-note { color: #617086; font-size: 13px; line-height: 1.55; margin: 0; }
.tpi-code-editor-head p { max-width: 760px; }
.tpi-code-editor-head code, .tpi-code-editor-note code { padding: 2px 4px; border-radius: 4px; color: #254f7a; background: #eef4fb; }
.tpi-front-editor .tpi-format-code {
  flex: 0 0 auto;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 8px 11px;
  background: #fff;
  color: #34445b;
  font-size: 13px;
  font-weight: 600;
}
.tpi-front-editor-code .tpi-code-source {
  display: block;
  width: 100%;
  min-height: 540px;
  max-height: 75vh;
  box-sizing: border-box;
  padding: 18px;
  border: 1px solid #273449;
  border-radius: 9px;
  background: #101827;
  color: #dce8f8;
  caret-color: #93c5fd;
  font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  tab-size: 2;
  resize: vertical;
  white-space: pre;
  overflow: auto;
  box-shadow: inset 0 1px 5px rgba(0, 0, 0, .2);
}
.tpi-front-editor-code .tpi-code-source:focus { border-color: #4b91f1; box-shadow: 0 0 0 3px rgba(59, 130, 246, .18); outline: none; }
.tpi-code-editor-note { margin-top: 11px; }
.tpi-front-editor-status { padding: 0; font-size: 14px; line-height: 1.5; }
.tpi-front-editor-status.is-error { padding: 10px 12px; border-radius: 7px; border: 1px solid #f0b5b5; background: #fff4f4; }
.tpi-front-editor-status.is-success { padding: 10px 12px; border-radius: 7px; border: 1px solid #a8dfb3; background: #f1fff4; }
.tpi-publication-table .tpi-isbn { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .tpi-editor-mode-tabs { width: 100%; }
  .tpi-front-editor .tpi-mode-tab { flex: 1; padding: 9px 8px; }
  .tpi-code-editor-head { flex-direction: column; }
  .tpi-front-editor-code .tpi-code-source { min-height: 420px; padding: 12px; font-size: 12px; }
  .tpi-front-editor-volume { padding: 12px; }
}


/* High-contrast controls and source editor: override themes/page builders that force white text or white textarea backgrounds. */
.tpi-front-editor .tpi-edit-toggle,
.tpi-front-editor .tpi-edit-toggle:visited {
  appearance: none !important;
  background: #1458a6 !important;
  background-color: #1458a6 !important;
  border: 1px solid #104782 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  opacity: 1 !important;
  text-shadow: none !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
}
.tpi-front-editor .tpi-edit-toggle:hover,
.tpi-front-editor .tpi-edit-toggle:focus {
  background: #0f4787 !important;
  background-color: #0f4787 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
.tpi-front-editor .tpi-editor-mode-tabs .tpi-mode-tab,
.tpi-front-editor .tpi-editor-mode-tabs .tpi-mode-tab:visited {
  appearance: none !important;
  background: #e9eef5 !important;
  background-color: #e9eef5 !important;
  border: 1px solid #c9d4e2 !important;
  color: #172b4d !important;
  -webkit-text-fill-color: #172b4d !important;
  opacity: 1 !important;
  text-shadow: none !important;
  font-weight: 700 !important;
}
.tpi-front-editor .tpi-editor-mode-tabs .tpi-mode-tab.is-active,
.tpi-front-editor .tpi-editor-mode-tabs .tpi-mode-tab[aria-selected="true"] {
  background: #1458a6 !important;
  background-color: #1458a6 !important;
  border-color: #104782 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
.tpi-front-editor .tpi-editor-mode-tabs .tpi-mode-tab:hover {
  filter: none !important;
  background: #dbe6f4 !important;
  background-color: #dbe6f4 !important;
  color: #102944 !important;
  -webkit-text-fill-color: #102944 !important;
}
.tpi-front-editor .tpi-editor-mode-tabs .tpi-mode-tab.is-active:hover {
  background: #0f4787 !important;
  background-color: #0f4787 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
.tpi-front-editor .tpi-code-editor-head .tpi-format-code {
  appearance: none !important;
  background: #ffffff !important;
  background-color: #ffffff !important;
  border: 1px solid #9aa9bd !important;
  color: #172b4d !important;
  -webkit-text-fill-color: #172b4d !important;
  opacity: 1 !important;
  text-shadow: none !important;
  font-weight: 700 !important;
}
.tpi-front-editor .tpi-front-editor-code textarea.tpi-code-source,
.tpi-front-editor textarea.tpi-code-source {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-height: 540px !important;
  max-height: 75vh !important;
  padding: 18px !important;
  background: #101827 !important;
  background-color: #101827 !important;
  color: #f1f5f9 !important;
  -webkit-text-fill-color: #f1f5f9 !important;
  caret-color: #93c5fd !important;
  border: 1px solid #273449 !important;
  border-radius: 9px !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  line-height: 1.65 !important;
  text-shadow: none !important;
  box-shadow: inset 0 1px 5px rgba(0, 0, 0, .2) !important;
  resize: vertical !important;
  white-space: pre !important;
  overflow: auto !important;
  appearance: auto !important;
}
.tpi-front-editor textarea.tpi-code-source::placeholder {
  color: #94a3b8 !important;
  -webkit-text-fill-color: #94a3b8 !important;
  opacity: 1 !important;
}
.tpi-front-editor .tpi-add-front-table,
.tpi-front-editor button[data-action],
.tpi-front-editor .tpi-cancel-public-changes {
  opacity: 1 !important;
  text-shadow: none !important;
}
.tpi-front-editor button[data-action] {
  background: #f8fafc !important;
  background-color: #f8fafc !important;
  border: 1px solid #b7c4d4 !important;
  color: #172b4d !important;
  -webkit-text-fill-color: #172b4d !important;
  font-weight: 650 !important;
}
.tpi-front-editor .tpi-add-front-table {
  background: #edf5ff !important;
  background-color: #edf5ff !important;
  border-color: #9ebde8 !important;
  color: #174ea6 !important;
  -webkit-text-fill-color: #174ea6 !important;
}
.tpi-front-editor .tpi-save-public-changes {
  background: #1458a6 !important;
  background-color: #1458a6 !important;
  border-color: #104782 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
.tpi-front-editor .tpi-cancel-public-changes {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border-color: #9aa9bd !important;
  color: #172b4d !important;
  -webkit-text-fill-color: #172b4d !important;
}
.tpi-front-editor button:disabled {
  opacity: .65 !important;
  cursor: not-allowed !important;
}
@media (max-width: 640px) {
  .tpi-front-editor .tpi-front-editor-code textarea.tpi-code-source,
  .tpi-front-editor textarea.tpi-code-source { min-height: 420px !important; padding: 12px !important; font-size: 12px !important; }
}
