/* Shared News Composer + Member Reader document styles */

.casa-rich-doc {
  --doc-ink: #152238;
  --doc-muted: #5d6b86;
  --doc-line: #e4ebf5;
  --doc-accent: #2f6fed;
  color: var(--doc-ink);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 17px;
  line-height: 1.7;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.casa-rich-doc > *:first-child { margin-top: 0; }
.casa-rich-doc > *:last-child { margin-bottom: 0; }

.casa-rich-doc h1,
.casa-rich-doc h2,
.casa-rich-doc h3,
.casa-rich-doc h4 {
  font-family: Inter, system-ui, sans-serif;
  color: #0b1f4d;
  line-height: 1.25;
  margin: 1.35em 0 0.55em;
  font-weight: 800;
}

.casa-rich-doc h1 { font-size: clamp(1.55rem, 4vw, 2.1rem); }
.casa-rich-doc h2 { font-size: clamp(1.3rem, 3.2vw, 1.65rem); }
.casa-rich-doc h3 { font-size: clamp(1.12rem, 2.6vw, 1.35rem); }
.casa-rich-doc h4 { font-size: 1.05rem; }

.casa-rich-doc p { margin: 0 0 1em; }
.casa-rich-doc a { color: var(--doc-accent); text-decoration: underline; text-underline-offset: 2px; }
.casa-rich-doc strong, .casa-rich-doc b { font-weight: 700; }
.casa-rich-doc em, .casa-rich-doc i { font-style: italic; }
.casa-rich-doc u { text-decoration: underline; }
.casa-rich-doc s, .casa-rich-doc strike { text-decoration: line-through; }
.casa-rich-doc mark {
  background: #ffe566;
  color: inherit;
  padding: 0.05em 0.15em;
  border-radius: 2px;
}

.casa-rich-doc ul,
.casa-rich-doc ol {
  margin: 0 0 1em;
  padding-left: 1.4em;
}
.casa-rich-doc li { margin: 0.25em 0; }
.casa-rich-doc blockquote {
  margin: 1.1em 0;
  padding: 0.75em 1em;
  border-left: 4px solid var(--doc-accent);
  background: #f4f8ff;
  color: #31405f;
  border-radius: 0 10px 10px 0;
}
.casa-rich-doc hr {
  border: 0;
  border-top: 1px solid var(--doc-line);
  margin: 1.5em 0;
}

.casa-rich-doc .doc-figure,
.casa-rich-doc figure {
  margin: 1.25em 0;
  max-width: 100%;
}

.casa-rich-doc img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.casa-rich-doc .doc-figure.align-left,
.casa-rich-doc img.align-left {
  float: left;
  margin: 0.35em 1em 0.85em 0;
  max-width: min(46%, 320px);
}

.casa-rich-doc .doc-figure.align-right,
.casa-rich-doc img.align-right {
  float: right;
  margin: 0.35em 0 0.85em 1em;
  max-width: min(46%, 320px);
}

.casa-rich-doc .doc-figure.align-center,
.casa-rich-doc img.align-center {
  float: none;
  margin-left: auto;
  margin-right: auto;
}

.casa-rich-doc figcaption,
.casa-rich-doc .doc-caption {
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--doc-muted);
  margin-top: 0.45em;
  text-align: center;
}

.casa-rich-doc .doc-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1.25em 0;
  border-radius: 14px;
  overflow: hidden;
  background: #0b1220;
  clear: both;
}

.casa-rich-doc .doc-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.casa-rich-doc .doc-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.2em 0;
  clear: both;
  border: 1px solid var(--doc-line);
  border-radius: 12px;
}

.casa-rich-doc table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.92rem;
  background: #fff;
}

.casa-rich-doc th,
.casa-rich-doc td {
  border: 1px solid var(--doc-line);
  padding: 0.65em 0.8em;
  text-align: left;
  vertical-align: top;
}

.casa-rich-doc th {
  background: #f3f7ff;
  font-weight: 700;
  color: #0b1f4d;
}

.casa-rich-doc .doc-chart {
  margin: 1.25em 0;
  padding: 14px 14px 8px;
  border: 1px solid var(--doc-line);
  border-radius: 14px;
  background: #fff;
  clear: both;
}

