/* ══════════════════════════════════════════════════════════════════
   gov.css — "החלטות ממשלה" tab (Task D)
   All rules scoped under #tab-gov; every class prefixed gov-.
   RTL, Bootstrap 5 chrome to match the rest of the site.
   ══════════════════════════════════════════════════════════════════ */

#tab-gov { direction: rtl; }
#tab-gov .gov-wrap { max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; }

/* ── intro / hint ── */
#tab-gov .gov-hint {
  background: #eef3f7; border: 1px solid #d7e0e8; border-radius: 10px;
  padding: 12px 16px; color: #445; font-size: .9rem; margin-bottom: 18px;
}

/* ── toolbar (search + filters + sort) ── */
#tab-gov .gov-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 18px;
}
#tab-gov .gov-toolbar input[type="search"],
#tab-gov .gov-toolbar select {
  border: 1px solid #cdd6de; border-radius: 8px; padding: 9px 12px;
  font-family: inherit; font-size: .92rem; background: #fff; color: #2c3e50;
}
#tab-gov .gov-toolbar input[type="search"] { flex: 1 1 240px; min-width: 200px; }
#tab-gov .gov-search-btn {
  border: 0; border-radius: 8px; padding: 9px 20px; font-weight: 700;
  color: #fff; background: #2c5364; cursor: pointer; font-family: inherit;
}
#tab-gov .gov-search-btn:hover { background: #22424f; }

/* ── result count / status ── */
#tab-gov .gov-status { color: #6b7b88; font-size: .85rem; margin-bottom: 12px; }

/* ── decision cards (list) ── */
#tab-gov .gov-list { display: grid; gap: 14px; }
#tab-gov .gov-card {
  background: #fff; border: 1px solid #e2e8ee; border-radius: 12px;
  padding: 16px 18px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
  cursor: pointer; transition: box-shadow .15s, border-color .15s;
}
#tab-gov .gov-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.09); border-color: #b9c7d3; }
#tab-gov .gov-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
#tab-gov .gov-card-uid {
  font-weight: 700; color: #2c5364; font-size: .82rem;
  background: #eef3f7; border-radius: 6px; padding: 2px 8px; white-space: nowrap;
}
#tab-gov .gov-card-title { font-weight: 700; color: #223; font-size: 1.02rem; line-height: 1.4; margin: 2px 0 6px; }
#tab-gov .gov-card-meta { color: #6b7b88; font-size: .84rem; display: flex; flex-wrap: wrap; gap: 4px 14px; }
#tab-gov .gov-card-meta i { margin-inline-end: 4px; color: #93a3af; }

/* ── count chips ── */
#tab-gov .gov-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
#tab-gov .gov-chip {
  font-size: .76rem; font-weight: 700; border-radius: 20px; padding: 3px 10px;
  background: #f1f5f8; color: #47606f; border: 1px solid #e0e8ee;
}
#tab-gov .gov-chip.gov-chip-amend  { background: #fff3e6; color: #9a5b12; border-color: #f4dcc0; }
#tab-gov .gov-chip.gov-chip-amended{ background: #fdeaea; color: #9a2b2b; border-color: #f2cfcf; }

/* ── empty / error / loading states ── */
#tab-gov .gov-empty, #tab-gov .gov-loading {
  text-align: center; color: #7a8896; padding: 42px 20px;
}
#tab-gov .gov-empty i, #tab-gov .gov-loading i { font-size: 1.8rem; margin-bottom: 10px; display: block; color: #b6c2cc; }

/* ── pagination ── */
#tab-gov .gov-pager { display: flex; justify-content: center; gap: 8px; margin-top: 22px; }
#tab-gov .gov-pager button {
  border: 1px solid #cdd6de; background: #fff; border-radius: 8px; padding: 7px 16px;
  font-family: inherit; font-weight: 700; color: #2c5364; cursor: pointer;
}
#tab-gov .gov-pager button:disabled { opacity: .45; cursor: default; }

