.resizer-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
}

.resizer-handle::before,
.resizer-handle::after,
.resizer-handle span {
  content: "";
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #888;
}

.slash-menu-container {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.slash-menu-item {
  padding: 4px 8px;
  cursor: pointer;
}

.slash-menu-item:hover {
  background-color: #f0f0f0;
}

.ql-slash-item.selected {
  font-weight: bold;
  background-color: lightblue;
}

.ql-container {
    font-size: 1rem !important;
    font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif !important;
    border: 1px solid #ddd !important;
}

.ql-container .ql-editor.ql-blank::before {
  color: #BBB !important;
}

/* Spell/Grammar Check Styles */
.ql-spellgram {
  text-decoration: underline wavy red;
  cursor: pointer;
  position: relative;
}

.ql-spellgram:hover {
  text-decoration: underline wavy darkred;
  background-color: rgba(255, 0, 0, 0.1);
}

.ql-editor .ql-spellgram {
  text-decoration: underline wavy red !important;
}

/* Ensure spellgram underlines are visible in the editor */
.ql-editor .ql-spellgram {
  text-decoration-skip-ink: none;
  text-underline-offset: 2px;
}

/* Phase 2 Non-Mutating Spell/Grammar Underlines (WCAG 1.4.1: color + line style) */
::highlight(spellgram-spelling) {
  text-decoration: underline wavy #d93025;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  text-decoration-skip-ink: none;
}

::highlight(spellgram-grammar) {
  text-decoration: underline dashed #1a73e8;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  text-decoration-skip-ink: none;
}

::highlight(spellgram-style) {
  text-decoration: underline dotted #7b1fa2;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  text-decoration-skip-ink: none;
}

/* Active spotlight highlight for the issue currently focused in the Proofing Drawer */
::highlight(spellgram-active) {
  background-color: rgba(255, 213, 79, 0.45);
}

/* Fallback positioned underline overlay for browsers without CSS.highlights */
#quill-container {
  position: relative;
}

.spellgram-overlay-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}

.spellgram-overlay-mark {
  position: absolute;
  pointer-events: none;
  box-sizing: border-box;
}

.spellgram-overlay-spelling {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='3' viewBox='0 0 6 3'%3E%3Cpath d='M0 2.5 Q1.5 0.5 3 2.5 T6 2.5' fill='none' stroke='%23d93025' stroke-width='1.2'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: bottom left;
  background-size: 6px 3px;
}

.spellgram-overlay-grammar {
  border-bottom: 2px dashed #1a73e8;
}

.spellgram-overlay-style {
  border-bottom: 2px dotted #7b1fa2;
}

.spellgram-overlay-active {
  background-color: rgba(255, 213, 79, 0.35);
  border-radius: 2px;
}

/* Suggestion dialog category pill (WCAG AA contrast) */
.spellgram-category-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.spellgram-category-spelling {
  background-color: #fde8e7;
  color: #a50e0e;
  border: 1px solid #f5b7b1;
}

.spellgram-category-grammar {
  background-color: #e8f0fe;
  color: #1558b0;
  border: 1px solid #aecbfa;
}

.spellgram-category-style {
  background-color: #f3e5f5;
  color: #6a1b9a;
  border: 1px solid #d1a7e2;
}

/* Compact issue-count badge anchored to the spellcheck toolbar button */
.spellgram-btn-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
}

.spellgram-toolbar-badge {
  position: absolute;
  top: -4px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background-color: #b71c1c;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 0 0 1.5px #ffffff;
}

.spellgram-toolbar-badge--grammar {
  background-color: #1558b0;
}

.spellgram-toolbar-badge--style {
  background-color: #6a1b9a;
}

/* Suggestion dialog Phase 3 action bar & footer */
.spellgram-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background-color: #fafafa;
  border-bottom: 1px solid #eee;
}

.spellgram-action-btn {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #333;
  background-color: #ffffff;
  border: 1px solid #d4d4d5;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.spellgram-action-btn:hover,
.spellgram-action-btn:focus-visible {
  background-color: #f0f4f8;
  border-color: #99b3cc;
  color: #111;
}

.spellgram-dialog-footer {
  display: flex;
  justify-content: flex-end;
  padding: 6px 12px;
  background-color: #f8f8f8;
  border-radius: 0 0 8px 8px;
}

.spellgram-settings-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  font-size: 12px;
  color: #1558b0;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.spellgram-settings-link-btn:hover,
.spellgram-settings-link-btn:focus-visible {
  background-color: #e8f0fe;
  text-decoration: underline;
}

/* Spellcheck Settings Modal (WCAG 2.2 AA, responsive) */
.spellcheck-settings-section {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e8e8e8;
}

.spellcheck-settings-section:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.spellcheck-section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.spellcheck-settings-heading {
  margin: 0 0 8px 0;
  font-size: 15px;
  font-weight: 600;
  color: #1f2933;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.spellcheck-section-header-row .spellcheck-settings-heading {
  margin-bottom: 0;
}

.spellcheck-count-badge {
  display: inline-block;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  color: #334e68;
  background-color: #e6eef5;
  border-radius: 999px;
}

.spellcheck-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.spellcheck-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spellcheck-field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.spellcheck-field-help {
  margin: 2px 0 8px 0;
  font-size: 12px;
  color: #555;
  line-height: 1.4;
}

.spellcheck-fieldset {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 0 0 12px 0;
}

.spellcheck-fieldset legend {
  padding: 0 6px;
  margin-bottom: 0;
}

.spellcheck-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.spellcheck-radio-option,
.spellcheck-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: #222;
  cursor: pointer;
  line-height: 1.4;
}

.spellcheck-radio-option input,
.spellcheck-checkbox-label input {
  margin-top: 2px;
  flex-shrink: 0;
}

.spellcheck-checkbox-row {
  margin-top: 6px;
}

.spellcheck-dict-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 12px;
}

.spellcheck-dict-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid #c9cdd1;
  border-radius: 4px;
  color: #222;
  background-color: #fff;
}

.spellcheck-chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.spellcheck-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 10px;
  font-size: 13px;
  color: #1f2933;
  background-color: #eef4fa;
  border: 1px solid #c7daec;
  border-radius: 999px;
}

.spellcheck-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: #486581;
  cursor: pointer;
}

.spellcheck-chip-remove:hover,
.spellcheck-chip-remove:focus-visible {
  background-color: #d9e6f2;
  color: #102a43;
}

.spellcheck-item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.spellcheck-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  background-color: #fafafa;
  border: 1px solid #e6e6e6;
  border-radius: 5px;
}

.spellcheck-item-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.spellcheck-item-primary {
  font-size: 13px;
  font-weight: 500;
  color: #222;
  word-break: break-word;
}

.spellcheck-item-code {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 3px;
  background-color: #eceff1;
  color: #455a64;
}

.spellcheck-row-action-btn {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #1558b0;
  background-color: #ffffff;
  border: 1px solid #b8d0ec;
  border-radius: 4px;
  cursor: pointer;
}

