:root{
  --content-max: 1520px;
  --label-col-wide: 520px;
  --label-col-med: 440px;
}

/* Overall row: sliders stack on the left, spacer in middle, notes on the right */
body.risk-form .risk-row{
  display:grid;
  grid-template-columns: minmax(420px, 1fr) var(--notes-gap, 64px) minmax(520px, 1.8fr);
  column-gap: 0;
  row-gap: 16px;
  align-items:start;
}

/* Left column stacks Probability + Impact neatly */
body.risk-form .risk-controls{
  display:grid;
  grid-template-rows:auto auto;
  gap:14px;
  grid-column: 1;
}
body.risk-form .risk-controls label{ display:flex; justify-content:space-between; align-items:center; }
body.risk-form .risk-controls input[type="range"]{ width:100%; }

/* Right column for Notes */
body.risk-form .risk-notes textarea{
  min-height: 220px;
  resize:vertical;
}

/* Bigger counters next to labels */
body.risk-form .range-value{
  font-weight:700;
  font-size:16px;
  line-height:1;
  padding-left:8px;
}


/* === GRC tweak (2025-10-13 gradient-track): multi-color gradient track with ticks === */
:root{
  --risk-gradient: linear-gradient(to right,
    #248E92 0%,
    #D0ED5A 25%,
    #FFD966 50%,
    #FFC000 75%,
    #FF0000 100%
  );
}

/* Base slider track uses the gradient; thumb styles unchanged */
body.risk-form input[type="range"]{
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background-image: var(--risk-gradient);
  background-size: 100% 8px;
  background-repeat: no-repeat;
}

/* WebKit: keep track transparent so the input background (with gradient) shows */
body.risk-form input[type="range"]::-webkit-slider-runnable-track{
  height: 8px;
  background: transparent;
  border-radius: 4px;
}

/* Firefox: apply gradient on track as well */
body.risk-form input[type="range"]::-moz-range-track{
  height: 8px;
  background-image: var(--risk-gradient);
  background-size: 100% 8px;
  background-repeat: no-repeat;
  border: none;
  border-radius: 4px;
}

/* Probability (1–5): overlay tick marks on top of the gradient */
body.risk-form input[type="range"][id$="_prob"]{
  background-image: var(--risk-gradient);
  background-size: 100% 8px;
  background-repeat: no-repeat;
}
body.risk-form input[type="range"][id$="_prob"]::-moz-range-track{
  background-image: var(--risk-gradient);
  background-size: 100% 8px;
  background-repeat: no-repeat;
}

/* Impact (1–16): overlay 15 interval tick marks on top of the gradient */
body.risk-form input[type="range"][id$="_impact"]{
  background-image: var(--risk-gradient);
  background-size: 100% 8px;
  background-repeat: no-repeat;
}
body.risk-form input[type="range"][id$="_impact"]::-moz-range-track{
  background-image: var(--risk-gradient);
  background-size: 100% 8px;
  background-repeat: no-repeat;
}


/* === GRC tweak (2025-10-13 segmented-tracks): discrete color bands per tick === */

/* Probability (1–5): 5 clear color bands aligned to ticks */
body.risk-form input[type="range"][id$="_prob"]{
  background-image:
linear-gradient(to right,
      /* evenly distributed colors with slightly wider ~8% transitions */
  #248E92 0%,  #248E92 16%,
  #D0ED5A 24%, #D0ED5A 36%,
  #FFD966 44%, #FFD966 56%,
  #FFC000 64%, #FFC000 76%,
  #FF0000 84%, #FF0000 100%
);
  background-size: 100% 8px;
  background-repeat: no-repeat;
}
body.risk-form input[type="range"][id$="_prob"]::-moz-range-track{
  background-image:
linear-gradient(to right,
  #248E92 0%,  #248E92 16%,
  #D0ED5A 24%, #D0ED5A 36%,
  #FFD966 44%, #FFD966 56%,
  #FFC000 64%, #FFC000 76%,
  #FF0000 84%, #FF0000 100%
);
  background-size: 100% 8px;
  background-repeat: no-repeat;
}