/* ══════════════ decision detail (in-tab panel) ══════════════ */
#tab-gov .gov-detail { background: #fff; border: 1px solid #e2e8ee; border-radius: 12px; }
#tab-gov .gov-detail-head {
  padding: 18px 20px; border-bottom: 1px solid #eef2f5;
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-start;
}
#tab-gov .gov-back {
  border: 0; background: none; color: #2c5364; font-weight: 700; cursor: pointer;
  font-family: inherit; padding: 0; font-size: .92rem;
}
#tab-gov .gov-back:hover { text-decoration: underline; }
#tab-gov .gov-detail-title { font-weight: 700; font-size: 1.25rem; color: #1f2d38; margin: 6px 0; flex-basis: 100%; }
#tab-gov .gov-detail-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: #556; font-size: .88rem; flex-basis: 100%; }
#tab-gov .gov-detail-meta i { color: #93a3af; margin-inline-end: 4px; }
#tab-gov .gov-source-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  color: #2c5364; font-weight: 700; font-size: .88rem; text-decoration: none;
}
#tab-gov .gov-source-link:hover { text-decoration: underline; }

#tab-gov .gov-detail-body { padding: 18px 20px; }

/* ── derived-list sections ── */
#tab-gov .gov-section { margin-bottom: 26px; }
#tab-gov .gov-section > h3 {
  font-size: 1.02rem; font-weight: 700; color: #2c5364; margin: 0 0 12px;
  padding-bottom: 6px; border-bottom: 2px solid #eef2f5;
  display: flex; align-items: center; gap: 8px;
}
#tab-gov .gov-section > h3 .gov-count-badge {
  font-size: .74rem; background: #eef3f7; color: #47606f; border-radius: 20px; padding: 1px 9px;
}
#tab-gov .gov-item {
  border: 1px solid #e8edf1; border-inline-start: 3px solid #cbd6de;
  border-radius: 8px; padding: 11px 14px; margin-bottom: 10px; background: #fbfcfd;
}
#tab-gov .gov-item-title { font-weight: 700; color: #2a3a45; font-size: .94rem; margin-bottom: 4px; }
#tab-gov .gov-item-fields { color: #556; font-size: .85rem; display: flex; flex-wrap: wrap; gap: 2px 16px; }
#tab-gov .gov-item-fields b { color: #33454f; font-weight: 700; }
#tab-gov .gov-quote {
  margin-top: 8px; padding: 8px 12px; background: #fff; border-radius: 6px;
  border-inline-start: 3px solid #d7c48a; color: #5a5030; font-size: .84rem; line-height: 1.55;
}
#tab-gov .gov-quote::before { content: "\201C"; }
#tab-gov .gov-quote::after  { content: "\201D"; }

/* ── human-verification badge + toggle (per block item / per version) ── */
#tab-gov .gov-verif-wrap {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 10px; padding-top: 9px; border-top: 1px dashed #e3e9ee;
}
#tab-gov .gov-verif {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 700; border-radius: 999px;
  padding: 3px 11px; white-space: nowrap; line-height: 1.4;
}
#tab-gov .gov-verif i { font-size: .82em; }
#tab-gov .gov-verif.is-model    { background: #eef2f5; color: #5b6b77; border: 1px solid #dde5eb; }
#tab-gov .gov-verif.is-verified { background: #e7f6ec; color: #1a7f37; border: 1px solid #b7e2c4; }
#tab-gov .gov-verif-by { font-weight: 500; opacity: .85; }
#tab-gov .gov-verify-toggle {
  font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer;
  background: #fff; color: #2f6fed; border: 1px solid #cdd9ea;
  border-radius: 6px; padding: 3px 11px; transition: background .12s, border-color .12s;
}
#tab-gov .gov-verify-toggle:hover { background: #f2f6fd; border-color: #2f6fed; }
#tab-gov .gov-verify-toggle:disabled { opacity: .55; cursor: default; }
/* on a verified unit the toggle is a "remove verification" affordance */
#tab-gov .gov-verif.is-verified ~ .gov-verify-toggle { color: #a15; border-color: #e6c4cd; }
#tab-gov .gov-verif.is-verified ~ .gov-verify-toggle:hover { background: #fdf2f5; border-color: #a15; }
/* version-level badge sits above the text, aligned right */
#tab-gov .gov-ver-body > .gov-verif-wrap { margin-top: 0; margin-bottom: 12px; border-top: 0; padding-top: 0; }

/* "בוצע ידנית" badge — amber, distinct from model/verified */
#tab-gov .gov-verif.is-edited { background: #fef3e2; color: #a15c07; border: 1px solid #f3d9a8; }

/* ── manual-edit mode ── */
#tab-gov .gov-edit-mode-btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit;
  font-size: .82rem; font-weight: 700; cursor: pointer;
  background: #fff; color: #a15c07; border: 1px solid #f0cf97;
  border-radius: 7px; padding: 5px 12px; transition: background .12s, border-color .12s;
}
#tab-gov .gov-edit-mode-btn:hover { background: #fef7ee; border-color: #a15c07; }
#tab-gov .gov-edit-mode-btn.is-on { background: #a15c07; color: #fff; border-color: #a15c07; }

