:root {
  color-scheme: light;
  --topbar-height: 56px;
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 92px;
  --bg: #f4f7fb;
  --bg-top: #f7f9fd;
  --bg-glow: rgba(54, 93, 252, 0.12);
  --bg-grid: rgba(148, 163, 184, 0.08);
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --panel-soft: rgba(255, 255, 255, 0.78);
  --panel-subtle: rgba(255, 255, 255, 0.86);
  --panel-elevated: #fbfcff;
  --line: #e5ebf5;
  --line-strong: rgba(229, 235, 245, 0.9);
  --text: #182133;
  --muted: #68768d;
  --muted-strong: #516073;
  --primary: #365dfc;
  --primary-strong: #5a78ff;
  --primary-soft: rgba(54, 93, 252, 0.12);
  --primary-soft-2: rgba(54, 93, 252, 0.09);
  --primary-soft-3: rgba(54, 93, 252, 0.08);
  --primary-line: rgba(54, 93, 252, 0.18);
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.12);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);
  --topbar-bg: rgba(248, 250, 255, 0.82);
  --topbar-bg-strong: rgba(248, 250, 255, 0.9);
  --sidebar-bg: rgba(248, 250, 255, 0.92);
  --secondary-bg: #eef3ff;
  --secondary-text: var(--primary);
  --secondary-bg-hover: #e6eeff;
  --input-bg: rgba(255, 255, 255, 0.96);
  --input-border-hover: rgba(54, 93, 252, 0.22);
  --hover-soft: rgba(54, 93, 252, 0.06);
  --row-hover: rgba(54, 93, 252, 0.04);
  --radius: 14px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #040507;
  --bg-top: #080a0f;
  --bg-glow: rgba(91, 140, 255, 0.12);
  --bg-grid: rgba(148, 163, 184, 0.09);
  --panel: rgba(11, 14, 19, 0.94);
  --panel-solid: #0d1015;
  --panel-soft: rgba(15, 19, 25, 0.92);
  --panel-subtle: rgba(17, 22, 29, 0.95);
  --panel-elevated: #121722;
  --line: #1b2330;
  --line-strong: rgba(42, 52, 68, 0.92);
  --text: #f3f7ff;
  --muted: #91a0b5;
  --muted-strong: #dce5f4;
  --primary: #7ba2ff;
  --primary-strong: #96b6ff;
  --primary-soft: rgba(123, 162, 255, 0.18);
  --primary-soft-2: rgba(123, 162, 255, 0.14);
  --primary-soft-3: rgba(123, 162, 255, 0.11);
  --primary-line: rgba(123, 162, 255, 0.22);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.14);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.16);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.16);
  --topbar-bg: rgba(5, 7, 10, 0.9);
  --topbar-bg-strong: rgba(5, 7, 10, 0.94);
  --sidebar-bg: rgba(6, 8, 12, 0.97);
  --secondary-bg: #111722;
  --secondary-text: #e8efff;
  --secondary-bg-hover: #171f2d;
  --input-bg: rgba(13, 17, 23, 0.96);
  --input-border-hover: rgba(123, 162, 255, 0.28);
  --hover-soft: rgba(123, 162, 255, 0.08);
  --row-hover: rgba(123, 162, 255, 0.06);
}

:root[data-sidebar-collapsed="true"] {
  --sidebar-width: var(--sidebar-collapsed-width);
}

[hidden] {
  display: none !important;
}

:root[data-theme="system"][data-resolved-theme="dark"] {
  color-scheme: dark;
  --bg: #040507;
  --bg-top: #080a0f;
  --bg-glow: rgba(91, 140, 255, 0.12);
  --bg-grid: rgba(148, 163, 184, 0.09);
  --panel: rgba(11, 14, 19, 0.94);
  --panel-solid: #0d1015;
  --panel-soft: rgba(15, 19, 25, 0.92);
  --panel-subtle: rgba(17, 22, 29, 0.95);
  --panel-elevated: #121722;
  --line: #1b2330;
  --line-strong: rgba(42, 52, 68, 0.92);
  --text: #f3f7ff;
  --muted: #91a0b5;
  --muted-strong: #dce5f4;
  --primary: #7ba2ff;
  --primary-strong: #96b6ff;
  --primary-soft: rgba(123, 162, 255, 0.18);
  --primary-soft-2: rgba(123, 162, 255, 0.14);
  --primary-soft-3: rgba(123, 162, 255, 0.11);
  --primary-line: rgba(123, 162, 255, 0.22);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.14);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.16);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.16);
  --topbar-bg: rgba(5, 7, 10, 0.9);
  --topbar-bg-strong: rgba(5, 7, 10, 0.94);
  --sidebar-bg: rgba(6, 8, 12, 0.97);
  --secondary-bg: #111722;
  --secondary-text: #e8efff;
  --secondary-bg-hover: #171f2d;
  --input-bg: rgba(13, 17, 23, 0.96);
  --input-border-hover: rgba(123, 162, 255, 0.28);
  --hover-soft: rgba(123, 162, 255, 0.08);
  --row-hover: rgba(123, 162, 255, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"]:not([data-resolved-theme]) {
    color-scheme: dark;
    --bg: #040507;
    --bg-top: #080a0f;
    --bg-glow: rgba(91, 140, 255, 0.12);
    --bg-grid: rgba(148, 163, 184, 0.09);
    --panel: rgba(11, 14, 19, 0.94);
    --panel-solid: #0d1015;
    --panel-soft: rgba(15, 19, 25, 0.92);
    --panel-subtle: rgba(17, 22, 29, 0.95);
    --panel-elevated: #121722;
    --line: #1b2330;
    --line-strong: rgba(42, 52, 68, 0.92);
    --text: #f3f7ff;
    --muted: #91a0b5;
    --muted-strong: #dce5f4;
    --primary: #7ba2ff;
    --primary-strong: #96b6ff;
    --primary-soft: rgba(123, 162, 255, 0.18);
    --primary-soft-2: rgba(123, 162, 255, 0.14);
    --primary-soft-3: rgba(123, 162, 255, 0.11);
    --primary-line: rgba(123, 162, 255, 0.22);
    --success: #4ade80;
    --success-soft: rgba(74, 222, 128, 0.14);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.16);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.16);
    --topbar-bg: rgba(5, 7, 10, 0.9);
    --topbar-bg-strong: rgba(5, 7, 10, 0.94);
    --sidebar-bg: rgba(6, 8, 12, 0.97);
    --secondary-bg: #111722;
    --secondary-text: #e8efff;
    --secondary-bg-hover: #171f2d;
    --input-bg: rgba(13, 17, 23, 0.96);
    --input-border-hover: rgba(123, 162, 255, 0.28);
    --hover-soft: rgba(123, 162, 255, 0.08);
    --row-hover: rgba(123, 162, 255, 0.06);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--bg-glow), transparent 28%),
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%);
  background-size: auto, 24px 24px, 24px 24px, auto;
  background-position: 0 0, 0 0, 0 0, 0 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