.spellcheck-row-action-btn:hover,
.spellcheck-row-action-btn:focus-visible {
  background-color: #e8f0fe;
  border-color: #1558b0;
}

.spellcheck-empty-note {
  margin: 4px 0 0 0;
  font-size: 13px;
  font-style: italic;
  color: #666;
}

/* Phase 4: Bottom-docked Proofing Drawer & Slim Status Footer */
.spellgram-proofing-dock {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid #d4d4d5;
  background-color: #ffffff;
  z-index: 4;
}

.spellgram-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
  padding: 4px 10px;
  background-color: #f8f9fa;
  font-size: 12px;
  color: #334e68;
}

.spellgram-footer-bar--readonly {
  justify-content: flex-end;
}

.spellgram-footer-left,
.spellgram-footer-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.spellgram-word-count {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: #334e68;
  white-space: nowrap;
  cursor: default;
}

.spellgram-word-count--selected {
  background-color: #e6eef5;
  color: #102a43;
  font-weight: 600;
}

.spellgram-footer-divider {
  display: inline-block;
  width: 1px;
  height: 14px;
  margin: 0 2px;
  background-color: #cbd2d9;
  flex-shrink: 0;
}

.spellgram-status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 500;
  color: #243b53;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}

.spellgram-status-toggle:hover,
.spellgram-status-toggle:focus-visible {
  background-color: #e6eef5;
  border-color: #bcccdc;
}

.spellgram-status-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.spellgram-status-label--clean {
  color: #1b6e2d;
}

.spellgram-status-label--warn {
  color: #a85600;
}

.spellgram-status-label--muted {
  color: #52606d;
}

.spellgram-status-counts {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.spellgram-status-count-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}

.spellgram-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.spellgram-dot--spelling {
  background-color: #d93025;
}

.spellgram-dot--grammar {
  background-color: #1a73e8;
}

.spellgram-dot--style {
  background-color: #7b1fa2;
}

.spellgram-footer-turn-on-btn {
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #1558b0;
  background-color: #ffffff;
  border: 1px solid #b8d0ec;
  border-radius: 4px;
  cursor: pointer;
}

.spellgram-footer-turn-on-btn:hover,
.spellgram-footer-turn-on-btn:focus-visible {
  background-color: #e8f0fe;
  border-color: #1558b0;
}

.spellgram-footer-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: #334e68;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}

.spellgram-footer-icon-btn:hover:not(:disabled),
.spellgram-footer-icon-btn:focus-visible:not(:disabled) {
  background-color: #e6eef5;
  border-color: #bcccdc;
  color: #102a43;
}

.spellgram-footer-icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.spellgram-proofing-drawer {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #e0e0e0;
  background-color: #ffffff;
  max-height: 290px;
}

.spellgram-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 10px;
  background-color: #f4f6f8;
  border-bottom: 1px solid #e4e7eb;
}

.spellgram-filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.spellgram-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 500;
  color: #334e68;
  background-color: #ffffff;
  border: 1px solid #d4d4d5;
  border-radius: 999px;
  cursor: pointer;
}

.spellgram-filter-pill:hover,
.spellgram-filter-pill:focus-visible {
  background-color: #eef4fa;
  border-color: #99b3cc;
}

.spellgram-filter-pill--active {
  background-color: #1558b0;
  border-color: #1558b0;
  color: #ffffff;
}

.spellgram-filter-pill--active:hover,
.spellgram-filter-pill--active:focus-visible {
  background-color: #11478e;
  border-color: #11478e;
  color: #ffffff;
}

.spellgram-filter-count {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.9;
}

.spellgram-drawer-header-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.spellgram-step-counter {
  font-size: 12px;
  font-weight: 600;
  color: #486581;
  margin-right: 4px;
  white-space: nowrap;
}

.spellgram-drawer-body {
  overflow-y: auto;
  max-height: 210px;
  padding: 6px 10px;
}

.spellgram-drawer-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 8px;
  font-size: 13px;
  color: #52606d;
}

.spellgram-drawer-empty--clean {
  color: #1b6e2d;
  font-weight: 500;
}

.spellgram-drawer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spellgram-issue-card {
  border: 1px solid #e4e7eb;
  border-radius: 6px;
  background-color: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.spellgram-issue-card--active {
  border-color: #1558b0;
  box-shadow: 0 0 0 1px rgba(21, 88, 176, 0.25);
  background-color: #fbfdff;
}

.spellgram-issue-row-btn {
  width: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 10px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #1f2933;
  font-size: 13px;
}

.spellgram-issue-row-btn:hover,
.spellgram-issue-row-btn:focus-visible {
  background-color: #f4f8fd;
}

.spellgram-issue-snippet {
  flex: 1 1 180px;
  min-width: 0;
  color: #334e68;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spellgram-snippet-match {
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 700;
  color: #102a43;
}

.spellgram-snippet-match--spelling {
  background-color: #fde8e7;
}

.spellgram-snippet-match--grammar {
  background-color: #e8f0fe;
}

.spellgram-snippet-match--style {
  background-color: #f3e5f5;
}

.spellgram-issue-short-msg {
  font-size: 12px;
  color: #52606d;
  white-space: nowrap;
}

.spellgram-issue-detail {
  padding: 8px 10px 10px 10px;
  border-top: 1px solid #e8eef5;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spellgram-issue-message {
  margin: 0;
  font-size: 12.5px;
  color: #334e68;
  line-height: 1.4;
}

.spellgram-drawer-suggestions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.spellgram-drawer-sugg-label {
  font-size: 12px;
  font-weight: 600;
  color: #52606d;
}

.spellgram-drawer-sugg-chip {
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
  background-color: #1558b0;
  border: 1px solid #1558b0;
  border-radius: 4px;
  cursor: pointer;
}

.spellgram-drawer-sugg-chip:hover,
.spellgram-drawer-sugg-chip:focus-visible {
  background-color: #104386;
  border-color: #104386;
}

.spellgram-drawer-no-sugg {
  margin: 0;
  font-size: 12px;
  font-style: italic;
  color: #627d98;
}

.spellgram-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.spellgram-drawer-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 500;
  color: #334e68;
  background-color: #ffffff;
  border: 1px solid #cbd2d9;
  border-radius: 4px;
  cursor: pointer;
}

.spellgram-drawer-action-btn:hover,
.spellgram-drawer-action-btn:focus-visible {
  background-color: #f0f4f8;
  border-color: #99b3cc;
  color: #102a43;
}

.spellgram-cyberhelper-bridge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 10px;
  background-color: #eef6fc;
  border-top: 1px solid #d0e3f5;
  font-size: 12px;
}

.spellgram-cyberhelper-bridge-text {
  color: #243b53;
}

.spellgram-cyberhelper-bridge-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  color: #1558b0;
  background-color: #ffffff;
  border: 1px solid #9dc2eb;
  border-radius: 4px;
  cursor: pointer;
}

.spellgram-cyberhelper-bridge-btn:hover,
.spellgram-cyberhelper-bridge-btn:focus-visible {
  background-color: #ddecfb;
  border-color: #1558b0;
}

