.ims-risk-results-list { list-style: none; margin: 0; padding: 0; }
.ims-risk-results-list li { padding: .35em 0; font-size: .9rem; }

/* Risk classification colors */
.ims-computed-status-unacceptable { background: #fbe0e0; color: #b3261e; }
.ims-computed-status-tolerable { background: #fdf3d0; color: #96741f; }
.ims-computed-status-acceptable { background: #e2f2e8; color: #2f6f4e; }

/* Opportunity classification colors */
.ims-computed-status-pursue { background: #e2f2e8; color: #2f6f4e; }
.ims-computed-status-pursue-limited { background: #fdf3d0; color: #96741f; }
.ims-computed-status-decline { background: #f1ece1; color: #7a7266; }

.ims-risk-only h4, .ims-opp-only h4 { margin: 1em 0 .5em; color: #6c2419; font-size: .95rem; }

/* ---- Front-end Register (list/table) view ---- */
.ims-register-filters {
	display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end;
	background: #faf7f2; border: 1px solid #c9beae; border-radius: 4px;
	padding: 1rem; margin-bottom: 1rem; font-family: Arial, Helvetica, sans-serif;
}
.ims-register-filters label { display: flex; flex-direction: column; font-size: .85rem; font-weight: 600; gap: .3em; }
.ims-register-filters select, .ims-register-filters input[type="search"] {
	font-size: .9rem; padding: .4em .5em; border: 1px solid #c9beae; border-radius: 3px; min-width: 160px;
}
.ims-register-count { font-family: Arial, Helvetica, sans-serif; color: #7a7266; font-size: .88rem; }

.ims-register-table-scroll { overflow-x: auto; }
.ims-register-table {
	width: 100%; border-collapse: collapse; font-family: Arial, Helvetica, sans-serif; font-size: .85rem;
}
.ims-register-table th, .ims-register-table td {
	border: 1px solid #c9beae; padding: .5em .6em; text-align: left; vertical-align: top;
}
.ims-register-table thead th { background: #f5e6a3; font-weight: 700; white-space: nowrap; }
.ims-register-table tbody tr:nth-child(even) { background: #faf7f2; }
.ims-register-table a { color: #6c2419; }

/* The plain-link color rule above has higher specificity (element + class)
 * than a bare .sopdoc-btn-view/.sopdoc-btn-edit/.ims-risk-edit-btn class
 * rule, so it was silently winning and turning the View/Edit icon links
 * back to dark maroon -- invisible against their navy background. This
 * matches its specificity (also element + class) so the icon buttons'
 * own white text/icon color wins instead. Delete uses a <button>, not an
 * <a>, so it was never affected by this in the first place. */
.ims-register-table a.sopdoc-btn,
.ims-register-table a.ims-risk-edit-btn {
	color: #fff;
}
.ims-register-table a.sopdoc-btn:hover,
.ims-register-table a.ims-risk-edit-btn:hover {
	color: #fff;
}

.ims-register-pagination { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; font-family: Arial, Helvetica, sans-serif; }
.ims-register-page-link {
	display: inline-block; padding: .4em .9em; border: 1px solid #c9beae; border-radius: 3px;
	text-decoration: none; color: #6c2419; font-size: .9rem; font-weight: 600; background: #faf7f2;
}
.ims-register-page-link:hover { background: #f2ecdd; }
.ims-register-page-link.is-disabled { color: #b8ae9c; background: #f5f2ec; cursor: default; }
.ims-register-page-status { font-size: .85rem; color: #7a7266; }

@media print {
	.ims-register-table-scroll { overflow: visible; }
	.ims-register-table { font-size: 9pt; }
}

/* ---- Key / legend ---- */
.ims-register-key {
	display: flex; gap: 1.25rem; list-style: none; margin: 0 0 .75rem; padding: .6rem 1rem;
	background: #faf7f2; border: 1px solid #c9beae; border-radius: 4px;
	font-family: Arial, Helvetica, sans-serif; font-size: .85rem; align-items: center;
}
.ims-key-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: .4em; vertical-align: middle; }
.ims-key-low { background: #4f9d6e; }
.ims-key-medium { background: #c9a63a; }
.ims-key-high { background: #b3261e; }

/* ---- Low/Medium/High traffic-light rating badges (register-specific) ---- */
.ims-risk-rating {
	display: inline-block; padding: .15em .55em; border-radius: 10px; font-size: .78rem; font-weight: 700; white-space: nowrap;
}
.ims-risk-rating-low { background: #e2f2e8; color: #1e5c3a; }
.ims-risk-rating-medium { background: #fbe9b0; color: #7a5c0c; }
.ims-risk-rating-high { background: #f6c8c4; color: #8c1c14; }

/* ---- Column visibility toggle ---- */
.ims-col-hidden { display: none !important; }

.ims-col-toggle-wrap { position: relative; display: inline-block; }
.ims-col-toggle-panel {
	position: absolute; top: 100%; left: 0; margin-top: .3rem; z-index: 10;
	background: #fff; border: 1px solid #c9beae; border-radius: 4px; padding: .75rem 1rem;
	box-shadow: 0 4px 12px rgba(0,0,0,.12); min-width: 220px;
	font-family: Arial, Helvetica, sans-serif; font-size: .85rem;
}
.ims-col-toggle-panel label { display: flex; align-items: center; gap: .5em; padding: .25em 0; font-weight: 400; }
.ims-col-toggle-panel[hidden] { display: none; }

@media print {
	/* Column resize widths don't translate to paper -- let everything
	   print at natural width and wrap normally. */
	.ims-register-table th, .ims-register-table td {
		width: auto !important; max-width: none !important;
		white-space: normal !important; background: #fff !important;
	}
	.ims-register-table thead th { background: #f5e6a3 !important; }
	.ims-col-hidden { display: table-cell !important; } /* show every column on paper even if hidden on screen */
}

/* ---- "View Details" / Edit icon buttons ----
 * Matches the same navy-blue-background, white-icon treatment used for
 * the equivalent View/Edit/Delete buttons in frontend.css (SOP, Audit),
 * so every module's register uses one consistent, high-contrast look
 * rather than each module having its own. #1b3a5c / #142c46 are the same
 * hex values as frontend.css's --sopdoc-navy / --sopdoc-navy-dark. */
.ims-risk-view-btn {
	border: none; background: #1b3a5c; color: #fff; border-radius: 4px;
	width: 32px; height: 32px; font-size: 1rem; cursor: pointer; line-height: 1;
	display: inline-flex; align-items: center; justify-content: center;
}
.ims-risk-view-btn:hover { background: #142c46; }

.ims-risk-edit-btn {
	border: none; background: #1b3a5c; border-radius: 4px;
	width: 32px; height: 32px; font-size: .95rem;
	cursor: pointer; margin-left: .3em; text-decoration: none; color: #fff;
	display: inline-flex; align-items: center; justify-content: center;
}
.ims-risk-edit-btn:hover { background: #142c46; color: #fff; }
.ims-risk-view-btn .sopdoc-icon-svg, .ims-risk-edit-btn .sopdoc-icon-svg { display: block; }

/* ---- Column resize handles ---- */
.ims-register-table th { position: relative; }
.ims-col-resize-handle {
	position: absolute; top: 0; right: 0; width: 6px; height: 100%;
	cursor: col-resize; user-select: none; z-index: 4;
}
.ims-col-resize-handle:hover, .ims-col-resize-handle.is-resizing { background: rgba(108, 36, 25, .35); }

.ims-risk-modal-overlay {
	position: fixed; inset: 0; background: rgba(20, 16, 10, .55);
	display: flex; align-items: flex-start; justify-content: center;
	z-index: 100000; padding: 3rem 1rem; overflow-y: auto;
}
/* Higher specificity than the bare class rule above, so [hidden] actually
   wins when JS sets/removes it -- without this the unconditional
   display:flex above overrides [hidden] and the modal never hides. */
.ims-risk-modal-overlay[hidden] {
	display: none;
}
.ims-risk-modal-box {
	background: #fff; max-width: 800px; width: 100%;
	border-radius: 6px; padding: 1.75rem 2rem; position: relative;
	font-family: Arial, Helvetica, sans-serif; max-height: 88vh; overflow-y: auto;
	transition: max-width .15s ease, max-height .15s ease;
}
/* Maximized: near-fullscreen, still leaving a hint of the overlay visible
   at the edges so it still reads as a modal rather than a full navigation. */
.ims-risk-modal-overlay.is-maximized {
	padding: 1rem;
}
.ims-risk-modal-overlay.is-maximized .ims-risk-modal-box {
	max-width: none; width: 96vw; max-height: 94vh;
}
.ims-risk-modal-close {
	position: absolute; top: .75rem; right: 1rem; border: none; background: none;
	font-size: 1.5rem; cursor: pointer; color: #7a7266; line-height: 1; z-index: 1;
}
.ims-risk-modal-maximize {
	position: absolute; top: .75rem; right: 2.75rem; border: none; background: none;
	font-size: 1.1rem; cursor: pointer; color: #7a7266; line-height: 1; z-index: 1;
}
.ims-risk-modal-maximize:hover, .ims-risk-modal-close:hover { color: #4a4438; }
.ims-risk-modal-view-full { text-align: right; margin: 0 0 .5rem; }
.ims-risk-modal-body .sopdoc-document { border: none; padding: 0; }

@media (max-width: 640px) {
	.ims-risk-modal-box { padding: 1.25rem; }
}

/* ---------------------------------------------------------------
 * Front-end Risk/Opportunity form: auto-computed 5x5 risk matrix
 * cards (Inherent + Residual) in the record sidebar. Colors reuse
 * the same green/amber/red bands as .ims-risk-rating-* above.
 * --------------------------------------------------------------- */

.imsrisk-side-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #7a7266; margin: .8em 0 .3em; }
.imsrisk-side-label:first-of-type { margin-top: 0; }
.imsrisk-matrix-box select,
.imsrisk-matrix-box input[type="date"] { width: 100%; font-family: inherit; font-size: .9rem; padding: .4em .5em; border: 1px solid #c9beae; border-radius: 4px; }

.ims-risk-matrix { border-collapse: collapse; width: 100%; margin-top: .5em; table-layout: fixed; }
.ims-risk-matrix th, .ims-risk-matrix td {
	width: 20%; text-align: center; padding: .4em 0; font-size: .82rem; border: 1px solid #fff;
}
.ims-risk-matrix thead th { background: transparent; color: #a1481f; font-weight: 700; }
.ims-risk-matrix tbody th { background: transparent; color: #a1481f; font-weight: 700; }
.ims-risk-matrix td { cursor: default; }
.ims-risk-matrix td.imsrisk-cell-acceptable   { background: #e2f2e8; color: #2f6f4e; }
.ims-risk-matrix td.imsrisk-cell-tolerable    { background: #fdf3d0; color: #96741f; }
.ims-risk-matrix td.imsrisk-cell-unacceptable { background: #fbe0e0; color: #b3261e; }
.ims-risk-matrix td.imsrisk-cell-pursue         { background: #e2f2e8; color: #2f6f4e; }
.ims-risk-matrix td.imsrisk-cell-pursue-limited { background: #fdf3d0; color: #96741f; }
.ims-risk-matrix td.imsrisk-cell-decline        { background: #f1ece1; color: #7a7266; }
.ims-risk-matrix td.is-selected { outline: 3px solid #2b241d; outline-offset: -3px; font-weight: 700; }

.imsrisk-matrix-caption { font-size: .74rem; color: #7a7266; margin: .6em 0 .2em; }
.imsrisk-matrix-score { font-size: .9rem; margin: 0; }
.imsrisk-matrix-score-value { color: #6c2419; }
