:root {
  --navy: #074676;
  --blue: #065ea8;
  --alert-red: #e73747;
  --night: #0b1f33;
  --slate: #586b7c;
  --ink: #0b1f33;
  --muted: #586b7c;
  --line: #d8dee8;
  --surface: #ffffff;
  --background: #f4f6f9;
  --danger: #e73747;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); }
.site-header { min-height: 76px; padding: 14px max(5vw, 32px); background: var(--night); border-bottom: 3px solid var(--alert-red); display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 16px; color: white; font-size: 14px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.brand img { width: 220px; max-height: 40px; object-fit: contain; }
.brand-rule { width: 1px; height: 26px; background: rgba(255, 255, 255, .36); }
.beta { background: rgba(231, 55, 71, .14); border: 1px solid var(--alert-red); border-radius: 999px; color: white; font-size: 11px; font-weight: 700; letter-spacing: .12em; padding: 6px 10px; }
.header-links { display: flex; gap: 18px; }
.header-link { color: white; font-size: 13px; font-weight: 650; text-decoration: none; }
.header-link:hover { text-decoration: underline; }
.incident-link { color: var(--blue); font-weight: 650; text-decoration: none; }
.incident-link:hover { text-decoration: underline; }
.header-logout { border-left: 1px solid rgba(255, 255, 255, .36); padding-left: 18px; }
main { max-width: 1120px; margin: 0 auto; padding: 56px 32px; }
.relay-log-content { max-width: none; padding-left: 20px; padding-right: 20px; width: 100%; }
.hero { margin-bottom: 32px; }
.eyebrow { margin: 0 0 10px; color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: .1em; }
h1, h2, p { margin-top: 0; }
h1 { color: var(--night); font-size: clamp(32px, 5vw, 46px); letter-spacing: -.035em; margin-bottom: 12px; }
.hero > p:last-child, .panel-header p, .how-it-works p { color: var(--muted); margin-bottom: 0; }
.panel, .how-it-works { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 22px rgba(11, 31, 51, .06); }
.panel { overflow: hidden; }
.panel-header, .panel-footer { align-items: center; display: flex; justify-content: space-between; padding: 24px 28px; }
.panel-header { border-bottom: 1px solid var(--line); }
h2 { color: var(--navy); font-size: 19px; margin-bottom: 6px; }
button { border: 0; border-radius: 6px; cursor: pointer; font: inherit; font-weight: 650; padding: 10px 15px; }
button:disabled { cursor: not-allowed; opacity: .5; }
.primary { background: var(--blue); color: white; }
.primary:hover:not(:disabled) { background: var(--navy); }
.secondary { background: #e8eef4; color: var(--night); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 16px 28px; text-align: left; }
th { background: #f8fafb; color: var(--muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
td { font-size: 15px; }
.actions { text-align: right; white-space: nowrap; }
.text-button { background: none; color: var(--blue); padding: 4px 8px; }
.text-button.danger { color: var(--danger); }
.empty { color: var(--muted); padding: 38px; text-align: center; }
.host-form { align-items: end; border-bottom: 1px solid var(--line); display: grid; gap: 16px; grid-template-columns: minmax(180px, 1fr) minmax(250px, 2fr) auto auto auto auto; padding: 24px 28px; }
.scope-option { align-items: center; color: var(--ink); display: flex; gap: 8px; margin: 0 0 10px; white-space: nowrap; }
.scope-option input { width: auto; }
label { color: var(--navy); display: block; font-size: 13px; font-weight: 650; margin-bottom: 7px; }
input { border: 1px solid #b8c6d1; border-radius: 6px; font: inherit; padding: 10px 11px; width: 100%; }
select { background: white; border: 1px solid #b8c6d1; border-radius: 6px; color: var(--ink); font: inherit; padding: 10px 11px; width: 100%; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #ddebF7; outline: 0; }
select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #ddebF7; outline: 0; }
.panel-footer { background: #fafcfd; }
.panel-footer span { color: var(--muted); font-size: 14px; }
.notice { margin: 20px 28px 0; border-radius: 6px; padding: 12px 14px; }
.notice.success { background: #e9f5ed; color: #2e8b57; }
.notice.error { background: #fff0f2; color: var(--alert-red); }
.relay-status { color: var(--muted); margin: 20px 28px 0; }
.relay-status.success { color: #2e8b57; }
.relay-status.error { color: var(--danger); }
.relay-log-content th, .relay-log-content td { padding: 13px 14px; white-space: nowrap; }
.relay-log-content th:last-child, .relay-log-content td:last-child { white-space: normal; }
.database-controls { align-items: end; border-bottom: 1px solid var(--line); display: grid; gap: 18px; grid-template-columns: minmax(240px, 420px) minmax(160px, 220px); padding: 20px 28px; }
.database-pagination { gap: 14px; justify-content: flex-end; }
.how-it-works { margin-top: 28px; padding: 24px 28px; }
.how-it-works h2 { font-size: 16px; }
.user-form-panel { margin-top: 28px; }
.user-form { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 24px 28px 28px; }
.user-form > button { justify-self: start; }
.user-form .division-fieldset { grid-column: 1 / -1; }
.compact-form { align-items: end; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto; }
.optional { color: var(--muted); font-weight: 400; }
.division-fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0; padding: 16px; }
.division-fieldset:disabled { background: #f8fafb; color: var(--muted); }
.division-fieldset legend { color: var(--navy); font-size: 13px; font-weight: 650; padding: 0 5px; }
.division-fieldset p { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.checkbox-list { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.checkbox-option { align-items: center; color: var(--ink); display: flex; font-weight: 400; gap: 7px; margin: 0; }
.checkbox-option input { width: auto; }
.division-permission-option { align-items: center; border: 1px solid var(--line); border-radius: 6px; display: flex; gap: 14px; padding: 8px 10px; }
.notification-steps { display: grid; gap: 10px; margin-bottom: 14px; }
.notification-step { align-items: end; background: #fbfcfe; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 10px; grid-template-columns: auto minmax(180px, 2fr) minmax(110px, 1fr) minmax(90px, 1fr) auto; padding: 12px; }
.notification-step.dragging { border-color: var(--blue); box-shadow: 0 6px 16px rgba(11, 31, 51, .16); opacity: .8; }
.step-drag-handle { align-self: stretch; background: #e8eef4; color: var(--night); cursor: grab; min-width: 46px; touch-action: none; }
.step-drag-handle:active { cursor: grabbing; }
.step-order-actions { display: flex; gap: 4px; }
.step-order-actions .text-button { padding: 6px; }
.user-identity { white-space: pre-line; }
.audit-events { display: grid; gap: 0; }
.audit-event { align-items: baseline; border-bottom: 1px solid var(--line); display: grid; gap: 8px 18px; grid-template-columns: minmax(150px, 1fr) minmax(220px, 2fr) auto; padding: 14px 28px; }
.audit-event strong { color: var(--navy); font-size: 14px; }
.audit-event span, .audit-event time { color: var(--muted); font-size: 13px; }
.audit-event time { white-space: nowrap; }
.timeline-panel { margin-top: 28px; }
.timeline { color: var(--muted); margin: 0; padding: 20px 48px 28px; }
.timeline li + li { margin-top: 10px; }
.legal-content { max-width: 880px; }
.legal-panel { padding: 28px; }
.legal-panel h2 { margin-top: 28px; }
.legal-panel h2:first-child { margin-top: 0; }
.legal-panel p { color: var(--ink); line-height: 1.65; }
.legal-panel a { color: var(--blue); }
.setup-key { background: #f4f6f9; border: 1px solid var(--line); display: inline-block; font-size: 16px; letter-spacing: .08em; margin-bottom: 20px; padding: 12px; word-break: break-all; }
.authenticator-qr-code { display: block; height: 220px; margin: 18px 0; width: 220px; }
.logout-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button-link { display: inline-block; text-decoration: none; }
.signin-entra { background: white; border: 1px solid var(--blue); border-radius: 6px; color: var(--night); display: inline-block; font-weight: 650; padding: 11px 16px; text-decoration: none; }
.signin-entra:hover { background: #e8eef4; }
.admin-signin-icon { align-items: center; display: flex; padding: 8px; }
.admin-signin-icon img { height: 24px; width: 24px; }
.admin-menu { display: grid; gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-menu-card { color: inherit; display: block; padding: 24px 28px; text-decoration: none; }
.admin-menu-card:hover { border-color: var(--blue); box-shadow: 0 10px 24px rgba(11, 31, 51, .12); }
.admin-menu-card p { color: var(--muted); margin-bottom: 0; }
.sr-only { height: 1px; margin: -1px; overflow: hidden; position: absolute; width: 1px; }
@media (max-width: 700px) {
  .site-header { padding: 14px 20px; }
  .brand img { width: 170px; }
  .brand { font-size: 14px; gap: 10px; }
  main { padding: 38px 16px; }
  .panel-header, .panel-footer { padding: 20px; }
  .host-form { grid-template-columns: 1fr; padding: 20px; }
  .user-form { grid-template-columns: 1fr; padding: 20px; }
  .notification-step { grid-template-columns: auto minmax(0, 1fr); }
  .notification-step > label { grid-column: 2; }
  .step-order-actions { grid-column: 2; }
  .notification-step > .text-button.danger { grid-column: 2; justify-self: start; }
  .audit-event { grid-template-columns: 1fr; padding: 14px 20px; }
  .admin-menu { grid-template-columns: 1fr; }
  .header-links { gap: 10px; }
  th, td { padding: 14px 20px; }
}
