/* 飞书身份源、组织同步与六类角色模型 */

.identity-source-strip {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  background: var(--surface);
  padding: 8px 12px;
  color: var(--muted);
  font-size: 11px;
}

.identity-source-strip strong {
  color: var(--text);
}

.identity-source-strip .tag {
  margin-left: auto;
}

.identity-rule-note {
  margin-bottom: 10px;
  border: 1px solid #d9e6f3;
  background: #f4f8fc;
  padding: 9px 12px;
  color: #48627d;
  font-size: 11px;
  line-height: 1.55;
}

.identity-rule-note strong {
  color: #2f4f70;
}

.identity-table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.identity-table-scroll table {
  min-width: 1040px;
}

.identity-table-scroll td,
.identity-table-scroll th {
  padding: 9px 10px;
}

.identity-user-toolbar {
  align-items: center;
  gap: 10px;
}

.identity-user-toolbar > div:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.identity-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.identity-toolbar-actions .input {
  width: 220px;
}

.identity-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 8px;
}

.identity-section-head h2 {
  margin: 0;
  font-size: 13px;
}

.identity-section-head span {
  color: var(--muted);
  font-size: 10px;
}

.identity-role-policy {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  background: #fafbfc;
  padding: 8px 10px;
}

.identity-role-policy span {
  border-right: 1px solid var(--line);
  padding: 2px 12px 2px 0;
  color: #596579;
  font-size: 10px;
}

.identity-role-policy span:last-child {
  border-right: 0;
}

.identity-role-policy strong {
  color: #344054;
}

.identity-scope {
  color: #475467;
  line-height: 1.5;
}

.identity-scope small {
  display: block;
  color: var(--muted);
}

.identity-drawer-section {
  margin: 10px 12px 0;
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

.identity-drawer-section h3 {
  margin: 0 0 10px;
  font-size: 12px;
}

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

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

.identity-role-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 7px;
}

.identity-role-options label {
  display: flex;
  min-width: 0;
  min-height: 40px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 8px 10px;
  color: #344054;
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
}

.identity-role-options label:has(input:checked) {
  border-color: #d7a5ae;
  background: #fff7f8;
  color: #8f1730;
}

.identity-form-grid .identity-role-options input[type="checkbox"] {
  display: inline-block;
  width: 16px;
  height: 16px;
  min-height: 16px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}

.identity-role-options span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-role-options label:focus-within {
  outline: 2px solid rgba(181, 31, 62, 0.2);
  outline-offset: 1px;
}

.identity-form-grid label,
.identity-form-row label {
  color: #4a5565;
  font-size: 11px;
}

.identity-form-grid label > em,
.identity-form-row label > em {
  color: var(--primary);
  font-style: normal;
}

.identity-form-grid input,
.identity-form-grid select,
.identity-form-row input,
.identity-form-row select,
.identity-form-row textarea {
  display: block;
  width: 100%;
  min-height: 34px;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  padding: 6px 8px;
}

.identity-form-grid input[readonly] {
  background: #f5f6f8;
  color: #667085;
}

.identity-form-grid select[multiple] {
  min-height: 94px;
  margin-top: 6px;
  background: #fff;
}

.identity-multi-select-hint {
  display: block;
  margin-top: 4px;
  color: #667085;
  font-size: 10px;
  line-height: 1.4;
}

.identity-multi-select-hint[hidden] {
  display: none;
}

.role-drawer-notice {
  margin: 10px 12px 0;
  padding: 8px 10px;
  line-height: 1.45;
}

.role-basic-section .identity-form-row {
  margin-top: 9px;
}

.identity-form-grid.role-basic-grid {
  grid-template-columns: 1.35fr 1fr 0.72fr;
  gap: 8px;
}

.role-basic-section textarea {
  height: 56px;
  min-height: 56px;
}

.role-permission-section {
  padding: 10px 12px 11px;
}

.role-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.role-section-heading h3 {
  margin: 0;
}

.role-section-heading > span {
  color: #7b8798;
  font-size: 9px;
}