/* per-unit edit/delete action buttons (inside the verif-wrap) */
#tab-gov .gov-edit-btn, #tab-gov .gov-del-btn, #tab-gov .gov-ver-edit-btn {
  display: inline-flex; align-items: center; gap: 5px; font: inherit;
  font-size: .78rem; font-weight: 700; cursor: pointer; border-radius: 6px;
  padding: 3px 11px; background: #fff; transition: background .12s, border-color .12s;
}
#tab-gov .gov-edit-btn, #tab-gov .gov-ver-edit-btn { color: #a15c07; border: 1px solid #f0cf97; }
#tab-gov .gov-edit-btn:hover, #tab-gov .gov-ver-edit-btn:hover { background: #fef7ee; border-color: #a15c07; }
#tab-gov .gov-del-btn { color: #b42318; border: 1px solid #e6c4cd; }
#tab-gov .gov-del-btn:hover { background: #fdf2f5; border-color: #b42318; }
#tab-gov .gov-edit-btn:disabled, #tab-gov .gov-del-btn:disabled,
#tab-gov .gov-ver-edit-btn:disabled { opacity: .55; cursor: default; }

/* inline edit form (block item + version) */
#tab-gov .gov-item-edit, #tab-gov .gov-ver-edit { display: flex; flex-direction: column; gap: 10px; }
#tab-gov .gov-edit-field { display: flex; flex-direction: column; gap: 3px; }
#tab-gov .gov-edit-field label { font-size: .8rem; font-weight: 700; color: #33454f; }
#tab-gov .gov-edit-field label small { font-weight: 500; color: #8a97a2; }
#tab-gov .gov-edit-input, #tab-gov .gov-ver-edit-text {
  font: inherit; font-size: .88rem; color: #2a3a45; background: #fff;
  border: 1px solid #cbd6de; border-radius: 6px; padding: 7px 10px; width: 100%;
}
#tab-gov .gov-edit-input:focus, #tab-gov .gov-ver-edit-text:focus {
  outline: none; border-color: #2f6fed; box-shadow: 0 0 0 2px rgba(47,111,237,.12);
}
#tab-gov .gov-edit-input[data-vkey], #tab-gov textarea.gov-edit-input { resize: vertical; }
#tab-gov .gov-ver-edit-text { min-height: 320px; line-height: 1.7; resize: vertical; }
#tab-gov .gov-edit-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
#tab-gov .gov-item-save, #tab-gov .gov-ver-save {
  display: inline-flex; align-items: center; gap: 6px; font: inherit;
  font-size: .82rem; font-weight: 700; cursor: pointer; border: 0; border-radius: 6px;
  padding: 6px 16px; background: #1a7f37; color: #fff;
}
#tab-gov .gov-item-save:hover, #tab-gov .gov-ver-save:hover { background: #156a2e; }
#tab-gov .gov-item-cancel, #tab-gov .gov-ver-cancel, #tab-gov .gov-ver-revert {
  font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer;
  background: #fff; color: #47606f; border: 1px solid #cbd6de; border-radius: 6px; padding: 6px 14px;
}
#tab-gov .gov-ver-revert { color: #a15c07; border-color: #f0cf97; margin-inline-start: auto; }
#tab-gov .gov-item-save:disabled, #tab-gov .gov-ver-save:disabled { opacity: .6; cursor: default; }

/* ── amendment link rows ── */
#tab-gov .gov-amend-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  border: 1px solid #e8edf1; border-radius: 8px; padding: 10px 14px; margin-bottom: 9px; background: #fbfcfd;
}
#tab-gov .gov-amend-action {
  font-size: .74rem; font-weight: 700; border-radius: 6px; padding: 2px 9px;
  background: #eef3f7; color: #47606f; white-space: nowrap;
}
#tab-gov .gov-amend-action.gov-act-revoke { background: #fdeaea; color: #9a2b2b; }
#tab-gov .gov-amend-target {
  font-weight: 700; color: #2c5364; cursor: pointer; background: none; border: 0; font-family: inherit; padding: 0;
}
#tab-gov .gov-amend-target:hover { text-decoration: underline; }
#tab-gov .gov-amend-target.gov-unresolved { color: #8a97a2; cursor: default; }
#tab-gov .gov-amend-target.gov-unresolved:hover { text-decoration: none; }
#tab-gov .gov-amend-date { color: #7a8896; font-size: .82rem; }
#tab-gov .gov-amend-reprocess-btn {
  display: inline-flex; align-items: center; gap: 5px; font: inherit;
  font-size: .76rem; font-weight: 700; cursor: pointer; border-radius: 6px;
  padding: 3px 11px; background: #fff; color: #6b3fa0; border: 1px solid #dccaf0;
  margin-inline-start: auto; transition: background .12s, border-color .12s;
}
#tab-gov .gov-amend-reprocess-btn:hover { background: #f7f2fd; border-color: #8250df; }

