:root {
  --navy: #12253d;
  --navy-2: #1c3854;
  --teal: #087e82;
  --teal-soft: #e4f3f1;
  --canvas: #f3f6f8;
  --surface: #ffffff;
  --line: #d9e2e8;
  --ink: #162538;
  --muted: #607386;
  --low: #147b55;
  --low-bg: #dff2e9;
  --moderate: #9a6b00;
  --moderate-bg: #fff1c9;
  --high: #bf4d23;
  --high-bg: #fde3d5;
  --extreme: #a62735;
  --extreme-bg: #f7d9de;
  --shadow: 0 10px 28px rgba(20, 37, 56, 0.06);
  font-family: "Segoe UI", "Aptos", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 1060px;
  background: var(--canvas);
}

button,
input,
select,
textarea {
  font: inherit;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px max(calc((100vw - 1400px) / 2), 34px);
  color: #fff;
  background: var(--navy);
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 13px;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  background: var(--teal);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.masthead .eyebrow {
  color: #76d4d2;
}

h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 650;
}

h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
}

.header-meta {
  text-align: right;
  color: #d1dee7;
  font-size: 13px;
}

.header-meta p {
  margin: 4px 0;
}

.header-meta strong {
  color: #fff;
}

.header-button {
  padding: 4px 11px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: #fff;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px max(calc((100vw - 1400px) / 2), 34px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  height: 40px;
  padding: 0 17px;
  border: 1px solid #cdd8e0;
  border-radius: 9px;
  color: var(--navy-2);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: border-color 120ms, background 120ms;
}

.button:hover {
  border-color: #a8bac6;
  background: #f6f9fa;
}

.button.primary {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal);
}

.button.primary:hover {
  background: #066e72;
}

.button.quiet {
  margin-left: auto;
  color: var(--muted);
}

.upload {
  cursor: pointer;
}

#restoreFile {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.workspace {
  max-width: 1400px;
  margin: 0 auto;
  padding: 25px 34px 35px;
}

.auth-panel {
  margin-bottom: 20px;
  padding: 22px;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1.08fr 0.9fr 0.9fr;
  gap: 22px;
  align-items: start;
}

.auth-copy p:last-child,
.request-panel p {
  margin: 11px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 11px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafb;
}

.auth-form h3 {
  margin: 0 0 3px;
  font-size: 15px;
}

.auth-form label,
.request-form label {
  display: grid;
  gap: 6px;
  color: var(--navy-2);
  font-size: 13px;
  font-weight: 600;
}

.auth-form input,
.request-form input {
  height: 40px;
  padding: 0 11px;
  border: 1px solid #ced9e0;
  border-radius: 7px;
}

.request-panel {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 28px;
  align-items: center;
}

.request-form {
  display: grid;
  gap: 12px;
}