p {
  margin: 0;
  line-height: 1.7;
}

h1,
h2,
h3,
strong {
  margin: 0;
}

code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--primary-soft-3);
  color: var(--primary);
  font-family: "SFMono-Regular", SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.auth-body,
.setup-body {
  min-height: 100vh;
  display: grid;
  align-items: center;
}

.auth-shell {
  width: min(100%, 392px);
  margin: 0 auto;
  padding: 12px 0;
  display: grid;
  gap: 10px;
  align-content: center;
}

.auth-shell-wide {
  width: min(100%, 980px);
}

.setup-toolbar,
.auth-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-toolbar {
  margin-bottom: 10px;
  min-height: 32px;
  gap: 6px;
}

.setup-card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-solid) 100%);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 22px;
  align-self: center;
}

.auth-brand-head {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
}

.auth-brand-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: 0 0 18px;
}

.console-body {
  min-height: 100vh;
}

.console-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 0 18px 18px;
  overflow: hidden;
  border-right: 1px solid var(--line-strong);
  background: var(--sidebar-bg);
  backdrop-filter: blur(18px);
}

.sidebar-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 22px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  margin: 0 -18px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-strong);
  overflow: hidden;
}

.sidebar-brand-logo {
  width: 30px;
  height: 30px;
  display: block;
  flex: 0 0 30px;
  object-fit: contain;
}

.sidebar-brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  transition: opacity 0.18s ease, width 0.18s ease;
}

.sidebar-brand-copy strong {
  display: block;
  font-size: 15px;
  line-height: 1.1;
}

.sidebar-brand-copy small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.sidebar-nav {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  gap: 6px;
  overflow-y: auto;
  padding-right: 6px;
  margin-right: -6px;
  scrollbar-width: thin;
}

.sidebar-nav-section {
  display: grid;
  gap: 8px;
}

.sidebar-nav-title {
  padding: 6px 12px 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav-items {
  display: grid;
  gap: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease, padding 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.sidebar-link::before {
  content: none;
}

.sidebar-link-icon {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 15px;
  color: currentColor;
}

.sidebar-link-icon svg {
  width: 15px;
  height: 15px;
  display: block;
  stroke: currentColor;
}

.sidebar-link-label {
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.18s ease, width 0.18s ease;
}

.sidebar-link:hover,
.sidebar-link.active,
.sidebar-link.is-pending,
.sidebar-link:active,
.sidebar-link:focus-visible {
  background: var(--primary-soft);
  color: var(--primary);
}

.sidebar-link:focus {
  outline: none;
}

.sidebar-user {
  flex: 0 0 auto;
  padding: 14px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--panel-soft), var(--panel-subtle));
  border: 1px solid var(--line-strong);
  display: grid;
  gap: 10px;
}

.sidebar-user-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-link {
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
  padding: 2px;
  margin: -2px;
  transition: background 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}

.sidebar-user-link:hover {
  background: var(--hover-soft);
}

.sidebar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--panel-elevated) url("/static/images/default-avatar.png") center / cover no-repeat;
  border: 1px solid var(--line);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar-avatar span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: color-mix(in srgb, var(--panel-elevated) 88%, transparent 12%);
}

.sidebar-user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.sidebar-user-actions form {
  display: flex;
  margin: 0 0 0 auto;
}

.sidebar-user-actions .icon-switch {
  width: 34px;
  height: 34px;
}

.sidebar-user-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.sidebar-user-meta strong {
  display: block;
  font-size: 13px;
  line-height: 1.2;
}

.sidebar-user-meta small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-actions .icon-switch:not(.sidebar-logout) {
  color: var(--muted-strong);
}

.sidebar-user-actions .icon-switch:not(.sidebar-logout):hover,
.sidebar-user-actions .icon-switch:not(.sidebar-logout):focus-visible {
  color: var(--text);
}

.sidebar-user-actions .language-switch {
  min-width: 56px;
  padding: 0 9px;
}

.sidebar-logout,
.sidebar-user-actions .sidebar-logout,
.sidebar-user-actions .sidebar-logout svg {
  color: var(--danger);
}

.sidebar-user-actions form[data-logout-form],
.sidebar-user-actions form[data-logout-form] .sidebar-logout {
  pointer-events: auto;
}

.sidebar-logout svg {
  display: block;
  width: 16px;
  height: 16px;
}

.sidebar-logout:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.sidebar-logout:focus-visible {
  outline-color: var(--danger-soft);
}

.page {
  width: 100%;
  padding: 0;
  display: grid;
  grid-template-rows: auto auto;
  min-width: 0;
  align-content: start;
}

.icon-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.16s ease;
}

.icon-switch:hover {
  color: var(--primary);
  background: var(--hover-soft);
}

.icon-switch:focus-visible {
  outline: 3px solid var(--primary-soft);
  outline-offset: 0;
}

.icon-switch-glyph {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-switch-glyph svg {
  display: block;
  width: 16px;
  height: 16px;
  color: inherit;
}

[data-theme-icon] svg {
  display: none;
}

.icon-switch[data-current-theme="light"] [data-theme-icon-mode="light"],
.icon-switch[data-current-theme="dark"] [data-theme-icon-mode="dark"] {
  display: block;
}

.icon-switch[data-current-theme="system"][data-resolved-theme="light"] [data-theme-icon-mode="light"],
.icon-switch[data-current-theme="system"][data-resolved-theme="dark"] [data-theme-icon-mode="dark"] {
  display: block;
}

[data-theme-toggle],
[data-theme-toggle] .icon-switch-glyph,
[data-theme-toggle] .icon-switch-glyph svg {
  color: inherit;
}

.language-switch {
  width: auto;
  min-width: 54px;
  padding: 0 10px;
}

.language-glyph {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.language-glyph [data-language-mode] {
  color: var(--muted);
  transition: color 0.2s ease, opacity 0.2s ease;
  opacity: 0.55;
}

.language-divider {
  color: var(--muted);
  opacity: 0.5;
  font-size: 10px;
}

.language-switch[data-current-locale="zh"] [data-language-mode="zh"],
.language-switch[data-current-locale="en"] [data-language-mode="en"] {
  color: var(--primary);
  opacity: 1;
}

.auth-toolbar .icon-switch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, transparent 8%);
  color: var(--muted);
}