/* Keep the green Save toast clear of the bottom proofing footer / open drawer */
.quill-editor--has-proofing-bar .save-message {
  bottom: 44px !important;
}

.quill-editor--proofing-drawer-open .save-message {
  bottom: auto !important;
  top: 52px !important;
}

@media print {
  ::highlight(spellgram-spelling),
  ::highlight(spellgram-grammar),
  ::highlight(spellgram-style),
  ::highlight(spellgram-active) {
    text-decoration: none !important;
    background: none !important;
  }

  .spellgram-overlay-layer,
  .spellgram-proofing-dock {
    display: none !important;
  }
}

/* Video embed styles */
.ql-video-embed {
  margin: 1em 0;
  position: relative;
  outline: none;
}

.ql-video-wrapper {
  position: relative;
  border: 2px solid transparent;
  border-radius: 4px;
  transition: border-color 0.2s ease;
}

.ql-video-wrapper.ql-video-selected {
  border-color: #007cff;
  box-shadow: 0 0 0 2px rgba(0, 124, 255, 0.2);
}

.ql-video-embed:focus .ql-video-wrapper {
  border-color: #007cff;
  box-shadow: 0 0 0 2px rgba(0, 124, 255, 0.2);
}

.ql-video-embed video {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Audio embed styles */
.ql-audio-embed {
  margin: 1em 0;
  position: relative;
  outline: none;
}

.ql-audio-wrapper {
  position: relative;
  border: 2px solid transparent;
  border-radius: 4px;
  transition: border-color 0.2s ease;
}

.ql-audio-wrapper.ql-audio-selected {
  border-color: #007cff;
  box-shadow: 0 0 0 2px rgba(0, 124, 255, 0.2);
}

/* File embed styles */
.ql-file-embed {
  margin: 1em 0;
  position: relative;
  outline: none;
}

.ql-file-wrapper {
  position: relative;
  border: 2px solid transparent;
  border-radius: 4px;
  padding: 0.5em;
  background-color: #f8f9fa;
  transition: border-color 0.2s ease;
}

.ql-file-wrapper.ql-file-selected {
  border-color: #007cff;
  box-shadow: 0 0 0 2px rgba(0, 124, 255, 0.2);
}

/* Annotation link styles */
.annotation-link {
  background-color: #f0f8ff !important;
  color: #2185d0 !important;
  padding: 2px 4px !important;
  border-radius: 3px !important;
  border: 1px solid #d4edda !important;
  text-decoration: underline !important;
  cursor: pointer !important;
  font-weight: bold !important;
  display: inline !important;
  white-space: nowrap !important;
}

.annotation-link:hover {
  background-color: #e6f3ff !important;
  border-color: #2185d0 !important;
}

/* Drag feedback */
.annotation-link.dragging {
  opacity: 0.7;
}

/* Drop zone feedback */
.ql-editor.dragover {
  background-color: #f8f9fa !important;
  border: 2px dashed #2185d0 !important;
}

/* Annotation tooltip */
.annotation-tooltip {
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 1000;
  max-width: 300px;
  font-size: 0.9em;
  line-height: 1.3;
}

/* Fix Semantic UI Tab height issues */
.ui.tab {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}

.ui.tabular.menu {
  flex: 0 0 auto !important;
  margin-bottom: 0 !important;
}

.tab-pane-scroll {
  flex: 1 1 auto !important;
  overflow: auto !important;
  padding: 1rem;
}

/* Remove other semantic UI styling that interferes */
.ui.segment.tab {
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
}

/* AI Feedback scroll area */
.ai-feedback-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-feedback-scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
}

/* Annotations panel scroll area */
.annotations-panel-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.annotations-scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* --- Messages UI Enhancements --- */
.messages-page {}

.messages-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
}