/* ── manual resend to the language model ── */
#tab-gov .gov-reprocess-btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit;
  font-size: .82rem; font-weight: 700; cursor: pointer;
  background: #fff; color: #6b3fa0; border: 1px solid #dccaf0;
  border-radius: 7px; padding: 5px 12px; transition: background .12s, border-color .12s;
}
#tab-gov .gov-reprocess-btn:hover { background: #f7f2fd; border-color: #8250df; }

#tab-gov .gov-item-initiated { border-inline-start: 3px solid #b794e8; background: #faf7fe; }

/* resend model-picker dialog */
.gov-rp-overlay {
  position: fixed; inset: 0; z-index: 2200; background: rgba(20, 28, 36, .48);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.gov-rp-dialog {
  background: #fff; border-radius: 12px; width: min(440px, 100%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .28); padding: 22px 22px 18px;
  direction: rtl; text-align: right; font-family: inherit;
}
.gov-rp-title { font-size: 1.05rem; font-weight: 800; color: #22303a; margin-bottom: 8px; }
.gov-rp-note { font-size: .88rem; line-height: 1.55; color: #51616d; margin-bottom: 16px; }
.gov-rp-choices { display: flex; flex-direction: column; gap: 9px; }
.gov-rp-choice {
  display: inline-flex; align-items: center; gap: 8px; font: inherit;
  font-size: .92rem; font-weight: 700; cursor: pointer; color: #4a2c78;
  background: #f7f2fd; border: 1px solid #dccaf0; border-radius: 8px;
  padding: 11px 14px; transition: background .12s, border-color .12s;
}
.gov-rp-choice:hover { background: #efe6fb; border-color: #8250df; }
.gov-rp-choice:disabled { opacity: .5; cursor: default; color: #8a97a2; background: #f4f6f8; border-color: #e2e8ee; }
.gov-rp-na { font-weight: 500; font-size: .82rem; }
.gov-rp-foot { display: flex; justify-content: flex-start; margin-top: 16px; }
.gov-rp-cancel {
  font: inherit; font-size: .86rem; font-weight: 700; cursor: pointer;
  background: #fff; color: #47606f; border: 1px solid #cbd6de; border-radius: 7px; padding: 7px 18px;
}
.gov-rp-cancel:hover { background: #f4f6f8; }

/* ── regex citation-reference rows (מאוזכרות / מאזכרות) ── */
#tab-gov .gov-ref-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  border: 1px solid #e8edf1; border-radius: 8px; padding: 10px 14px; margin-bottom: 9px; background: #fbfcfd;
}
#tab-gov .gov-ref-target {
  font-weight: 700; color: #2c5364; cursor: pointer; background: none; border: 0; font-family: inherit; padding: 0;
}
#tab-gov .gov-ref-target:hover { text-decoration: underline; }
#tab-gov .gov-ref-target.gov-unresolved { color: #8a97a2; cursor: default; }
#tab-gov .gov-ref-target.gov-unresolved:hover { text-decoration: none; }
#tab-gov .gov-ref-context { color: #6b7885; font-size: .82rem; }

/* ── versions placeholder (shown when no layered versions exist) ── */
#tab-gov .gov-versions-box {
  border: 1px dashed #c6d2db; border-radius: 10px; padding: 18px 20px;
  background: #f7fafc; color: #5b6b78; text-align: center;
}
#tab-gov .gov-versions-box i { font-size: 1.4rem; display: block; margin-bottom: 8px; color: #a9b7c1; }

/* ══════════════ versions: track-changes + switcher (Task F) ══════════════ */
#tab-gov .gov-versions { direction: rtl; }

/* mode toggle (עקוב / נוסח נקי) */
#tab-gov .gov-ver-modes {
  display: inline-flex; gap: 0; margin-bottom: 12px;
  border: 1px solid #cdd6de; border-radius: 8px; overflow: hidden; background: #fff;
}
#tab-gov .gov-ver-mode {
  border: 0; background: #fff; color: #47606f; font-family: inherit;
  font-weight: 700; font-size: .84rem; padding: 7px 16px; cursor: pointer;
}
#tab-gov .gov-ver-mode + .gov-ver-mode { border-inline-start: 1px solid #e0e8ee; }
#tab-gov .gov-ver-mode:hover { background: #f1f5f8; }
#tab-gov .gov-ver-mode.is-on { background: #2c5364; color: #fff; }

/* version switcher chips */
#tab-gov .gov-ver-bar { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
#tab-gov .gov-ver-chip {
  border: 1px solid #cdd6de; background: #fff; color: #2c5364; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: .8rem; border-radius: 20px;
  padding: 5px 13px; transition: background .15s, border-color .15s;
}
#tab-gov .gov-ver-chip:hover { background: #eef3f7; border-color: #b9c7d3; }
#tab-gov .gov-ver-chip.is-on { background: #2c5364; color: #fff; border-color: #2c5364; }
#tab-gov .gov-ver-chip.gov-ver-chip-review { border-color: #e6c15a; }
#tab-gov .gov-ver-chip.gov-ver-chip-review::after { content: " \26A0"; font-size: .78rem; }
#tab-gov .gov-ver-chip.gov-ver-chip-revoked { border-color: #e0a3a3; }
#tab-gov .gov-ver-chip.gov-ver-chip-revoked.is-on { background: #9a2b2b; border-color: #9a2b2b; }

