:root {
  color-scheme: light;
  --bg: #f7f9fa;
  --surface: #ffffff;
  --surface-muted: #eef2f5;
  --line: #d8dee6;
  --text: #1f2933;
  --muted: #667384;
  --accent: #0f766e;
  --accent-dark: #0b4f4a;
  --accent-soft: #e6f4f1;
  --danger: #b42318;
  --warning: #b7791f;
  --info: #0f6b8f;
  --ok: #166534;
  --sidebar: #12201f;
  --sidebar-muted: #b7c5c2;
  --radius: 8px;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--theme-accent, var(--accent));
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 9999;
  transform: translateY(-150%);
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 800;
}

.skip-link:focus {
  transform: translateY(0);
}

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 6px;
  font-weight: 800;
}

.brand-name {
  font-weight: 800;
}

.brand-subtitle,
.sidebar-footer {
  color: var(--sidebar-muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav a {
  text-decoration: none;
  color: #e6edf3;
  padding: 10px 12px;
  border-radius: 6px;
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.content {
  min-width: 0;
  padding: 28px;
}

.page-header,
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.topbar {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.page-title-block {
  min-width: 220px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 16px;
  margin-bottom: 16px;
}

.mode-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 720px;
}

.account-strip {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.account-meta {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.logout-form {
  margin: 0;
}

.logout-form button {
  min-height: 30px;
  padding: 4px 9px;
}

.flag,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}

.flag-on {
  background: #fff3d6;
}

.flag-off {
  background: #e8f5ef;
}

.risk-low {
  background: #e8f5ef;
  color: #14532d;
}

.risk-medium {
  background: #fff7ed;
  color: #9a3412;
}

.risk-high {
  background: #fff1f2;
  color: #991b1b;
}

.risk-unknown {
  background: var(--surface-muted);
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 16px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  font-size: 30px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 20px;
}

.panel {
  padding: 18px;
  overflow: hidden;
}

.subtle-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
  margin: 16px 0;
  padding: 14px;
}

.panel.narrow {
  max-width: 720px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-heading h2 {
  margin-bottom: 0;
}

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

.detail-list {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 10px 18px;
  margin: 0;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 700;
}

.detail-list dd {
  margin: 0;
}

.flag-list,
.settings-grid {
  display: grid;
  gap: 8px;
}

.readiness-grid,
.checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 12px 0 18px;
}

.readiness-grid > div,
.checklist-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px;
}

.readiness-grid span,
.checklist-item span,
.checklist-item small {
  overflow-wrap: anywhere;
}

.notice {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #f8fbfb;
  margin: 0 0 16px;
  padding: 10px 12px;
}

.notice.success {
  border-left-color: var(--ok);
  background: #f0fdf4;
}

.notice.warning {
  border-left-color: #d97706;
  background: #fff7ed;
}

.notice.error {
  border-left-color: var(--danger);
  background: #fff1f2;
}

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 18px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand-primary, #0f766e) 12%, transparent), rgba(255, 255, 255, 0) 46%),
    #f5f8f8;
}

.login-panel {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 24px;
}

.compact-brand {
  margin-bottom: 20px;
}

.login-layout {
  display: grid;
  place-items: center;
  width: min(100%, 620px);
  min-height: calc(100vh - 64px);
}

.login-card {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--brand-primary, #0f766e) 18%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
  padding: clamp(24px, 5vw, 42px);
}

.login-brand {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
}

.login-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
  border-radius: 0;
  background: #fff;
  overflow: visible;
}

.login-logo-wrap.has-logo {
  width: min(240px, 42vw);
  min-height: 56px;
}

.login-logo-wrap.fallback-mark {
  width: auto;
  min-height: 36px;
  border: 0;
}

.login-logo {
  display: block;
  width: min(220px, 40vw);
  max-width: 100%;
  height: auto;
  max-height: 86px;
  object-fit: contain;
  aspect-ratio: auto;
}