.auth-toolbar .language-switch {
  min-width: 50px;
  padding: 0 8px;
}

.auth-toolbar .icon-switch:hover {
  background: var(--hover-soft);
  color: var(--primary);
}

.section-title p,
.panel-head p,
.metric-card small,
.info-card p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.content-topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--topbar-bg-strong);
  backdrop-filter: blur(18px);
}

.content-topbar-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-topbar-title {
  min-width: 0;
}

.content-topbar h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.15;
}

.content-topbar p {
  color: var(--muted);
  font-size: 11px;
}

.content-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--primary-soft-2);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
}

.content-topbar-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-left: auto;
}

.sidebar-toggle {
  flex-shrink: 0;
}

.sidebar-toggle-glyph svg {
  display: none;
}

.content-topbar .sidebar-toggle,
.content-topbar .sidebar-toggle .sidebar-toggle-glyph,
.content-topbar .sidebar-toggle .sidebar-toggle-glyph svg {
  color: var(--muted-strong);
}

.content-topbar .sidebar-toggle:hover,
.content-topbar .sidebar-toggle:focus-visible,
.content-topbar .sidebar-toggle:hover .sidebar-toggle-glyph,
.content-topbar .sidebar-toggle:focus-visible .sidebar-toggle-glyph,
.content-topbar .sidebar-toggle:hover .sidebar-toggle-glyph svg,
.content-topbar .sidebar-toggle:focus-visible .sidebar-toggle-glyph svg {
  color: var(--text);
}

.sidebar-toggle[data-collapsed="false"] [data-sidebar-icon="collapse"],
.sidebar-toggle[data-collapsed="true"] [data-sidebar-icon="expand"] {
  display: block;
}

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

.content-topbar-actions .topbar-help-action,
.content-topbar-actions .topbar-help-action .icon-switch-glyph,
.content-topbar-actions .topbar-help-action .icon-switch-glyph svg {
  color: var(--muted-strong);
}

.content-topbar-actions .topbar-help-action:hover,
.content-topbar-actions .topbar-help-action:focus-visible,
.content-topbar-actions .topbar-help-action:hover .icon-switch-glyph,
.content-topbar-actions .topbar-help-action:focus-visible .icon-switch-glyph,
.content-topbar-actions .topbar-help-action:hover .icon-switch-glyph svg,
.content-topbar-actions .topbar-help-action:focus-visible .icon-switch-glyph svg {
  color: var(--text);
}

.topbar-tutorial-action,
.topbar-secondary-action {
  order: 98;
}

.topbar-primary-action {
  order: 99;
}

.page-flow {
  padding: 20px 22px;
  display: grid;
  gap: 16px;
  align-items: start;
  align-content: start;
  grid-auto-rows: max-content;
  min-height: 0;
}

.page-flow > * {
  align-self: start;
}

.page-flow .alert {
  margin-bottom: 0;
}

.section-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.section-tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-tabs-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

.audit-filter-action {
  position: relative;
  color: var(--muted-strong);
}

.audit-filter-action:hover,
.audit-filter-action:focus-visible {
  color: var(--text);
}

.audit-filter-action.is-active {
  color: var(--primary);
  background: var(--primary-soft-2);
}

.audit-filter-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 2px var(--panel-solid);
}

.section-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-subtle);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.section-tab:hover,
.section-tab:focus-visible {
  color: var(--primary);
  border-color: var(--primary-line);
  background: var(--primary-soft-2);
}

.section-tab.active,
.section-tab[aria-selected="true"] {
  color: var(--primary);
  border-color: var(--primary-line);
  background: var(--primary-soft-2);
}

.dashboard-guide-panel {
  display: grid;
  gap: 14px;
}

.page-intro {
  display: grid;
  gap: 12px;
}

.page-intro-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.page-intro-copy h2 {
  font-size: 18px;
  line-height: 1.15;
  margin: 0;
}

.page-intro-copy p {
  margin-top: 6px;
  max-width: 680px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.page-intro-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-intro-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-intro-compact {
  gap: 10px;
}

.page-intro-compact .page-intro-copy h2 {
  font-size: 16px;
}

.dashboard-step-list {
  display: grid;
  gap: 10px;
}

.dashboard-step-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
}

.dashboard-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 10px;
  background: var(--primary-soft-2);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}

.dashboard-step-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.dashboard-step-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-step-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-step-copy h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
}

.dashboard-step-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

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

.dashboard-summary-panel {
  padding-top: 14px;
  padding-bottom: 14px;
}

.dashboard-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.dashboard-summary-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel-subtle) 88%, var(--panel-solid) 12%);
}

.dashboard-summary-item strong {
  display: block;
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.dashboard-summary-item small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.dashboard-guide-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.dashboard-guide-head h2 {
  font-size: 19px;
  line-height: 1.15;
}

.dashboard-guide-head p {
  margin-top: 6px;
  max-width: 640px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

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

.dashboard-overview-grid,
.integration-relationship-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.dashboard-guide-card,
.dashboard-overview-card,
.integration-relationship-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel-solid) 88%, var(--panel-subtle) 12%);
  overflow: hidden;
}