/* version body */
#tab-gov .gov-ver-body { margin-top: 6px; }
#tab-gov .gov-ver-text {
  background: #fff; border: 1px solid #e8edf1; border-radius: 8px;
  padding: 14px 16px; color: #263038; font-size: .92rem; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
  direction: rtl; text-align: start;
}

/* track-changes marks (Word conventions). unicode-bidi:isolate keeps each mark
   from disturbing the bidirectional ordering of the surrounding Hebrew, and
   dir="auto" gives number-/Latin-only marks the right internal direction. */
#tab-gov .gov-ver-text .gov-del,
#tab-gov .gov-ver-text .gov-ins {
  unicode-bidi: isolate;
}
#tab-gov .gov-del {
  color: #b3261e; text-decoration: line-through;
  text-decoration-thickness: 1.5px; background: #fdecec; border-radius: 3px;
}
#tab-gov .gov-ins {
  color: #1565c0; text-decoration: underline;
  text-decoration-thickness: 1.5px; background: #e8f1fc; border-radius: 3px;
}
#tab-gov .gov-ver-orphan {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed #e0e8ee;
  color: #6b7b88; font-size: .84rem;
}

/* banners (revoke / needs_review) */
#tab-gov .gov-ver-banner {
  border-radius: 8px; padding: 11px 14px; margin-bottom: 12px;
  font-weight: 700; font-size: .9rem; display: flex; align-items: center; gap: 8px;
}
#tab-gov .gov-ver-banner i { font-size: 1rem; }
#tab-gov .gov-ver-banner-revoke { background: #fdeaea; color: #9a2b2b; border: 1px solid #f2cfcf; }
#tab-gov .gov-ver-banner-review { background: #fff6e5; color: #8a5b12; border: 1px solid #f2e0b8; }

/* per-version footnote + instruction source */
#tab-gov .gov-ver-foot, #tab-gov .gov-ver-src {
  margin-top: 12px; color: #556; font-size: .84rem; line-height: 1.6;
}
#tab-gov .gov-ver-foot i { color: #93a3af; margin-inline-end: 4px; }
#tab-gov .gov-ver-foot .gov-quote, #tab-gov .gov-ver-banner-review + .gov-quote {
  margin-top: 8px;
}

/* inline link to an amending decision (reuses the tab's uid-navigation) */
#tab-gov .gov-ver-link {
  border: 0; background: none; padding: 0; font-family: inherit;
  font-weight: 700; color: #2c5364; cursor: pointer; text-decoration: underline;
}
#tab-gov .gov-ver-link:hover { color: #22424f; }

