/* Match the Messages workspace while keeping news styles self-contained. */
.news-page {
  --ink: #16291e;
  --muted: #617469;
  --muted-strong: #617469;
  --line: #e1e9e3;
  --surface: #fff;
  --canvas: #f6f8f6;
  --news-accent: #167344;
  --news-soft: #e8f5eb;
  --news-hover: #f0f4f1;
  --news-shadow: 0 8px 30px rgba(28, 60, 39, .07);
  max-width: 1540px;
  min-width: 0;
  margin-inline: auto;
  color: var(--ink);
}
.dark-theme .news-page {
  --ink: #edf5ef;
  --muted: #a4b8aa;
  --muted-strong: #a4b8aa;
  --line: #2c4033;
  --surface: #17251d;
  --canvas: #101b16;
  --news-accent: #80dda1;
  --news-soft: #233f2d;
  --news-hover: #203328;
  --news-shadow: 0 8px 30px rgba(0, 0, 0, .2);
  color-scheme: dark;
}
.news-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.news-page .eyebrow { display: block; font-size: 10px; font-weight: 800; letter-spacing: 1.6px; color: var(--news-accent); }
.news-page-heading h1 { font-size: 29px; line-height: 1.4; margin: 4px 0; color: var(--ink); }
.news-page-heading p { font-size: 13px; color: var(--muted); margin: 3px 0 0; }
.news-page .primary-button { gap: 8px; font-size: 12px; padding: 12px 17px; border-radius: 14px; }
.news-page-heading .primary-button { flex-shrink: 0; }
.news-workspace { display: grid; grid-template-columns: 326px minmax(0, 1fr); height: calc(100dvh - 225px); min-height: 540px; max-height: 1100px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--news-shadow); overflow: hidden; }
.news-list { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-inline-end: 1px solid var(--line); }
.news-inbox-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 25px 22px 18px; }
.news-inbox-heading > div { min-width: 0; }
.news-inbox-heading h2 { font-size: 18px; margin: 0; color: var(--ink); }
.news-inbox-heading p { font-size: 11px; color: var(--muted); margin: 5px 0 0; overflow-wrap: anywhere; }
.news-icon-button { display: grid; place-items: center; width: 34px; height: 34px; flex: none; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.news-icon-button:hover { background: var(--news-hover); color: var(--news-accent); }
.news-icon-button .material-symbols-rounded { font-size: 20px; }
.news-search { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin: 0 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--canvas); }
.news-page .news-search input { width: 100%; min-width: 0; border: 0 !important; background: transparent !important; box-shadow: none !important; color: var(--ink) !important; font: inherit; font-size: 12px; padding: 0 !important; }
.news-search .news-icon-button { width: 20px; height: 20px; }
.news-search input::placeholder { color: var(--muted); opacity: 1; }
.news-search:focus-within { border-color: var(--news-accent); outline: 2px solid var(--news-soft); }
.news-search input:focus { outline: none; box-shadow: none; }
.news-filters { display: flex; gap: 6px; padding: 15px 18px 13px; border-bottom: 1px solid var(--line); }
.news-filters button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 11px; font-weight: 700; padding: 8px 12px; border-radius: 9px; cursor: pointer; }
.news-list-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px; }
.news-composer { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 26px; background: var(--canvas); }
.news-school-picker { min-width: 0; padding: 24px; }
.news-welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 40px; background: var(--canvas); text-align: center; }
.news-page .news-welcome-icon { display: grid; place-items: center; width: 88px; height: 88px; border-radius: 28px; background: var(--news-soft); color: var(--news-accent); font-size: 42px; }
.news-welcome h2 { margin: 8px 0 0; font-size: 24px; color: var(--ink); }
.news-welcome p { max-width: 380px; margin: 0 0 8px; font-size: 13px; line-height: 1.8; color: var(--muted); }
.news-welcome-note { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; margin-top: 10px; }
.news-welcome-note .material-symbols-rounded { font-size: 18px; }
.news-school-picker { min-width: 0; padding: 24px; }
.news-school-picker { margin-block-end: 24px; }
.news-section-heading, .news-block header, .news-row-top { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.news-section-heading h2 { font-size: 20px; margin: 4px 0 18px; overflow-wrap: anywhere; }
.news-field { display: grid; gap: 7px; min-width: 0; margin-block-end: 14px; color: var(--ink); font-size: 13px; font-weight: 700; }
.news-field input, .news-field textarea, .news-field select { width: 100%; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; }
.news-field textarea { resize: vertical; min-height: 130px; line-height: 1.8; font-weight: 400; }
.news-toolbar, .news-actions, .news-school-results, .news-tabs, .news-reactions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.news-toolbar .news-field { flex: 1 1 220px; margin: 0; }
.news-school-results button { display: flex; flex-direction: column; align-items: start; }
.news-school-results small { font-weight: 400; }
.news-hint, .news-row-meta, .news-preview header p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.news-posts { display: grid; gap: 10px; }
.news-post-row { width: 100%; text-align: start; display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.news-post-row strong { font-size: 17px; overflow-wrap: anywhere; }
.news-row-top { align-items: center; flex-wrap: wrap; }
.news-row-top time { font-size: 11px; color: var(--muted); }
.news-row-meta { display: flex; gap: 14px; flex-wrap: wrap; }
.news-selected { border-color: var(--news-accent) !important; box-shadow: inset 0 0 0 1px var(--news-accent); }
.news-badge { padding: 4px 10px; border-radius: 8px; background: var(--canvas); font-size: 11px; font-weight: 700; }
.news-published { background: var(--news-soft); color: var(--news-accent); }
.news-empty { text-align: center; padding: 50px 16px; color: var(--muted); }
.news-empty > span { font-size: 44px; color: var(--news-accent); }
.news-empty h3 { color: var(--ink); }
.news-more { margin-block-start: 20px; }
.news-tabs { margin-block: 20px; }
.news-editor-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.news-block { padding: 16px; border: 1px solid var(--line); border-radius: 16px; margin-block-end: 14px; }
.news-block header { align-items: center; margin-block-end: 10px; }
.news-block header strong { font-size: 13px; }
.news-block-controls { display: flex; gap: 4px; }
.news-block-controls button { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted-strong); background: var(--surface); cursor: pointer; }
.news-block-controls .material-symbols-rounded { font-size: 19px; }
.news-page button:disabled, .news-page fieldset:disabled { opacity: .55; cursor: default; }
.news-page :focus-visible { outline: 3px solid var(--news-accent); outline-offset: 3px; }
.news-file-button { position: relative; overflow: hidden; cursor: pointer; }
.news-file-button input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.news-file-button:focus-within { outline: 3px solid var(--news-accent); outline-offset: 3px; }
.news-image { display: block; max-width: 100%; max-height: 420px; width: auto; border-radius: 12px; object-fit: contain; margin-block: 12px; }
.news-preview { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow-wrap: anywhere; }
.news-preview header { display: flex; align-items: center; gap: 12px; }
.news-preview header p { margin: 4px 0; }
.news-school-icon { padding: 12px; border-radius: 50%; background: var(--news-soft); color: var(--news-accent); }
.news-preview h2 { font-size: 22px; }
.news-preview figure { margin: 18px 0; }
.news-preview figcaption { color: var(--muted); font-size: 13px; }
.news-text { white-space: pre-wrap; line-height: 1.9; }
.news-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; color: var(--news-accent); margin-block: 14px; }
.news-link .material-symbols-rounded { flex-shrink: 0; }
.news-reactions { margin-block: 20px; font-size: 13px; }
.news-reactions > span { padding: 8px 12px; background: var(--canvas); border-radius: 10px; }
.news-save-actions { padding-block-start: 22px; margin-block-start: 22px; border-top: 1px solid var(--line); }
.news-page .news-delete { margin-inline-start: auto; color: #b33434; border-color: currentColor; }
.dark-theme .news-page .news-delete { color: #ffb3ac; }
.news-status, .news-error, .news-conflict, .news-upload { padding: 16px; border: 1px solid var(--line); border-radius: 14px; margin-block: 14px; overflow-wrap: anywhere; }
.news-status { background: var(--canvas); }
.news-error { color: #a52b2b; background: #fff2f0; border-color: #f0ceca; }
.news-conflict { background: var(--canvas); }
.news-latest-content { overflow-wrap: anywhere; max-height: 260px; overflow-y: auto; font-size: 13px; padding: 14px; background: var(--surface); border-radius: 12px; }

.dark-theme .news-error { color: #ffb8af; background: #382320; border-color: #71403a; }
@media (max-width: 600px) { .news-list, .news-composer, .news-school-picker { padding: 16px; } .news-section-heading { flex-wrap: wrap; } .news-preview { padding: 14px; } .news-row-top { gap: 8px; } }
.dark-theme .news-link, .dark-theme .news-page .eyebrow, .dark-theme .news-page .text-button { color: var(--news-accent); }

/* Compact rows and controls use the same selected treatment as Messages. */
.news-posts { gap: 8px; }
.news-post-row { position: relative; gap: 12px; padding: 16px 14px; border-color: transparent; border-radius: 14px; min-width: 0; }
.news-post-row strong { font-size: 14px; line-height: 1.6; }
.news-post-row:not(.news-selected) + .news-post-row:not(.news-selected)::before { content: ""; position: absolute; inset-inline: 14px; top: -5px; height: 1px; background: var(--line); pointer-events: none; }
.news-post-row:hover { background: var(--news-hover); }
.news-row-top { gap: 6px; }
.news-row-top time { font-size: 10px; }
.news-row-meta { font-size: 11px; gap: 12px; }
.news-filters .news-selected, .news-tabs .news-selected { color: var(--news-accent); background: var(--news-soft); border-color: transparent !important; box-shadow: none; }
.news-post-row.news-selected {
  color: var(--ink);
  background: color-mix(in srgb, var(--news-soft) 55%, var(--surface));
  border-color: color-mix(in srgb, var(--news-accent) 45%, var(--line)) !important;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--news-accent) 6%, transparent);
}
.news-post-row.news-selected strong { color: var(--ink); }
.news-post-row.news-selected .news-badge { background: var(--news-soft); color: var(--news-accent); }
.news-row-meta { align-items: center; }
.news-selection-mark { margin-inline-start: auto; display: inline-flex; color: var(--news-accent); }
.news-selection-mark .material-symbols-rounded { font-size: 18px; }
.news-post-row .news-row-top time { line-height: 1.6; }

.news-filters button:hover { background: var(--news-hover); }
.news-composer .news-section-heading h2 { font-size: 21px; margin: 5px 0 0; color: var(--ink); }
.news-composer .news-section-heading > div { min-width: 0; }
.news-composer .news-section-heading > button { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; }
.news-composer .news-section-heading > button .material-symbols-rounded { font-size: 18px; }
.news-tabs { padding: 5px; width: fit-content; gap: 4px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.news-tabs button { border: 0; box-shadow: none; padding: 9px 18px; border-radius: 9px; font-size: 12px; }
.news-block { background: var(--surface); }
.news-more { display: flex; margin: 16px auto; }
@media (max-width: 900px) {
  .news-workspace { grid-template-columns: 290px minmax(0, 1fr); }
  .news-composer { padding: 20px; }
  .news-welcome { padding: 24px; }
}
@media (max-width: 760px) {
  .news-workspace { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 225px); min-height: 480px; border-radius: 20px; }
  .news-list { border-inline-end: 0; padding: 0; }
  .news-welcome, .news-editing .news-list { display: none; }
  .news-composer { padding: 18px; }
  .news-page-heading { gap: 12px; align-items: flex-start; }
  .news-page-heading h1 { font-size: 25px; }
  .news-page-heading p { font-size: 12px; line-height: 1.7; }
  .news-page-heading .primary-button { padding: 11px 12px; }
}
@media (max-width: 400px) {
  .news-page-heading { flex-wrap: wrap; }
  .news-page-heading .primary-button { width: 100%; justify-content: center; }
}

/* Composer: a quiet writing surface with compact tools and a persistent action bar. */
.news-composer { padding: 0; }
.news-editor-shell { min-height: 100%; display: flex; flex-direction: column; padding: 24px 26px 0; }
.news-editor-shell > * { flex-shrink: 0; }
.news-editor-shell > .news-section-heading { margin-bottom: 18px; }
.news-composer .news-section-heading h2 { font-size: 20px; }
.news-editor-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.news-audience { display: flex; align-items: center; gap: 10px; min-width: 0; }
.news-audience > .material-symbols-rounded { background: var(--news-soft); color: var(--news-accent); padding: 9px; border-radius: 12px; font-size: 22px; }
.news-audience > div { display: grid; gap: 3px; min-width: 0; }
.news-audience strong { font-size: 12px; overflow-wrap: anywhere; }
.news-audience div > span { color: var(--muted); font-size: 11px; }
.news-editor-toolbar .news-tabs { margin: 0; flex-shrink: 0; padding: 3px; border-radius: 10px; }
.news-composer .secondary-button, .news-composer .text-button, .news-composer .primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 9px 12px; font-size: 12px; line-height: 1.5; border-radius: 10px; }
.news-composer .secondary-button { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.news-composer .primary-button { background: var(--news-accent); border: 1px solid var(--news-accent); color: var(--surface); box-shadow: none; }
.news-composer .material-symbols-rounded { font-size: 19px; }
.news-composer .news-tabs button { min-height: 34px; padding: 6px 10px; border: 0; }
.news-composer .news-tabs .news-selected { background: var(--news-soft); color: var(--news-accent); }
.news-title-field { margin-bottom: 24px; }
.news-page .news-title-field input { padding: 14px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; font-size: 22px; font-weight: 600; }
.news-title-field > span { font-size: 11px; color: var(--muted); font-weight: 500; }
.news-content-heading { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 12px; font-size: 12px; }
.news-content-heading > span { font-size: 11px; color: var(--muted); }
.news-block { border-radius: 12px; padding: 14px; }
.news-block header strong { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.news-block-number { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--canvas); color: var(--muted); font-size: 11px; }
.news-block-controls button { border: 0; background: transparent; width: 32px; height: 32px; }
.news-block-controls button:hover:not(:disabled) { background: var(--news-hover); color: var(--news-accent); }
.news-block .news-field:last-child { margin-bottom: 0; }
.news-page .news-block-text textarea { border: 0; background: transparent; padding: 4px 2px; border-radius: 4px; min-height: 120px; box-shadow: none; font-size: 14px; }
.news-composer-empty { display: grid; justify-items: center; gap: 10px; padding: 30px 20px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; background: var(--surface); }
.news-composer-empty > .material-symbols-rounded { font-size: 32px; color: var(--news-accent); }
.news-composer-empty strong { font-size: 14px; }
.news-composer-empty p { margin: 0; font-size: 12px; color: var(--muted); }
.news-insert-toolbar { gap: 6px; padding: 10px 0 0; }
.news-insert-toolbar > span { font-size: 11px; color: var(--muted); margin-inline-end: auto; }
.news-content-limits { font-size: 10px; line-height: 1.8; color: var(--muted); margin: 10px 0 20px; }
.news-composer .news-save-actions { position: sticky; bottom: 0; z-index: 2; margin: auto -26px 0; padding: 14px 26px; background: var(--canvas); border-top: 1px solid var(--line); gap: 8px; }
.news-save-actions .news-hint { font-size: 11px; }
.news-page .news-delete { border: 0; padding-inline: 6px; }
.news-upload { position: sticky; bottom: 90px; z-index: 3; flex-shrink: 0; background: var(--surface); border-color: var(--line); box-shadow: var(--news-shadow); padding: 18px; margin: 0 0 20px; }
.news-upload-heading { display: flex; align-items: center; gap: 12px; }
.news-upload-heading > div { min-width: 0; display: grid; gap: 5px; }
.news-upload-heading strong { font-size: 13px; }
.news-upload-filename { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.news-composer .news-upload-icon { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; background: var(--news-soft); color: var(--news-accent); border-radius: 12px; font-size: 24px; }
.news-upload p { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 12px 0; }
.news-upload-progress { height: 4px; background: var(--news-soft); border-radius: 4px; overflow: hidden; margin-top: 16px; }
.news-upload-progress > span { display: block; height: 100%; width: 35%; background: var(--news-accent); border-radius: inherit; animation: news-upload-slide 1.8s ease-in-out infinite alternate; }
.news-upload-failed { border-style: dashed; }
@keyframes news-upload-slide { from { transform: translateX(0); } to { transform: translateX(185%); } }
[dir="rtl"] .news-upload-progress > span { animation-name: news-upload-slide-rtl; }
@keyframes news-upload-slide-rtl { from { transform: translateX(0); } to { transform: translateX(-185%); } }
.news-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .news-upload-progress > span { animation: none; width: 100%; opacity: .65; } }
@media (max-width: 1100px) { .news-editor-toolbar { flex-wrap: wrap; } }
@media (max-width: 600px) {
  .news-editor-shell { padding: 18px 16px 0; }
  .news-composer .news-save-actions { margin-inline: -16px; padding: 12px 16px; }
  .news-insert-toolbar > span { flex-basis: 100%; margin-bottom: 4px; }
  .news-content-heading { flex-wrap: wrap; }
  .news-save-actions .news-hint { flex-basis: 100%; order: 1; }
  .news-composer .news-section-heading h2 { font-size: 18px; }
}

/* Empty auto-direction fields inherit the UI language until text supplies a direction. */
[dir="rtl"] .news-editor-fields input[dir="auto"]:placeholder-shown,
[dir="rtl"] .news-editor-fields textarea[dir="auto"]:placeholder-shown {
  direction: rtl;
  text-align: right;
}

/* Match the portal forms: invalid controls, inline messages and focus on submission. */
.news-page .news-field.field-invalid input,
.news-page .news-field.field-invalid textarea {
  border: 1px solid #ef9b9b;
  background: color-mix(in srgb, var(--surface) 88%, #fff1f1);
  box-shadow: 0 0 0 4px rgba(239,68,68,.08);
}
.dark-theme .news-page .news-field.field-invalid input,
.dark-theme .news-page .news-field.field-invalid textarea { background: color-mix(in srgb, var(--surface) 92%, #ef4444); }
.news-field.field-invalid, .news-content-validation.field-invalid { scroll-margin-block: 24px 150px; }
.news-validation-summary { flex-basis: 100%; margin: 0 0 4px; }
.news-preview { margin-block-end: 24px; }
.news-image-loading { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 180px; padding: 24px; margin-block: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas); color: var(--muted); font-size: 13px; }
.news-image-loading .list-spinner { flex-shrink: 0; }

.news-save-notice { flex: 1 1 200px; min-width: 0; color: var(--news-accent); font-size: 12px; }
.news-control-disabled { opacity: .55; cursor: default; }
.news-control-disabled input { cursor: default; }
.news-page .news-composer .news-delete { color: var(--sirb-danger, #b33434); }
.dark-theme .news-page .news-composer .news-delete { color: #ffb3ac; }
.news-editor-fields input, .news-editor-fields textarea { scroll-margin-block: 80px 160px; }
.news-preview, .news-upload, .news-conflict { scroll-margin-block: 24px 120px; }
.news-field .field-error { overflow-wrap: anywhere; }
.news-link { min-width: 0; overflow-wrap: anywhere; }
[dir="rtl"] .news-page .eyebrow { letter-spacing: 0; }
@media (max-width: 760px) {
  .news-workspace { height: auto; min-height: 0; max-height: none; overflow: visible; }
  .news-list { height: min(70dvh, 680px); }
  .news-composer { overflow: visible; border-radius: inherit; }
  .news-editor-shell { min-height: 0; }
  .news-composer .news-save-actions { border-radius: 0 0 20px 20px; }
  .news-upload { position: static; }
  .news-composer .secondary-button, .news-composer .primary-button, .news-composer .text-button,
  .news-composer .news-tabs button, .news-block-controls button { min-height: 44px; }
  .news-block-controls button { width: 44px; }
  .news-editor-fields input, .news-editor-fields textarea { font-size: 16px; }
  .news-page .news-block-text textarea { font-size: 16px; }
  .news-block header { gap: 8px; }
  .news-composer .news-save-actions > button { flex: 1 1 auto; }
  .news-composer .news-save-actions .news-delete { margin-inline-start: 0; }
}

.news-composer .news-section-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.news-image-error { display: grid; justify-items: center; gap: 10px; padding: 24px; margin-block: 12px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); }
.news-image-error p { font-size: 13px; margin: 0; }

.news-working { display: flex; align-items: center; gap: 8px; }