.auth-message {
  min-height: 19px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-message.error {
  color: var(--extreme);
}

.auth-message.success {
  color: var(--low);
}

.hero {
  display: grid;
  grid-template-columns: 1fr 365px;
  gap: 26px;
  margin-bottom: 20px;
}

.hero h2 {
  margin-bottom: 9px;
  font-size: 27px;
}

.intro {
  max-width: 785px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.priority-card {
  padding: 17px 19px;
  border-left: 4px solid var(--extreme);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.priority-card .label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.priority-title {
  margin: 0 0 7px;
  font-weight: 650;
  line-height: 1.35;
}

.priority-detail {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 19px;
}

.metric {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--teal);
  border-radius: 11px;
  background: var(--surface);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.metric strong {
  display: block;
  margin: 7px 0 4px;
  color: var(--navy);
  font-size: 34px;
  line-height: 1;
}

.metric small {
  color: var(--muted);
}

.metric.high {
  border-top-color: var(--high);
}

.metric.overdue {
  border-top-color: var(--extreme);
}

.metric.action {
  border-top-color: #4d73ad;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.register-panel {
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 19px 15px;
  border-bottom: 1px solid var(--line);
}

.panel-head.compact {
  padding-bottom: 14px;
}

.filters {
  display: flex;
  gap: 9px;
  align-items: center;
}

.filters input,
.filters select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.filters input {
  width: 250px;
}

.filters select {
  min-width: 148px;
}

.table-wrap {
  overflow-x: auto;
}

.risk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.risk-table th {
  padding: 12px 13px;
  color: var(--muted);
  background: #f7f9fa;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.risk-table td {
  max-width: 245px;
  padding: 13px;
  border-bottom: 1px solid #edf1f3;
  vertical-align: top;
}

.risk-table tr:hover td {
  background: #fafcfc;
}

.risk-table .risk-title {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-weight: 650;
  line-height: 1.38;
}

.risk-id {
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
}

.muted-line {
  color: var(--muted);
  line-height: 1.4;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.badge.low {
  color: var(--low);
  background: var(--low-bg);
}

.badge.moderate {
  color: var(--moderate);
  background: var(--moderate-bg);
}

.badge.high {
  color: var(--high);
  background: var(--high-bg);
}

.badge.extreme {
  color: var(--extreme);
  background: var(--extreme-bg);
}

.badge.status {
  color: var(--navy-2);
  background: #e8eef5;
}

.due-overdue {
  color: var(--extreme);
  font-weight: 650;
}

.due-soon {
  color: var(--high);
  font-weight: 650;
}

.row-actions {
  display: flex;
  gap: 7px;
}

.text-button {
  padding: 3px 0;
  border: 0;
  color: var(--teal);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.text-button.delete {
  color: var(--extreme);
}

.empty-state {
  margin: 0;
  padding: 32px 20px;
  color: var(--muted);
  text-align: center;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(480px, 0.96fr) 1.04fr;
  gap: 18px;
}

.matrix-layout {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 9px;
  padding: 20px 20px 8px;
}

.axis {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.y-axis {
  align-self: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.x-axis {
  grid-column: 2;
  text-align: center;
}

.matrix {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.matrix-cell {
  position: relative;
  min-height: 61px;
  padding: 6px;
  border-radius: 7px;
  font-size: 11px;
}

.matrix-cell .coordinate {
  color: rgba(20, 37, 56, 0.54);
  font-weight: 600;
}

.matrix-cell .dots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.risk-dot {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  color: #fff;
  background: var(--navy);
  font-size: 10px;
  font-weight: 700;
}

.cell-low {
  background: var(--low-bg);
}

.cell-moderate {
  background: var(--moderate-bg);
}

.cell-high {
  background: var(--high-bg);
}

.cell-extreme {
  background: var(--extreme-bg);
}

.legend {
  display: flex;
  gap: 9px;
  padding: 8px 20px 20px 60px;
}

.legend span {
  padding: 5px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 650;
}

.legend .low {
  color: var(--low);
  background: var(--low-bg);
}

.legend .moderate {
  color: var(--moderate);
  background: var(--moderate-bg);
}

.legend .high {
  color: var(--high);
  background: var(--high-bg);
}

.legend .extreme {
  color: var(--extreme);
  background: var(--extreme-bg);
}

.treatment-list {
  max-height: 417px;
  overflow-y: auto;
  padding: 7px 18px 17px;
}

.treatment {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  padding: 13px 2px;
  border-bottom: 1px solid #edf1f3;
}

.treatment:last-child {
  border-bottom: 0;
}

.treatment h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.treatment p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.treatment-meta {
  color: var(--muted);
  font-size: 12px;
}

.treatment .badge {
  align-self: start;
}

.risk-dialog {
  width: min(930px, calc(100vw - 50px));
  max-height: calc(100vh - 46px);
  padding: 0;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 20px 55px rgba(18, 37, 61, 0.22);
}

.risk-dialog::backdrop {
  background: rgba(18, 37, 61, 0.48);
}

.risk-dialog form {
  padding: 22px 25px 20px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 17px;
}

.form-grid > label,
fieldset label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--navy-2);
  font-size: 13px;
  font-weight: 600;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #ced9e0;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
}

.form-grid textarea {
  resize: vertical;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: 2px solid rgba(8, 126, 130, 0.25);
  border-color: var(--teal);
}

.span-2 {
  grid-column: span 2;
}

fieldset {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 21px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.footer {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 34px 25px;
  color: var(--muted);
  font-size: 13px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