/* ── per-decision permalink (?tab=gov&decision=<uid>) ── */
#tab-gov .gov-card-head { display: flex; align-items: flex-start; gap: 8px; }
#tab-gov .gov-card-head .gov-card-title { flex: 1 1 auto; }
#tab-gov .gov-card-link {
  flex: 0 0 auto; color: #93a3af; font-size: .8rem; text-decoration: none;
  padding: 2px 6px; border-radius: 6px; line-height: 1.6;
}
#tab-gov .gov-card-link:hover { color: #2c5364; background: #eef3f7; }
#tab-gov .gov-permalink {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  margin-inline-start: 14px; padding: 0; border: 0; background: none;
  color: #2c5364; font-weight: 700; font-size: .88rem; cursor: pointer;
}
#tab-gov .gov-permalink:hover { text-decoration: underline; }
#tab-gov .gov-feedback {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  margin-inline-start: 14px; color: #2c5364; font-weight: 700; font-size: .88rem;
  text-decoration: none;
}
#tab-gov .gov-feedback:hover { text-decoration: underline; }
#tab-gov .gov-card-feedback:hover { color: #2c5364; background: #eef3f7; }

/* ── the decision's own נוסח ── */
#tab-gov .gov-decision-text {
  white-space: pre-wrap; unicode-bidi: isolate;
  border: 1px solid #e8edf1; border-inline-start: 3px solid #cbd6de;
  border-radius: 8px; padding: 14px 16px; background: #fbfcfd;
  color: #33454f; font-size: .9rem; line-height: 1.75;
  max-height: 460px; overflow-y: auto;
}

/* ══════════════ sub-tabs (החלטות ⇄ אודות המערכת) ══════════════ */
#tab-gov .gov-subtabs {
  display: flex; gap: 6px; margin-bottom: 18px;
  border-bottom: 1px solid #e2e8ee;
}
#tab-gov .gov-subtab {
  border: 0; background: none; font-family: inherit; cursor: pointer;
  font-weight: 700; font-size: .95rem; color: #6b7b88;
  padding: 10px 18px; border-bottom: 3px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 7px;
}
#tab-gov .gov-subtab i { color: #a9b7c1; }
#tab-gov .gov-subtab:hover { color: #2c5364; }
#tab-gov .gov-subtab.is-on { color: #2c5364; border-bottom-color: #2c5364; }
#tab-gov .gov-subtab.is-on i { color: #2c5364; }

/* ══════════════ about / documentation page ══════════════ */
#tab-gov .gov-about { color: #33454f; }
#tab-gov .gov-about-permalink { margin: 0 0 18px; }
#tab-gov .gov-about-sec { margin-bottom: 34px; }
#tab-gov .gov-about-sec > h2 {
  font-size: 1.18rem; font-weight: 700; color: #1f2d38; margin: 0 0 12px;
  padding-bottom: 8px; border-bottom: 2px solid #eef2f5;
  display: flex; align-items: center; gap: 9px;
}
#tab-gov .gov-about-sec > h2 i { color: #2c5364; font-size: 1.05rem; }
#tab-gov .gov-about-sec > h3 {
  font-size: 1rem; font-weight: 700; color: #2c5364; margin: 20px 0 8px;
}
#tab-gov .gov-about-sec p { font-size: .93rem; line-height: 1.8; margin: 0 0 12px; }
#tab-gov .gov-about-sub { color: #556; font-size: .88rem !important; }
#tab-gov .gov-about-note {
  background: #eef3f7; border: 1px solid #d7e0e8; border-radius: 10px;
  padding: 11px 15px; color: #445; font-size: .86rem; line-height: 1.65; margin-top: 14px;
}
#tab-gov .gov-mono {
  font-family: ui-monospace, "SFMono-Regular", "Consolas", monospace;
  font-size: .86em; background: #eef2f5; border: 1px solid #e0e8ee;
  border-radius: 5px; padding: 1px 6px; color: #2c5364; direction: ltr;
  unicode-bidi: isolate; white-space: nowrap;
}

/* ── flow diagram (vertical, RTL-safe HTML boxes) ── */
#tab-gov .gov-flow {
  display: flex; flex-direction: column; align-items: stretch;
  max-width: 560px; margin: 6px auto 0;
}
#tab-gov .gov-flow-step {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border: 1px solid #e2e8ee; border-inline-start: 4px solid #2c5364;
  border-radius: 10px; padding: 13px 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