.audit-inventory-link {
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.audit-inventory-link:hover,
.audit-inventory-link:focus-visible {
  border-color: var(--primary-line);
  background: color-mix(in srgb, var(--primary-soft-2) 42%, var(--panel-solid) 58%);
}

.audit-inventory-link.is-active {
  border-color: var(--primary-line);
}

.audit-inventory-stack {
  display: grid;
  gap: 14px;
}

.audit-inventory-block {
  display: grid;
  gap: 10px;
}

.audit-inventory-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.audit-inventory-card {
  gap: 10px;
}

.audit-inventory-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.audit-inventory-title {
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-inventory-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.dashboard-guide-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dashboard-guide-step,
.dashboard-guide-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}

.dashboard-guide-step {
  background: var(--primary-soft-2);
  color: var(--primary);
}

.dashboard-guide-status {
  background: var(--secondary-bg);
  color: var(--secondary-text);
}

.dashboard-guide-status.is-ready {
  background: var(--success-soft);
  color: var(--success);
}

.dashboard-guide-card h3,
.dashboard-overview-card h3,
.integration-relationship-card h3 {
  font-size: 13px;
  line-height: 1.35;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-guide-card p,
.dashboard-overview-card p,
.integration-relationship-card p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.dashboard-guide-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.dashboard-guide-meta span,
.dashboard-overview-label {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--primary-soft-3);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
}

.dashboard-guide-links,
.dashboard-guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.integration-subsection {
  display: grid;
  gap: 12px;
  padding-top: 6px;
}

:root[data-sidebar-collapsed="true"] .sidebar {
  padding-left: 12px;
  padding-right: 12px;
}

:root[data-sidebar-collapsed="true"] .sidebar-inner {
  gap: 14px;
}

:root[data-sidebar-collapsed="true"] .sidebar-brand {
  justify-content: center;
  gap: 0;
  margin-left: -12px;
  margin-right: -12px;
  padding-left: 12px;
  padding-right: 12px;
}

:root[data-sidebar-collapsed="true"] .sidebar-brand-copy,
:root[data-sidebar-collapsed="true"] .sidebar-nav-title,
:root[data-sidebar-collapsed="true"] .sidebar-link-label,
:root[data-sidebar-collapsed="true"] .sidebar-user-meta {
  width: 0;
  opacity: 0;
  overflow: hidden;
}

:root[data-sidebar-collapsed="true"] .sidebar-nav-section {
  gap: 4px;
}

:root[data-sidebar-collapsed="true"] .sidebar-nav-title {
  padding: 0;
  min-height: 0;
  font-size: 0;
}

:root[data-sidebar-collapsed="true"] .sidebar-nav {
  justify-items: center;
  padding-right: 0;
  margin-right: 0;
}

:root[data-sidebar-collapsed="true"] .sidebar-nav-items {
  justify-items: center;
}

:root[data-sidebar-collapsed="true"] .sidebar-link {
  justify-content: center;
  gap: 0;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding-left: 0;
  padding-right: 0;
  margin-inline: auto;
}

:root[data-sidebar-collapsed="true"] .sidebar-user {
  padding: 10px 8px;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

:root[data-sidebar-collapsed="true"] .sidebar-user-head,
:root[data-sidebar-collapsed="true"] .sidebar-user-link {
  width: 100%;
  justify-content: center;
}

:root[data-sidebar-collapsed="true"] .sidebar-user-actions {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

:root[data-sidebar-collapsed="true"] .sidebar-user-actions .icon-switch,
:root[data-sidebar-collapsed="true"] .sidebar-user-actions form {
  margin-inline: auto;
}

:root[data-sidebar-collapsed="true"] .sidebar-user-actions .icon-switch {
  width: 36px;
  height: 36px;
}

:root[data-sidebar-collapsed="true"] .sidebar-user-actions .icon-switch-glyph,
:root[data-sidebar-collapsed="true"] .sidebar-user-actions .language-glyph {
  width: 100%;
  justify-content: center;
}

:root[data-sidebar-collapsed="true"] .sidebar-user-actions .language-switch {
  width: 36px;
  min-width: 36px;
  padding: 0;
}

:root[data-sidebar-collapsed="true"] .sidebar-user-actions .language-glyph {
  gap: 0;
}

:root[data-sidebar-collapsed="true"] .sidebar-user-actions .language-divider,
:root[data-sidebar-collapsed="true"] .sidebar-user-actions .language-switch[data-current-locale="zh"] [data-language-mode="en"],
:root[data-sidebar-collapsed="true"] .sidebar-user-actions .language-switch[data-current-locale="en"] [data-language-mode="zh"] {
  display: none;
}

:root[data-sidebar-collapsed="true"] .sidebar-user-actions .language-switch[data-current-locale="en"] [data-language-mode="en"] {
  font-size: 10px;
  letter-spacing: 0;
}

:root[data-sidebar-collapsed="true"] .sidebar-user-actions form {
  margin: 0;
}

.auth-card,
.panel,
.metric-card,
.form-section,
.info-card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-solid) 100%);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.auth-card,
.panel,
.metric-card,
.info-card {
  border-radius: var(--radius);
}

.auth-card {
  width: 100%;
  padding: 24px 18px 22px;
}

.hero-banner {
  margin-bottom: 18px;
}

.auth-card-login .hero-banner {
  margin-bottom: 14px;
}

.auth-login-hero {
  display: flex;
  justify-content: center;
  align-items: center;
}

.info-card {
  margin-top: 18px;
  padding: 14px;
}

.info-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.stack-lg {
  display: grid;
  gap: 18px;
}

.form-section {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius);
}

.section-title h2,
.panel-head h2 {
  font-size: 16px;
  margin-bottom: 4px;
}

.grid {
  display: grid;
  gap: 12px;
}

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

label {
  display: grid;
  gap: 4px;
}

label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.input {
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  line-height: 1.4;
  outline: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.input:hover {
  border-color: var(--input-border-hover);
}

.input:focus {
  border-color: var(--line);
  outline: none;
}

select.input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 1px),
    calc(100% - 13px) calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

select.input option {
  color: var(--text);
  background: var(--panel);
  font-size: 11px;
}

.textarea {
  resize: vertical;
  min-height: 104px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  border-radius: 8px;
  min-height: 36px;
  padding: 8px 12px;
  font: inherit;
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}

.btn:hover {
  transform: none;
}

.btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
}

.btn-secondary {
  background: var(--secondary-bg);
  color: var(--secondary-text);
}

.btn-secondary:hover {
  background: var(--secondary-bg-hover);
}

.btn-block {
  width: 100%;
}

.btn-compact {
  min-height: 32px;
  padding: 6px 11px;
  font-size: 11px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check input {
  margin: 0;
}

.check span {
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}

.auth-card .panel-head {
  margin-bottom: 14px;
  justify-content: center;
  text-align: center;
}

.auth-card .panel-head > div {
  width: 100%;
}

.auth-card .panel-head h2 {
  font-size: 16px;
  line-height: 1.2;
  margin: 0;
}

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

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

.auth-form {
  gap: 10px;
}

.auth-mode-panel {
  display: grid;
  gap: 12px;
}

.auth-field {
  display: grid;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--input-bg) 92%, var(--panel) 8%);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.auth-input-wrap:hover,
.auth-input-wrap:focus-within {
  border-color: var(--line);
}

.auth-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  pointer-events: none;
  z-index: 1;
}

.auth-input-icon svg {
  width: 16px;
  height: 16px;
}