.messages-sidebar {
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 12px;
  padding: 0.75rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.convo-list {
  max-height: 60vh;
  overflow-y: auto;
  margin-top: 0.25rem;
  padding-right: 2px;
}

.ui.list .item.convo-item {
  padding: 0.65rem 0.5rem !important;
  border-radius: 10px !important;
  transition: background-color .15s ease, box-shadow .15s ease;
}

.ui.list .item.convo-item:hover {
  background: #f7f9fb !important;
  box-shadow: inset 0 0 0 1px rgba(34,36,38,.08);
}

.ui.list .item.convo-item.active {
  background: #eef6ff !important;
  box-shadow: inset 0 0 0 1px rgba(33,133,208,.25);
}

.messages-header-actions .ui.button {
  margin-left: 0.5rem;
}

.chat-scroll {
  max-height: 60vh !important;
  overflow-y: auto !important;
  padding-right: 0.25rem !important;
  background: #fff !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04) !important;
}

/* Modal styling for New Conversation */
.ui.modal.messages-new-modal > .header {
  background: linear-gradient(135deg, #2185d0, #6435c9);
  color: #fff;
  border-bottom: none;
}

.ui.modal.messages-new-modal > .content {
  background: #f9fafb;
}

.ui.modal.messages-new-modal .ui.segment {
  border-radius: 12px !important;
}

/* ============================================================================
   Admin Projects Dashboard Redesign - Styles
   ============================================================================ */

/* Recent Projects Section */
.recent-projects-section {
  margin-bottom: 1.5rem;
}

.recent-projects-section .ui.cards {
  margin-top: 0.5rem;
}

/* Project Card with Pin */
.project-card-pinnable {
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.project-card-pinnable:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12) !important;
}

.project-card-pinnable .pin-button-container {
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.project-card-pinnable:hover .pin-button-container {
  opacity: 1;
}

.project-card-pinnable .pin-button-container:hover {
  transform: scale(1.2);
}

/* Pin icon styling */
.project-card-pinnable .pin-button-container .icon {
  font-size: 1.1em !important;
}

/* All Projects Section */
.all-projects-section {
  margin-top: 2rem;
}

.all-projects-header {
  margin-bottom: 0 !important;
  padding: 0.8em 1em !important;
}

.all-projects-header:hover {
  background-color: #f0f4f8 !important;
}

.all-projects-content {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

/* Slide down animation for expandable section */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* All projects table row hover */
.all-projects-row:hover {
  background-color: #f8f9fa !important;
}

.all-projects-row:hover td:first-child {
  color: #2185d0;
}

/* Pagination styling */
.all-projects-section .ui.button.icon {
  transition: background-color 0.15s ease;
}

.all-projects-section .ui.button.icon:not(:disabled):hover {
  background-color: #e8e8e8;
}

/* Search input styling */
.all-projects-section .ui.input input {
  border-radius: 20px !important;
  padding-left: 2.5em !important;
}

.all-projects-section .ui.input .icon {
  opacity: 0.6;
}

/* Mobile responsiveness for admin projects dashboard */
@media only screen and (max-width: 767px) {
  .recent-projects-section .ui.cards {
    margin: 0 !important;
  }
  
  .recent-projects-section .ui.card {
    margin: 0.5rem 0 !important;
  }
  
  .all-projects-header h4 {
    font-size: 1rem !important;
  }
  
  .all-projects-section .ui.form .fields {
    flex-direction: column !important;
  }
  
  .all-projects-section .ui.form .field {
    margin-bottom: 0.5rem !important;
  }
}

/* Table-only view styles */
.table-only-view {
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Pinned row styling in table view */
.table-only-view .pinned-row {
  background-color: #fffbeb !important;
  border-left: 3px solid #f59e0b !important;
}

.table-only-view .pinned-row:hover {
  background-color: #fef3c7 !important;
}

/* View mode toggle button styling */
.ui.buttons .ui.button.active {
  background-color: #2185d0 !important;
  color: white !important;
}

.ui.buttons .ui.button:not(.active) {
  background-color: #f8f9fa !important;
  color: #666 !important;
}

.ui.buttons .ui.button:not(.active):hover {
  background-color: #e9ecef !important;
}

/* Work Editor split Save button: restore standard Semantic UI primary blue
   and disabled styles overridden by the global .ui.buttons toggle rule above. */
.ui.primary.buttons.editor-save-group > .ui.button {
  background-color: #2185d0 !important;
  color: #ffffff !important;
}

.ui.primary.buttons.editor-save-group > .ui.button:hover {
  background-color: #1678c2 !important;
  color: #ffffff !important;
}

.ui.primary.buttons.editor-save-group > .ui.button:focus {
  background-color: #0d71bb !important;
  color: #ffffff !important;
}

.ui.primary.buttons.editor-save-group > .ui.button:active,
.ui.primary.buttons.editor-save-group > .ui.button.active {
  background-color: #1a69a4 !important;
  color: #ffffff !important;
}

.ui.buttons.editor-save-group > .ui.button.disabled {
  background-color: #e0e1e2 !important;
  color: rgba(0, 0, 0, 0.6) !important;
}

/* ==========================================================================
   Accessibility (UIUC WCAG 2.2 remediation)
   ========================================================================== */

/* Strong, consistent keyboard focus indicator for every focusable element
   (WCAG 2.2 - 2.4.7 Focus Visible). :focus-visible only triggers on
   keyboard focus, so mouse users see no change. */
:focus-visible {
  outline: 3px solid #1a5dab !important;
  outline-offset: 2px;
}

/* Screen-reader-only content, e.g. aria-live announcements
   (visible to assistive technology, hidden visually) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip-navigation link (WCAG 2.4.1 Bypass Blocks). Visually hidden
   until it receives keyboard focus, then shown over the menu bar. */
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.skip-link:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  clip: auto;
  z-index: 2000;
  padding: 0.75em 1.25em;
  background-color: #1e2a3a;
  color: #ffffff;
  font-weight: bold;
  border-radius: 6px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Ensure any scrollIntoView targeting #main-content clears the fixed menu bar. */
#main-content {
  scroll-margin-top: 76px;
}

/* The skip-link target receives programmatic focus; no ring needed on
   the whole content region itself. */
#main-content:focus {
  outline: none !important;
}

/* ==========================================================================
   Page shell spacing (UX review, Section 1: cramped half-screen layout)
   ========================================================================== */

/* page-wrapper in core.cljs: outer flex body and the <main> card. Padding
   is set here (not inline) so it can shrink on narrow viewports, where the
   nested page-body + page-main + per-page Container padding otherwise eats
   most of the width. */
.page-body {
  padding: 2em;
}

.page-main {
  padding: 2em;
}

@media only screen and (max-width: 991px) {
  .page-body {
    padding: 1em;
  }

  .page-main {
    padding: 1em;
  }
}

@media only screen and (max-width: 767px) {
  .page-body {
    padding: 0.5em;
  }

  .page-main {
    padding: 0.75em;
  }
}

/* Horizontal-scroll wrapper for wide tables (WCAG 1.4.10 Reflow). The
   wrapper is given tabIndex 0 + role region + aria-label in the view so
   keyboard users can scroll it. */
.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}


/* ==========================================================================
   CyberContribution Report
   ========================================================================== */

/* Paste-source dialog and blocked-paste notice float over the bottom of the
   editor column. They are not modal: the member keeps writing. */
/* Editor control row: when the (resizable) editor pane is narrow, the
   secondary controls fold into the More menu instead of being clipped.
   A container query, because the pane's width is set by the divider, not
   by the viewport. */
.left-pane {
  container-type: inline-size;
}

/* When editable on wide panes (>640px), keep the More (...) menu visible for
   menu-only controls (such as Spelling & grammar settings) while hiding items
   already displayed inline as toolbar buttons. */
.editor-more-menu--persistent {
  display: inline-flex;
}

@container (min-width: 641px) {
  .editor-more-menu--persistent .editor-more-narrow-only {
    display: none !important;
  }
}

@container (max-width: 640px) {
  .editor-secondary-controls {
    display: none !important;
  }
  .editor-more-menu {
    display: inline-flex !important;
  }
}

/* CyberContribution task settings: each dropdown option carries a short
   description. Semantic floats descriptions to the right of the label,
   which crams both into a narrow menu; here the description sits under
   its label in smaller grey text and the menu is wide enough to read. */
.cc-settings .ui.selection.dropdown .menu {
  min-width: 24em;
  /* never wider than the viewport allows inside the task modal */
  max-width: min(36em, calc(100vw - 6em));
}

/* A menu that opens to the left (the checkpoint mode dropdowns at the
   modal's right edge) anchors to the control's right side. */
.cc-settings .ui.selection.dropdown.left .menu {
  left: auto;
  right: 0;
}

/* Semantic puts the description element before the label in the DOM and
   floats it right; a column flex layout with explicit order puts the
   label first and the description under it. */
.cc-settings .ui.selection.dropdown .menu > .item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  white-space: normal;
  line-height: 1.3;
}

.cc-settings .ui.selection.dropdown .menu > .item > .text {
  order: 1;
}

.cc-settings .ui.selection.dropdown .menu > .item > .description {
  order: 2;
  float: none;
  display: block;
  margin: 0.15em 0 0;
  font-size: 0.85em;
  color: rgba(0, 0, 0, 0.55);
}

.cc-paste-dialog,
.cc-blocked-notice {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  max-width: 640px;
  margin: 0 auto;
}

.cc-paste-dialog .ui.segment {
  max-height: 60vh;
  overflow-y: auto;
}

.cc-blocked-notice {
  bottom: auto;
  top: 56px;
}

@media only screen and (max-width: 767px) {
  .cc-paste-dialog,
  .cc-blocked-notice {
    left: 4px;
    right: 4px;
    bottom: 4px;
  }
}

/* CyberContribution origin overlay ------------------------------------------
   Quill writes data-cc-origin on inline spans; the class on the container
   turns the marking on. Each group has its own line style as well as a
   colour (WCAG 1.4.1). Off in print. */