/* Impact (1–16): 16 bands aligned to each tick */
body.risk-form input[type="range"][id$="_impact"]{
  background-image:
    linear-gradient(to right,
  /* evenly distributed colors with slightly wider ~8% transitions */
  #248E92 0%,  #248E92 16%,
  #D0ED5A 24%, #D0ED5A 36%,
  #FFD966 44%, #FFD966 56%,
  #FFC000 64%, #FFC000 76%,
  #FF0000 84%, #FF0000 100%
);
  background-size: 100% 8px;
  background-repeat: no-repeat;
}
body.risk-form input[type="range"][id$="_impact"]::-moz-range-track{
  background-image:
    linear-gradient(to right,
  #248E92 0%,  #248E92 16%,
  #D0ED5A 24%, #D0ED5A 36%,
  #FFD966 44%, #FFD966 56%,
  #FFC000 64%, #FFC000 76%,
  #FF0000 84%, #FF0000 100%
);
  background-size: 100% 8px;
  background-repeat: no-repeat;
}


/* === GRC tweak (2025-10-13 spacing+align): more vertical space, more column padding, align titles === */
/* More space between the two sliders */
body.risk-form .risk-controls{
  gap: 32px;
  padding-top: 6px;
  padding-bottom: 4px;
}

/* More space between stacked slider groups */
body.risk-form .risk-row{
  row-gap: 28px;
  align-items: start;
}

/* Spacer column now handles separation; keep internal padding neutral */
body.risk-form .risk-controls{ padding-right: 0; }
body.risk-form .risk-notes{ padding-left: 0; }

/* Ensure the risk title lines up visually with the top edge of the slider/notes block */
/* Style all risk prompts as bold headers */
body.risk-form .row > .prompt{
  margin-bottom: 14px;         /* clearer separation before sliders */
  line-height: 1.25;
  font-weight: 700;
  font-size: 16px;
  color: #1a1a1a;
}

/* Keep each slider block compact with label below input */
body.risk-form .risk-controls > div{
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;                    /* a bit more breathing room label<->slider */
}


/* === GRC tweak (2025-10-15 notes-gap): dedicated spacer column between sliders and notes === */
body.risk-form{ --notes-gap: 64px; } /* width of spacer column between controls and notes */

@media (min-width: 1200px){
  body.risk-form{ --notes-gap: 88px; }
}
@media (min-width: 1600px){
  body.risk-form{ --notes-gap: 104px; } /* extra on ultra-wide to maintain alignment */
}

/* === GRC tweak (2025-10-14 restructured-rows): Notes label now in same row as prompt === */

/* The row now contains both the prompt and the notes label side-by-side */
body.risk-form .row{
  display: grid !important;
  grid-template-columns: minmax(420px, 1fr) var(--notes-gap, 64px) minmax(520px, 1.8fr);
  column-gap: 0;
  align-items: start;
  margin-bottom: 0;
}

/* Display mediating controls heading in the same row as the prompt */
body.risk-form .row .notes-label{
  grid-column: 3;
  align-self: start;
  justify-self: stretch;
  font-weight: 700;
  font-size: 16px;
  color: #1a1a1a;
  line-height: 1.25;
  margin: 0 0 8px 0;
}

/* The risk-row is now a sibling to row (not a child) */
body.risk-form .risk-row{
  display: grid;
  grid-template-columns: minmax(420px, 1fr) var(--notes-gap, 64px) minmax(520px, 1.8fr);
  column-gap: 0;
  align-items: start;
  margin-bottom: 26px;
}

@media (max-width:1100px){
  body.risk-form .row{
    grid-template-columns: 1fr;
  }
  body.risk-form .risk-row{
    grid-template-columns: 1fr;
    row-gap: 20px;
  }
  body.risk-form .risk-controls,
  body.risk-form .risk-notes{
    grid-column: auto;
  }
  body.risk-form .row .notes-label{
    grid-column: auto;
    margin-top: 16px;
  }
}