#tab-gov .gov-flow-ico {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  background: #eef3f7; color: #2c5364; display: flex; align-items: center;
  justify-content: center; font-size: 1.05rem;
}
#tab-gov .gov-flow-txt { display: flex; flex-direction: column; gap: 2px; }
#tab-gov .gov-flow-txt b { color: #223; font-size: .96rem; font-weight: 700; }
#tab-gov .gov-flow-txt span { color: #6b7b88; font-size: .83rem; line-height: 1.5; }
#tab-gov .gov-flow-arrow { text-align: center; color: #b6c2cc; font-size: 1rem; padding: 4px 0; }

/* ── auth cards (SSO vs service token) ── */
#tab-gov .gov-auth-cards {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0;
}
#tab-gov .gov-auth-card {
  border: 1px solid #e2e8ee; border-radius: 12px; padding: 15px 17px; background: #fbfcfd;
}
#tab-gov .gov-auth-h {
  font-weight: 700; color: #2c5364; font-size: .98rem; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
#tab-gov .gov-auth-card p { font-size: .87rem !important; line-height: 1.7; margin: 0; color: #47606f; }
@media (max-width: 640px) { #tab-gov .gov-auth-cards { grid-template-columns: 1fr; } }

/* ── endpoint / tool tables ── */
#tab-gov .gov-api-tablewrap { overflow-x: auto; margin: 6px 0 4px; }
#tab-gov .gov-api-table { width: 100%; border-collapse: collapse; font-size: .87rem; }
#tab-gov .gov-api-table th {
  text-align: start; font-weight: 700; color: #6b7b88; font-size: .8rem;
  padding: 8px 10px; border-bottom: 2px solid #eef2f5; white-space: nowrap;
}
#tab-gov .gov-api-table td {
  padding: 9px 10px; border-bottom: 1px solid #eef2f5; vertical-align: top; color: #47606f;
}
#tab-gov .gov-api-table tr:last-child td { border-bottom: 0; }
#tab-gov .gov-verb {
  font-family: ui-monospace, "Consolas", monospace; font-size: .78rem; font-weight: 700;
  background: #e8f1fc; color: #1565c0; border-radius: 5px; padding: 2px 8px; white-space: nowrap;
}
#tab-gov .gov-tool-tag {
  font-size: .76rem; font-weight: 700; background: #eef3f7; color: #47606f;
  border-radius: 5px; padding: 2px 9px; white-space: nowrap;
}

/* ── code blocks (prompt + schema) ── */
#tab-gov .gov-code-block {
  border: 1px solid #e2e8ee; border-radius: 10px; overflow: hidden;
  background: #fbfcfd; margin: 12px 0;
}
#tab-gov .gov-code-cap {
  background: #eef2f5; color: #47606f; font-weight: 700; font-size: .82rem;
  padding: 7px 14px; border-bottom: 1px solid #e2e8ee;
}
#tab-gov .gov-code-block pre {
  margin: 0; padding: 14px 16px; font-size: .86rem; line-height: 1.7;
  color: #33454f; white-space: pre-wrap; word-break: break-word;
  max-height: 520px; overflow-y: auto;
  font-family: ui-monospace, "SFMono-Regular", "Consolas", monospace;
}
#tab-gov .gov-code-block pre[dir="ltr"] { text-align: left; }

/* ── about: quality-controls list ── */
#tab-gov .gov-about-list { margin: 10px 0 0; padding-inline-start: 22px; }
#tab-gov .gov-about-list li { margin-bottom: 9px; line-height: 1.75; color: #33454f; font-size: .92rem; }
#tab-gov .gov-about-list li b { color: #2c5364; }

/* ══════════════════════════════════════════════════════════════════
   DECISION PAGE — two-box layout (layered text + tabbed data)
   Box 1: the layered decision text (default view) with the version list
   as a side rail. Box 2: the derived data lists, one tab each. Every tab
   configuration is a shareable URL (see gov.js GP.ver / GP.mode / GP.panel).
   ══════════════════════════════════════════════════════════════════ */
#tab-gov .gov-box {
  border: 1px solid #e2e8ee; border-radius: 12px; background: #fff;
  padding: 16px 18px; margin-bottom: 20px;
}
#tab-gov .gov-box-primary {
  background: #fbfdff; border-color: #d8e2ec; box-shadow: 0 1px 3px rgba(20,50,80,.05);
}
#tab-gov .gov-box-title {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
  font-size: 1.05rem; font-weight: 700; color: #2c5364;
  padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2px solid #eef2f5;
}
#tab-gov .gov-box-title i { color: #7f97a8; }
#tab-gov .gov-box-sub { font-size: .8rem; font-weight: 600; color: #7a8896; }