.cc-overlay-on .ql-editor [data-cc-origin="typed"],
.cc-legend-typed {
  text-decoration: underline solid rgba(33, 133, 208, 0.45);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.cc-overlay-on .ql-editor [data-cc-origin="paste-own"],
.cc-legend-paste-own {
  text-decoration: underline dashed #a5673f;
  text-underline-offset: 3px;
}

.cc-overlay-on .ql-editor [data-cc-origin="paste-quote"],
.cc-legend-paste-quote {
  text-decoration: underline dotted #767676;
  text-underline-offset: 3px;
}

.cc-overlay-on .ql-editor [data-cc-origin="paste-prompt"],
.cc-overlay-on .ql-editor [data-cc-origin="assignment-prompt"],
.cc-legend-paste-prompt {
  text-decoration: underline double #5c6f82;
  text-underline-offset: 3px;
}

.cc-overlay-on .ql-editor [data-cc-origin^="cyberhelper"],
.cc-overlay-on .ql-editor [data-cc-origin="paste-cyberhelper"],
.cc-legend-cyberhelper {
  text-decoration: underline wavy #f2711c;
  text-underline-offset: 3px;
  background: rgba(242, 113, 28, 0.08);
}

.cc-overlay-on .ql-editor [data-cc-origin^="cyberreview"],
.cc-overlay-on .ql-editor [data-cc-origin="paste-cyberreview"],
.cc-legend-cyberreview {
  text-decoration: underline wavy #00b5ad;
  text-underline-offset: 3px;
  background: rgba(0, 181, 173, 0.08);
}

.cc-overlay-on .ql-editor [data-cc-origin="paste-ext-ai"],
.cc-legend-paste-ext-ai {
  text-decoration: underline wavy #db2828;
  text-underline-offset: 3px;
  background: rgba(219, 40, 40, 0.08);
}

.cc-overlay-on .ql-editor [data-cc-origin="paste-undeclared"],
.cc-legend-paste-undeclared {
  text-decoration: underline dashed #7a8a00;
  text-underline-offset: 3px;
  background: rgba(181, 204, 24, 0.14);
}

.cc-overlay-on .ql-editor [data-cc-origin="citation"],
.cc-legend-citation {
  text-decoration: underline solid #6435c9;
  text-underline-offset: 3px;
}

.cc-legend-before-tracking {
  color: #767676;
}

.cc-legend-sample {
  font-family: Georgia, serif;
  padding: 0 2px;
}

.cc-timeline-marker:focus-visible {
  outline: 2px solid #2185d0;
  outline-offset: 2px;
}

@media print {
  .cc-overlay-on .ql-editor [data-cc-origin] {
    text-decoration: none !important;
    background: none !important;
  }
}

@media only screen and (max-width: 767px) {
  .cc-pane .cc-report-page header {
    flex-direction: column;
  }
  .cc-pane .cc-report-page section[style*="display: flex"] {
    flex-direction: column;
  }
  /* Pane: comfortable touch targets and no horizontal scroll */
  .cc-pane {
    padding: 0 4px;
  }
  .cc-pane .cc-timeline-marker,
  .cc-pane .ui.mini.button,
  .cc-pane .ui.tiny.button {
    min-height: 32px;
  }
  .cc-pane textarea,
  .cc-pane input[type="number"] {
    width: 100%;
    max-width: 100%;
  }
  /* Report page everywhere (viewer, verify page): pie above the sectors */
  .cc-report-page section[style*="display: flex"] > div {
    flex: 1 1 100% !important;
  }
  /* Paste dialog and checkpoint prompt (same class): buttons wrap cleanly */
  .cc-paste-dialog .ui.buttons,
  .cc-paste-dialog .ui.button {
    margin-bottom: 4px;
  }
}

/* WCAG 2.4.7 / 2.4.13: visible focus on the custom controls added by the
   CyberContribution surfaces (the global :focus-visible ring still applies;
   these keep it visible on tinted backgrounds). */
.cc-pane button:focus-visible,
.cc-report-page a:focus-visible,
.cc-standalone-control button:focus-visible,
.cc-progress-glyph:focus-visible {
  outline: 2px solid #2185d0;
  outline-offset: 2px;
}

/* Reduced motion: the pane's live-updating pie must not animate */
@media (prefers-reduced-motion: reduce) {
  .cc-report-page svg,
  .cc-progress-glyph svg {
    transition: none !important;
    animation: none !important;
  }
}

/* ==========================================================================
   Model management (Admin Dashboard > Model Mgt) and model facts
   ========================================================================== */

/* The model list is a table on wide screens and a stack of cards on narrow
   ones (WCAG 1.4.10 Reflow). Both are rendered; the one that does not fit is
   display:none, which also hides it from assistive technology. */
.modelmgt-cards {
  display: none;
}

@media only screen and (max-width: 767px) {
  .modelmgt-table {
    display: none;
  }

  .modelmgt-cards {
    display: block;
  }
}

/* Label / value pairs used in the model cards, the model detail dialog and
   the model-facts panel. */
.modelmgt-dl {
  display: grid;
  grid-template-columns: minmax(8em, max-content) 1fr;
  gap: 0.3em 1em;
  margin: 0.6em 0;
}

.modelmgt-dl dt {
  font-weight: 600;
  color: #444;
}

.modelmgt-dl dd {
  margin: 0;
}

@media only screen and (max-width: 480px) {
  .modelmgt-dl {
    grid-template-columns: 1fr;
    gap: 0.1em;
  }

  .modelmgt-dl dd {
    margin-bottom: 0.5em;
  }
}

/* Model Mgt: search and sort controls above the list (wrap on narrow screens) */
.modelmgt-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75em 1.5em;
  align-items: flex-end;
  margin: 0.75em 0;
}

.modelmgt-controls-search {
  flex: 2 1 22em;
  min-width: 0;
}

.modelmgt-controls-sort {
  flex: 1 1 16em;
  min-width: 0;
}

.modelmgt-controls label,
.modelmgt-controls .modelmgt-controls-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25em;
}

/* "Help me choose" model wizard: one fieldset per question */
.modelwizard-fieldset {
  border: none;
  margin: 0 0 1em 0;
  padding: 0;
  min-width: 0;
}

.modelwizard-fieldset legend {
  font-weight: 600;
  margin-bottom: 0.35em;
  padding: 0;
}

/* ==========================================================================
   Work Editor & Read-Only Viewer Tables
   Scoped strictly to .ql-editor / .work-content-viewer so Semantic UI tables
   elsewhere in the application are completely unaffected.
   ========================================================================== */

#quill-container .ql-editor {
  overflow-x: auto;
}

.ql-editor table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
  margin: 1em 0;
}

.ql-editor td {
  border: 1px solid #c9cfd6;
  padding: 6px 10px;
  vertical-align: top;
  min-width: 60px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  background-color: #ffffff;
}

.ql-editor td[data-table-header="true"] {
  background-color: #f2f5f8;
  font-weight: 700;
  border-bottom: 2px solid #8a99ad;
  color: #1b1c1d;
}

.ql-editor td.ql-active-cell {
  outline: 2px solid #2185d0;
  outline-offset: -2px;
  background-color: #f7fbff;
}

