/* 企业组织运维：对齐盛元 0817 StyleSeed 表面语言。不定盛元业务 IA。 */
:root {
  --canvas: #ffffff;
  --surface: #fafafb;
  --surface-2: #f5f6f8;
  --surface-3: #f8f9fb;
  --tab-track: #f3f4f6;
  --line: #e8ebf0;
  --line-soft: #eef1f4;
  --ink: #111723;
  --shadow-soft: 0 1px 2px rgba(16, 24, 40, 0.03), 0 10px 30px rgba(16, 24, 40, 0.04);
  --foreground: #172033;
  --muted-foreground: #657184;
  --faint-foreground: #8995a5;
  --primary: #3458d4;
  --primary-foreground: #ffffff;
  --destructive: #b54842;
  --success: #16875b;
  --green-soft: #ecf8f2;
  --amber-soft: #fff5e8;
  --red-soft: #fff1f1;
  --chip-success-foreground: #16714e;
  --chip-danger-foreground: #b53e3e;
  --radius-stage: 24px;
  --radius-block: 22px;
  --radius-object: 18px;
  --radius-control: 12px;
  --page-pad: clamp(20px, 4vw, 48px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--canvas);
  color: var(--foreground);
  font-family: "Noto Sans SC", "Source Han Sans SC", "Source Han Sans CN", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  font-synthesis: none;
  line-height: 1.5;
}

body {
  min-height: 100dvh;
}

.hidden {
  display: none !important;
}

.workspace-shell {
  min-height: 100dvh;
  background: var(--canvas);
}

.workspace-header {
  position: sticky;
  top: 0;
  z-index: 20;
  overflow: hidden;
  background: var(--canvas);
  border-bottom: 1px solid var(--line);
}

.workspace-header-inner {
  display: flex;
  height: 60px;
  align-items: center;
  gap: 20px;
  overflow: hidden;
  padding: 0 var(--page-pad);
}

.workspace-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--foreground);
  text-decoration: none;
}

.workspace-brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 3px;
  padding: 6px;
  border-radius: 8px;
  background: #20283a;
}

.workspace-brand-mark i {
  display: block;
  border-radius: 1px;
  background: var(--canvas);
}

.workspace-brand-mark i:nth-child(1) { height: 9px; opacity: 0.55; }
.workspace-brand-mark i:nth-child(2) { height: 14px; opacity: 0.78; }
.workspace-brand-mark i:nth-child(3) { height: 18px; }

.workspace-brand-mark.login-brand-mark {
  width: 48px;
  height: 48px;
  gap: 4px;
  padding: 9px;
  border-radius: 9px;
}

.login-brand-mark i:nth-child(1) { height: 14px; }
.login-brand-mark i:nth-child(2) { height: 21px; }
.login-brand-mark i:nth-child(3) { height: 28px; }

.workspace-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.workspace-brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.workspace-brand-subtitle {
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 500;
}

.workspace-domain-nav {
  display: flex;
  height: 60px;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
}

.workspace-domain-link {
  position: relative;
  display: inline-flex;
  height: 60px;
  min-height: 0;
  flex-shrink: 0;
  align-items: center;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.workspace-domain-link:hover,
.workspace-domain-link[data-active="true"] {
  color: var(--foreground);
}

.workspace-domain-link[data-active="true"] {
  font-weight: 600;
}

.workspace-domain-link[data-active="true"]::after {
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 2px;
  background: var(--primary);
  content: "";
}

.workspace-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.who {
  color: var(--muted-foreground);
  font-size: 13px;
}

.workspace-main {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 32px var(--page-pad) 48px;
}

.page-kicker {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.page-title {
  margin: 0;
  font-size: clamp(26px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-lead {
  margin: 0;
  max-width: 40rem;
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 1.6;
}

.page-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stage {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-stage);
  background: var(--canvas);
  box-shadow: var(--shadow-soft);
}

.section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.muted {
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 1.6;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.col {
  min-width: min(100%, 260px);
  flex: 1;
}

.tree-col {
  flex: 0 0 min(100%, 220px);
}

label,
.field-label {
  display: block;
  margin: 0 0 6px;
  color: var(--foreground);
  font-size: 13px;
  font-weight: 500;
}

input[type="text"],
input[type="password"],
select,
textarea {
  width: min(480px, 100%);
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--canvas);
  color: var(--foreground);
  font: inherit;
  font-size: 16px;
}

.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;
}

.file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

label.btn {
  display: inline-flex;
  margin: 0;
}

textarea {
  width: min(100%, 720px);
  min-height: 180px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

textarea.preview-json {
  max-height: min(18rem, 40dvh);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent);
}

.btn,
button.btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.btn:hover {
  background: color-mix(in srgb, var(--ink) 88%, white);
}

.btn-outline,
button.btn-outline {
  border-color: var(--line);
  background: var(--canvas);
  color: var(--foreground);
}

.btn-outline:hover {
  background: var(--surface);
}

.btn-ghost,
button.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted-foreground);
}