/* box 1 — version rail sits BESIDE the layered text (stacks on narrow screens) */
#tab-gov .gov-ver-layout { display: flex; gap: 18px; align-items: flex-start; }
#tab-gov .gov-ver-rail { flex: 0 0 240px; min-width: 0; }
#tab-gov .gov-ver-rail-title { font-size: .82rem; font-weight: 700; color: #6b7b88; margin-bottom: 8px; }
#tab-gov .gov-ver-rail-title i { color: #93a3af; margin-inline-end: 4px; }
#tab-gov .gov-ver-main { flex: 1 1 auto; min-width: 0; }
/* the switcher chips become a vertical list inside the rail */
#tab-gov .gov-ver-rail .gov-ver-bar { flex-direction: column; flex-wrap: nowrap; gap: 6px; margin-bottom: 0; }
#tab-gov .gov-ver-rail .gov-ver-chip {
  width: 100%; text-align: start; border-radius: 8px; white-space: normal; line-height: 1.4;
}
@media (max-width: 760px) {
  #tab-gov .gov-ver-layout { flex-direction: column; }
  #tab-gov .gov-ver-rail { flex-basis: auto; width: 100%; }
  #tab-gov .gov-ver-rail .gov-ver-bar { flex-direction: row; flex-wrap: wrap; }
  #tab-gov .gov-ver-rail .gov-ver-chip { width: auto; }
}

/* per-version source header — prominent, top of an amended version */
#tab-gov .gov-ver-source {
  background: #eef4f8; border: 1px solid #d5e2ec; border-inline-start: 3px solid #2c5364;
  border-radius: 8px; padding: 10px 13px; margin-bottom: 12px;
}
#tab-gov .gov-ver-source-main { color: #2c4656; font-weight: 700; font-size: .88rem; line-height: 1.6; }
#tab-gov .gov-ver-source-main i { color: #5c7a8c; margin-inline-end: 3px; }
#tab-gov .gov-ver-source .gov-quote { margin-top: 8px; }

/* plain-text fallback when a decision has no layered versions yet */
#tab-gov .gov-decision-text {
  background: #fff; border: 1px solid #e8edf1; border-radius: 8px;
  padding: 14px 16px; color: #263038; font-size: .92rem; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word; direction: rtl; text-align: start;
}

/* box 2 — data-tab strip */
#tab-gov .gov-panel-tabs {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px;
  border-bottom: 1px solid #eef2f5;
}
#tab-gov .gov-panel-tab {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: 1px solid transparent; border-bottom: 0; background: none;
  font-family: inherit; font-weight: 700; font-size: .86rem; color: #5b6b78;
  padding: 8px 14px; border-radius: 8px 8px 0 0; margin-bottom: -1px;
}
#tab-gov .gov-panel-tab i { color: #9aa9b4; }
#tab-gov .gov-panel-tab:hover { background: #f1f5f8; color: #2c5364; }
#tab-gov .gov-panel-tab.is-on {
  color: #2c5364; background: #fff; border-color: #e2e8ee #e2e8ee #fff;
}
#tab-gov .gov-panel-tab.is-on i { color: #2c5364; }
#tab-gov .gov-panel-tab.is-empty { color: #9aa9b4; }
#tab-gov .gov-panel-count {
  font-size: .72rem; font-weight: 700; border-radius: 20px; padding: 1px 8px;
  background: #eef3f7; color: #47606f; min-width: 20px; text-align: center;
}
#tab-gov .gov-panel-tab.is-empty .gov-panel-count { background: #f2f4f6; color: #a7b2bb; }
#tab-gov .gov-panel-tab.is-on .gov-panel-count { background: #2c5364; color: #fff; }
#tab-gov .gov-panel-body { min-height: 56px; }
#tab-gov .gov-panel-body .gov-section:last-child { margin-bottom: 0; }
#tab-gov .gov-item-empty { color: #8a97a2; text-align: center; background: #fbfcfd; }

/* ── clickable counterpart title in amendment rows + instructions tab ── */
#tab-gov .gov-amend-sub {
  font-weight: 400; color: #7d8b96; font-size: .8em; margin-inline-start: 6px; white-space: nowrap;
}
#tab-gov .gov-inline-link {
  display: inline; padding: 0; border: 0; background: none; cursor: pointer;
  color: #2c5364; font-weight: 700; font-size: inherit; text-align: inherit;
}
#tab-gov .gov-inline-link:hover { text-decoration: underline; }
