:root{
  --bg:#f5f7fb;
  --surface:#ffffff;
  --surface-2:#f9fafc;
  --text:#151922;
  --muted:#71798a;
  --line:#e5e8ef;
  --line-strong:#d9dee8;
  --primary:#345dff;
  --primary-hover:#274fe8;
  --primary-soft:#eef2ff;
  --success:#118847;
  --success-soft:#ecfdf3;
  --danger:#d92d20;
  --danger-soft:#fff1ef;
  --warning:#b54708;
  --warning-soft:#fff8e7;
  --sidebar:#11141b;
  --sidebar-2:#191d27;
  --shadow:0 10px 28px rgba(18,24,40,.055);
  --shadow-hover:0 14px 36px rgba(18,24,40,.08);
  --radius:16px;
}

*{box-sizing:border-box}
html,body{margin:0;min-height:100%}
html{background:var(--bg)}
body{
  color:var(--text);
  background:var(--bg);
  font:14px/1.5 Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;text-decoration:none}
button,input,select{font:inherit}
button{appearance:none}
code{
  font-family:"SFMono-Regular",Consolas,Monaco,monospace;
  font-size:.92em;
  overflow-wrap:anywhere;
}

/* Shell */
.shell{min-height:100vh;display:flex}
.sidebar{
  position:fixed;
  inset:0 auto 0 0;
  width:236px;
  padding:18px 12px 14px;
  display:flex;
  flex-direction:column;
  z-index:40;
  background:linear-gradient(180deg,#10131a 0%,#12151d 100%);
  color:#e9edf7;
  border-right:1px solid rgba(255,255,255,.035);
}
.brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding:4px 8px 22px;
}
.logo{
  width:42px;
  height:42px;
  flex:0 0 42px;
  display:grid;
  place-items:center;
  border-radius:13px;
  background:linear-gradient(135deg,#426bff,#3158ee);
  color:#fff;
  font-size:15px;
  font-weight:800;
  box-shadow:0 7px 18px rgba(49,94,251,.26);
}
.brand b,.brand small{display:block}
.brand b{font-size:15px;letter-spacing:.01em}
.brand small{margin-top:2px;color:#8f98aa;font-size:12px}
nav{display:grid;gap:4px}
nav a{
  position:relative;
  padding:10px 12px;
  border-radius:10px;
  color:#aeb6c7;
  font-weight:560;
  transition:background .16s,color .16s,transform .16s;
}
nav a:hover{
  color:#fff;
  background:rgba(255,255,255,.055);
}
nav a.active{
  color:#fff;
  background:#222733;
}
nav a.active:before{
  content:"";
  position:absolute;
  left:-2px;
  top:10px;
  bottom:10px;
  width:3px;
  border-radius:3px;
  background:#5e7cff;
}
.logout{margin-top:auto}
.main{
  min-width:0;
  margin-left:236px;
  width:calc(100% - 236px);
}
.topbar{
  position:sticky;
  top:0;
  z-index:20;
  height:70px;
  padding:0 30px;
  display:flex;
  align-items:center;
  gap:14px;
  border-bottom:1px solid rgba(223,227,235,.9);
  background:rgba(255,255,255,.88);
  backdrop-filter:blur(14px);
}
.topbar b,.topbar small{display:block}
.topbar b{font-size:15px}
.topbar small{margin-top:2px;color:var(--muted);font-size:12px}
.menu{
  display:none;
  width:38px;
  height:38px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
  color:var(--text);
  font-size:20px;
  cursor:pointer;
}
.content{
  width:100%;
  max-width:1460px;
  margin:0 auto;
  padding:28px;
}

/* Generic cards */
.card,
.stats article,
.settings-card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.card{
  min-width:0;
  padding:20px;
  margin-bottom:18px;
}
.card h2{margin:0 0 6px;font-size:17px}
.card p{margin:0;color:var(--muted);line-height:1.65}
.head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:16px;
}
.head a{color:var(--primary);font-weight:650}
.grid2{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px;
}
.accent{
  border-color:#ccd6ff;
  background:linear-gradient(180deg,#fff 0%,#fbfcff 100%);
}

/* Buttons */
.btn{
  min-height:40px;
  padding:9px 15px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:1px solid var(--line-strong);
  border-radius:10px;
  background:#fff;
  color:var(--text);
  cursor:pointer;
  font-weight:650;
  transition:transform .12s,box-shadow .12s,background .12s,border-color .12s;
}
.btn:hover{
  border-color:#cbd1dc;
  background:#fbfcfe;
}
.btn:active{transform:translateY(1px)}
.btn.primary{
  color:#fff;
  border-color:var(--primary);
  background:var(--primary);
  box-shadow:0 5px 13px rgba(52,93,255,.18);
}
.btn.primary:hover{
  border-color:var(--primary-hover);
  background:var(--primary-hover);
}
.btn.danger{
  color:#fff;
  border-color:var(--danger);
  background:var(--danger);
}
.btn.ghost{
  color:#c5cbda;
  border-color:#303642;
  background:transparent;
}
.btn.ghost:hover{background:#1e232d;color:#fff}
.btn.small{min-height:32px;padding:6px 10px;font-size:12px}
.btn.full{width:100%}

/* Forms */
.form-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
  align-items:end;
}
.span2{grid-column:span 2}
.form-action{display:flex;align-items:end}
.stack{display:grid;gap:14px}
label{font-weight:650}
label small{font-weight:400;color:var(--muted)}
input,select{
  width:100%;
  min-width:0;
  height:42px;
  padding:0 12px;
  border:1px solid var(--line-strong);
  border-radius:10px;
  outline:none;
  color:var(--text);
  background:#fff;
  transition:border-color .15s,box-shadow .15s,background .15s;
}
input:hover,select:hover{border-color:#c9cfda}
input:focus,select:focus{
  border-color:#6b86ff;
  box-shadow:0 0 0 3px rgba(52,93,255,.11);
}
input::placeholder{color:#a7aebb}

/* Stats */
.stats{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:16px;
  margin-bottom:18px;
}
.stats article{padding:18px}
.stats span,.stats small{display:block;color:var(--muted)}
.stats strong{display:block;margin:7px 0;font-size:28px}
.stats small{font-size:12px}

/* Tables */
.table-wrap{
  width:100%;
  overflow:auto;
  border:1px solid var(--line);
  border-radius:12px;
}
table{
  width:100%;
  min-width:720px;
  border-collapse:collapse;
}
th,td{
  padding:12px 14px;
  text-align:left;
  vertical-align:middle;
  border-bottom:1px solid var(--line);
}
th{
  color:var(--muted);
  background:#fafbfc;
  font-size:12px;
  white-space:nowrap;
}
tr:last-child td{border-bottom:0}
.right{text-align:right}

/* Small UI */
.badge,.chip{
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:4px 9px;
  background:#f0f2f5;
  font-size:12px;
  font-weight:700;
}
.badge.ok{color:var(--success);background:var(--success-soft)}
.badge.bad{color:var(--danger);background:var(--danger-soft)}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{padding:7px 10px}
.alert{
  padding:12px 14px;
  margin-bottom:16px;
  border:1px solid var(--line);
  border-radius:12px;
}
.alert.success{color:var(--success);background:var(--success-soft)}
.alert.danger,.alert.error{color:var(--danger);background:var(--danger-soft)}
.alert.warning{color:var(--warning);background:var(--warning-soft)}
.logs{display:grid}
.log{
  display:grid;
  grid-template-columns:72px minmax(0,1fr);
  gap:12px;
  padding:11px 0;
  border-bottom:1px solid var(--line);
}
.log:last-child{border-bottom:0}
.log b,.log small{display:block}
.log b{font-weight:560;overflow-wrap:anywhere}
.log small{margin-top:4px;color:var(--muted);font-size:12px}
.level{font-size:11px;font-weight:800}
.level.error{color:var(--danger)}
.level.warning{color:var(--warning)}
.level.info{color:var(--primary)}
.empty{padding:24px;text-align:center;color:var(--muted)}
.summary{display:grid;gap:8px}
.summary .badge{width:max-content}
.muted{color:var(--muted)!important}
.kv{
  display:flex;
  justify-content:space-between;
  gap:20px;
  padding:12px 0;
  border-bottom:1px solid var(--line);
}
.switch{display:flex;align-items:center;gap:10px}
.switch input{width:18px;height:18px}

/* Login */
.login-page{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:20px;
  background:
    radial-gradient(circle at 18% 10%,#eaf0ff 0,transparent 34%),
    linear-gradient(180deg,#f8f9fc,#f3f5fa);
}
.login-card{
  width:min(430px,100%);
  padding:28px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:20px;
  box-shadow:0 22px 55px rgba(20,28,50,.11);
}
.login-card .brand{padding:0 0 20px}
.login-card h1{margin:2px 0 8px;font-size:24px}
.overlay{display:none}

/* ===============================
   Settings page
   =============================== */
.settings-page{
  width:min(1180px,100%);
  margin:0 auto;
}
.settings-card{
  padding:24px 26px;
  margin-bottom:18px;
}
.settings-card:hover{box-shadow:var(--shadow-hover)}
.settings-card-compact{margin-bottom:0}
.settings-card-head{
  display:flex;
  align-items:flex-start;
  gap:14px;
  padding-bottom:18px;
  margin-bottom:20px;
  border-bottom:1px solid var(--line);
}
.settings-card-head>div:last-child{min-width:0}
.settings-card-head h2{
  margin:0 0 5px;
  font-size:18px;
  line-height:1.35;
  letter-spacing:-.01em;
}
.settings-card-head p{
  margin:0;
  color:var(--muted);
  font-size:13px;
  line-height:1.6;
}
.section-mark{
  flex:0 0 auto;
  width:34px;
  height:28px;
  display:grid;
  place-items:center;
  margin-top:1px;
  border-radius:9px;
  color:var(--primary);
  background:var(--primary-soft);
  font-size:11px;
  font-weight:800;
  letter-spacing:.04em;
}
.settings-form-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px 22px;
}
.field{min-width:0}
.field>label{
  display:block;
  margin:0 0 7px;
  color:#303642;
  font-size:12px;
  font-weight:750;
}
.field input,.field select{
  height:44px;
  border-radius:11px;
}
.field-note{
  min-height:17px;
  margin-top:6px;
  color:var(--muted);
  font-size:11.5px;
  line-height:1.45;
}
.status-dot{
  display:inline-block;
  width:7px;
  height:7px;
  margin:0 4px 0 2px;
  border-radius:50%;
  vertical-align:1px;
  background:#aab1bf;
}
.status-dot.is-ok{background:var(--success)}
.status-dot.is-empty{background:#aab1bf}
.input-suffix{position:relative}
.input-suffix input{padding-right:48px}
.input-suffix>span{
  position:absolute;
  top:50%;
  right:13px;
  transform:translateY(-50%);
  color:var(--muted);
  font-size:12px;
  pointer-events:none;
}
.settings-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:12px;
  padding-top:18px;
  margin-top:20px;
  border-top:1px solid var(--line);
}
.settings-actions .btn{min-width:132px}
.action-hint{
  margin-right:auto;
  color:var(--muted);
  font-size:12px;
}
.toggle-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  margin-top:20px;
}
.toggle-card{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  min-height:74px;
  padding:14px 15px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-2);
  cursor:pointer;
  transition:border-color .14s,background .14s,transform .14s;
}
.toggle-card:hover{
  border-color:#d4d9e4;
  background:#fff;
  transform:translateY(-1px);
}
.toggle-card span{min-width:0}
.toggle-card b{
  display:block;
  color:var(--text);
  font-size:13px;
}
.toggle-card small{
  display:block;
  margin-top:4px;
  color:var(--muted);
  font-size:11.5px;
  font-weight:400;
  line-height:1.5;
}
.toggle-card input{
  flex:0 0 auto;
  width:18px;
  height:18px;
  margin:0;
  accent-color:var(--primary);
  box-shadow:none;
}
.toggle-wide{grid-column:1/-1}
.settings-bottom-grid{
  display:grid;
  grid-template-columns:minmax(0,1.15fr) minmax(330px,.85fr);
  gap:18px;
}
.security-summary{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin-bottom:20px;
}
.security-summary>div{
  padding:12px 13px;
  border:1px solid var(--line);
  border-radius:11px;
  background:var(--surface-2);
}
.security-summary span,.security-summary strong{display:block}
.security-summary span{
  margin-bottom:5px;
  color:var(--muted);
  font-size:11px;
}
.security-summary strong{
  font-size:12.5px;
  overflow-wrap:anywhere;
}
.password-form{display:grid;gap:15px}
.password-row{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:15px;
}
.info-card{display:flex;flex-direction:column}
.info-list{display:grid;gap:2px}
.info-list>div{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:12px 0;
  border-bottom:1px solid var(--line);
}
.info-list span{color:var(--muted);font-size:11.5px}
.info-list code{text-align:right;font-weight:650}
.info-tip{
  margin-top:auto;
  padding:14px;
  border:1px solid #dbe3ff;
  border-radius:12px;
  background:#f4f7ff;
}
.info-tip b{
  display:block;
  margin-bottom:4px;
  color:#294ac5;
  font-size:12.5px;
}
.info-tip p{
  margin:0;
  color:#5365a2;
  font-size:11.5px;
  line-height:1.65;
}

/* Responsive */
@media(max-width:1150px){
  .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .span2{grid-column:span 1}
  .settings-bottom-grid{grid-template-columns:1fr}
  .settings-card-compact{margin-bottom:18px}
}
@media(max-width:820px){
  .sidebar{
    width:min(82vw,280px);
    transform:translateX(-100%);
    transition:transform .2s ease;
  }
  body.nav-open .sidebar{transform:translateX(0)}
  .main{margin-left:0;width:100%}
  .menu{display:grid;place-items:center}
  .content{padding:18px}
  .topbar{height:64px;padding:0 16px}
  .grid2{grid-template-columns:1fr}
  .overlay{
    display:block;
    position:fixed;
    inset:0;
    z-index:30;
    background:rgba(0,0,0,.36);
    opacity:0;
    pointer-events:none;
    transition:opacity .2s;
  }
  body.nav-open .overlay{opacity:1;pointer-events:auto}
}
@media(max-width:720px){
  body{font-size:13px}
  .settings-card{padding:18px}
  .settings-card-head{padding-bottom:15px;margin-bottom:17px}
  .settings-form-grid{grid-template-columns:1fr;gap:15px}
  .toggle-grid{grid-template-columns:1fr}
  .toggle-wide{grid-column:auto}
  .security-summary{grid-template-columns:1fr}
  .password-row{grid-template-columns:1fr}
  .settings-actions{
    flex-direction:column-reverse;
    align-items:stretch;
  }
  .settings-actions .btn{width:100%}
  .action-hint{margin:0;text-align:center}
}
@media(max-width:640px){
  .stats{grid-template-columns:1fr 1fr;gap:10px}
  .stats article{padding:14px}
  .stats strong{font-size:22px}
  .card{padding:14px;border-radius:14px}
  .form-grid{grid-template-columns:1fr}
  .actions .btn{flex:1 1 140px}
  .table-wrap{border:0;overflow:visible}
  table{min-width:0;display:block}
  thead{display:none}
  tbody{display:grid;gap:10px}
  tr{
    display:block;
    padding:8px 12px;
    border:1px solid var(--line);
    border-radius:12px;
    background:#fff;
  }
  td{
    display:grid;
    grid-template-columns:105px minmax(0,1fr);
    gap:10px;
    padding:8px 0;
    border-bottom:1px dashed var(--line);
    text-align:left!important;
    overflow-wrap:anywhere;
  }
  td:last-child{border-bottom:0}
  td::before{
    content:attr(data-label);
    color:var(--muted);
    font-size:11px;
    font-weight:700;
  }
  td[colspan]{display:block}
  td[colspan]::before{display:none}
  .login-card{padding:22px}
}
@media(max-width:420px){
  .content{padding:14px}
  .settings-card{padding:15px;border-radius:14px}
  .section-mark{width:30px;height:26px}
  .settings-card-head h2{font-size:16px}
  .toggle-card{padding:12px}
  .stats{grid-template-columns:1fr}
}


/* ===============================
   Discovery page v4
   =============================== */
.discovery-page{
  width:min(1320px,100%);
  margin:0 auto;
}
.discovery-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:18px 20px;
}
.discovery-toolbar h2{
  margin:0 0 4px;
  font-size:16px;
}
.discovery-toolbar p{
  margin:0;
  color:var(--muted);
  font-size:12px;
}
.discovery-toolbar form{flex:0 0 auto}

.discovery-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px;
  align-items:start;
  margin-bottom:18px;
}
.discovery-grid-secondary{
  grid-template-columns:minmax(0,1.1fr) minmax(320px,.9fr);
}

.discovery-card{
  min-width:0;
  margin-bottom:0;
  padding:18px;
}
.discovery-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.discovery-card-head h2{
  margin:0 0 2px;
  font-size:16px;
}
.discovery-card-head p{
  margin:0;
  color:var(--muted);
  font-size:11.5px;
}

.discovery-table{
  max-height:420px;
  overflow:auto;
  scrollbar-gutter:stable;
}
.discovery-table-short{
  max-height:300px;
}
.discovery-table table{
  min-width:0;
  table-layout:fixed;
}
.compact-table th,
.compact-table td{
  padding:10px 12px;
  line-height:1.4;
}
.compact-table th{
  position:sticky;
  top:0;
  z-index:2;
  background:#fafbfc;
}
.compact-table td{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.compact-table code{
  font-size:12px;
}

.feishu-table th:nth-child(1){width:28%}
.feishu-table th:nth-child(2){width:32%}
.feishu-table th:nth-child(3){width:40%}

.casdoor-user-table th:nth-child(1){width:23%}
.casdoor-user-table th:nth-child(2){width:27%}
.casdoor-user-table th:nth-child(3){width:50%}

.department-table th:nth-child(1){width:46%}
.department-table th:nth-child(2){width:54%}

.email-cell{
  overflow-wrap:anywhere;
}
.role-list{
  display:flex;
  flex-wrap:wrap;
  align-content:flex-start;
  gap:9px;
  min-height:74px;
}
.role-chip{
  display:inline-flex;
  align-items:center;
  min-height:32px;
  padding:6px 11px;
  border:1px solid #dbe2ff;
  border-radius:999px;
  background:#f4f7ff;
  color:#3652b5;
  font-size:12px;
  font-weight:650;
}

.discovery-table::-webkit-scrollbar{
  width:8px;
  height:8px;
}
.discovery-table::-webkit-scrollbar-track{
  background:transparent;
}
.discovery-table::-webkit-scrollbar-thumb{
  border-radius:999px;
  background:#c5cad4;
}
.discovery-table::-webkit-scrollbar-thumb:hover{
  background:#abb2bf;
}

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

@media(max-width:720px){
  .discovery-toolbar{
    align-items:stretch;
    flex-direction:column;
  }
  .discovery-toolbar .btn{
    width:100%;
  }
  .discovery-card{
    padding:15px;
  }
  .discovery-table{
    max-height:none;
    overflow:visible;
  }
  .discovery-table table{
    table-layout:auto;
  }
  .compact-table td{
    white-space:normal;
  }
}


/* ===============================
   Discovery page v5
   =============================== */
.discovery-page{
  width:min(1320px,100%);
  margin:0 auto;
}
.discovery-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:18px 20px;
}
.discovery-toolbar h2{
  margin:0 0 4px;
  font-size:16px;
}
.discovery-toolbar p{
  margin:0;
  color:var(--muted);
  font-size:12px;
}

.discovery-columns{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px;
  align-items:start;
}
.discovery-column{
  min-width:0;
  display:grid;
  gap:18px;
  align-content:start;
}
.discovery-card{
  min-width:0;
  margin-bottom:0;
  padding:18px;
}
.discovery-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.discovery-card-head h2{
  margin:0 0 2px;
  font-size:16px;
}
.discovery-card-head p{
  margin:0;
  color:var(--muted);
  font-size:11.5px;
}

.discovery-table{
  overflow:auto;
  scrollbar-gutter:stable;
  border-radius:14px;
}
.discovery-table-tall{max-height:500px}
.discovery-table-medium{max-height:340px}
.discovery-table-short{max-height:260px}

.discovery-table table{
  min-width:0;
  table-layout:fixed;
}
.compact-table th,
.compact-table td{
  padding:10px 12px;
  line-height:1.4;
}
.compact-table th{
  position:sticky;
  top:0;
  z-index:2;
  background:#fafbfc;
}
.compact-table td{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.compact-table code{
  font-size:12px;
}

.feishu-table th:nth-child(1){width:28%}
.feishu-table th:nth-child(2){width:34%}
.feishu-table th:nth-child(3){width:38%}

.casdoor-user-table th:nth-child(1){width:23%}
.casdoor-user-table th:nth-child(2){width:27%}
.casdoor-user-table th:nth-child(3){width:50%}

.department-table th:nth-child(1){width:44%}
.department-table th:nth-child(2){width:56%}

.email-cell{
  overflow-wrap:anywhere;
}
.role-list-box{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-content:flex-start;
  min-height:auto;
  padding:4px 0 2px;
}
.role-chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  max-width:100%;
  min-height:34px;
  padding:7px 12px;
  border:1px solid #dbe2ff;
  border-radius:999px;
  background:#f4f7ff;
  color:#3652b5;
  font-size:12px;
  font-weight:650;
  line-height:1.2;
  overflow-wrap:anywhere;
  word-break:break-word;
}

.discovery-table::-webkit-scrollbar{
  width:8px;
  height:8px;
}
.discovery-table::-webkit-scrollbar-track{
  background:transparent;
}
.discovery-table::-webkit-scrollbar-thumb{
  border-radius:999px;
  background:#c5cad4;
}
.discovery-table::-webkit-scrollbar-thumb:hover{
  background:#abb2bf;
}

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

@media(max-width:720px){
  .discovery-toolbar{
    align-items:stretch;
    flex-direction:column;
  }
  .discovery-toolbar .btn{
    width:100%;
  }
  .discovery-card{
    padding:15px;
  }
  .discovery-table,
  .discovery-table-tall,
  .discovery-table-medium,
  .discovery-table-short{
    max-height:none;
    overflow:visible;
  }
  .discovery-table table{
    table-layout:auto;
  }
  .compact-table td{
    white-space:normal;
  }
}


/* ===============================
   Manual SSO binding v6
   =============================== */
.sso-page{
  width:min(1240px,100%);
  margin:0 auto;
}
.sso-intro{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
}
.sso-intro h2,
.sso-section-head h2,
.sso-note-card h2{
  margin:0 0 5px;
  font-size:17px;
}
.sso-intro p,
.sso-section-head p{
  margin:0;
  color:var(--muted);
  font-size:12px;
  line-height:1.65;
}
.warning-badge{
  flex:0 0 auto;
  color:var(--warning);
  background:var(--warning-soft);
}
.sso-section-head{
  display:flex;
  justify-content:space-between;
  gap:16px;
  padding-bottom:16px;
  margin-bottom:18px;
  border-bottom:1px solid var(--line);
}
.sso-bind-form{
  display:grid;
  grid-template-columns:minmax(0,1fr) 34px minmax(0,1fr);
  gap:18px;
  align-items:end;
}
.sso-arrow{
  display:grid;
  place-items:center;
  height:44px;
  color:var(--primary);
  font-size:22px;
  font-weight:800;
}
.sso-mapping-option{
  grid-column:1/-1;
  display:flex;
  align-items:flex-start;
  gap:11px;
  padding:13px 14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-2);
  cursor:pointer;
}
.sso-mapping-option input{
  flex:0 0 auto;
  width:17px;
  height:17px;
  margin:2px 0 0;
  accent-color:var(--primary);
  box-shadow:none;
}
.sso-mapping-option b,
.sso-mapping-option small{
  display:block;
}
.sso-mapping-option b{
  font-size:12.5px;
}
.sso-mapping-option small{
  margin-top:3px;
  color:var(--muted);
  font-size:11.5px;
  font-weight:400;
}
.sso-actions{
  grid-column:1/-1;
  margin-top:0;
}
.sso-table-wrap{
  max-height:480px;
  overflow:auto;
}
.sso-table{
  min-width:860px;
  table-layout:fixed;
}
.sso-table th:nth-child(1){width:17%}
.sso-table th:nth-child(2){width:17%}
.sso-table th:nth-child(3){width:18%}
.sso-table th:nth-child(4){width:38%}
.sso-table th:nth-child(5){width:10%}
.sso-table td strong,
.sso-table td small{
  display:block;
}
.sso-table td small{
  margin-top:3px;
  color:var(--muted);
  font-size:11px;
}
.sso-openid{
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.danger-outline{
  color:var(--danger);
  border-color:#f1c6c2;
  background:#fff;
}
.danger-outline:hover{
  color:#fff;
  border-color:var(--danger);
  background:var(--danger);
}
.sso-rules{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}
.sso-rules>div{
  padding:13px 14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-2);
}
.sso-rules b,
.sso-rules span{
  display:block;
}
.sso-rules b{
  margin-bottom:4px;
  font-size:12px;
}
.sso-rules span{
  color:var(--muted);
  font-size:11.5px;
  line-height:1.55;
}

