/* ===== Policies view (top-nav Policy) — policies.js =====
 * Only what the view adds. Tables, cards, badges, header band, breadcrumb and
 * the unverified / focus-icon styling all come from styles.css and bindnow.css
 * (.data-table, .ls-card, .status-badge, .policy-header, .lr-cell-unverified,
 * .lr-focus), so a policy reads like the rest of the workbench. */

/* The Policies views belong to the top nav, not the sidebar. */
.topnav-links a.active { background: rgba(255,255,255,0.16); color: #fff; }

.pol-list-header { display: flex; align-items: center; gap: 12px; }

/* Where the data came from. Snapshot is neutral; Live is the in-force green. */
.pol-source {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: #eef2f6; color: #415061; border: 1px solid #dde2e8;
}
.pol-source.is-live { background: #e6f7f2; color: #1a7a5a; border-color: #b3e6d4; }

/* Same left-edge-plus-tint idiom as .sm-next-action / pending loss-run rows. */
.pol-warning {
  border-left: 3px solid #cca300; background: #fdf8e8; color: #6b4e00;
  border-radius: 0 4px 4px 0; padding: 8px 12px; margin-bottom: 14px; font-size: 13px;
}

.pol-muted { color: #8a9bb0; font-style: italic; }
.pol-nowrap { white-space: nowrap; }
.pol-error { color: #b32525; font-style: normal; }
/* Errors read left to right with their diagnosis beneath, not centred. */
td.pol-error, .pol-message.pol-error { text-align: left; }
.pol-error .pol-message-text { font-weight: 500; }
.pol-error-detail {
  margin: 6px 0 0; padding: 8px 10px;
  background: #f8fafc; border: 1px solid #edf1f7; border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px; line-height: 1.5; font-style: normal; font-weight: 400;
  color: #4a5a6b; white-space: pre-wrap; overflow-wrap: anywhere;
}

/* A row of a LIVE list that fell back to the snapshot. */
.pol-status-cell { white-space: nowrap; }
.pol-row-snapshot {
  font-size: 10px; font-style: italic; color: #8a9bb0;
  border: 1px dashed #c5cdd8; border-radius: 3px; padding: 0 4px;
  vertical-align: middle; cursor: help;
}
.pol-badge-error { background: #fbeaea; color: #b32525; border: 1px solid #f0c9c9; }

.pol-list-table td { vertical-align: top; }
.pol-list-table .pol-policy-no { font-weight: 600; color: #1a3a5c; white-space: nowrap; }
.pol-list-table td .status-badge { white-space: nowrap; }

/* ---- Detail ---- */
.pol-header { margin-top: 10px; border-top: 1px solid #dde2e8; }
.pol-titlebar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.pol-title { font-size: 18px; font-weight: 600; color: #1a2a3a; margin-right: 4px; }
.pol-open-doc { margin-left: auto; }
.pol-header .policy-header-fields { align-items: flex-start; }

.pol-body { padding: 0 24px 32px; }
.pol-body > .pol-warning { margin-top: 14px; margin-bottom: 0; }
.pol-section-title { margin-top: 22px; }
.pol-message { padding: 20px 0; }

.pol-cards {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.pol-card-title { display: block; margin-bottom: 8px; }
.pol-card .pol-field {
  display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 12px;
  align-items: baseline; padding: 6px 0; border-top: 1px solid #f0f3f7;
}
.pol-card .pol-field:first-of-type { border-top: none; }
.pol-field-value { font-size: 13px; color: #1a2a3a; min-width: 0; overflow-wrap: break-word; }
.pol-empty { color: #8a9bb0; }

.pol-table-wrap { overflow-x: auto; }
.pol-table td { vertical-align: top; }
.pol-subtable + .pol-subtable,
.pol-cards + .pol-subtable { margin-top: 16px; }
.pol-subtable-title { font-size: 13px; font-weight: 700; color: #1a3a5c; margin-bottom: 8px; }
.pol-subtable-count { font-weight: 500; color: #6b7a8d; margin-left: 8px; font-size: 12px; }

/* Focus icons: revealed on row / field hover, like the Loss History table.
 * Same specificity as .lr-table tbody tr:hover .lr-focus. */
.pol-table tbody tr:hover .pol-focus,
.pol-field:hover .pol-focus { opacity: .85; }
