.rc-root {
  --rc-fix: #991b1b;       --rc-fix-bg: #fee2e2;
  --rc-feature: #065f46;   --rc-feature-bg: #d1fae5;
  --rc-change: #1e40af;    --rc-change-bg: #dbeafe;
  --rc-undefined: #475569; --rc-undefined-bg: #f1f5f9;
  --rc-accent: #6d28d9;    --rc-accent-bg: #ede9fe;
  --rc-problem: #ef4444;
  --rc-cause: #f59e0b;
  --rc-solution: #10b981;

  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #111827;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px;
}

.rc-with-sidebar { display: grid; grid-template-columns: 1fr 220px; gap: 22px; }
@media (max-width: 720px) { .rc-with-sidebar { grid-template-columns: 1fr; } }

.rc-hero { border-bottom: 1px solid #f1f5f9; padding-bottom: 10px; margin-bottom: 10px; }
.rc-eyebrow { color: #64748b; font-size: 12px; letter-spacing: .08em; font-weight: 600; text-transform: uppercase; }
.rc-title { font-size: 22px; font-weight: 700; margin: 4px 0 10px; line-height: 1.25; color: #0f172a; }
.rc-subtitle { color: #64748b; font-size: 13px; margin-bottom: 8px; }

.rc-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.rc-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.rc-badge-neutral { background: #f1f5f9; color: #334155; }
.rc-badge-fix { background: var(--rc-fix-bg); color: var(--rc-fix); }
.rc-badge-feature { background: var(--rc-feature-bg); color: var(--rc-feature); }
.rc-badge-change { background: var(--rc-change-bg); color: var(--rc-change); }
.rc-badge-undefined { background: var(--rc-undefined-bg); color: var(--rc-undefined); }
.rc-badge-accent { background: var(--rc-accent-bg); color: var(--rc-accent); }

.rc-section { margin: 14px 0; }
.rc-section-label { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.rc-section-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--rc-section-dot); }
.rc-section-body { background: #f8fafc; border-left: 3px solid var(--rc-section-dot); padding: 10px 14px; border-radius: 4px; font-size: 13px; line-height: 1.55; color: #334155; }
.rc-section-body code { background: #e2e8f0; padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px; }
.rc-section-body pre { background: #0f172a; color: #e2e8f0; padding: 10px 12px; border-radius: 4px; font-size: 12px; overflow-x: auto; }
.rc-plain { white-space: pre-wrap; margin: 0; font-family: inherit; }

.rc-autofmt-version { background: #f3f4f6; color: #374151; padding: 1px 6px; border-radius: 4px; font-family: ui-monospace, monospace; font-size: 0.92em; }
.rc-autofmt-ticket { color: #1e40af; text-decoration: none; border-bottom: 1px dashed currentColor; }

.rc-accent { background: linear-gradient(135deg, #f5f3ff 0%, #eff6ff 100%); border: 1px solid #ddd6fe; border-radius: 6px; padding: 12px 14px; margin: 14px 0; }
.rc-accent-label { color: var(--rc-accent); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.rc-accent-body { color: #3730a3; font-size: 13px; line-height: 1.6; }

.rc-remark { margin: 14px 0; border-left: 2px solid #cbd5e1; padding: 6px 10px; color: #475569; font-style: italic; font-size: 12.5px; }
.rc-remark-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; margin-bottom: 2px; }
.rc-remark-body > :first-child { margin-top: 0; }
.rc-remark-body > :last-child { margin-bottom: 0; }
.rc-remark-body p { margin: 0 0 6px; }
.rc-remark-body code { background: #e2e8f0; padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px; font-style: normal; }
.rc-remark-body strong { font-style: normal; color: #1e293b; }
.rc-remark-body a { color: #1e40af; text-decoration: underline; font-style: normal; }

.rc-empty-hints { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.rc-empty-hint { background: #fefce8; border: 1px dashed #eab308; color: #713f12; border-radius: 999px; padding: 4px 12px; font-size: 11px; cursor: pointer; }
.rc-empty-hint:hover { background: #fef9c3; }

.rc-sidebar { border-left: 1px solid #f1f5f9; padding-left: 16px; font-size: 12px; }
.rc-sb-row { margin-bottom: 10px; }
.rc-sb-label { color: #94a3b8; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.rc-sb-value { color: #334155; margin-top: 2px; }
.rc-sb-sub { color: #94a3b8; font-size: 11px; }
.rc-sb-section-title { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: #475569; margin: 14px 0 6px; }
.rc-sb-external { color: #1e40af; text-decoration: none; display: inline-flex; gap: 4px; align-items: center; }

.rc-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.rc-chip { background: #f1f5f9; border-radius: 4px; padding: 4px 8px; font-size: 11px; color: #334155; display: inline-flex; gap: 4px; align-items: center; }
.rc-chip-module { background: #dbeafe; color: #1e40af; }
.rc-chip-tag { background: #ede9fe; color: #5b21b6; }
.rc-chip-download { text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.rc-chip-download:hover { background: #e2e8f0; border-color: #cbd5e1; }

.rc-notes { list-style: none; padding: 0; margin: 0; }
.rc-note { background: #fefce8; border-left: 2px solid #eab308; padding: 6px 10px; font-size: 11px; border-radius: 3px; margin-bottom: 4px; color: #713f12; }
.rc-note-text > :first-child { margin-top: 0; }
.rc-note-text > :last-child { margin-bottom: 0; }
.rc-note-text p { margin: 0 0 4px; }
.rc-note-text code { background: #fde68a; padding: 1px 4px; border-radius: 3px; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 10px; }
.rc-note-text a { color: #b45309; text-decoration: underline; }
.rc-note-meta { color: #a16207; font-size: 10px; margin-top: 2px; }

.rc-ribbon {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px;
  margin: -14px -14px 10px -14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #fff;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  flex-wrap: wrap;
}
.rc-ribbon-warning { background: linear-gradient(90deg, #f59e0b, #d97706); }
.rc-ribbon-info    { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.rc-ribbon-icon    { font-size: 13px; }

.rc-structure-section { margin: 8px 0; }
.rc-structure-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid #e5e7eb; }
.rc-structure-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #374151; margin: 0; }
.rc-structure-count { font-size: 12px; color: #6b7280; }

.rc-col-list { display: flex; flex-direction: column; }
.rc-col-row { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; border-bottom: 1px solid #f3f4f6; }
.rc-col-row:last-child { border-bottom: none; }
.rc-col-icon { flex: 0 0 16px; text-align: center; font-size: 13px; }
.rc-col-icon-key       { color: #a16207; }
.rc-col-icon-meso      { color: #6366f1; }
.rc-col-icon-timestamp { color: #6b7280; }
.rc-col-content { flex: 1; min-width: 0; }
.rc-col-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rc-col-name { font-family: ui-monospace, SFMono-Regular, monospace; font-weight: 600; font-size: 13px; color: #111; }
.rc-col-type { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; color: #6b7280; }
.rc-col-desc {
  font-family: inherit;
  font-weight: 400;
  color: #6b7280;
  font-size: 12px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 40ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: 4px;
}

.rc-col-model {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  color: #9ca3af;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  margin-left: 2px;
  white-space: nowrap;
}
.rc-col-model-arrow { color: #cbd5e1; font-family: inherit; font-size: 12px; }
.rc-col-model-name { color: #6b7280; font-weight: 500; }
.rc-col-model-sep { color: #cbd5e1; }
.rc-col-model-type { color: #9ca3af; font-style: italic; }

.rc-flag { font-size: 10px; padding: 1px 5px; border-radius: 4px; font-weight: 600; }
.rc-flag-key  { background: #fef9c3; color: #a16207; }
.rc-flag-null { background: #fee2e2; color: #991b1b; }
.rc-flag-id   { background: #e0e7ff; color: #3730a3; }
.rc-flag-uq   { background: #dcfce7; color: #166534; }
.rc-flag-rv   { background: #ede9fe; color: #5b21b6; }

.rc-rel-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f3f4f6; }
.rc-rel-row:last-child { border-bottom: none; }
.rc-rel-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.rc-rel-status-implemented { background: #22c55e; }
.rc-rel-status-progress    { background: #f59e0b; }
.rc-rel-status-draft       { background: #9ca3af; }
.rc-rel-status-dropped     { background: #ef4444; }
.rc-rel-status-unknown     { background: #cbd5e1; }
.rc-rel-target { flex: 1; }
.rc-rel-name { font-family: ui-monospace, SFMono-Regular, monospace; font-weight: 600; font-size: 13px; color: #111; }
.rc-rel-arrow { color: #9ca3af; margin-right: 4px; }
.rc-rel-link { color: #1e40af; text-decoration: none; font-family: ui-monospace, SFMono-Regular, monospace; font-weight: 600; font-size: 13px; }
.rc-rel-link:hover { text-decoration: underline; color: #1e3a8a; }
.rc-rel-desc { color: #6b7280; font-weight: 400; font-family: inherit; font-size: 13px; margin-left: 6px; }
.rc-rel-sub { font-size: 11px; color: #6b7280; margin-top: 2px; display: flex; gap: 8px; align-items: center; }
.rc-rel-type { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #eef2ff; color: #3730a3; font-weight: 600; }
.rc-rel-meta { font-family: ui-monospace, SFMono-Regular, monospace; color: #6b7280; }

.rc-col-details { margin-top: 4px; }
.rc-col-details-summary { cursor: pointer; padding: 8px 0; font-size: 12px; color: #3b82f6; font-weight: 600; list-style: none; }
.rc-col-details-summary::-webkit-details-marker { display: none; }
.rc-col-details-summary::before { content: "▸ "; display: inline-block; transition: transform .15s; }
.rc-col-details[open] > .rc-col-details-summary::before { content: "▾ "; }
.rc-col-details-summary:hover { color: #2563eb; }

.rc-tabs { margin: 10px 0; }
.rc-tab-strip { display: flex; gap: 4px; border-bottom: 2px solid #e5e7eb; margin-bottom: 8px; }
.rc-tab-radio { position: absolute; opacity: 0; pointer-events: none; }
.rc-tab-label { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; cursor: pointer; font-size: 13px; font-weight: 600; color: #6b7280; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s; }
.rc-tab-label:hover { color: #374151; }
.rc-tab-count { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: #f3f4f6; color: #6b7280; font-weight: 600; }

/* Active tab: radio checked -> sibling label gets the active style */
.rc-tab-radio:checked + .rc-tab-label { color: #111827; border-bottom-color: #3b82f6; }
.rc-tab-radio:checked + .rc-tab-label .rc-tab-count { background: #dbeafe; color: #1e40af; }

/* Hide all panels by default, show the one matching the checked radio.
   We rely on :nth-of-type of the radios and panels being in matching order. */
.rc-tab-panel { display: none; }
/* Show panel corresponding to checked radio via sibling selectors within .rc-tabs. */
.rc-tabs:has(.rc-tab-radio:nth-of-type(1):checked) .rc-tab-panel[data-tab-index="0"] { display: block; }
.rc-tabs:has(.rc-tab-radio:nth-of-type(2):checked) .rc-tab-panel[data-tab-index="1"] { display: block; }
.rc-tabs:has(.rc-tab-radio:nth-of-type(3):checked) .rc-tab-panel[data-tab-index="2"] { display: block; }

.rc-structure-filter { margin: 4px 0 12px; }
.rc-filter-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  box-sizing: border-box;
  font-family: inherit;
  color: #111827;
  background: #fff;
}
.rc-filter-input::placeholder { color: #9ca3af; }
.rc-filter-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.rc-filtered-out { display: none !important; }

/* Remark disclosure: row becomes a <details> element */
.rc-col-row.rc-col-has-remark { display: block; padding: 0; border-bottom: 1px solid #f3f4f6; }
.rc-col-row-summary { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; cursor: pointer; list-style: none; }
.rc-col-row-summary::-webkit-details-marker { display: none; }

.rc-col-remark-icon {
  color: #eab308;
  font-size: 13px;
  margin-left: auto;
  padding-left: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.rc-col-row-summary:hover .rc-col-remark-icon { color: #ca8a04; }

.rc-col-remark-body {
  margin: 0 0 6px 28px;
  padding: 8px 12px;
  background: #fefce8;
  border-left: 3px solid #eab308;
  border-radius: 4px;
  font-size: 12px;
  color: #713f12;
  line-height: 1.5;
}
.rc-col-remark-body > :first-child { margin-top: 0; }
.rc-col-remark-body > :last-child { margin-bottom: 0; }
.rc-col-remark-body p { margin: 0 0 6px; }
.rc-col-remark-body code { background: #fde68a; padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; }
.rc-col-remark-body pre code { background: transparent; padding: 0; border-radius: 0; font-size: inherit; color: inherit; }
.rc-col-remark-body pre {
  background: #fffbeb;
  color: #451a03;
  border: 1px solid #fde68a;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  line-height: 1.45;
  overflow-x: auto;
}
.rc-col-remark-body a { color: #b45309; text-decoration: underline; }

/* --- Markdown Property Editor (Edit-Mode) --- */
.rc-mde { display: flex; flex-direction: column; gap: 6px; }
.rc-mde-memo {
  width: 100%;
  min-height: 120px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  color: #111827;
  background: #fff;
  box-sizing: border-box;
  resize: vertical;
}
.rc-mde-memo:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.rc-mde-memo:disabled,
.rc-mde-memo[readonly] {
  background: #f9fafb;
  color: #6b7280;
  cursor: not-allowed;
}
.rc-mde-preview-wrap { border: 1px solid #e5e7eb; border-radius: 4px; background: #f9fafb; }
.rc-mde-preview-toggle {
  cursor: pointer;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #3b82f6;
  list-style: none;
}
.rc-mde-preview-toggle::-webkit-details-marker { display: none; }
.rc-mde-preview-toggle::before { content: "▸ "; display: inline-block; }
.rc-mde-preview-wrap[open] .rc-mde-preview-toggle::before { content: "▾ "; }
.rc-mde-preview-toggle:hover { color: #2563eb; }
.rc-mde-preview {
  padding: 10px 14px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  font-size: 13px;
  line-height: 1.55;
  color: #334155;
}
.rc-mde-preview > :first-child { margin-top: 0; }
.rc-mde-preview > :last-child { margin-bottom: 0; }
.rc-mde-preview p { margin: 0 0 8px; }
.rc-mde-preview code { background: #e2e8f0; padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px; }
.rc-mde-preview pre { background: #0f172a; color: #e2e8f0; padding: 10px 12px; border-radius: 4px; font-size: 12px; overflow-x: auto; }
.rc-mde-preview a { color: #1e40af; text-decoration: underline; }
.rc-mde-preview-empty { color: #9ca3af; font-style: italic; font-size: 12px; padding: 4px 0; }
.rc-mde-hint { font-size: 11px; color: #9ca3af; }
.rc-mde-hint code { background: #f3f4f6; padding: 0 3px; border-radius: 2px; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 10px; }

/* === Notes Panel === */
.rc-notes-panel {
    margin-top: 1.5rem;
    border-top: 1px solid var(--rc-border, #e5e7eb);
    padding-top: 1rem;
}

.rc-notes-header {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    color: var(--rc-text-strong, #1f2937);
}

.rc-notes-empty-hint {
    font-style: italic;
    color: var(--rc-text-muted, #6b7280);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.rc-notes-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rc-note {
    background: var(--rc-note-bg, #f9fafb);
    border: 1px solid var(--rc-border, #e5e7eb);
    border-radius: 6px;
    padding: 0.75rem;
    position: relative;
}

.rc-note-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.rc-note:hover .rc-note-actions {
    opacity: 1;
}

.rc-note-edit, .rc-note-delete {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 0.25rem 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.rc-note-edit:hover, .rc-note-delete:hover {
    background: var(--rc-hover, #f3f4f6);
    border-color: var(--rc-border, #e5e7eb);
}

.rc-note-text {
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.rc-note-text > *:first-child { margin-top: 0; }
.rc-note-text > *:last-child { margin-bottom: 0; }

.rc-note-attachment-chip {
    display: inline-block;
    margin: 0.25rem 0;
    padding: 0.15rem 0.5rem;
    background: var(--rc-chip-bg, #eef2ff);
    border-radius: 999px;
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--rc-link, #4f46e5);
}

.rc-note-attachment-chip:hover { text-decoration: underline; }

.rc-note-meta {
    font-size: 0.75rem;
    color: var(--rc-text-muted, #6b7280);
    display: flex;
    gap: 0.25rem;
}

.rc-note-edit-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    justify-content: flex-end;
}

.rc-note-edit-save, .rc-notes-composer-submit {
    background: var(--rc-primary, #4f46e5);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.rc-note-edit-save:disabled, .rc-notes-composer-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rc-note-edit-cancel {
    background: transparent;
    border: 1px solid var(--rc-border, #e5e7eb);
    border-radius: 4px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.rc-notes-composer {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--rc-composer-bg, #fafafa);
    border: 1px solid var(--rc-border, #e5e7eb);
    border-radius: 6px;
}

.rc-notes-composer-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.rc-notes-error {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 4px;
    color: #b91c1c;
    font-size: 0.85rem;
}