.auth-input {
  box-sizing: border-box;
  min-width: 0;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 8px 12px 8px 44px !important;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 400;
  text-indent: 0;
}

.auth-input:hover,
.auth-input:focus {
  border-color: transparent;
}

.auth-input::placeholder {
  opacity: 0.72;
  font-weight: 400;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 400;
}

.check-row span {
  font-size: 12px;
  font-weight: 400;
}

.check-input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary);
}

.form-stack .auth-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  margin-top: 2px;
}

.auth-remember span {
  line-height: 1;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.auth-actions {
  justify-content: center;
  margin-top: 2px;
}

.auth-submit {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--primary-strong) 72%, #000 28%);
  background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary-strong) 82%, #000 18%) 100%);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.auth-submit:hover {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 88%, #fff 12%) 0%, var(--primary-strong) 100%);
}

.auth-submit:active {
  transform: translateY(0);
}

.auth-extra-actions {
  margin-top: 0;
}

.auth-secondary-submit {
  width: 100%;
  min-height: 38px;
  border-radius: 8px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.metric-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  align-self: start;
  background: color-mix(in srgb, var(--panel-solid) 92%, var(--panel-subtle) 8%);
  overflow: hidden;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card strong {
  display: block;
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-card-compact {
  gap: 7px;
  padding: 13px;
}

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

.role-resource-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}

.role-resource-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.role-resource-card-code {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  text-align: left;
}

.resource-card-compact h3 {
  font-size: 12px;
  margin: 0;
  white-space: normal;
  word-break: break-word;
}

.resource-card-compact p {
  display: none;
}

.role-resource-card .dashboard-guide-meta {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}

.role-resource-card .dashboard-guide-meta span {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  justify-content: flex-start;
  white-space: normal;
  word-break: break-word;
  text-align: left;
}

.role-resource-card .dashboard-guide-links {
  justify-content: flex-start;
  margin-top: auto;
}

.resource-card-compact .dashboard-guide-meta {
  gap: 5px 6px;
}

.resource-card-compact .dashboard-guide-links {
  gap: 6px;
}

.panel {
  border-radius: var(--radius);
  padding: 16px;
  align-self: start;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-toolbar h2 {
  font-size: 14px;
  line-height: 1.2;
}

.section-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section-toolbar > .section-toolbar-actions:only-child {
  margin-left: auto;
}

.data-health-generated-at {
  margin: 0 0 12px;
}

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

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-actions form {
  display: flex;
}

.department-tree-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding-left: calc(var(--department-depth, 0) * 18px);
}

.department-tree-entry.is-root {
  padding-left: 0;
}

.department-tree-branch {
  flex: 0 0 auto;
  width: 12px;
  height: 14px;
  margin-top: 3px;
  border-left: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  border-bottom-left-radius: 8px;
  opacity: 0.92;
}

.department-tree-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.department-tree-toggle,
.department-tree-spacer {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.department-tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
}

.department-tree-toggle:hover,
.department-tree-toggle:focus-visible {
  color: var(--text);
}

.department-tree-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform 0.18s ease;
}

.department-tree-toggle[aria-expanded="true"] svg {
  transform: rotate(90deg);
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  background: var(--panel-subtle);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

td {
  font-size: 13px;
}

.table-cell-main {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.table-cell-plain {
  min-width: 0;
  font-weight: 400;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-cell-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.table-link-subtle {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.table-link-subtle:hover,
.table-link-subtle:focus-visible {
  color: var(--primary);
}

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: var(--row-hover);
}

.alert {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.alert.is-dismissing {
  opacity: 0;
  transform: translateY(-6px);
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.alert-success {
  background: var(--success-soft);
  color: var(--success);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--primary-soft-3);
  border: 1px solid var(--primary-line);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag.is-neutral {
  background: var(--secondary-bg);
  border-color: var(--line);
  color: var(--muted-strong);
}

.tag.is-success {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 24%, var(--line) 76%);
  color: var(--success);
}

.tag.is-warning {
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 24%, var(--line) 76%);
  color: var(--warning);
}

.tag.is-danger {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 24%, var(--line) 76%);
  color: var(--danger);
}

.audit-table-tags {
  gap: 6px;
}

.audit-log-table {
  min-width: 1120px;
  table-layout: fixed;
}

.audit-log-table col.audit-log-col-time {
  width: 172px;
}

.audit-log-table col.audit-log-col-event {
  width: 26%;
}

.audit-log-table col.audit-log-col-actor {
  width: 15%;
}

.audit-log-table col.audit-log-col-request {
  width: 17%;
}

.audit-log-table col.audit-log-col-endpoint {
  width: 20%;
}

.audit-log-table col.audit-log-col-result {
  width: 22%;
}

.audit-log-table td {
  vertical-align: middle;
}

.audit-log-cell {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.audit-log-tags {
  flex-wrap: nowrap;
  min-width: 0;
}

.audit-log-tags .audit-badge {
  flex: 0 1 auto;
  min-width: 0;
}

.audit-log-single-line {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-log-time {
  font-variant-numeric: tabular-nums;
}

.audit-log-inline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: nowrap;
}

.audit-log-inline-text {
  min-width: 0;
  margin-top: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-log-link {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-log-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  margin-left: auto;
}

.integration-log-summary-trigger {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
}

.integration-log-summary-trigger:hover,
.integration-log-summary-trigger:focus-visible {
  color: var(--primary);
}

.integration-log-table {
  table-layout: fixed;
}

.integration-log-table col.integration-log-col-provider {
  width: 14%;
}

.integration-log-table col.integration-log-col-type {
  width: 14%;
}

.integration-log-table col.integration-log-col-status {
  width: 14%;
}

.integration-log-table col.integration-log-col-summary {
  width: 40%;
}

.integration-log-table col.integration-log-col-time {
  width: 18%;
}

.integration-log-table td {
  vertical-align: top;
}

.audit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  max-width: 100%;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-badge-neutral {
  background: var(--panel-subtle);
  border-color: var(--line);
  color: var(--muted-strong);
}

.audit-badge-primary {
  background: var(--primary-soft-2);
  border-color: var(--primary-line);
  color: var(--primary);
}

.audit-badge-app {
  background: color-mix(in srgb, var(--secondary-bg) 85%, var(--panel-subtle) 15%);
  border-color: color-mix(in srgb, var(--secondary-text) 18%, transparent);
  color: var(--secondary-text);
}

.audit-badge-success {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 24%, transparent);
  color: var(--success);
}

.audit-badge-error {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 22%, transparent);
  color: var(--danger);
}

.audit-badge-warning {
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 22%, transparent);
  color: var(--warning);
}

.audit-badge-link {
  text-decoration: none;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.audit-badge-link:hover,
.audit-badge-link:focus-visible {
  filter: brightness(0.98);
  transform: translateY(-1px);
}

td.empty {
  padding: 34px 16px !important;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  white-space: normal;
}

.empty:not(td),
.empty-inline {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
  padding: 20px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

td.empty::before,
.empty:not(td)::before,
.empty-inline::before {
  content: "";
  display: block;
  width: 46px;
  height: 46px;
  margin: 0 auto 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a78ff' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7.5A2.5 2.5 0 0 1 6.5 5h11A2.5 2.5 0 0 1 20 7.5v9A2.5 2.5 0 0 1 17.5 19h-11A2.5 2.5 0 0 1 4 16.5v-9Z'/%3E%3Cpath d='M8 10h8'/%3E%3Cpath d='M9.5 14h5'/%3E%3C/svg%3E") center / 22px 22px no-repeat,
    linear-gradient(180deg, var(--panel-subtle) 0%, var(--panel-solid) 100%);
}

.table-empty-row:hover {
  background: transparent;
}

.table-empty-row td {
  border-bottom: 0;
}

.form-span {
  grid-column: 1 / -1;
}

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

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

.profile-page-flow {
  gap: 14px;
}

.profile-identity-shell {
  margin-bottom: 16px;
}

.profile-avatar-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px 18px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-subtle);
}

.profile-avatar-frame {
  width: 76px;
  height: 76px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--panel-elevated) 0%, var(--panel-solid) 100%);
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
}