.btn-sm,
button.btn-sm {
  min-height: 40px;
  padding: 0 12px;
  font-size: 13px;
}

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

.status {
  min-height: 1.4em;
  margin: 0;
  font-size: 13px;
}

.status.err,
.err {
  color: var(--destructive);
}

.status.ok,
.ok {
  color: var(--success);
}

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

.table-wrap-lock {
  max-height: min(28rem, 52dvh);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-object);
}

.table-wrap-lock thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.people-table {
  min-width: 1100px;
}

.people-table td:last-child {
  width: 1%;
  white-space: nowrap;
}

.people-move {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.people-move-select,
.people-table select {
  width: auto;
  max-width: 10rem;
  min-width: 0;
  flex: 1 1 auto;
}

.people-move .btn {
  flex: 0 0 auto;
}

.scroll-pane {
  max-height: min(28rem, 52dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

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

th {
  background: var(--surface);
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
}

.badge-ok {
  background: var(--green-soft);
  color: var(--chip-success-foreground);
}

.badge-warn {
  background: var(--amber-soft);
  color: #a65713;
}

.badge-err {
  background: var(--red-soft);
  color: var(--chip-danger-foreground);
}

.tree details {
  margin-left: 12px;
}

.tree-item,
.tree button.link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.tree-item.is-active,
.tree button.link.is-active {
  background: color-mix(in srgb, var(--primary) 8%, white);
  color: var(--primary);
  font-weight: 600;
}

.check-row,
.grant-row,
.root-row,
.preview-row {
  display: flex;
  min-height: 44px;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--canvas);
}

.dept-label {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.dept-name,
.dept-parent {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dept-parent {
  color: var(--muted-foreground);
  font-size: 11px;
  line-height: 1.3;
}

.dept-desc-lab {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.check-row:has(input:checked),
.grant-row:has(> input[type="checkbox"]:checked),
.root-row:has(input:checked) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 5%, white);
}

.grant-row > input[type="checkbox"],
.root-row > input[type="checkbox"] {
  flex: 0 0 auto;
}

.grant-panel {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-object);
  background: var(--surface);
}

.preview-row {
  justify-content: space-between;
}

.preview-src {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.4;
}

.proj-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-object);
  background: var(--surface);
}

.proj-card legend,
.proj-title {
  padding: 0;
  font-size: 16px;
  font-weight: 600;
}

.login-shell {
  display: flex;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--canvas);
}

.login-stack {
  display: flex;
  width: min(100%, 28rem);
  flex-direction: column;
  gap: 32px;
}

.login-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.login-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-block);
  background: var(--canvas);
  box-shadow: var(--shadow-soft);
}

.login-card-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px 32px;
  border-bottom: 1px solid var(--line);
}

.login-card-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px 32px;
}

@media (max-width: 720px) {
  .workspace-header-inner {
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
  }

  .workspace-domain-nav {
    order: 3;
    width: 100%;
    height: 48px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .workspace-domain-link {
    height: 48px;
  }

  .workspace-main,
  .stage {
    padding: 20px;
  }

  .tree-col {
    flex-basis: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