.casa-rich-doc .doc-chart-title {
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0b1f4d;
  margin: 0 0 10px;
}

.casa-rich-doc .doc-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 140px;
  padding: 8px 4px 0;
  flex-wrap: nowrap;
}

.casa-rich-doc .doc-chart-col {
  flex: 1 1 0;
  min-width: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.casa-rich-doc .doc-chart-bar {
  width: 100%;
  max-width: 42px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #5b8ff9, #2f6fed);
  min-height: 8px;
}

.casa-rich-doc .doc-chart-col small {
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.7rem;
  color: var(--doc-muted);
  text-align: center;
  line-height: 1.2;
}

.casa-rich-doc .doc-callout {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-start;
  margin: 1.2em 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: #eef6ff;
  border: 1px solid #d4e4ff;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.95rem;
  clear: both;
}

.casa-rich-doc .doc-callout strong {
  display: block;
  margin-bottom: 2px;
}

.casa-rich-doc .text-left { text-align: left; }
.casa-rich-doc .text-center { text-align: center; }
.casa-rich-doc .text-right { text-align: right; }
.casa-rich-doc .text-justify { text-align: justify; }

.casa-rich-doc::after {
  content: "";
  display: table;
  clear: both;
}


/* Composer chrome */
.composer-shell { display: grid; gap: 16px; }

.composer-steps {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px;
  background: var(--surface, #fff); border: 1px solid var(--line, #e4ebf5); border-radius: 14px;
}
.composer-step {
  appearance: none; border: 1px solid transparent; background: transparent;
  display: inline-flex; align-items: center; gap: 10px; text-align: left;
  padding: 8px 12px; border-radius: 12px; cursor: pointer; color: #5d6b86; min-width: 0; flex: 1 1 220px;
}
.composer-step:hover { background: #f4f7fc; }
.composer-step.is-active { background: #eef4ff; border-color: #c9dbff; color: #0b1f4d; }
.composer-step.is-done .composer-step-num { background: #1f8a5b; color: #fff; }
.composer-step-num {
  width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center;
  font: 700 13px/1 Inter, system-ui, sans-serif; background: #e4ebf5; color: #3d4967; flex: none;
}
.composer-step.is-active .composer-step-num { background: #2f6fed; color: #fff; }
.composer-step-copy { display: grid; gap: 2px; min-width: 0; }
.composer-step-copy strong { font: 700 13px/1.2 Inter, system-ui, sans-serif; }
.composer-step-copy small { font-size: 11px; color: #8a96ab; }
.composer-step-divider { width: 28px; height: 2px; background: #d7e0ef; flex: none; }
.composer-step-pane[hidden] { display: none !important; }
.composer-step-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 4px; }

.composer-editor-summary {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--line, #e4ebf5); border-radius: 12px; background: #f8fbff;
  margin-bottom: 14px;
}
.composer-editor-summary strong { display: block; font-size: 14px; color: #0b1f4d; }
.composer-editor-summary small { color: #6b7a95; font-size: 12px; }
.composer-summary-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.composer-meta {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.7fr); gap: 16px; align-items: start;
}

.composer-workspace {
  background: var(--surface, #fff); border: 1px solid var(--line, #e4ebf5); border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column; min-height: 620px;
}
.composer-workspace.is-sticky-shell {
  height: calc(100vh - 210px); min-height: 520px; max-height: calc(100vh - 160px);
}

.composer-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 10px 12px;
  border-bottom: 1px solid var(--line, #e4ebf5); background: linear-gradient(180deg, #fbfcfe, #f4f7fc);
  position: sticky; top: 0; z-index: 8; flex: none; box-shadow: 0 1px 0 rgba(20, 40, 80, .04);
}
.composer-toolbar .tb-group {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding-right: 8px; margin-right: 4px; border-right: 1px solid #dde5f2;
}
.composer-toolbar .tb-group:last-child { border-right: 0; padding-right: 0; margin-right: 0; }
.composer-toolbar .tb-group-actions { margin-left: auto; border-right: 0; gap: 6px; }

.composer-toolbar button,
.composer-toolbar label.tb-btn,
.composer-toolbar a.tb-action {
  appearance: none; border: 0; background: transparent; color: #3d4967; width: 34px; height: 34px;
  border-radius: 8px; display: inline-grid; place-items: center; cursor: pointer; font-size: 15px; line-height: 1; text-decoration: none;
}
.composer-toolbar .tb-action {
  width: auto; min-height: 34px; padding: 0 10px; gap: 6px; grid-auto-flow: column;
  font-family: Inter, system-ui, sans-serif; font-size: 12px; font-weight: 650;
  border: 1px solid #d5deee; background: #fff;
}
.composer-toolbar .tb-action-primary { background: #2f6fed; border-color: #2f6fed; color: #fff; }
.composer-toolbar .tb-action-primary:hover { background: #1f5fd6; color: #fff; }
.composer-toolbar button:hover,
.composer-toolbar label.tb-btn:hover,
.composer-toolbar a.tb-action:hover { background: #e8eef9; color: #1d2a44; }
.composer-toolbar button.is-active { background: #dce8ff; color: #1a4fb8; }
.composer-toolbar select.tb-select {
  height: 32px; border: 1px solid #d5deee; border-radius: 8px; background: #fff;
  padding: 0 8px; font-size: 12px; color: #3d4967; max-width: 128px;
}
.composer-toolbar select.tb-select-font {
  max-width: 168px;
  min-width: 140px;
}

/* Hover tooltips for icon toolbar controls — show below buttons */
.composer-toolbar [data-tip] {
  position: relative;
}
.composer-toolbar [data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  bottom: auto;
  transform: translateX(-50%) translateY(-4px);
  background: #152238;
  color: #fff;
  font-family: Inter, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  padding: 6px 8px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
  z-index: 30;
  box-shadow: 0 8px 20px rgba(10, 20, 40, .25);
}
.composer-toolbar [data-tip]::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% + 2px);
  bottom: auto;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: transparent;
  border-bottom-color: #152238;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 30;
}
.composer-toolbar [data-tip]:hover::after,
.composer-toolbar [data-tip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.composer-toolbar [data-tip]:hover::before,
.composer-toolbar [data-tip]:focus-visible::before {
  opacity: 1;
}
.composer-toolbar label.tb-btn { position: relative; }
.composer-toolbar label.tb-btn input[type="color"],
.composer-toolbar label.tb-btn input[type="file"] {
  position: absolute; opacity: 0; width: 100%; height: 100%; inset: 0; cursor: pointer;
}

.composer-canvas-wrap {
  flex: 1; background: #e9eef6; padding: 18px 12px 28px; overflow: auto; min-height: 0;
}
.composer-page {
  width: min(820px, 100%); margin: 0 auto; background: #fff; min-height: 720px; border-radius: 4px;
  box-shadow: 0 10px 40px rgba(20, 40, 80, .12); padding: clamp(22px, 4vw, 48px) clamp(18px, 4vw, 56px); outline: none;
}
.composer-page:focus { box-shadow: 0 10px 40px rgba(20, 40, 80, .14), 0 0 0 2px #c9dbff; }
.composer-page[data-placeholder]:empty::before {
  content: attr(data-placeholder); color: #9aa6ba; font-family: Inter, system-ui, sans-serif; font-size: 15px; pointer-events: none;
}

.composer-status {
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-top: 1px solid var(--line, #e4ebf5); background: #fafbfd; font-size: 12px; color: #6b7a95; flex: none;
}
.composer-status-left { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.composer-submit-bar {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  padding: 16px 18px; border: 1px solid #c9dbff; border-radius: 14px; background: linear-gradient(180deg, #f7faff, #eef4ff);
}
.composer-submit-bar strong { display: block; font-size: 14px; color: #0b1f4d; margin-bottom: 2px; }
.composer-submit-bar p { margin: 0; color: #5d6b86; font-size: 13px; }
.composer-submit-bar-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.composer-preview-frame {
  border: 1px solid var(--line, #e4ebf5); border-radius: 14px; background: #fff; padding: clamp(16px, 3vw, 28px);
}
.composer-modal-backdrop {
  position: fixed; inset: 0; background: rgba(12, 22, 44, .45); display: none;
  align-items: center; justify-content: center; z-index: 120; padding: 16px;
}
.composer-modal-backdrop.open { display: flex; }
.composer-modal {
  width: min(440px, 100%); background: #fff; border-radius: 14px; padding: 18px;
  box-shadow: 0 20px 60px rgba(10, 20, 40, .28);
}
.composer-modal h3 { margin: 0 0 8px; font-size: 16px; }
.composer-modal .field { margin-bottom: 12px; }
.composer-modal .form-actions { justify-content: flex-end; margin-top: 8px; }

/* Media selection / resize */
.casa-rich-doc .doc-figure,
.casa-rich-doc .doc-video { position: relative; max-width: 100%; }
.casa-rich-doc img { cursor: pointer; }
.casa-rich-doc .doc-video { cursor: pointer; }
.casa-rich-doc .doc-media-selected { outline: 2px solid #2f6fed; outline-offset: 2px; }
.casa-rich-doc .doc-video.doc-media-selected { overflow: visible; }
.casa-rich-doc .doc-resize-box { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.casa-rich-doc .doc-resize-handle {
  position: absolute; width: 10px; height: 10px; background: #fff; border: 2px solid #2f6fed;
  border-radius: 2px; pointer-events: auto; box-shadow: 0 1px 2px rgba(0,0,0,.15); z-index: 5;
}
.casa-rich-doc .doc-resize-handle.nw { left: -5px; top: -5px; cursor: nwse-resize; }
.casa-rich-doc .doc-resize-handle.ne { right: -5px; top: -5px; cursor: nesw-resize; }
.casa-rich-doc .doc-resize-handle.sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.casa-rich-doc .doc-resize-handle.se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.casa-rich-doc img.is-resized { width: var(--media-w, 100%); max-width: 100%; height: auto; }
.casa-rich-doc .doc-video.is-resized { width: var(--media-w, 100%); max-width: 100%; margin-left: auto; margin-right: auto; }

@media (max-width: 980px) {
  .composer-meta { grid-template-columns: 1fr; }
  .composer-workspace.is-sticky-shell { height: calc(100vh - 180px); }
}
@media (max-width: 720px) {
  .casa-rich-doc { font-size: 16px; line-height: 1.65; }
  .casa-rich-doc .doc-figure.align-left,
  .casa-rich-doc .doc-figure.align-right,
  .casa-rich-doc img.align-left,
  .casa-rich-doc img.align-right {
    float: none; display: block; max-width: 100%; margin: 1em auto;
  }
  .casa-rich-doc .doc-chart-bars { overflow-x: auto; padding-bottom: 4px; }
  .composer-step-divider { display: none; }
  .composer-toolbar .tb-action span { display: none; }
  .composer-toolbar .tb-group-actions { margin-left: 0; width: 100%; }
  .composer-workspace.is-sticky-shell { height: calc(100vh - 150px); max-height: none; }
  .composer-canvas-wrap { padding: 10px 6px 18px; }
  .composer-page { min-height: 520px; border-radius: 8px; }
  .composer-toolbar { padding: 8px; gap: 3px; }
  .composer-toolbar .tb-group { border-right: 0; padding-right: 0; margin-right: 0; }
  .composer-submit-bar-actions { width: 100%; }
  .composer-submit-bar-actions .button { flex: 1; }
}

/* Member article reader */
.news-article-page {
  width: min(860px, 100%);
  margin: 0 auto;
}

.news-article-top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.news-article-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #3d4967;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}

.news-article-back:hover { color: #2f6fed; }

.news-article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 10px;
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  color: #6b7a95;
}

.news-article-meta .news-tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #e8f0ff;
  color: #2f6fed;
}

.news-article-title {
  margin: 0 0 8px;
  font: var(--text-display, 800 28px/1.2 Inter, system-ui, sans-serif);
  color: #0b1f4d;
  letter-spacing: -0.02em;
}

.news-article-summary {
  margin: 0 0 18px;
  color: #5d6b86;
  font-family: Inter, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.news-article-hero {
  margin: 0 0 20px;
  border-radius: 16px;
  overflow: hidden;
}

.news-article-hero img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
}

.news-article-body-card {
  background: #fff;
  border: 1px solid #e4ebf5;
  border-radius: 18px;
  padding: clamp(16px, 3.5vw, 32px);
  box-shadow: 0 8px 24px rgba(24, 55, 110, .05);
}

.news-article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