.profile-avatar-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-avatar-copy {
  display: grid;
  gap: 4px;
  align-content: center;
}

.profile-avatar-copy strong {
  font-size: 14px;
}

.profile-avatar-copy span {
  color: var(--muted);
  font-size: 11px;
}

.profile-avatar-form {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.profile-avatar-upload {
  display: grid;
  gap: 6px;
}

.profile-avatar-upload .input {
  padding: 7px 10px;
}

.profile-access-summary,
.profile-session-summary {
  margin-bottom: 0;
}

.profile-session-summary {
  margin-bottom: 12px;
}

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

.table-row-focus td {
  background: color-mix(in srgb, var(--primary-soft) 52%, var(--panel) 48%);
}

.applications-subsection-marker {
  margin-bottom: 12px;
}

.modal {
  width: min(100% - 32px, 520px);
  max-width: calc(100vw - 32px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-solid) 100%);
  color: var(--text);
  overflow: hidden;
}

.modal[open],
.modal.is-open {
  display: block;
}

.modal::backdrop {
  background: rgba(2, 6, 12, 0.58);
  backdrop-filter: blur(8px);
}

.modal-card {
  display: grid;
}

.modal-card-wide {
  width: 100%;
  max-width: 100%;
}

.modal-wide {
  width: min(100% - 32px, 1120px);
}

.modal-fullscreen {
  width: calc(100vw - 24px);
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  height: calc(100vh - 24px);
}

.modal-medium {
  width: min(100% - 32px, 720px);
}

.modal-medium .modal-card {
  max-height: 86vh;
}

.modal-medium .modal-body {
  min-height: 0;
  max-height: calc(86vh - 74px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-wide .modal-card {
  max-height: 86vh;
}

.modal-wide .modal-body {
  max-height: calc(86vh - 74px);
  overflow-y: auto;
}

.modal-fullscreen .modal-card {
  height: 100%;
  max-height: calc(100vh - 24px);
}

.modal-fullscreen .modal-body {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 0;
  max-height: calc(100vh - 98px);
  overflow-y: auto;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-subtle);
}

.modal-head > div {
  display: grid;
  gap: 4px;
}

.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mapping-list-modal .modal-head {
  align-items: center;
}

.mapping-list-modal .modal-head > div {
  min-width: 0;
}

.mapping-list-modal-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
}

.mapping-list-toolbar {
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 12px;
  margin-bottom: 0;
}

.mapping-list-toolbar-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.mapping-list-toolbar-copy h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
}

.mapping-list-toolbar-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.mapping-list-toolbar .section-toolbar-actions {
  width: 100%;
  justify-content: flex-start;
}

.mapping-list-table-wrap {
  min-height: 0;
  height: 100%;
}

.mapping-list-table-wrap table {
  min-width: 860px;
}

.mapping-list-provider-tag {
  white-space: nowrap;
}

.mapping-list-table-wrap .table-actions {
  flex-wrap: nowrap;
}

.mapping-form-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

.mapping-form-grid label {
  width: 100%;
}

.modal-head h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.modal-head p {
  margin-top: 0;
  color: var(--muted);
  font-size: 11px;
}

.modal-body {
  padding: 16px;
  overflow-x: hidden;
}

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

.modal-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.page-help-list {
  display: grid;
  gap: 10px;
}

.page-help-item {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-subtle);
}

.page-help-item strong {
  display: block;
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.page-help-item p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.data-health-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.data-health-card {
  gap: 10px;
}

.data-health-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.data-health-card-head h3 {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.data-health-card-count {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

.data-health-card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.data-health-card-samples {
  display: grid;
  gap: 4px;
}

.context-inline-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.page-section-stack {
  display: grid;
  gap: 16px;
  align-items: start;
}

.modal-inline-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

.modal-inline-row-split > * {
  flex: 1 1 0;
  min-width: 0;
}

.modal-field-grow {
  flex: 1 1 auto;
  min-width: 0;
}

.modal-inline-actions {
  flex: 0 0 auto;
  align-self: flex-end;
}

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

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

.role-auth-summary > div {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-subtle);
  display: grid;
  gap: 5px;
}

.role-auth-summary > div strong {
  font-size: 13px;
  line-height: 1.35;
}

.role-auth-summary-label,
.role-auth-section-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
}

.user-session-note {
  margin-top: -4px;
}

.user-session-table-wrap {
  margin-top: 8px;
}

.profile-session-table-wrap {
  margin-top: 8px;
}

.user-session-device {
  word-break: break-word;
}

.session-device-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.session-device-caption {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.user-session-table td:last-child,
.user-session-table th:last-child {
  white-space: nowrap;
}

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

.integration-summary > div {
  padding: 12px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-subtle);
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.integration-summary-span {
  grid-column: auto;
}

.integration-inline-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.integration-inline-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-subtle);
  overflow: hidden;
}