.role-module-grid,
.role-access-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.role-access-details {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.role-access-details label {
  padding-right: 5px;
  padding-left: 5px;
  font-size: 9px;
}

.role-module-grid label,
.role-access-mode label,
.role-access-details label {
  display: flex;
  min-width: 0;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  border: 1px solid #e1e6ec;
  border-radius: 3px;
  background: #fff;
  padding: 5px 7px;
  color: #344054;
  font-size: 10px;
  line-height: 1.2;
}

.role-module-grid input,
.role-access-mode input,
.role-access-details input {
  display: inline-block;
  width: 13px;
  min-height: 13px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
}

.role-access-picker {
  display: grid;
  gap: 7px;
}

.role-access-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.role-access-mode label {
  min-height: 32px;
  border-color: #cfd7e3;
  background: #f7f8fa;
  font-weight: 600;
}

.role-access-mode label:has(input:checked),
.role-module-grid label:has(input:checked),
.role-access-details label:has(input:checked) {
  border-color: #d7a5ae;
  background: #fff7f8;
  color: #8f1730;
}

.role-access-details.disabled {
  opacity: 0.48;
}

.role-access-details input:disabled {
  cursor: not-allowed;
}

.identity-form-row {
  margin-top: 10px;
}

.identity-form-row textarea {
  min-height: 76px;
  resize: vertical;
}

.manual-user-intro {
  display: grid;
  gap: 3px;
  line-height: 1.5;
}

.manual-user-intro strong {
  color: #2f4f70;
}

.manual-form-help,
.manual-security-section p {
  margin: 8px 0 0;
  color: #667085;
  font-size: 10px;
  line-height: 1.55;
}

.manual-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.manual-check-grid span {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  background: #fafbfc;
  padding: 8px;
  color: #667085;
  font-size: 9px;
  line-height: 1.4;
}

.manual-check-grid b {
  color: #8a6428;
  font-size: 10px;
}

.manual-check-grid b.passed {
  color: #277357;
}

.manual-check-grid b.failed,
.manual-check-grid b.warn {
  color: var(--primary);
}

.manual-user-cell > span {
  border-radius: 4px;
  background: #f3f4f6;
  color: #475467;
}

.master-drawer-intro {
  margin: 10px 12px 0;
  line-height: 1.55;
}

.master-drawer-section {
  padding: 11px 12px;
}

.master-type-switch,
.master-data-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.master-type-switch button,
.master-data-tabs button {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: #596579;
  font-size: 11px;
  font-weight: 650;
}

.master-type-switch button:last-child,
.master-data-tabs button:last-child {
  border-right: 0;
}

.master-type-switch button.active,
.master-data-tabs button.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.master-type-switch.is-locked button:not(.active) {
  color: #a3aab4;
  cursor: not-allowed;
}

.master-type-help {
  margin: 8px 0 0;
  color: #667085;
  font-size: 10px;
  line-height: 1.5;
}

.master-form-grid [hidden] {
  display: none;
}

.master-form-grid input[readonly] {
  background: #f5f6f8;
  color: #667085;
}

.master-validation-section {
  margin-bottom: 12px;
}

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

.master-validation-head h3 {
  margin-bottom: 3px;
}

.master-validation-head p {
  margin: 0;
  color: #667085;
  font-size: 10px;
  line-height: 1.45;
}

.master-validation-head button {
  flex: 0 0 auto;
}

.master-check-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.master-check-list span {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  background: #fafbfc;
  padding: 7px 8px;
  color: #667085;
  font-size: 9px;
}

.master-check-list b {
  color: #8a6428;
  font-size: 10px;
}

.master-check-list b.passed {
  color: #277357;
}

.master-check-list b.failed {
  color: var(--primary);
}

.master-data-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}

.master-data-tabs {
  width: 360px;
}

.master-data-toolbar .page-actions {
  margin-left: auto;
}

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

.master-data-summary {
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
  padding: 8px 14px;
  color: #667085;
  font-size: 10px;
}

.master-object-table td small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.master-row-actions {
  white-space: nowrap;
}

.master-action-muted {
  color: var(--muted);
  font-size: 10px;
}

.master-work-dialog {
  width: min(760px, calc(100vw - 40px));
  max-height: min(760px, calc(100vh - 48px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 24px 64px rgba(16, 24, 40, 0.24);
}

.master-work-dialog::backdrop {
  background: rgba(16, 24, 40, 0.46);
}

.master-work-dialog > header,
.master-work-dialog > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.master-work-dialog > header small {
  color: var(--primary);
  font-weight: 700;
}

.master-work-dialog > header h2 {
  margin: 3px 0 0;
  font-size: 18px;
}

.master-work-dialog > header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.master-work-dialog > header > button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: #667085;
  font-size: 20px;
}

.master-work-dialog > footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.master-work-dialog-body {
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding: 16px 18px;
}

.master-dialog-section,
.master-dialog-section label {
  display: grid;
  gap: 7px;
}

.master-dialog-section {
  gap: 14px;
}

.master-dialog-section label {
  color: #475467;
  font-size: 11px;
  font-weight: 650;
}

.master-dialog-section input,
.master-dialog-section select,
.master-dialog-section textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  padding: 7px 9px;
}