.ql-editor td[data-table-header="true"].ql-active-cell {
  background-color: #e6f2fc;
}

/* Cell paragraph spacing and clean empty-line height inside table cells */
#quill-container .ql-editor td p {
  margin: 0 0 0.55em 0 !important;
  line-height: 1.5 !important;
  min-height: 1.5em;
}

#quill-container .ql-editor td p:last-child {
  margin-bottom: 0 !important;
}

/* Override the editor's paragraph <br> margin rule inside empty table cells */
#quill-container .ql-editor td br {
  display: inline !important;
  content: normal !important;
  margin: 0 !important;
}

/* Disabled block-level Quill toolbar buttons while cursor is inside a table */
#quill-toolbar-host .ql-toolbar .ql-table-disabled {
  opacity: 0.35;
  pointer-events: none;
  cursor: not-allowed;
}

/* Docked Table Controls Bar (sibling between #quill-toolbar-host and #editor-scroll) */
.table-context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 6px 10px;
  background-color: #f4f8fc;
  border-bottom: 1px solid #c5d9ed;
  flex-shrink: 0;
}

.table-context-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85em;
  font-weight: 600;
  color: #1e4b7a;
  margin-right: 4px;
  white-space: nowrap;
}

.table-context-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.table-context-bar .ui.button:focus-visible {
  outline: 2px solid #2185d0;
  outline-offset: 2px;
}

/* Insert Table Modal: dimension quick-pick grid + numeric inputs */
.table-insert-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25em;
}

.table-grid-picker-section {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.table-grid-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-grid-picker-label {
  font-weight: 600;
  color: #333;
}

.table-grid-picker-readout {
  font-weight: 700;
  color: #2185d0;
  font-size: 0.95em;
}

.table-grid-picker {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px;
  border: 1px solid #d4d4d5;
  border-radius: 4px;
  background-color: #fafafa;
  align-self: flex-start;
  max-width: 100%;
  overflow-x: auto;
}

.table-grid-picker-row {
  display: flex;
  gap: 3px;
}

.table-grid-cell {
  width: 24px;
  height: 22px;
  padding: 0;
  border: 1px solid #c4cbd2;
  border-radius: 2px;
  background-color: #ffffff;
  cursor: pointer;
  transition: background-color 0.08s ease, border-color 0.08s ease;
}

.table-grid-cell.active {
  background-color: #d6ecfc;
  border-color: #2185d0;
}

.table-grid-cell.header-preview {
  background-color: #2185d0;
  border-color: #1678c2;
}

.table-grid-cell:focus-visible {
  outline: 2px solid #1678c2;
  outline-offset: 1px;
  z-index: 1;
}

/* Read-only Groups / Publications viewer tables */
.work-content-viewer .table-scroll {
  margin: 1em 0;
}

.work-content-viewer table {
  border-collapse: collapse;
  width: 100%;
  margin: 0;
  border: 1px solid #c9cfd6;
}

.work-content-viewer th,
.work-content-viewer td {
  border: 1px solid #c9cfd6;
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.work-content-viewer thead th {
  background-color: #f2f5f8;
  font-weight: 700;
  border-bottom: 2px solid #8a99ad;
  color: #1b1c1d;
}

.work-content-viewer td p,
.work-content-viewer th p {
  margin: 0 0 0.55em 0;
  text-align: left;
}

.work-content-viewer td p:last-child,
.work-content-viewer th p:last-child {
  margin-bottom: 0;
}

@media only screen and (max-width: 767px) {
  .ql-editor table {
    table-layout: auto;
  }

  .table-context-bar {
    padding: 6px;
    gap: 4px;
  }

  .table-context-bar .ui.mini.button {
    min-height: 32px;
  }

  .table-grid-cell {
    width: 22px;
    height: 22px;
  }
}

/* ==========================================================================
   Work Editor Diff Viewer (.diff-view)
   Full-height flex layout with responsive version pickers, Lato prose
   typography, and WCAG 1.4.1 color-independent addition/removal cues.
   ========================================================================== */

.diff-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0.65em 0.8em;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

.diff-top-bar {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.45em;
  flex-shrink: 0;
}

.diff-top-bar .diff-heading {
  margin: 0 !important;
  min-width: 0;
  font-size: 1.08em !important;
  overflow-wrap: break-word;
}

.diff-top-bar-buttons {
  display: flex;
  align-items: center;
  gap: 0.35em;
  flex-shrink: 0;
}

.diff-controls {
  display: flex;
  flex-direction: column;
  gap: 0.45em;
  margin-bottom: 0.45em;
  flex-shrink: 0;
}

.diff-compact-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.35em 0.55em;
  padding: 0.3em 0.5em;
  background-color: #f8f9fa;
  border: 1px solid #d4d4d5;
  border-radius: 4px;
}

.diff-compact-bar-left,
.diff-compact-bar-right {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35em;
}

.diff-version-drawer {
  display: flex;
  flex-direction: column;
  gap: 0.55em;
  padding: 0.6em 0.7em;
  background-color: #fafbfc;
  border: 1px solid #d4d4d5;
  border-radius: 4px;
}

.diff-disclosure-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  padding: 0.24em 0.55em;
  border: 1px solid #c9d1d9;
  border-radius: 3px;
  background-color: #ffffff;
  color: #24292f;
  font-size: 0.82em;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
}

.diff-disclosure-btn:hover {
  background-color: #eef2f6;
  border-color: #9aa5b1;
}

.diff-disclosure-btn:focus-visible {
  outline: 2px solid #1a5dab !important;
  outline-offset: 1px;
}

.diff-disclosure-btn .icon {
  margin: 0 !important;
}

.diff-disclosure-chevron {
  font-size: 0.85em !important;
  opacity: 0.75;
}

.diff-disclosure-reviews {
  background-color: #f0f7fd;
  border-color: #8cc0e8;
  color: #165a96;
}

.diff-disclosure-reviews:hover {
  background-color: #e1f0fc;
  border-color: #2185d0;
}

.diff-version-pickers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75em 1em;
}

.diff-version-field {
  flex: 1 1 180px;
  min-width: 0;
}

.diff-field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35em;
  color: #333;
}

.diff-action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5em 0.75em;
}

.diff-step-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}

.diff-preset-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35em 0.5em;
}

.diff-preset-label {
  font-size: 0.8em;
  font-weight: 600;
  color: #555;
  flex-shrink: 0;
}

.diff-preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35em;
}

.diff-freshness-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em 0.65em;
  font-size: 0.82em;
  color: #57606a;
}

.diff-compared-at {
  font-weight: 500;
}

.diff-stale-badge {
  display: inline-block;
  padding: 0.1em 0.5em;
  border-radius: 3px;
  background-color: #fff3cd;
  color: #7a4f01;
  border: 1px dashed #d4a72c;
  font-weight: 600;
}

.diff-loading {
  padding: 0.75em 0;
  flex-shrink: 0;
}

.diff-error,
.diff-empty-state {
  margin-top: 0 !important;
  margin-bottom: 0.75em !important;
  flex-shrink: 0;
}