.integration-config-code {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  font-family: "SFMono-Regular", SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-inline-note span {
  flex: 0 0 auto;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-inline-note strong {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  line-height: 1.5;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-note-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.integration-status-stack {
  margin-top: 14px;
}

.integration-note-block {
  display: grid;
  justify-content: stretch;
  gap: 6px;
}

.integration-note-block span,
.integration-note-block strong,
.integration-note-block .integration-config-code {
  overflow: visible;
  text-align: left;
  text-overflow: clip;
  white-space: normal;
}

.integration-summary > div .role-auth-summary-label,
.integration-summary > div strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-note-warning {
  border-color: color-mix(in srgb, var(--warning) 22%, var(--line) 78%);
  background: color-mix(in srgb, var(--warning-soft) 82%, var(--panel-subtle) 18%);
}

.integration-note-warning span,
.integration-note-warning strong,
.integration-note-warning code {
  color: var(--warning);
}

.integration-note-warning code {
  background: color-mix(in srgb, var(--warning-soft) 72%, transparent);
}

.integration-field-grow {
  flex: 1 1 280px;
  min-width: min(100%, 280px);
}

.integration-inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.pagination-summary {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.pagination-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-subtle);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.pagination-link:hover,
.pagination-link:focus-visible {
  border-color: var(--primary-line);
  color: var(--primary);
}

.pagination-link.is-active {
  border-color: var(--primary-line);
  background: var(--primary-soft-3);
  color: var(--primary);
}

.pagination-link.is-disabled {
  opacity: 0.48;
  pointer-events: none;
}

.integration-token-block {
  display: grid;
  gap: 6px;
}

.guide-metric-grid {
  margin-top: 0;
}

.guide-section-spacing {
  margin-top: 14px;
}

.guide-code-grid {
  display: grid;
  gap: 12px;
}

.guide-code-card {
  gap: 10px;
}

.guide-code-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.guide-code-block {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.guide-code-block code {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.guide-code-block.integration-code {
  white-space: pre-wrap;
}

.integration-code {
  font-size: 12px;
  line-height: 1.6;
  font-family: "SFMono-Regular", SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;
  white-space: pre;
}

.integration-snapshot-grid {
  display: grid;
  gap: 14px;
}

.user-role-checklist {
  max-height: 360px;
}

.user-identity-cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.user-identity-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--panel-elevated) url("/static/images/default-avatar.png") center / cover no-repeat;
}

.user-identity-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-identity-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.positions-table {
  table-layout: fixed;
}

.positions-table .position-col-code {
  width: 16%;
}

.positions-table .position-col-name {
  width: 20%;
}

.positions-table .position-col-department {
  width: 22%;
}

.positions-table .position-col-users {
  width: 10%;
}

.positions-table .position-col-active-users {
  width: 10%;
}

.positions-table .position-col-status {
  width: 12%;
}

.positions-table .position-col-actions {
  width: 12%;
}

.position-table-text,
.position-table-number {
  min-width: 0;
  margin-top: 0;
  font-weight: 400;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.position-table-number {
  text-align: center;
}

.position-status-tags {
  flex-wrap: nowrap;
}

.user-table-text {
  min-width: 0;
  margin-top: 0;
  font-weight: 400;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.department-table-text {
  min-width: 0;
  margin-top: 0;
  font-weight: 400;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-identity-name,
.user-identity-meta {
  margin-top: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-summary-tags,
.user-summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.role-auth-error {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
}

.role-auth-app-nav-wrap {
  display: grid;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 10px;
  background: linear-gradient(180deg, var(--panel-solid) 0%, color-mix(in srgb, var(--panel-solid) 88%, transparent 12%) 100%);
}

.role-auth-app-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.role-auth-app-link {
  flex: 0 0 auto;
  white-space: nowrap;
}

.role-auth-app-link-focused {
  background: var(--primary-soft);
  color: var(--primary);
}

.role-auth-layout {
  display: grid;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

.role-auth-app {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.role-auth-context-bar {
  padding-bottom: 2px;
}

.role-auth-context-tags,
.role-auth-app-tags {
  min-width: 0;
}

.role-auth-context-tags .tag,
.role-auth-app-tags .tag {
  max-width: 100%;
}

.role-auth-app-toolbar {
  align-items: flex-start;
  margin-bottom: 0;
}

.role-auth-app-toolbar .section-toolbar-actions {
  margin-left: auto;
}

.audit-filter-grid {
  align-items: end;
}

.audit-filter-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
  margin-top: 0;
}

.integration-relationship-card-focus {
  border-color: var(--primary-line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary-soft) 36%, var(--panel) 64%) 0%, var(--panel-solid) 100%);
}

.role-auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 16px;
  align-items: start;
  min-height: 0;
}

.role-auth-block {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 0;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  overflow: hidden;
}

.role-auth-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.role-auth-block-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.role-auth-block-title .tag {
  flex: 0 0 auto;
}

.role-auth-block-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.role-auth-block-head h4 {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
}

.auth-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: min(52vh, 520px);
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 46px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.auth-check:hover {
  border-color: var(--primary-line);
  background: color-mix(in srgb, var(--primary-soft-2) 40%, var(--panel-solid) 60%);
}

.auth-check:has(input:checked) {
  border-color: var(--primary-line);
  background: var(--primary-soft-3);
}

.auth-check:has(input:focus-visible) {
  outline: 3px solid var(--primary-soft);
  outline-offset: 0;
}

.auth-check input {
  margin: 2px 0 0;
}

.auth-check-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.auth-check-main strong {
  font-size: 12px;
  line-height: 1.3;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-check-main small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
}

.auth-check-menu {
  padding-left: calc(10px + var(--role-auth-depth, 0) * 14px);
}

.role-auth-scope-fields {
  display: grid;
  gap: 14px;
}

.role-auth-scope-panel {
  background: linear-gradient(180deg, var(--panel) 0%, color-mix(in srgb, var(--panel-subtle) 82%, var(--primary-soft-4) 18%) 100%);
}

.role-auth-scope-choices {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.role-auth-scope-choice {
  position: relative;
  display: block;
  cursor: pointer;
}

.role-auth-scope-choice-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.role-auth-scope-choice-body {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--panel-subtle) 0%, var(--panel) 100%);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.role-auth-scope-choice-body strong {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
}

.role-auth-scope-choice-body small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.role-auth-scope-choice:hover .role-auth-scope-choice-body {
  border-color: var(--primary-line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary-soft-2) 46%, var(--panel-subtle) 54%) 0%, var(--panel) 100%);
}

.role-auth-scope-choice-input:checked + .role-auth-scope-choice-body {
  border-color: var(--primary-line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary-soft-2) 72%, var(--panel-subtle) 28%) 0%, color-mix(in srgb, var(--primary-soft-4) 44%, var(--panel) 56%) 100%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 16%, transparent 84%);
}

.role-auth-scope-choice-input:focus-visible + .role-auth-scope-choice-body {
  outline: 3px solid var(--primary-soft);
  outline-offset: 0;
}

.role-auth-departments {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.role-auth-departments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.role-auth-department-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  max-height: min(38vh, 360px);
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.auth-check-department {
  min-height: 52px;
}

.role-auth-modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-solid) 20%, transparent 80%) 0%, var(--panel-solid) 22px, var(--panel-solid) 100%);
}