/* risk-notes container setup */
body.risk-form .risk-notes{
  position: relative;
  display: block;
  grid-column: 3;
  padding-left: 0;
  justify-self: stretch;
}

/* Textarea sits directly beneath the heading within the notes column */
body.risk-form .risk-notes textarea{
    margin-top: 4px;
    margin-left: 0;
    width: 100%;
  }

body.risk-form .risk-notes select{
    width: 100%;
    max-width: 500px;
  }

/* === GRC tweak (2025-10-14 category-headers): Enhanced visibility for risk category legends === */
body.risk-form fieldset {
  margin-top: 40px;
  margin-bottom: 40px;
  padding-top: 32px;
}

body.risk-form fieldset:first-of-type {
  margin-top: 24px;
}

body.risk-form legend {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  padding: 0 12px;
  margin-bottom: 20px;
}

/* === Small button styling === */
button.small-btn{
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
}

/* === Toolbar spacer to separate Add Control from other buttons === */
.toolbar-spacer{
  flex: 1;
}

/* === Delete risk button === */
.delete-risk-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 24px;
  height: 24px;
  background: #ef4444;
  border: none;
  border-radius: 4px;
  color: white;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.delete-risk-btn:hover {
  background: #dc2626;
}

/* Show delete button when hovering over the prompt */
body.risk-form .prompt:hover .delete-risk-btn {
  opacity: 1;
}

/* Make prompt position relative to contain the absolute button */
body.risk-form .prompt {
  position: relative;
  padding-right: 32px; /* Add padding to prevent text overlap with button */
}

/* Keep row and risk-row relative for grid positioning */
body.risk-form .row {
  position: relative;
}

body.risk-form .risk-row {
  position: relative;
}

/* === Navigation Dropdown Container === */
body.risk-form .nav-dropdown-container,
body.riskprofile-form .nav-dropdown-container {
  grid-column: 2;
  justify-self: end;
  position: relative;
}

/* === Navigation Dropdown Button === */
.nav-dropdown-btn {
  padding: 8px 14px;
  border: 1px solid var(--ink-3, #333);
  border-radius: 8px;
  background: white;
  color: var(--ink-3, #333);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-dropdown-btn:hover {
  filter: brightness(0.95);
}

/* === Navigation Dropdown Menu === */
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  min-width: 200px;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  color: #334155;
  transition: background 0.2s ease;
  border-bottom: 1px solid #f1f5f9;
}

.nav-item:last-child {
  border-bottom: none;
}

.nav-item:hover {
  background: #f8fafc;
}

.nav-item.active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}

.nav-icon {
  font-size: 16px;
  line-height: 1;
}

.nav-text {
  font-size: 14px;
  font-weight: 500;
}

.nav-item.active .nav-text {
  font-weight: 600;
}

/* === Security footer === */
.security-footer {
  margin-top: 60px;
  padding: 20px 0;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  color: #64748b;
  font-size: 12px;
  font-family: system-ui, -apple-system, sans-serif;
}

/* === GRC tweak (2025-10-14 column-headers): Category header row for Mediating Controls === */

/* === Export Modal Styles === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-dialog {
  background: #fff;
  border-radius: 12px;
  padding: 0;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: #f1f5f9;
  color: #1a1a1a;
}

.modal-body {
  padding: 24px;
}

.modal-body p {
  margin: 0 0 16px 0;
  color: #64748b;
  font-size: 14px;
}

.export-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-option-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.export-option-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.export-icon {
  font-size: 32px;
  line-height: 1;
}

.export-label {
  font-weight: 600;
  font-size: 16px;
  color: #1a1a1a;
  display: block;
}

.export-desc {
  font-size: 13px;
  color: #64748b;
  display: block;
  margin-top: 4px;
}
