:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #627084;
  --line: #d9e0e7;
  --accent: #156f77;
  --accent-dark: #0e555b;
  --critical: #b42318;
  --high: #c2410c;
  --medium: #9a6700;
  --low: #28764f;
  --missing: #687280;
  --shadow: 0 18px 60px rgba(18, 28, 38, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.auth-page {
  min-height: 100vh;
  padding: clamp(22px, 5vw, 64px);
}

.auth-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: clamp(22px, 4vw, 42px);
  position: relative;
  width: min(1180px, calc(100vw - 44px));
  min-height: calc(100vh - clamp(44px, 10vw, 128px));
  margin: 0 auto;
  padding: clamp(22px, 4vw, 40px);
  align-items: center;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(217, 224, 231, 0.92);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.auth-info,
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.auth-info {
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(26px, 5vw, 52px);
}

.app-brand-logo {
  width: min(360px, 86%);
  max-height: 132px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 26px;
}

.auth-info h1 {
  max-width: 780px;
  font-size: clamp(2.1rem, 5vw, 4.2rem);
}

.auth-info p {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.auth-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.auth-points span {
  padding: 8px 11px;
  color: var(--accent-dark);
  background: #e9f7f6;
  border-radius: 999px;
  font-weight: 900;
}

.auth-card {
  padding: clamp(20px, 3vw, 30px);
  align-self: center;
}

.auth-legal-links {
  position: absolute;
  right: clamp(18px, 4vw, 40px);
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.auth-legal-links a {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 22px;
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
}

.app-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.app-topbar-logo {
  max-width: 260px;
  max-height: 78px;
  object-fit: contain;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.admin-modal-panel {
  width: min(1280px, 100%);
}

.results-shell {
  min-width: 0;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 16px;
}

.masthead,
.lookup-panel,
.settings-panel,
.results-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.global-error {
  position: fixed;
  right: 20px;
  bottom: 16px;
  z-index: 20;
  max-width: min(520px, calc(100vw - 40px));
  padding: 10px 12px;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.global-error:empty {
  display: none;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.05;
}

h2 {
  font-size: 1.12rem;
}

.source-link {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 36px;
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 800;
}

.lookup-panel,
.settings-panel {
  padding: 18px;
}

.lookup-panel label,
.settings-panel label,
.threshold-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
}

textarea {
  display: block;
  width: 100%;
  min-height: 240px;
  resize: vertical;
  padding: 14px;
  color: var(--ink);
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.45;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-bottom: 12px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

input.input-error,
select.input-error,
textarea.input-error {
  border-color: var(--critical);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.13);
}

.template-textarea {
  min-height: 170px;
}

.legal-settings-panel {
  grid-column: 1 / -1;
}

.rich-editor {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rich-toolbar button {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.rich-toolbar button:hover {
  color: var(--accent-dark);
  background: #e9f7f6;
  border-color: #acd7d5;
}

.legal-editor {
  min-height: 260px;
  max-height: 520px;
  overflow: auto;
  padding: 14px;
  color: var(--ink);
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.55;
}

.legal-editor:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(21, 111, 119, 0.14);
}

.legal-editor h1,
.legal-editor h2,
.legal-editor h3,
.legal-editor p,
.legal-editor ul,
.legal-editor ol {
  margin-top: 0;
}

.soft-line {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.registration-trigger {
  margin-top: 12px;
}

.help-content {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.help-content h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
}

.help-content ul {
  margin: 0;
  padding-left: 18px;
}

.help-content .icon-help-list {
  display: grid;
  gap: 10px;
  padding-left: 0;
  list-style: none;
}

.icon-help-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.icon-help-list li strong {
  color: var(--ink);
}

.inline-action-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--accent-dark);
  background: #e9f7f6;
  border: 1px solid #acd7d5;
  border-radius: 8px;
  font-weight: 950;
  line-height: 1;
}

.inline-action-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.inline-action-icon .sharepoint-icon {
  color: #107c41;
  fill: currentColor;
  stroke: none;
}

.inline-action-icon .sharepoint-icon text {
  fill: #fff;
}

.support-link {
  justify-self: start;
  color: var(--accent);
  font-weight: 900;
  text-decoration: none;
}

.support-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button {
  display: inline-flex;
  margin-top: 10px;
  padding: 0;
  color: var(--accent);
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.field-hint {
  margin: -6px 0 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.35;
}

.register-message {
  margin: 14px 0 0;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  border-radius: 8px;
  font-size: 0.94rem;
  font-weight: 850;
  line-height: 1.45;
}

.register-message:empty {
  display: none;
}

.register-message.success {
  color: #0b4f36;
  background: #e8f7ee;
  border: 1px solid #9fd9b6;
}

.register-message.error {
  color: #8f1b13;
  background: #fff1ee;
  border: 1px solid #f0a69d;
}

.legal-consent {
  display: grid !important;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700 !important;
  line-height: 1.45;
}

.legal-consent input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
}

.legal-consent a {
  color: var(--accent);
  font-weight: 900;
}

.info-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.captcha-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
  padding: 10px 12px;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.note-input {
  min-height: 92px;
  margin-top: 8px;
}

textarea:focus,
input:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(21, 111, 119, 0.25);
  outline-offset: 2px;
}

.form-actions,
.status-row,
.settings-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-actions {
  flex-wrap: wrap;
  margin-top: 12px;
}

.status-row,
.settings-head,
.section-head {
  justify-content: space-between;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.tenant-state {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  color: var(--accent);
  background: #e9f7f6;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.hidden {
  display: none !important;
}

.primary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button.compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.ghost-button,
.icon-button {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.ghost-button {
  padding: 0 14px;
}

.ghost-button.compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.microsoft-login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 215px;
  height: 41px;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-decoration: none;
}

.microsoft-login-button:hover {
  filter: brightness(0.97);
}

.microsoft-button-art {
  display: block;
  width: 215px;
  height: 41px;
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 1.2rem;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.threshold-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.threshold-grid label {
  display: grid;
  grid-template-columns: 1fr minmax(92px, 120px) 54px;
  align-items: center;
  gap: 10px;
}

.threshold-grid span {
  margin: 0;
}

.threshold-grid input {
  width: 100%;
  padding: 10px 9px;
  text-align: right;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.results-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 16px;
  padding: 20px;
  overflow: hidden;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.summary-item {
  min-height: 76px;
  padding: 13px;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-item span {
  display: block;
  font-size: 1.7rem;
  font-weight: 900;
}

.summary-item small {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.summary-item.critical span {
  color: var(--critical);
}

.summary-item.high span {
  color: var(--high);
}

.summary-item.medium span {
  color: var(--medium);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 850px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f8fafb;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-row td {
  color: var(--muted);
  text-align: center;
}

.cve-link {
  color: var(--accent);
  font-weight: 900;
  text-decoration: none;
}

td small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.meter {
  display: grid;
  gap: 6px;
  min-width: 140px;
}

.meter-track {
  width: 100%;
  height: 9px;
  overflow: hidden;
  background: #e8edf2;
  border-radius: 999px;
}

.meter-fill {
  height: 100%;
  border-radius: inherit;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  color: #fff;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.badge.critical,
.meter-fill.critical {
  background: var(--critical);
}

.badge.high,
.meter-fill.high {
  background: var(--high);
}

.badge.medium,
.meter-fill.medium {
  background: var(--medium);
}

.badge.low,
.meter-fill.low {
  background: var(--low);
}

.badge.priority-critical {
  background: var(--critical);
}

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

.badge.priority-medium {
  background: #3f6f8f;
}

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

.badge.missing {
  background: var(--missing);
}

.recommendation {
  max-width: 380px;
  margin: 8px 0 0;
  color: #334155;
  line-height: 1.38;
}

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 150px;
}

.row-action-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 950;
  line-height: 1;
}

.row-action-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.row-action-button.sharepoint-action svg {
  width: 22px;
  height: 22px;
  fill: #0b7f83;
  stroke: #fff;
  stroke-width: 0.7;
}

.row-action-button.sharepoint-action text {
  fill: #fff;
  stroke: none;
}

.row-action-button:hover {
  color: var(--accent-dark);
  background: #e9f7f6;
  border-color: #acd7d5;
}

.row-action-button:focus-visible {
  outline: 3px solid rgba(21, 111, 119, 0.22);
  outline-offset: 2px;
}

.row-action-button.is-loading {
  color: var(--muted);
}

.row-action-button.is-done {
  color: #fff;
  background: var(--low);
  border-color: var(--low);
}

.history-list {
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.history-item {
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.history-item strong,
.history-item time,
.history-item small {
  display: block;
}

.history-item time,
.history-item small {
  color: var(--muted);
  font-size: 0.82rem;
}

.history-item p {
  margin: 8px 0;
  color: var(--ink);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, 0.46);
}

.modal-panel {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tenant-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.branding-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 280px);
  gap: 14px;
  align-items: center;
}

.branding-grid label span {
  display: block;
  margin-bottom: 8px;
}

.branding-preview {
  display: grid;
  gap: 8px;
  align-content: center;
  min-height: 94px;
  padding: 12px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.branding-preview img {
  max-width: 100%;
  max-height: 64px;
  object-fit: contain;
  object-position: left center;
}

.branding-preview.icon-preview img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.branding-preview small {
  color: var(--muted);
  line-height: 1.35;
}

.tenant-card {
  padding: 12px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tenant-card strong,
.tenant-card code {
  display: block;
}

.tenant-card code {
  margin-top: 8px;
  overflow-wrap: anywhere;
  color: var(--accent-dark);
}

.error-message {
  min-height: 22px;
  margin: 0;
  color: var(--critical);
  font-weight: 800;
}

@media (max-width: 920px) {
  .auth-frame,
  .app-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .auth-info {
    min-height: auto;
  }

  .app-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .branding-grid {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 180px;
  }
}

@media (max-width: 620px) {
  .auth-page,
  .app-shell {
    padding: 12px;
  }

  .auth-frame {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
  }

  .auth-legal-links {
    position: static;
    grid-column: 1;
    padding: 4px 8px 0;
  }

  .masthead,
  .status-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .threshold-grid label {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