@media (max-width: 1180px) {
  .role-resource-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .role-auth-grid {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .sidebar-nav {
    overflow: visible;
    padding-right: 0;
    margin-right: 0;
  }

  .sidebar-toggle {
    display: none;
  }

  .content-topbar,
  .page-flow {
    padding-left: 18px;
    padding-right: 18px;
  }

  .content-topbar {
    height: auto;
    min-height: var(--topbar-height);
    padding-top: 12px;
    padding-bottom: 12px;
    flex-direction: column;
    align-items: flex-start;
  }

  .content-topbar-main,
  .content-topbar-end {
    width: 100%;
  }

  .content-topbar-end {
    justify-content: flex-end;
  }

  .section-tabs-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  .modal-fullscreen {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    height: calc(100vh - 16px);
  }

  .modal-fullscreen .modal-card {
    max-height: calc(100vh - 16px);
  }

  .modal-fullscreen .modal-body {
    max-height: calc(100vh - 90px);
  }

  .role-auth-summary {
    grid-template-columns: 1fr;
  }

  .user-session-summary {
    grid-template-columns: 1fr;
  }

  .role-auth-scope-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-checklist {
    grid-template-columns: 1fr;
  }

  .dashboard-overview-grid,
  .integration-relationship-grid,
  .metric-grid,
  .integration-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .dashboard-step-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .dashboard-step-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .dashboard-guide-head {
    flex-direction: column;
    align-items: stretch;
  }

  :root[data-sidebar-collapsed="true"] .sidebar-brand {
    justify-content: flex-start;
    gap: 10px;
    margin-left: -18px;
    margin-right: -18px;
    padding-left: 18px;
    padding-right: 18px;
  }

  :root[data-sidebar-collapsed="true"] .sidebar-brand-copy,
  :root[data-sidebar-collapsed="true"] .sidebar-nav-title,
  :root[data-sidebar-collapsed="true"] .sidebar-link-label,
  :root[data-sidebar-collapsed="true"] .sidebar-user-meta {
    width: auto;
    opacity: 1;
  }

  :root[data-sidebar-collapsed="true"] .sidebar-link {
    justify-content: flex-start;
    padding-left: 12px;
    padding-right: 12px;
  }

  :root[data-sidebar-collapsed="true"] .sidebar-user {
    padding: 14px;
  }

  :root[data-sidebar-collapsed="true"] .sidebar-user-head,
  :root[data-sidebar-collapsed="true"] .sidebar-user-link {
    justify-content: flex-start;
  }

  :root[data-sidebar-collapsed="true"] .sidebar-user-actions {
    flex-direction: row;
    justify-content: flex-start;
  }

  :root[data-sidebar-collapsed="true"] .sidebar-user-actions form {
    margin: 0 0 0 auto;
  }
}

@media (max-width: 720px) {
  .content-topbar,
  .page-flow {
    padding-left: 14px;
    padding-right: 14px;
  }

  .auth-card,
  .panel,
  .metric-card,
  .form-section,
  .info-card {
    padding: 16px;
  }

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

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

  .dashboard-overview-grid,
  .integration-relationship-grid,
  .metric-grid,
  .integration-summary {
    grid-template-columns: 1fr;
  }

  .role-resource-grid {
    grid-template-columns: 1fr;
  }

  .role-resource-card-head {
    align-items: stretch;
  }

  .page-intro-main {
    grid-template-columns: 1fr;
  }

  .page-intro-actions {
    justify-content: flex-start;
  }

  .dashboard-step-item {
    grid-template-columns: 1fr;
  }

  .dashboard-step-actions {
    grid-column: auto;
    width: 100%;
  }

  .dashboard-step-actions .btn {
    width: 100%;
  }

  .dashboard-step-head {
    flex-direction: column;
  }

  .dashboard-summary-strip {
    grid-template-columns: 1fr;
  }

  .modal-inline-row {
    flex-wrap: wrap;
  }

  .modal-inline-actions {
    width: 100%;
  }

  .modal-inline-actions .btn {
    width: 100%;
  }

  .modal-wide {
    width: calc(100% - 20px);
  }

  .modal-fullscreen {
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
    height: calc(100vh - 12px);
    border-radius: 10px;
  }

  .modal-fullscreen .modal-card {
    max-height: calc(100vh - 12px);
  }

  .modal-fullscreen .modal-body {
    max-height: calc(100vh - 86px);
  }

  .role-auth-app-toolbar,
  .role-auth-block-head,
  .role-auth-departments-head {
    flex-direction: column;
    align-items: stretch;
  }

  .role-auth-scope-choices {
    grid-template-columns: 1fr;
  }

  .auth-checklist {
    grid-template-columns: 1fr;
  }

  .role-auth-block-actions {
    justify-content: flex-start;
  }

  .integration-inline-actions {
    width: 100%;
  }

  .integration-inline-actions .btn {
    width: 100%;
  }

  .profile-avatar-panel {
    grid-template-columns: 1fr;
  }

  .profile-avatar-frame {
    justify-self: center;
  }

  .profile-avatar-copy {
    justify-items: center;
    text-align: center;
  }

  .profile-summary-span {
    grid-column: auto;
  }

  .audit-filter-actions {
    justify-content: stretch;
  }

  .audit-filter-actions .btn {
    width: 100%;
  }

  .content-topbar-end {
    justify-content: flex-start;
  }

  th,
  td {
    padding: 10px 6px;
  }

  .dashboard-guide-actions,
  .dashboard-guide-links {
    width: 100%;
  }

  .dashboard-guide-actions .btn,
  .dashboard-guide-links .btn {
    width: 100%;
  }
}