.master-dialog-section textarea {
  min-height: 88px;
  resize: vertical;
}

.master-dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.master-dialog-note,
.master-impact-card {
  border-left: 3px solid #90a8c5;
  background: #f4f7fb;
  padding: 10px 12px;
  color: #536174;
  font-size: 11px;
  line-height: 1.55;
}

.master-impact-card {
  display: grid;
  gap: 4px;
  border-left-color: var(--primary);
  background: var(--primary-soft);
}

.master-version-list {
  display: grid;
  gap: 8px;
}

.master-version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.master-version-item > div {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
}

.master-version-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.master-version-item small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.master-dialog-loading,
.master-dialog-error {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
}

.master-dialog-error {
  color: var(--primary);
}

@media (max-width: 980px) {
  .master-data-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .master-data-tabs {
    width: 100%;
  }

  .master-data-toolbar .page-actions {
    margin-left: 0;
    justify-content: flex-start;
  }

  .master-dialog-grid {
    grid-template-columns: 1fr;
  }
}

.identity-drawer-section .check-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.identity-drawer-section .check-grid input {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}

.identity-drawer-section .check-grid span {
  flex: 1;
}

.scope-impact-section p {
  margin: 9px 0 0;
  color: #667085;
  font-size: 10px;
  line-height: 1.55;
}

.scope-impact-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: #fafbfc;
}

.scope-impact-strip span {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 8px 9px;
  color: #667085;
  font-size: 9px;
}

.scope-impact-strip span:last-child {
  border-right: 0;
}

.scope-impact-strip strong {
  display: block;
  margin-top: 4px;
  color: #344054;
  font-size: 10px;
}

.feishu-login-shell {
  display: grid;
  min-height: 100vh;
  align-items: start;
  justify-items: center;
  background: #eef1f5;
  padding: 32px 20px;
}

.feishu-login-panel {
  width: min(500px, 100%);
  border: 1px solid var(--line);
  border-top: 4px solid var(--primary);
  border-radius: 6px;
  background: #fff;
  padding: 30px 32px 24px;
  box-shadow: 0 20px 50px rgba(16, 24, 40, 0.1);
}

.feishu-login-brand {
  display: grid;
  justify-items: start;
  gap: 5px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.feishu-login-wordmark {
  position: relative;
  display: block;
  width: 150px;
  height: 28px;
  overflow: hidden;
  background: #fff;
}

.feishu-login-wordmark img {
  position: absolute;
  top: -33px;
  left: -22px;
  width: 190px;
  height: auto;
  max-width: none;
  user-select: none;
}

.feishu-login-brand small {
  color: #667085;
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.025em;
}

.feishu-login-button {
  width: auto;
  min-width: 104px;
  height: 34px;
  margin: 0;
  font-size: 11px;
}

.feishu-primary-login {
  border: 1px solid #d9e2f0;
  border-radius: 6px;
  background: #f8fbff;
  padding: 16px;
}

.feishu-login-method-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.feishu-login-method-head > div {
  display: grid;
  gap: 3px;
}

.feishu-login-method-head span,
.feishu-login-method-head > b {
  width: fit-content;
  border-radius: 3px;
  background: #e7f0ff;
  padding: 3px 6px;
  color: #285ea8;
  font-size: 9px;
  font-weight: 700;
}

.feishu-login-method-head strong {
  color: #1f2937;
  font-size: 15px;
}

.feishu-login-method-head small {
  color: #667085;
  font-size: 10px;
}

.feishu-qr-stage {
  display: grid;
  min-height: 310px;
  overflow: hidden;
  place-items: center;
  border: 1px solid #dce3ec;
  border-radius: 5px;
  background: #fff;
}

.feishu-qr-stage[hidden] {
  display: none;
}

.feishu-qr-stage > img {
  display: block;
  width: 232px;
  height: 232px;
  padding: 8px;
  border: 1px solid #eef1f5;
  border-radius: 5px;
  background: #fff;
  object-fit: contain;
}

.feishu-qr-placeholder {
  display: grid;
  gap: 6px;
  padding: 32px;
  color: #344054;
  text-align: center;
}

.feishu-qr-placeholder strong {
  font-size: 13px;
}

.feishu-qr-placeholder span {
  color: #98a2b3;
  font-size: 10px;
}

.feishu-qr-placeholder.error strong {
  color: var(--primary);
}

.feishu-primary-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.feishu-primary-login.oauth-login-mode {
  padding: 20px;
}

.oauth-login-mode .feishu-login-method-head {
  margin-bottom: 16px;
}

.oauth-login-mode .feishu-session-state {
  margin-top: 0;
  border: 1px solid #d9e2f0;
  border-radius: 5px;
  background: #fff;
  padding: 12px 14px;
  line-height: 1.6;
}

.oauth-login-mode .feishu-primary-actions {
  margin-top: 12px;
}

.oauth-login-mode .feishu-login-button {
  width: 100%;
  height: 42px;
  font-size: 12px;
}

.test-account-login {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  padding: 14px;
}

.test-account-login-title,
.test-account-login-status,
.test-account-login-button {
  grid-column: 1 / -1;
}

.test-account-login-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.test-account-login-title strong {
  color: #344054;
  font-size: 12px;
}

.test-account-login-title span,
.test-account-login-status {
  color: #667085;
  font-size: 10px;
}

.test-account-login-status:empty {
  display: none;
}

.test-account-login label {
  display: grid;
  gap: 5px;
  color: #475467;
  font-size: 10px;
}

.test-account-login input {
  width: 100%;
  height: 38px;
  border: 1px solid #d7dce3;
  border-radius: 4px;
  background: #fff;
  padding: 0 10px;
  color: #202734;
  font: inherit;
  font-size: 11px;
  outline: none;
}

.test-account-login input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(196, 18, 48, 0.08);
}