.diff-legend-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35em 0.9em;
  padding: 0.35em 0.6em;
  margin-bottom: 0.4em;
  background-color: #f9fafb;
  border: 1px solid #e0e1e2;
  border-radius: 4px;
  font-size: 0.82em;
  color: #444;
  flex-shrink: 0;
}

.diff-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}

.diff-result {
  flex: 1 1 auto;
  min-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid #d4d4d5;
  border-radius: 4px;
  padding: 0.85em 1em;
  background-color: #ffffff;
  font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: #1b1c1d;
}

.diff-result:focus-visible {
  outline: 3px solid #1a5dab !important;
  outline-offset: -3px;
}

.diff-unchanged-banner {
  margin-top: 0 !important;
  margin-bottom: 1em !important;
}

.diff-paragraph {
  margin: 0 0 0.7em 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.diff-paragraph:last-child {
  margin-bottom: 0;
}

.diff-blank-line {
  height: 0.6em;
}

ins.diff-added {
  background-color: #ddfbe6;
  color: #116329;
  text-decoration: none;
  border-bottom: 2px solid #2da44e;
  padding: 0 2px;
  border-radius: 2px;
}

del.diff-removed {
  background-color: #ffebe9;
  color: #82071e;
  text-decoration: line-through;
  padding: 0 2px;
  border-radius: 2px;
}

/* Phase 2: Revision Summary Strip, Toolbar, Mini Revision Map, Structured Blocks */

.diff-summary-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.3em 0.6em;
  padding: 0.3em 0.55em;
  margin-bottom: 0.4em;
  background-color: #f8f9fa;
  border: 1px solid #d4d4d5;
  border-radius: 4px;
  font-size: 0.82em;
  flex-shrink: 0;
}

.diff-summary-words {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25em 0.45em;
}

.diff-summary-toggles {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35em;
}

.diff-stat-chip {
  display: inline-block;
  padding: 0.08em 0.4em;
  border-radius: 3px;
  font-weight: 600;
  white-space: nowrap;
}

.diff-stat-added {
  background-color: #ddfbe6;
  color: #116329;
  border: 1px solid #86d39c;
}

.diff-stat-removed {
  background-color: #ffebe9;
  color: #82071e;
  border: 1px solid #f2a2a8;
}

.diff-stat-neutral {
  background-color: #eef1f4;
  color: #24292f;
}

.diff-summary-blocks {
  color: #555;
  font-size: 0.94em;
  white-space: nowrap;
}

.diff-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.35em 0.55em;
  margin-bottom: 0.4em;
  flex-shrink: 0;
}

.diff-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35em;
}

.diff-change-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
}

.diff-change-counter {
  font-size: 0.82em;
  font-weight: 600;
  color: #333;
  margin-right: 0.15em;
  white-space: nowrap;
}

.diff-revision-map {
  display: flex;
  align-items: center;
  gap: 0.4em;
  margin-bottom: 0.4em;
  flex-shrink: 0;
}

.diff-revision-map-label {
  font-size: 0.74em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #555;
  flex-shrink: 0;
}

.diff-revision-map-track {
  display: flex;
  flex: 1 1 auto;
  align-items: stretch;
  gap: 2px;
  min-height: 15px;
  padding: 2px;
  background-color: #f3f4f6;
  border: 1px solid #d4d4d5;
  border-radius: 4px;
  overflow-x: auto;
}

.diff-map-seg {
  flex: 1 1 8px;
  min-width: 8px;
  min-height: 11px;
  padding: 0;
  border-radius: 2px;
  border: 1px solid transparent;
  cursor: pointer;
  background-color: #d8dee4;
}

.diff-map-seg:focus-visible {
  outline: 2px solid #1a5dab !important;
  outline-offset: 1px;
  z-index: 2;
}

.diff-map-unchanged {
  background-color: #dde2e7;
  border-color: #cfd6dd;
}

.diff-map-added {
  background-color: #2da44e;
  border-color: #116329;
}

.diff-map-removed {
  background-color: #cf222e;
  border: 1px dashed #82071e;
}

.diff-map-modified {
  background-color: #d4a72c;
  border-color: #8a6100;
}

.diff-map-moved,
.diff-map-moved-modified,
.diff-map-moved-from {
  background-color: #8250df;
  border: 2px double #4c2889;
}

.diff-map-active {
  box-shadow: 0 0 0 2px #1a5dab;
  z-index: 1;
}

.diff-blocks-list {
  display: flex;
  flex-direction: column;
  gap: 0.55em;
}

.diff-block {
  padding: 0.45em 0.7em;
  border-radius: 3px;
  border-left: 4px solid #e5e7eb;
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.diff-block-unchanged {
  border-left: 3px solid #e5e7eb;
  background-color: transparent;
}

.diff-block-added {
  border-left: 4px solid #2da44e;
  background-color: #f6fff8;
}

.diff-block-removed {
  border-left: 4px dashed #cf222e;
  background-color: #fff8f8;
}

.diff-block-modified {
  border-left: 4px solid #bf8700;
  background-color: #fffdf5;
}

.diff-block-moved,
.diff-block-moved-modified {
  border-left: 4px double #6f42c1;
  background-color: #faf7ff;
}

.diff-block-moved-from {
  border-left: 4px dotted #6f42c1;
  background-color: #f7f4fc;
  padding-top: 0.3em;
  padding-bottom: 0.3em;
}

.diff-block-active {
  outline: 2px solid #1a5dab;
  outline-offset: 1px;
  box-shadow: 0 0 0 3px rgba(26, 93, 171, 0.16);
}

.diff-block-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45em;
  margin-bottom: 0.25em;
  font-size: 0.8em;
}

.diff-block-moved-from .diff-block-meta {
  margin-bottom: 0;
}

.diff-block-label {
  font-weight: 700;
  color: #57606a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.diff-badge {
  display: inline-block;
  padding: 0.1em 0.48em;
  border-radius: 3px;
  font-size: 0.85em;
  font-weight: 600;
  line-height: 1.35;
}

.diff-badge-added {
  background-color: #ddfbe6;
  color: #116329;
  border: 1px solid #86d39c;
}

.diff-badge-removed {
  background-color: #ffebe9;
  color: #82071e;
  border: 1px dashed #cf222e;
}

.diff-badge-modified {
  background-color: #fff3cd;
  color: #7a4f01;
  border: 1px solid #d4a72c;
}

.diff-badge-moved,
.diff-badge-moved-modified,
.diff-badge-moved-from {
  background-color: #f0e8ff;
  color: #4c2889;
  border: 1px solid #9f7be5;
}

.diff-badge-unchanged {
  background-color: #eef1f4;
  color: #444;
  border: 1px solid #d0d7de;
}