.login-mark {
  display: inline-block;
  color: var(--brand-primary, var(--accent-dark));
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.login-brand-copy {
  min-width: 0;
}

.login-brand-copy h1 {
  margin: 2px 0 5px;
  color: #10201f;
  font-size: 30px;
  line-height: 1.1;
}

.login-brand-copy p {
  margin: 0;
  color: var(--muted);
}

.login-kicker {
  color: var(--brand-primary, var(--accent-dark)) !important;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-alerts {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.login-alert {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 10px 12px;
  background: #f8fbfb;
  color: var(--text);
}

.login-alert-info {
  border-left-color: var(--info);
  background: #eef8fb;
}

.login-alert-warning {
  border-left-color: #d97706;
  background: #fff7ed;
}

.login-alert-muted {
  border-left-color: var(--line);
  background: #f8fafc;
  color: var(--muted);
}

.login-actions {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.login-microsoft-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--brand-primary, var(--accent-dark));
  border-radius: 6px;
  background: var(--brand-primary, var(--accent));
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.login-microsoft-button:hover {
  background: var(--brand-accent, var(--accent-dark));
}

.login-alt-link {
  justify-self: center;
  color: var(--brand-primary, var(--accent-dark));
  font-weight: 800;
  text-decoration: underline;
}

.local-login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 18px;
}

.local-login-panel.is-hidden {
  display: none;
}

.login-form input:focus {
  border-color: var(--brand-primary, var(--accent));
  outline: 2px solid color-mix(in srgb, var(--brand-accent, #14b8a6) 30%, transparent);
  outline-offset: 1px;
}

.local-login-heading {
  margin-bottom: 14px;
}

.local-login-heading h2 {
  color: #152522;
  font-size: 16px;
  line-height: 1.25;
}

.local-login-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.local-login-submit {
  justify-content: center;
  min-height: 42px;
}

.login-warning {
  color: var(--muted);
  font-size: 12px;
  margin: 16px 0 0;
}

.notice.compact {
  margin-bottom: 0;
}

.panel-note {
  color: var(--muted);
  margin: -6px 0 14px;
}

.panel-note.tight {
  margin: 2px 0 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.icon-actions {
  min-width: 124px;
}

.icon-actions form {
  margin: 0;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 6px;
  line-height: 1;
}

.icon-button.button-secondary {
  padding: 0;
}

.icon-button.button-danger {
  border-color: var(--danger);
  background: #fff;
  color: var(--danger);
}

.inline-form {
  display: flex;
  align-items: end;
  gap: 8px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.context-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.inline-form label {
  min-width: 110px;
}

.tabs a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  text-decoration: none;
}

.tabs a.active {
  background: var(--brand-primary, var(--accent-dark));
  border-color: var(--brand-primary, var(--accent-dark));
  color: #fff;
}

.flag-row,
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 40px;
  border-bottom: 1px solid var(--line);
}

.flag-row:last-child,
.setting-row:last-child {
  border-bottom: 0;
}

.ok {
  color: var(--ok);
}

.danger {
  color: var(--danger);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.simple-table-wrap {
  overflow-x: visible;
}

.simple-messages-table {
  table-layout: fixed;
  width: 100%;
}

.simple-messages-table th,
.simple-messages-table td {
  overflow-wrap: anywhere;
  vertical-align: top;
}

.simple-messages-table .subject {
  width: 24%;
}

.compact-reason {
  max-width: 28ch;
}

.purpose-line {
  margin-top: -6px;
}

.advanced-filters,
.advanced-details {
  margin: 14px 0 18px;
}

.advanced-filters summary,
.advanced-details summary {
  cursor: pointer;
  font-weight: 700;
}

.filters,
.feedback-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.feedback-form {
  grid-template-columns: 1fr;
}

.dense-filters {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.domain-editor {
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 14px;
  padding: 12px;
}

.domain-editor-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.domain-editor-form {
  margin-bottom: 10px;
}

.confidence-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.confidence-low {
  background: #fff1f2;
  color: #991b1b;
}

.confidence-medium {
  background: #fff7ed;
  color: #9a3412;
}

.confidence-high {
  background: #e8f5ef;
  color: #14532d;
}

.confidence-unknown {
  background: var(--surface-muted);
  color: var(--muted);
}

.rule-builder-form {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 14px;
  align-items: start;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
}

legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 0 6px;
  text-transform: uppercase;
}

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

.context-panel {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.context-panel h2 {
  margin-bottom: 10px;
}

.compact-list {
  gap: 6px 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 9px 10px;
  text-transform: none;
}

.rule-builder-form input,
.rule-builder-form select,
.rule-builder-form textarea {
  padding: 7px 9px;
}

input:disabled,
textarea:disabled {
  background: var(--surface-muted);
  color: var(--muted);
}

.required-label {
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
}

textarea {
  resize: vertical;
}

button,
.button-primary,
.button-secondary,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 38px;
  border: 1px solid var(--brand-primary, var(--accent-dark));
  border-radius: 6px;
  background: var(--brand-primary, var(--accent-dark));
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 8px 12px;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.button-primary,
.btn-primary {
  border-color: var(--brand-primary, var(--accent-dark));
  background: var(--brand-primary, var(--accent-dark));
  color: #fff;
}

.button-secondary,
.btn-secondary,
.btn-outline {
  background: #fff;
  color: var(--brand-primary, var(--accent-dark));
}

.btn-outline {
  border-color: var(--line);
}

.button-danger,
.btn-danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.btn-small {
  min-width: 96px;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.btn-icon {
  min-width: 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.action-group,
.table-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.action-group {
  align-items: center;
}

.table-actions {
  justify-content: flex-end;
  min-width: 220px;
}

.table-actions .btn,
.table-actions .button-primary,
.table-actions .button-secondary {
  flex: 0 0 auto;
}

.tenant-table-actions {
  gap: 6px;
  justify-content: flex-end;
}

.tenant-action-button {
  min-width: 68px;
  padding-inline: 8px;
}

.users-mailboxes-wrap {
  overflow-x: visible;
}

.users-mailboxes-table {
  table-layout: fixed;
  width: 100%;
}

.users-mailboxes-table th,
.users-mailboxes-table td {
  overflow-wrap: anywhere;
  vertical-align: top;
}

.users-mailboxes-table th:nth-child(1) {
  width: 28%;
}

.users-mailboxes-table th:nth-child(2),
.users-mailboxes-table th:nth-child(3),
.users-mailboxes-table th:nth-child(4) {
  width: 21%;
}

.users-mailboxes-table th:nth-child(5) {
  width: 9%;
}

.user-cell,
.sync-cell,
.status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.cell-title,
.cell-detail {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.provider-user-heading {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}

.provider-user-heading .cell-title {
  min-width: 0;
}

.provider-sync-tabs {
  margin-top: 8px;
}

.user-filter-toolbar {
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px;
}

.filter-group {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  min-width: 0;
}

.filter-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.filter-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  padding: 6px 9px;
  text-decoration: none;
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--theme-primary-soft, var(--brand-soft));
  border-color: var(--theme-primary, var(--brand-primary));
  color: var(--theme-primary-dark, var(--brand-primary));
}

.filter-sort-form label {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  font-weight: 900;
  gap: 6px;
  text-transform: uppercase;
}

.filter-sort-form select {
  min-height: 32px;
  min-width: 190px;
}

.filter-summary {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
  min-height: 32px;
}

.filter-summary a {
  font-size: 12px;
  font-weight: 800;
}

.setup-progress-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.workflow-tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
  padding: 10px 12px;
  text-decoration: none;
}

.workflow-tab small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.workflow-tab.active {
  background: var(--theme-primary-soft, var(--brand-soft));
  border-color: var(--theme-primary, var(--brand-primary));
  box-shadow: inset 0 0 0 1px var(--theme-primary, var(--brand-primary));
}

.workflow-tab.active span {
  color: var(--theme-primary-dark, var(--brand-primary));
  font-weight: 900;
}

.compact-workflow-check {
  min-height: auto;
}

.nested-panel {
  box-shadow: none;
  margin-top: 14px;
}

.provider-sync-indicator {
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 auto;
  height: 10px;
  width: 22px;
}

.provider-sync-syncing {
  background: #22c55e;
  border-color: #15803d;
}

.provider-sync-not_enabled {
  background: #facc15;
  border-color: #ca8a04;
}

.provider-sync-error {
  background: #ef4444;
  border-color: #b91c1c;
}

.provider-sync-not_linked {
  background: transparent;
  border-color: var(--muted);
}

.cell-detail {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.compact-actions {
  justify-content: flex-start;
  min-width: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
  white-space: normal;
}

.badge-success {
  background: #dcfce7;
  color: #14532d;
}

.badge-warning {
  background: #fff7ed;
  color: #9a3412;
}

.badge-muted {
  background: var(--surface-muted);
  color: var(--muted);
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #e0f2fe;
  color: #075985;
}

.detail-layout {
  align-items: start;
  margin-bottom: 20px;
}

.detail-list.wide {
  grid-template-columns: 160px minmax(0, 1fr);
}

.preview-text {
  margin: 0;
  white-space: pre-wrap;
}

.preview-box {
  margin: 0;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 12px;
}

.break-word {
  overflow-wrap: anywhere;
}

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

.summary-table {
  min-width: 0;
}

.wide-table {
  min-width: 1380px;
}

.table-check {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.table-check input,
.suggestion-select {
  width: auto;
  margin: 0;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  max-width: 360px;
}

.subject,
.details {
  min-width: 280px;
}

.warning-text {
  color: #8a5a00;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.truncate {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

  .page-header,
  .two-column,
  .form-grid,
  .form-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .mode-strip {
    justify-content: flex-start;
  }

  .users-mailboxes-table,
  .users-mailboxes-table thead,
  .users-mailboxes-table tbody,
  .users-mailboxes-table tr,
  .users-mailboxes-table th,
  .users-mailboxes-table td {
    display: block;
    width: 100%;
  }

  .users-mailboxes-table thead {
    display: none;
  }

  .users-mailboxes-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 8px 10px;
  }

  .users-mailboxes-table td {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 6px;
    grid-template-columns: minmax(92px, 32%) minmax(0, 1fr);
    padding: 9px 0;
  }

  .users-mailboxes-table td:last-child {
    border-bottom: 0;
  }

  .users-mailboxes-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .users-mailboxes-table .user-cell,
  .users-mailboxes-table .sync-cell,
  .users-mailboxes-table .status-stack {
    min-width: 0;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.role-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--theme-primary-soft, var(--accent-soft));
  color: var(--theme-primary-dark, var(--accent-dark));
  font-size: 12px;
  font-weight: 800;
  padding: 3px 9px;
  white-space: nowrap;
}

.tenant-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  min-width: 54px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: capitalize;
  white-space: nowrap;
}

.tenant-status-active {
  background: #dcfce7;
  color: #14532d;
}

.tenant-status-neutral {
  background: var(--surface-muted);
  color: var(--muted);
}

.safety-banner,
.intro-panel {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border: 1px solid #cfe5de;
  border-radius: var(--radius);
  background: #f2fbf8;
  margin-bottom: 20px;
  padding: 14px 16px;
}

.intro-panel {
  align-items: flex-start;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intro-panel h2 {
  font-size: 24px;
  margin-bottom: 6px;
}

.intro-panel p {
  color: var(--muted);
  margin: 0;
  max-width: 720px;
}

.message-card-list {
  display: grid;
  gap: 14px;
}

.message-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.65fr);
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}

.review-card {
  align-items: stretch;
}

.review-card-main {
  min-width: 0;
}

.review-card-reason {
  max-width: 78ch;
}

.review-card-meta {
  overflow-wrap: anywhere;
}

.review-card-status {
  margin-top: 10px;
}

.review-card-actions {
  align-content: start;
  align-items: stretch;
  display: grid;
  gap: 8px;
  justify-self: end;
  min-width: 260px;
  width: min(100%, 340px);
}

.review-card-actions form,
.review-card-actions a,
.review-card-actions button {
  width: 100%;
}

.bulk-review-toolbar {
  position: sticky;
  top: 14px;
  z-index: 5;
  border: 1px solid var(--theme-border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--theme-primary) 8%, #ffffff);
  box-shadow: var(--shadow);
  padding: 12px;
}

.bulk-review-form,
.bulk-review-actions,
.bulk-select-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bulk-review-form {
  justify-content: space-between;
}

.bulk-review-summary {
  display: grid;
  gap: 2px;
}

.bulk-review-summary span {
  color: var(--muted);
  font-size: 13px;
}

.bulk-review-actions button,
.bulk-select-row button {
  width: auto;
}

.bulk-select-row {
  margin-bottom: 12px;
}

.bulk-result-region {
  margin-bottom: 12px;
}

.bulk-training-groups {
  display: grid;
  gap: 16px;
}

.bulk-training-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}

.bulk-training-group-header {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.bulk-training-group-header h3 {
  font-size: 16px;
  margin: 0 0 4px;
}

.bulk-training-group-header button {
  flex: 0 0 auto;
}

.bulk-training-list {
  display: grid;
  gap: 10px;
}

.bulk-training-row {
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: grid;
  gap: 12px;
  grid-template-columns: 18px minmax(0, 1fr);
  padding: 12px;
}

.bulk-training-row:hover,
.bulk-training-row:has(input:focus-visible) {
  border-color: var(--theme-primary);
}

.bulk-training-row input {
  height: 16px;
  margin: 3px 0 0;
  width: 16px;
}

.bulk-training-row:has(input:checked) {
  background: var(--theme-primary-soft);
  border-color: var(--theme-primary);
}

.bulk-training-row.is-selected {
  background: var(--theme-primary-soft);
  border-color: var(--theme-primary);
}

.bulk-training-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.bulk-training-main strong,
.bulk-training-main span,
.bulk-training-main small {
  overflow-wrap: anywhere;
}

.bulk-training-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bulk-training-main small {
  color: var(--muted);
}

.review-action-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.message-card h3 {
  margin: 6px 0;
  font-size: 18px;
}

.message-card p {
  color: var(--muted);
  margin: 8px 0;
}

.message-meta {
  color: var(--muted);
  font-size: 13px;
}

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

.segmented-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-pill {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-transform: none;
}

.choice-pill input {
  width: auto;
}

.choice-pill span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 7px 10px;
}

.choice-pill input:checked + span {
  border-color: var(--accent-dark);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.status-critical {
  background: #fee2e2;
  color: #991b1b;
}

.status-important {
  background: #ffedd5;
  color: #9a3412;
}

.status-watch {
  background: #e0f2fe;
  color: #075985;
}

.status-needs-help {
  background: #fef3c7;
  color: #92400e;
}

.status-noise {
  background: #f1f5f9;
  color: #475569;
}

.status-unknown {
  background: #e2e8f0;
  color: #334155;
}

.empty-state,
.permission-denied {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.public-body {
  background: var(--bg);
}

.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(20px, 5vw, 72px);
}

.public-brand,
.public-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.public-brand {
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
}

.public-nav a {
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.hero-section,
.public-section {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(36px, 7vw, 86px) 24px;
}

.hero-section {
  min-height: 520px;
  display: flex;
  align-items: center;
}

.hero-copy {
  max-width: 760px;
}

.hero-copy h1 {
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1.02;
  margin-bottom: 16px;
}

.hero-copy p {
  color: var(--muted);
  font-size: 18px;
  max-width: 680px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: 28px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.feature-grid h3 {
  margin: 0 0 8px;
}

.feature-grid p {
  color: var(--muted);
  margin: 0;
}

.safety-check {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 800;
  padding: 16px;
}

.public-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.security-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

@media (max-width: 900px) {
  .topbar,
  .topbar-actions,
  .safety-banner,
  .intro-panel,
  .message-card,
  .login-layout,
  .public-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .review-card-actions {
    justify-self: stretch;
    width: 100%;
  }

  .bulk-training-group-header {
    display: grid;
  }

  .bulk-training-group-header button {
    width: 100%;
  }

  .account-meta {
    text-align: left;
  }

  .public-nav {
    flex-wrap: wrap;
  }

  .login-brand {
    align-items: flex-start;
    gap: 12px;
  }

  .login-logo-wrap.has-logo {
    width: min(210px, 52vw);
    min-height: 54px;
  }

  .login-logo {
    width: min(200px, 50vw);
  }
}

/* Helix~OA light shell, aligned to the Stitch simple training reference. */
.shell-light {
  grid-template-columns: 252px minmax(0, 1fr);
  background: #f5f7f9;
}

.app-sidebar {
  background: #fff;
  color: var(--text);
  border-right: 1px solid var(--line);
  height: 100vh;
  overflow-y: auto;
  padding: 20px 12px;
  position: sticky;
  top: 0;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #001f2a;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  margin: 2px 0 6px;
  text-decoration: none;
}

.wordmark-tilde {
  color: var(--theme-accent, var(--brand-accent));
}

.app-sidebar .brand-subtitle {
  color: #667384;
  font-size: 12px;
  margin-bottom: 28px;
}

.app-sidebar .nav {
  gap: 6px;
}

.app-sidebar .nav a {
  align-items: center;
  border-radius: 6px;
  color: #22313f;
  display: flex;
  font-weight: 700;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
}

.app-sidebar .nav a.active,
.app-sidebar .nav a:hover {
  background: var(--theme-primary-soft, var(--brand-soft, #d9e3ff));
  color: var(--theme-primary, var(--brand-primary, #25345d));
}

.nav-icon {
  color: #334155;
  display: inline-grid;
  font-size: 18px;
  place-items: center;
  width: 18px;
}

.app-content {
  padding: 0 28px 32px;
}

.app-topbar {
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  margin: 0 -28px 26px;
  min-height: 40px;
  padding: 0 20px;
}

.tenant-chip {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: flex;
  gap: 8px;
  min-height: 40px;
  padding: 6px 14px;
}

.tenant-chip .status-dot {
  background: var(--theme-accent, var(--brand-accent));
  width: 7px;
  height: 7px;
}

.topbar-status {
  display: flex;
  gap: 18px;
  min-height: 40px;
}

.topbar-status span {
  border-bottom: 2px solid transparent;
  color: #102133;
  display: grid;
  font-size: 12px;
  font-weight: 800;
  place-content: center;
}

.topbar-status span:first-child {
  border-bottom-color: var(--theme-primary, var(--brand-primary, #0b4f4a));
}

.topbar-status small {
  color: #334155;
  font-size: 11px;
  font-weight: 700;
}

.top-search {
  flex: 1;
  max-width: 260px;
}

.top-search input {
  background: #eef3fb;
  border-radius: 999px;
  height: 30px;
  padding: 5px 14px;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 12px;
}

.topbar-icon {
  color: #1f2937;
  font-weight: 800;
}

.avatar-dot {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--brand-primary, #0b4f4a);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.text-button {
  background: transparent;
  border: 0;
  color: var(--brand-primary, #001f2a);
  min-height: 0;
  padding: 0;
}

.app-topbar .account-meta {
  color: #334155;
  font-size: 12px;
}

.safety-banner {
  border-color: color-mix(in srgb, var(--brand-accent, #14b8a6) 28%, var(--line));
  border-radius: 8px;
  box-shadow: none;
}

.dashboard-hero {
  margin: 0 0 26px;
}

.dashboard-hero h1 {
  color: #001f2a;
  font-size: 28px;
  line-height: 1.15;
  margin: 0 0 8px;
}

.dashboard-hero p {
  color: #334155;
  margin: 0;
  max-width: 650px;
}

.qa-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.8fr) minmax(150px, 0.85fr) minmax(150px, 0.85fr);
  gap: 18px;
  margin-bottom: 26px;
}

.training-cta-card {
  background: #195955;
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: #fff;
  min-height: 190px;
  overflow: hidden;
  padding: 30px;
  position: relative;
}

.training-cta-card h2 {
  font-size: 20px;
  margin: 0 0 10px;
}

.training-cta-card p {
  color: #d7eeee;
  max-width: 430px;
}

.training-cta-card .button-primary {
  background: #fff;
  border-color: #fff;
  color: #073b3a;
  margin-top: 12px;
}

.training-watermark {
  bottom: -34px;
  color: rgba(255, 255, 255, 0.12);
  font-size: 112px;
  position: absolute;
  right: 10px;
}

.qa-dashboard-grid .metric {
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-height: 190px;
  padding: 24px;
}

.metric-alert {
  border-color: #e11d48;
}

.metric-alert span {
  align-self: start;
  background: #ffe4e6;
  border-radius: 999px;
  color: #be123c;
  display: inline-flex;
  padding: 6px 10px;
  text-transform: none;
}

.metric-suggestions span {
  background: #dbeafe;
  border-radius: 6px;
  color: #075985;
  display: inline-flex;
  padding: 6px 10px;
  text-transform: none;
}

.qa-dashboard-grid .metric strong {
  align-self: end;
  font-size: 42px;
}

.qa-dashboard-grid .metric small {
  color: #001f2a;
  font-size: 15px;
  font-weight: 800;
}

.mini-metric {
  min-height: 96px !important;
}

.mini-metric strong {
  font-size: 20px !important;
}

.dashboard-lower-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.6fr) minmax(260px, 0.8fr);
  gap: 22px;
}

.recent-actions-card,
.health-card {
  box-shadow: var(--shadow);
}

.training-action-list {
  display: grid;
}

.training-action-row {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 14px;
  padding: 14px 0;
}

.row-icon {
  background: #e9f2ff;
  border-radius: 999px;
  display: inline-grid;
  height: 34px;
  place-items: center;
  width: 34px;
}

.training-action-row p {
  color: #334155;
  margin: 2px 0 0;
}

.health-card {
  display: grid;
  gap: 14px;
}

.health-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.health-row strong {
  color: #10b981;
}

.health-bar {
  background: #e2e8f0;
  border-radius: 999px;
  height: 7px;
  overflow: hidden;
}

.health-bar span {
  background: #35c896;
  display: block;
  height: 100%;
}

.health-bar.dark span {
  background: #0b4f4a;
}

@media (max-width: 1100px) {
  .qa-dashboard-grid,
  .dashboard-lower-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .shell-light {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
  }

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

  .app-content {
    padding: 0 16px 24px;
  }

  .app-topbar {
    margin: 0 -16px 20px;
    padding: 12px 16px;
  }
}

.suggestion-corrections {
  align-items: stretch;
  margin-top: 0.5rem;
}

.correction-label {
  color: var(--muted-text, #64748b);
  font-size: 0.85rem;
  margin-right: 0.25rem;
}


.brand-logo {
  display: block;
  width: min(190px, 100%);
  height: auto;
  max-height: 56px;
  object-fit: contain;
  aspect-ratio: auto;
  flex: 0 1 auto;
}

.brand-fallback-mark {
  display: inline-block;
  flex: 0 0 auto;
  color: var(--brand-primary, #0f766e);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.tenant-brand-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
}

.tenant-brand-preview-logo {
  display: block;
  width: min(220px, 100%);
  max-height: 72px;
  object-fit: contain;
}

.wordmark span:first-child {
  color: var(--brand-primary, currentColor);
}

.button-primary {
  background: var(--brand-primary, #0f766e);
}

.status-dot {
  background: var(--brand-accent, #14b8a6);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

[hidden] {
  display: none !important;
}

.modal-card {
  width: min(520px, 100%);
  background: #fff;
  color: #0f172a;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.35);
}

.message-review-modal-card {
  max-height: min(86vh, 860px);
  overflow: auto;
  width: min(760px, 100%);
}

.modal-review-actions {
  justify-self: stretch;
  margin-top: 16px;
  width: 100%;
}

.app-modal {
  display: flex;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.license-modal-card {
  width: min(680px, 100%);
  border-radius: 8px;
}

.compact-metrics {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  margin-bottom: 14px;
}

.mini-metric {
  min-height: 74px;
  padding: 12px;
}

.mini-metric strong {
  font-size: 22px;
}

.alert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.license-form {
  margin-top: 16px;
}

.modal-card h2 {
  margin-top: 0;
}

.logo-preview-modal {
  width: min(640px, 100%);
}

.logo-preview-frame {
  display: grid;
  place-items: center;
  min-height: 180px;
  margin: 16px 0;
  padding: 28px;
  border-radius: 8px;
  background: var(--sidebar);
}

.logo-preview-frame img {
  max-width: min(420px, 100%);
  max-height: 180px;
  object-fit: contain;
}

.syncing-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
  color: var(--theme-primary, var(--brand-primary));
  font-weight: 700;
}

.sync-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, var(--theme-primary, var(--brand-primary)) 25%, transparent);
  border-top-color: var(--theme-primary, var(--brand-primary));
  border-radius: 50%;
  animation: sync-spin 0.8s linear infinite;
}

@keyframes sync-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