@media(max-width:900px){
  .sso-bind-form{
    grid-template-columns:1fr;
  }
  .sso-arrow{
    height:auto;
    transform:rotate(90deg);
  }
}
@media(max-width:720px){
  .sso-intro{
    align-items:flex-start;
    flex-direction:column;
  }
  .sso-rules{
    grid-template-columns:1fr;
  }
  .sso-table-wrap{
    max-height:none;
    overflow:visible;
  }
}


/* ===============================
   Auto sync selector v7
   =============================== */
.autosync-current{
  height:44px;
  display:flex;
  align-items:center;
  gap:7px;
  padding:0 13px;
  border:1px solid var(--line);
  border-radius:11px;
  background:var(--surface-2);
}
.autosync-current strong{
  font-size:12.5px;
}
.autosync-block{
  margin-top:20px;
  padding:17px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fafbfc;
}
.autosync-title{
  display:flex;
  justify-content:space-between;
  gap:14px;
  margin-bottom:13px;
}
.autosync-title b,
.autosync-title small{
  display:block;
}
.autosync-title b{
  font-size:13px;
}
.autosync-title small{
  margin-top:4px;
  color:var(--muted);
  font-size:11.5px;
  font-weight:400;
}
.autosync-options{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
}
.autosync-option{
  position:relative;
  display:block;
  cursor:pointer;
}
.autosync-option input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}
.autosync-option span{
  min-height:68px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding:11px 12px;
  border:1px solid var(--line);
  border-radius:11px;
  background:#fff;
  transition:border-color .14s,background .14s,box-shadow .14s,transform .14s;
}
.autosync-option span:hover{
  border-color:#cbd3e2;
  transform:translateY(-1px);
}
.autosync-option b,
.autosync-option small{
  display:block;
}
.autosync-option b{
  color:var(--text);
  font-size:12.5px;
}
.autosync-option small{
  margin-top:3px;
  color:var(--muted);
  font-size:11px;
  font-weight:400;
}
.autosync-option input:checked + span{
  border-color:#8ba0ff;
  background:var(--primary-soft);
  box-shadow:0 0 0 2px rgba(52,93,255,.08);
}
.autosync-option input:checked + span b{
  color:var(--primary);
}
.autosync-custom{
  display:none;
  grid-template-columns:minmax(0,180px) minmax(0,180px) 1fr;
  gap:12px;
  align-items:end;
  margin-top:12px;
  padding:14px;
  border:1px dashed #cdd5e6;
  border-radius:11px;
  background:#fff;
}
.autosync-custom.is-visible{
  display:grid;
}
.autosync-custom-note{
  align-self:center;
  color:var(--muted);
  font-size:11.5px;
}
.runtime-grid{
  margin-top:20px;
  grid-template-columns:repeat(3,minmax(0,1fr));
}