button.diff-move-link {
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

button.diff-move-link:hover {
  background-color: #e4d4ff;
}

button.diff-move-link:focus-visible {
  outline: 2px solid #1a5dab !important;
  outline-offset: 1px;
}

.diff-heading-block {
  font-weight: 700;
  margin-top: 0.1em;
}

.diff-blockquote {
  border-left: 3px solid #9ca3af;
  padding-left: 0.85em;
  color: #374151;
  font-style: italic;
}

.diff-list-item {
  padding-left: 0.6em;
}

.diff-list-marker {
  font-weight: 700;
  margin-right: 0.25em;
}

.diff-collapsed-run-btn,
.diff-collapse-run-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  width: 100%;
  padding: 0.45em 0.75em;
  border: 1px dashed #b0b8c1;
  border-radius: 4px;
  background-color: #f6f8fa;
  color: #3b434b;
  font-size: 0.88em;
  font-weight: 600;
  cursor: pointer;
}

.diff-collapsed-run-btn:hover,
.diff-collapse-run-btn:hover {
  background-color: #eaeef2;
  color: #1b1c1d;
}

.diff-collapsed-run-btn:focus-visible,
.diff-collapse-run-btn:focus-visible {
  outline: 2px solid #1a5dab !important;
  outline-offset: 1px;
}

.diff-expanded-run {
  display: flex;
  flex-direction: column;
  gap: 0.45em;
  padding: 0.4em;
  background-color: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
}

.diff-collapse-run-btn {
  margin-top: 0.2em;
  padding: 0.3em 0.6em;
  font-size: 0.82em;
}

/* Structured HTML Table Diffs */

.diff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
  line-height: 1.45;
  background-color: #ffffff;
}

.diff-table th,
.diff-table td {
  border: 1px solid #d0d7de;
  padding: 0.4em 0.55em;
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
}

.diff-table th {
  background-color: #f3f4f6;
  font-weight: 700;
}

.diff-row-added td,
.diff-row-added th {
  background-color: #f0fff4;
}

.diff-row-removed td,
.diff-row-removed th {
  background-color: #fff5f5;
}

.diff-cell-modified {
  background-color: #fffbeb;
}

.diff-cell-added {
  background-color: #f0fff4;
}

.diff-cell-removed {
  background-color: #fff5f5;
}

/* Visual Media Diff Cards */

.diff-media-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85em;
  padding: 0.65em 0.75em;
  border: 1px solid #d0d7de;
  border-radius: 5px;
  background-color: #ffffff;
}

.diff-media-thumb {
  width: 112px;
  height: 84px;
  object-fit: contain;
  border: 1px solid #d8dee4;
  border-radius: 3px;
  background-color: #f6f8fa;
  flex-shrink: 0;
}

.diff-media-icon-box {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8dee4;
  border-radius: 4px;
  background-color: #f6f8fa;
  color: #57606a;
  flex-shrink: 0;
}

.diff-media-meta {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.92em;
}

.diff-media-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35em 0.5em;
  margin-bottom: 0.25em;
}

.diff-media-size {
  color: #57606a;
  font-size: 0.9em;
}

.diff-media-detail {
  margin-top: 0.2em;
  overflow-wrap: break-word;
}

/* Side-by-Side Grid */

.diff-sbs-grid {
  display: flex;
  flex-direction: column;
  min-width: 440px;
}

.diff-sbs-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75em;
  padding: 0.45em 0.6em;
  margin-bottom: 0.45em;
  background-color: #f3f4f6;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.88em;
  color: #24292f;
  position: sticky;
  top: -1em;
  z-index: 3;
}

.diff-sbs-body {
  display: flex;
  flex-direction: column;
  gap: 0.45em;
}

.diff-sbs-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75em;
  padding: 0.45em 0.55em;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
}

.diff-sbs-added {
  background-color: #f6fff8;
  border-left: 4px solid #2da44e;
}

.diff-sbs-removed {
  background-color: #fff8f8;
  border-left: 4px dashed #cf222e;
}

.diff-sbs-modified {
  background-color: #fffdf5;
  border-left: 4px solid #bf8700;
}

.diff-sbs-moved,
.diff-sbs-moved-modified {
  background-color: #faf7ff;
  border-left: 4px double #6f42c1;
}

.diff-sbs-moved-from {
  background-color: #f7f4fc;
  border-left: 4px dotted #6f42c1;
}

.diff-sbs-col {
  min-width: 0;
  overflow-wrap: break-word;
}

.diff-sbs-left {
  padding-right: 0.65em;
  border-right: 1px solid #e5e7eb;
}

.diff-sbs-empty {
  color: #8c959f;
}

.diff-result:has(.diff-sbs-grid) {
  overflow-x: auto;
}

/* Full-Width Expanded Diff Modal (a11y-modal) */

.ui.modal.diff-expanded-modal {
  display: flex !important;
  flex-direction: column;
  max-height: 94vh;
}

.ui.modal.diff-expanded-modal > .header.diff-modal-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75em;
  padding: 0.85em 1.25em;
  flex-shrink: 0;
}

.diff-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.ui.modal.diff-expanded-modal > .content.diff-modal-content {
  display: flex !important;
  flex-direction: column;
  height: calc(90vh - 5em);
  min-height: 360px;
  overflow: hidden;
  padding: 1em 1.25em;
}

.ui.modal.diff-expanded-modal .diff-sbs-grid {
  min-width: 0;
}

/* Phase 3: Between-Versions Review Callout, Formatting Badges & Toolbar */

.diff-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em;
}

.diff-review-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em 0.65em;
  padding: 0.45em 0.7em;
  margin-bottom: 0.55em;
  background-color: #f0f7fd;
  border: 1px solid #b5d6f0;
  border-left: 4px solid #2185d0;
  border-radius: 4px;
  font-size: 0.86em;
  color: #1a4d7a;
  flex-shrink: 0;
}

.diff-review-callout-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-weight: 700;
  flex-shrink: 0;
}

.diff-review-callout-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35em;
}

.diff-review-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  padding: 0.2em 0.55em;
  border: 1px solid #7ab3e0;
  border-radius: 3px;
  background-color: #ffffff;
  color: #165a96;
  font-size: 0.92em;
  font-weight: 600;
  cursor: pointer;
}

.diff-review-link-btn:hover {
  background-color: #e3f1fc;
  color: #0f3f6c;
}

.diff-review-link-btn:focus-visible {
  outline: 2px solid #1a5dab !important;
  outline-offset: 1px;
}

.diff-format-badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3em;
}

.diff-badge-format {
  background-color: #e0f2fe;
  color: #0c4a6e;
  border: 1px dotted #0284c7;
}

.diff-block-format-only {
  border-left: 4px dotted #0e7490;
  background-color: #f0f9ff;
}

.diff-map-format {
  background-color: #0284c7;
  border: 1px dotted #0c4a6e;
}

.diff-format-only-banner-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5em;
}

@media (prefers-reduced-motion: reduce) {
  .diff-block {
    transition: none;
  }
}

@media only screen and (max-width: 767px) {
  .diff-view {
    padding: 0.75em;
    overflow-y: auto;
  }

  .diff-result {
    min-height: 220px;
  }

  .diff-media-card {
    flex-direction: column;
  }
}