.test-account-login-status.failed {
  color: var(--primary);
}

.test-account-login-status.passed {
  color: #277357;
}

.test-account-login-button {
  height: 40px;
}

.login-method-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 12px;
  color: #98a2b3;
  font-size: 10px;
}

.login-method-divider::before,
.login-method-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.feishu-session-state {
  border: 1px solid var(--line);
  margin-top: 10px;
  border: 0;
  background: transparent;
  padding: 0;
  color: #667085;
  font-size: 11px;
}

.feishu-session-state.ready {
  color: #277357;
}

.feishu-session-state.pending {
  border-color: #e5e7eb;
}

.feishu-auth-steps {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.feishu-auth-steps[hidden] {
  display: none;
}

.feishu-auth-steps a,
.feishu-auth-steps button {
  width: auto;
  min-width: 106px;
  height: 32px;
  margin: 0;
  padding: 0 10px;
  text-decoration: none;
}

@media (max-width: 560px) {
  .feishu-login-panel {
    padding: 24px 18px 20px;
  }

  .test-account-login-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .feishu-qr-stage {
    min-height: 280px;
    height: 280px;
  }

  .feishu-primary-login.oauth-login-mode {
    padding: 16px;
  }

  .feishu-auth-steps {
    align-items: stretch;
    flex-direction: column;
  }
}

.feishu-login-panel footer {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-top: 18px;
  color: #98a2b3;
  font-size: 9px;
  text-align: center;
}

.feishu-login-footer a {
  color: #667085;
  text-decoration: none;
}

.feishu-login-footer a:hover,
.feishu-login-footer a:focus-visible {
  color: var(--primary);
  text-decoration: underline;
}

.identity-live-warning {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -2px 0 12px;
  border: 1px solid #f0d7a6;
  border-left: 3px solid #d79028;
  background: #fffaf0;
  padding: 9px 11px;
}

.identity-live-warning > div {
  display: grid;
  flex: 1;
  gap: 2px;
}

.identity-live-warning strong {
  color: #6f4b14;
  font-size: 11px;
}

.identity-live-warning span {
  color: #8a6428;
  font-size: 10px;
}

.live-user-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-user-cell > img,
.live-user-cell > span {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #e9edf2;
  object-fit: cover;
  color: #526173;
  font-size: 10px;
  font-weight: 700;
}

.live-user-cell > div {
  display: grid;
  gap: 2px;
}

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

.scope-panel-action > div {
  display: grid;
  gap: 2px;
}

.scope-panel-action strong {
  color: #1d2939;
  font-size: 13px;
}

.scope-panel-action span {
  color: #667085;
  font-size: 10px;
}

@media (max-width: 1180px) {
  .identity-source-strip {
    flex-wrap: wrap;
    gap: 7px 14px;
  }

  .identity-source-strip .tag {
    margin-left: 0;
  }

  .identity-user-toolbar,
  .identity-toolbar-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .identity-form-grid {
    grid-template-columns: 1fr;
  }

  .manual-check-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 460px) {
  .identity-role-options {
    grid-template-columns: 1fr;
  }
}