@media(max-width:1000px){
  .autosync-options{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
@media(max-width:720px){
  .autosync-options{
    grid-template-columns:1fr 1fr;
  }
  .autosync-custom{
    grid-template-columns:1fr 1fr;
  }
  .autosync-custom-note{
    grid-column:1/-1;
  }
  .runtime-grid{
    grid-template-columns:1fr;
  }
}
@media(max-width:460px){
  .autosync-options{
    grid-template-columns:1fr;
  }
  .autosync-custom{
    grid-template-columns:1fr;
  }
}


/* SSO fast-open v9 */
.sso-intro-actions{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.sso-ready-card{
  display:flex;
  align-items:center;
  gap:16px;
  padding:22px;
  border-style:dashed;
}
.sso-ready-card h2{
  margin:0 0 5px;
  font-size:16px;
}
.sso-ready-card p{
  margin:2px 0;
  color:var(--muted);
  font-size:12px;
  line-height:1.6;
}
.sso-ready-icon{
  flex:0 0 44px;
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  border-radius:13px;
  background:var(--primary-soft);
  color:var(--primary);
  font-size:22px;
  font-weight:800;
}
.sso-local-table{
  min-width:880px;
  table-layout:fixed;
}
.sso-local-table th:nth-child(1){width:18%}
.sso-local-table th:nth-child(2){width:18%}
.sso-local-table th:nth-child(3){width:28%}
.sso-local-table th:nth-child(4){width:18%}
.sso-local-table th:nth-child(5){width:18%}

@media(max-width:720px){
  .sso-intro-actions{
    width:100%;
    justify-content:stretch;
  }
  .sso-intro-actions form,
  .sso-intro-actions .btn{
    width:100%;
  }
  .sso-ready-card{
    align-items:flex-start;
  }
}


/* ===============================
   Per-run sync logs v10
   =============================== */
.badge.running{
  color:#b54708;
  background:#fff4e5;
}
.run-time-link{
  font-weight:650;
}
.run-time-link:hover{
  color:var(--primary);
}
.run-id{
  display:block;
  margin-top:2px;
  color:var(--muted);
  font-size:10.5px;
}
.sync-summary-cell{
  max-width:390px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.run-detail-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-bottom:16px;
}
.run-detail-head>div{
  display:flex;
  gap:8px;
}
.run-stat-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin-bottom:16px;
}
.run-stat{
  padding:17px 18px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  box-shadow:var(--shadow);
}
.run-stat span,
.run-stat strong{
  display:block;
}
.run-stat span{
  color:var(--muted);
  font-size:11.5px;
}
.run-stat strong{
  margin-top:6px;
  font-size:23px;
}
.run-meta-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px 24px;
}
.run-meta-grid>div{
  min-width:0;
}
.run-meta-grid span,
.run-meta-grid strong{
  display:block;
}
.run-meta-grid span{
  margin-bottom:4px;
  color:var(--muted);
  font-size:11.5px;
}
.run-meta-grid strong{
  font-size:12.5px;
  overflow-wrap:anywhere;
}
.run-meta-summary{
  grid-column:1/-1;
  padding-top:12px;
  border-top:1px solid var(--line);
}
.run-log-list{
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden;
}
.run-log-row{
  display:grid;
  grid-template-columns:88px minmax(0,1fr);
  gap:14px;
  padding:12px 14px;
  border-bottom:1px solid var(--line);
  background:#fff;
}
.run-log-row:last-child{
  border-bottom:0;
}
.run-log-body b,
.run-log-body small{
  display:block;
}
.run-log-body b{
  font-size:12.5px;
  font-weight:600;
  overflow-wrap:anywhere;
}
.run-log-body small{
  margin-top:4px;
  color:var(--muted);
  font-size:11px;
}
.run-live-alert{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.live-dot{
  flex:0 0 auto;
  width:9px;
  height:9px;
  border-radius:50%;
  background:#f79009;
  box-shadow:0 0 0 0 rgba(247,144,9,.35);
  animation:runPulse 1.4s infinite;
}
@keyframes runPulse{
  0%{box-shadow:0 0 0 0 rgba(247,144,9,.35)}
  70%{box-shadow:0 0 0 8px rgba(247,144,9,0)}
  100%{box-shadow:0 0 0 0 rgba(247,144,9,0)}
}
@media(max-width:900px){
  .run-stat-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
@media(max-width:640px){
  .run-detail-head{
    align-items:stretch;
    flex-direction:column;
  }
  .run-detail-head .btn{
    width:100%;
  }
  .run-stat-grid{
    grid-template-columns:1fr 1fr;
    gap:10px;
  }
  .run-meta-grid{
    grid-template-columns:1fr;
  }
  .run-meta-summary{
    grid-column:auto;
  }
  .run-log-row{
    grid-template-columns:70px minmax(0,1fr);
    padding:11px;
  }
}


/* ===============================
   Dashboard action spacing v11
   =============================== */
.dashboard-actions{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:26px;
  margin-top:22px;
}
.dashboard-actions .btn{
  min-width:172px;
}
@media(max-width:640px){
  .dashboard-actions{
    gap:12px;
  }
  .dashboard-actions .btn{
    flex:1 1 100%;
    width:100%;
    min-width:0;
  }
}

/* ===============================
   Admin OIDC binding v11
   =============================== */
.oidc-binding{
  margin-top:22px;
  padding-top:20px;
  border-top:1px solid var(--line);
}
.oidc-binding-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:14px;
}
.oidc-binding-head b,
.oidc-binding-head small{
  display:block;
}
.oidc-binding-head b{
  font-size:13.5px;
}
.oidc-binding-head small{
  margin-top:4px;
  color:var(--muted);
  font-size:11.5px;
  font-weight:400;
}
.oidc-callback-box{
  padding:12px 13px;
  margin-bottom:14px;
  border:1px solid var(--line);
  border-radius:11px;
  background:var(--surface-2);
}
.oidc-callback-box span,
.oidc-callback-box code{
  display:block;
}
.oidc-callback-box span{
  margin-bottom:5px;
  color:var(--muted);
  font-size:11px;
}
.oidc-callback-box code{
  color:#31456f;
  font-size:11.5px;
  overflow-wrap:anywhere;
}
.oidc-inline-alert{
  margin:12px 0;
}
.oidc-identity-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin:14px 0;
}
.oidc-identity-grid>div{
  min-width:0;
  padding:11px 12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fafbfc;
}
.oidc-identity-grid span,
.oidc-identity-grid strong,
.oidc-identity-grid code{
  display:block;
}
.oidc-identity-grid span{
  margin-bottom:4px;
  color:var(--muted);
  font-size:10.5px;
}
.oidc-identity-grid strong,
.oidc-identity-grid code{
  font-size:11.5px;
  overflow-wrap:anywhere;
}
.oidc-binding-actions{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin-top:14px;
}
.oidc-binding-actions form{
  margin:0;
}
.oidc-help{
  margin:13px 0 0;
  color:var(--muted);
  font-size:11px;
  line-height:1.6;
}
.login-divider{
  position:relative;
  margin:20px 0;
  text-align:center;
  color:var(--muted);
  font-size:11px;
}
.login-divider:before{
  content:"";
  position:absolute;
  top:50%;
  left:0;
  right:0;
  height:1px;
  background:var(--line);
}
.login-divider span{
  position:relative;
  padding:0 10px;
  background:#fff;
}
.oidc-login-btn{
  border-color:#b9c7ff;
  color:#284cc7;
  background:#f4f7ff;
}
.oidc-login-btn:hover{
  border-color:#8da3ff;
  background:#edf2ff;
}
@media(max-width:720px){
  .oidc-identity-grid{
    grid-template-columns:1fr;
  }
  .oidc-binding-actions{
    align-items:stretch;
    flex-direction:column;
  }
  .oidc-binding-actions .btn,
  .oidc-binding-actions form{
    width:100%;
  }
}


/* Department mapping options v12 */
.dept-map-page{width:min(1180px,100%);margin:0 auto}
.dept-option-card{padding:24px 26px}
.dept-option-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;padding-bottom:18px;margin-bottom:20px;border-bottom:1px solid var(--line)}
.dept-option-head h2{margin:0 0 5px;font-size:18px}
.dept-option-head p{margin:0;color:var(--muted);font-size:12px}
.dept-select-grid{display:grid;grid-template-columns:minmax(0,1fr) 38px minmax(0,1fr);gap:16px;align-items:end}
.dept-map-arrow{height:44px;display:grid;place-items:center;color:var(--primary);font-size:22px;font-weight:800}
.dept-selected-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:18px}
.dept-selected-summary>div{min-width:0;padding:12px 13px;border:1px solid var(--line);border-radius:11px;background:var(--surface-2)}
.dept-selected-summary span,.dept-selected-summary strong{display:block}
.dept-selected-summary span{margin-bottom:5px;color:var(--muted);font-size:10.5px}
.dept-selected-summary strong{font-size:12.5px;overflow-wrap:anywhere}
.dept-user-panel{margin-top:18px;padding:16px;border:1px solid var(--line);border-radius:13px;background:#fafbfc}
.dept-user-panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:12px}
.dept-user-panel-head h3{margin:0 0 3px;font-size:14px}
.dept-user-panel-head p{margin:0;color:var(--muted);font-size:11.5px}
.dept-user-table-wrap{max-height:300px;overflow:auto;background:#fff}
.dept-user-table{min-width:0;table-layout:fixed}
.dept-user-table th:nth-child(1){width:27%}
.dept-user-table th:nth-child(2){width:31%}
.dept-user-table th:nth-child(3){width:42%}
.dept-user-table td{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dept-load-placeholder{display:flex;align-items:center;gap:15px;padding:18px;border:1px dashed #ccd3e1;border-radius:12px;background:#fafbfc}
.dept-load-icon{flex:0 0 42px;width:42px;height:42px;display:grid;place-items:center;border-radius:12px;background:var(--primary-soft);color:var(--primary);font-size:20px;font-weight:800}
.dept-load-placeholder p{margin:3px 0 0;color:var(--muted);font-size:11.5px}
.dept-manual-card{padding:17px 20px}
.dept-manual-card summary{cursor:pointer;font-weight:700}
.dept-manual-card details>p{margin:8px 0 15px}
.dept-manual-form{display:grid;grid-template-columns:repeat(3,minmax(0,1fr)) auto;gap:14px;align-items:end}
.dept-existing-table{min-width:760px}
@media(max-width:900px){
  .dept-selected-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
  .dept-manual-form{grid-template-columns:1fr 1fr}
}
@media(max-width:720px){
  .dept-option-head{flex-direction:column}
  .dept-option-head form,.dept-option-head .btn{width:100%}
  .dept-select-grid{grid-template-columns:1fr}
  .dept-map-arrow{height:auto;transform:rotate(90deg)}
  .dept-selected-summary{grid-template-columns:1fr 1fr}
  .dept-manual-form{grid-template-columns:1fr}
  .dept-user-table-wrap{max-height:none;overflow:visible}
}
@media(max-width:460px){.dept-selected-summary{grid-template-columns:1fr}}


/* ===============================
   SSH password recovery v13
   =============================== */
.login-help-row{
  display:flex;
  justify-content:flex-end;
  margin-top:10px;
}
.login-help-row a{
  color:var(--primary);
  font-size:11.5px;
  font-weight:600;
}
.login-help-row a:hover{
  text-decoration:underline;
}
.recovery-card{
  width:min(570px,100%);
}
.recovery-steps{
  display:grid;
  gap:10px;
  margin:20px 0;
}
.recovery-step{
  display:grid;
  grid-template-columns:34px minmax(0,1fr);
  gap:12px;
  align-items:start;
  padding:13px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-2);
}
.recovery-step>span{
  width:30px;
  height:30px;
  display:grid;
  place-items:center;
  border-radius:9px;
  color:var(--primary);
  background:var(--primary-soft);
  font-size:12px;
  font-weight:800;
}
.recovery-step b,
.recovery-step p,
.recovery-step code{
  display:block;
}
.recovery-step b{
  margin-bottom:4px;
  font-size:12.5px;
}
.recovery-step p{
  margin:4px 0;
  color:var(--muted);
  font-size:11.5px;
  line-height:1.55;
}
.recovery-step code{
  margin-top:7px;
  padding:8px 9px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
  color:#31456f;
  font-size:11px;
  white-space:normal;
  overflow-wrap:anywhere;
}
.recovery-note{
  padding:13px 14px;
  border:1px solid #dbe2ff;
  border-radius:12px;
  background:#f4f7ff;
}
.recovery-note b{
  color:#294ac5;
  font-size:12.5px;
}
.recovery-note p{
  margin:4px 0 0;
  color:#5365a2;
  font-size:11.5px;
  line-height:1.65;
}
.recovery-actions{
  display:grid;
  gap:10px;
  margin-top:18px;
}
