/* Retter-Portal v1.2.95 – complete Admin-Verwaltung refresh.
   Scoped to admin pages only. Public site, dashboard and operational modules stay untouched. */

body.admin-surface{
  --admin-accent:#e11d48;
  --admin-accent-soft:rgba(225,29,72,.10);
  --admin-info:#2563eb;
  --admin-good:#059669;
  --admin-warning:#d97706;
}
body.admin-surface .content{
  width:min(1720px,100%);
  padding-top:22px;
}

/* Internal admin command bar */
.admin-command-nav{
  position:sticky;
  top:78px;
  z-index:4;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  width:100%;
  margin:0 0 22px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:18px;
  background:color-mix(in srgb,var(--surface-2) 88%,transparent);
  box-shadow:0 14px 36px rgba(15,23,42,.10);
  backdrop-filter:blur(20px) saturate(1.15);
  overflow-x:auto;
  scrollbar-width:none;
}
.admin-command-nav::-webkit-scrollbar{display:none}
.admin-command-nav__group{display:flex;align-items:center;gap:6px;min-width:max-content}
.admin-command-nav__label{
  padding:0 8px;
  color:var(--muted-2);
  font-size:.68rem;
  font-weight:950;
  letter-spacing:.11em;
  text-transform:uppercase;
}
.admin-command-nav a{
  display:inline-flex;
  align-items:center;
  min-height:38px;
  padding:8px 12px;
  border:1px solid transparent;
  border-radius:12px;
  color:var(--muted);
  font-size:.86rem;
  font-weight:900;
  white-space:nowrap;
  transition:.16s ease;
}
.admin-command-nav a:hover{color:var(--text);background:var(--surface);border-color:var(--line)}
.admin-command-nav a.is-active{
  color:#fff;
  background:linear-gradient(135deg,#d80f2c,#94132a);
  box-shadow:0 10px 24px rgba(200,16,46,.22);
}

/* Shared admin header */
.admin-page-hero{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:28px;
  margin-bottom:20px;
  padding:28px 30px;
  border:1px solid var(--line);
  border-radius:26px;
  background:
    radial-gradient(circle at 94% 0,rgba(37,99,235,.15),transparent 23rem),
    radial-gradient(circle at 0 100%,rgba(225,29,72,.11),transparent 25rem),
    var(--surface);
  box-shadow:var(--shadow);
  overflow:hidden;
}
.admin-page-hero>div:first-child{max-width:920px;min-width:0}
.admin-page-hero h1{font-size:clamp(2.25rem,4vw,4.25rem);max-width:100%;text-wrap:balance}
.admin-page-hero p.muted{max-width:850px;margin:12px 0 0;font-size:1rem;line-height:1.6}
.admin-page-hero__actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:10px;min-width:max-content}

/* Stats */
.admin-stat-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin:0 0 20px;
}
.admin-stat-grid--overview{grid-template-columns:repeat(5,minmax(0,1fr))}
.admin-stat-grid article{
  position:relative;
  display:grid;
  align-content:center;
  min-width:0;
  min-height:116px;
  padding:18px 20px;
  border:1px solid var(--line);
  border-radius:20px;
  background:var(--surface);
  box-shadow:var(--shadow-sm);
  overflow:hidden;
}
.admin-stat-grid article:before{content:"";position:absolute;inset:0 auto 0 0;width:4px;background:linear-gradient(180deg,#e11d48,#2563eb)}
.admin-stat-grid article.needs-attention:before{background:var(--admin-warning)}
.admin-stat-grid span{color:var(--muted);font-size:.74rem;font-weight:950;text-transform:uppercase;letter-spacing:.09em}
.admin-stat-grid strong{margin-top:4px;font-size:2.35rem;line-height:1;letter-spacing:-.055em}
.admin-stat-grid small{margin-top:8px;color:var(--muted-2);font-weight:800}

/* Overview hub */
.admin-hub-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-bottom:22px}
.admin-hub-card{
  display:grid;
  grid-template-columns:48px minmax(0,1fr) auto;
  align-items:center;
  gap:15px;
  min-width:0;
  min-height:132px;
  padding:18px;
  border:1px solid var(--line);
  border-radius:21px;
  background:var(--surface);
  box-shadow:var(--shadow-sm);
  transition:.18s ease;
}
.admin-hub-card:hover{transform:translateY(-2px);border-color:rgba(225,29,72,.35);box-shadow:0 20px 42px rgba(15,23,42,.13)}
.admin-hub-card__icon,.admin-list-avatar,.admin-account-avatar{
  display:grid;
  place-items:center;
  flex:0 0 auto;
  width:48px;
  height:48px;
  border-radius:15px;
  color:#fff;
  background:linear-gradient(135deg,#d80f2c,#64152a);
  font-size:.78rem;
  font-weight:950;
  letter-spacing:.06em;
}
.admin-hub-card div{min-width:0}
.admin-hub-card h2{font-size:1.08rem;letter-spacing:-.025em}
.admin-hub-card p{margin:6px 0 0;color:var(--muted);font-size:.88rem;line-height:1.45}
.admin-hub-card>strong{color:var(--admin-accent);font-size:.84rem;white-space:nowrap}
.admin-overview-grid{align-items:start}
.admin-compact-list,.admin-activity-list{display:grid;gap:8px}
.admin-compact-list>a{
  display:grid;
  grid-template-columns:42px minmax(0,1fr) auto;
  align-items:center;
  gap:12px;
  padding:11px;
  border:1px solid var(--line-soft);
  border-radius:15px;
  background:rgba(148,163,184,.045);
}
.admin-list-avatar{width:42px;height:42px;border-radius:13px}
.admin-compact-list strong,.admin-compact-list small{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.admin-compact-list small{margin-top:3px;color:var(--muted);font-size:.78rem}
.admin-activity-list article{display:grid;grid-template-columns:12px minmax(0,1fr);gap:10px;padding:10px 4px;border-bottom:1px solid var(--line-soft)}
.admin-activity-dot{width:9px;height:9px;margin-top:7px;border-radius:999px;background:var(--admin-accent);box-shadow:0 0 0 5px var(--admin-accent-soft)}
.admin-activity-list strong,.admin-activity-list small{display:block}
.admin-activity-list small{margin-top:3px;color:var(--muted);font-size:.78rem}
.admin-security-summary{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:24px}
.admin-security-points{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}
.admin-security-points>span:not(.secure-pill){padding:8px 11px;border:1px solid var(--line);border-radius:999px;color:var(--muted);font-size:.8rem;font-weight:900;background:var(--surface-2)}
.admin-changelog-details>summary,.admin-create-account>summary,.admin-account-editor>summary{
  list-style:none;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.admin-changelog-details>summary::-webkit-details-marker,.admin-create-account>summary::-webkit-details-marker,.admin-account-editor>summary::-webkit-details-marker{display:none}
.admin-changelog-details>summary span:first-child,.admin-create-account>summary span:first-child{display:grid;gap:3px}
.admin-changelog-details>summary small,.admin-create-account>summary small{color:var(--muted);font-weight:750}
.admin-changelog-details[open]>summary,.admin-create-account[open]>summary{padding-bottom:16px;border-bottom:1px solid var(--line-soft);margin-bottom:18px}

/* Filters */
.admin-filter-card{padding:20px}
.admin-account-filter{
  display:grid;
  grid-template-columns:minmax(260px,1.7fr) minmax(170px,.75fr) minmax(170px,.75fr) auto auto;
  gap:10px;
  align-items:center;
}
.admin-account-filter>*{min-width:0;margin:0}
.admin-create-account{padding:20px}
.admin-create-account__form,.admin-account-form{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
  margin-top:2px;
}
.admin-create-account__form label,.admin-account-form label{
  min-width:0;
  padding:13px;
  border:1px solid var(--line-soft);
  border-radius:15px;
  background:rgba(148,163,184,.045);
}
.admin-create-account__form input,.admin-create-account__form select,.admin-account-form input,.admin-account-form select{min-height:46px}
.admin-switch-field{align-content:start}
.admin-switch-line{display:flex;align-items:center;gap:10px;min-height:46px;color:var(--text);font-weight:850}
.admin-switch-line input{width:auto;min-height:0;margin:0}
.admin-field-wide{grid-column:1/-1}
.password-reveal{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center}
.password-reveal .btn{width:auto;min-width:88px;box-shadow:none}

/* Unified account cards */
.admin-account-list{display:grid;gap:14px}
.admin-account-card{
  scroll-margin-top:156px;
  border:1px solid var(--line);
  border-radius:22px;
  background:var(--surface);
  box-shadow:var(--shadow-sm);
  overflow:visible;
}
.admin-account-card__head{
  display:grid;
  grid-template-columns:52px minmax(0,1fr) auto;
  align-items:center;
  gap:15px;
  min-width:0;
  padding:18px;
}
.admin-account-avatar{width:52px;height:52px;border-radius:17px;font-size:1.15rem}
.admin-account-identity{min-width:0}
.admin-account-title-line{display:flex;align-items:center;gap:8px;min-width:0;flex-wrap:wrap}
.admin-account-title-line h2{min-width:0;max-width:100%;font-size:1.14rem;letter-spacing:-.025em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.admin-account-identity>p{margin:5px 0 0;color:var(--muted);font-size:.9rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.admin-account-meta{display:flex;flex-wrap:wrap;gap:6px 12px;margin-top:9px;color:var(--muted-2);font-size:.77rem;font-weight:800}
.admin-account-meta span{position:relative;white-space:nowrap}
.admin-account-meta span+span:before{content:"·";position:absolute;left:-8px;color:var(--muted-2)}
.admin-account-quicklinks{display:flex;align-items:center;justify-content:flex-end;gap:8px}
.admin-account-quicklinks .btn{box-shadow:none}
.admin-account-editor{border-top:1px solid var(--line-soft)}
.admin-account-editor>summary{padding:13px 18px;color:var(--text);font-weight:900;background:rgba(148,163,184,.045)}
.admin-account-editor>summary span{display:block}
.admin-account-editor>summary small{color:var(--muted);font-size:.78rem;font-weight:750}
.admin-account-editor[open]>summary{border-bottom:1px solid var(--line-soft)}
.admin-account-editor__body{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;padding:18px}
.admin-account-editor__section{min-width:0;padding:17px;border:1px solid var(--line-soft);border-radius:18px;background:rgba(148,163,184,.035)}
.admin-section-heading{margin-bottom:14px}
.admin-section-heading h3{font-size:1.05rem;letter-spacing:-.025em}
.admin-section-heading p{margin:5px 0 0;font-size:.84rem;line-height:1.45}
.admin-danger-zone{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:18px;border-color:rgba(225,29,72,.22);background:rgba(225,29,72,.045)}
.admin-danger-zone .admin-section-heading{margin:0;max-width:760px}
.admin-empty-state{display:flex;flex-direction:column;align-items:center;gap:7px;padding:34px!important;text-align:center}
.admin-empty-state span{color:var(--muted)}

/* Access workflow */
.admin-workflow-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-bottom:28px}
.admin-workflow-card{min-width:0;margin:0!important;padding:18px!important;overflow:visible!important}
.admin-workflow-step{display:grid;grid-template-columns:42px minmax(0,1fr);gap:12px;align-items:start;margin-bottom:16px}
.admin-workflow-step>span{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:var(--admin-accent-soft);color:var(--admin-accent);font-weight:950}
.admin-workflow-step h2{font-size:1.08rem;letter-spacing:-.025em}
.admin-workflow-step p{margin:5px 0 0;font-size:.82rem;line-height:1.45}
.admin-workflow-card .form-grid{gap:11px}
.admin-workflow-card .smart-select-field,.admin-workflow-card label{min-width:0}
.admin-workflow-card .smart-select-results{z-index:140!important}
.admin-assignment-section{margin-top:26px}
.admin-assignment-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.admin-assignment-grid>.card{margin:0}
.admin-assignment-wide{grid-column:1/-1}

/* Existing admin templates get a consistent visual language without changing their functionality. */
.admin-surface .page-head,.admin-surface .page-hero{
  padding:24px 26px;
  border:1px solid var(--line);
  border-radius:24px;
  background:var(--surface);
  box-shadow:var(--shadow-sm);
}
.admin-surface .page-head h1,.admin-surface .page-hero h1{font-size:clamp(2rem,3vw,3.35rem)}
.admin-surface .page-head .muted,.admin-surface .page-hero .muted{max-width:900px}
.admin-surface .card{box-shadow:var(--shadow-sm);border-color:var(--line);overflow:visible}
.admin-surface .card h2,.admin-surface .card h3{letter-spacing:-.025em}
.admin-surface .toolbar{border-color:var(--line);box-shadow:none}
.admin-surface .table-wrap{overflow:auto!important;border:1px solid var(--line);background:var(--surface);box-shadow:var(--shadow-sm)}
.admin-surface table{min-width:720px}
.admin-surface th{position:sticky;top:0;z-index:1;background:var(--surface-2)}
.admin-surface td,.admin-surface th{vertical-align:middle}
.admin-surface .form-grid>label,.admin-surface .inline-form>label{min-width:0}
.admin-surface input,.admin-surface select,.admin-surface textarea{min-width:0;max-width:100%}
.admin-surface .grid.two,.admin-surface .grid.three{align-items:start}
.admin-surface .smart-select-results{z-index:150!important}
.admin-surface .pill.off{background:rgba(225,29,72,.09);color:#be123c}

/* Light mode admin contrast */
body.admin-surface[data-theme="light"] .admin-command-nav,
body.admin-surface[data-theme="light"] .admin-account-card,
body.admin-surface[data-theme="light"] .admin-page-hero,
body.admin-surface[data-theme="light"] .admin-stat-grid article,
body.admin-surface[data-theme="light"] .admin-hub-card{background:rgba(255,255,255,.92)}
body.admin-surface[data-theme="light"] .admin-account-editor__section,
body.admin-surface[data-theme="light"] .admin-create-account__form label,
body.admin-surface[data-theme="light"] .admin-account-form label{background:#f8fafc}

/* Tablet */
@media (max-width:1280px){
  .admin-stat-grid--overview{grid-template-columns:repeat(3,minmax(0,1fr))}
  .admin-hub-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .admin-workflow-grid{grid-template-columns:1fr}
  .admin-workflow-card{display:grid;grid-template-columns:minmax(230px,.65fr) minmax(0,1fr);gap:18px;align-items:start}
  .admin-workflow-step{margin:0}
  .admin-account-filter{grid-template-columns:minmax(220px,1fr) minmax(150px,.55fr) minmax(150px,.55fr) auto}
  .admin-account-filter>a{grid-column:1/-1;width:max-content}
}

@media (max-width:1024px){
  .admin-command-nav{top:112px}
  .admin-page-hero{align-items:flex-start;flex-direction:column;padding:24px}
  .admin-page-hero__actions{justify-content:flex-start;min-width:0}
  .admin-stat-grid,.admin-stat-grid--overview{grid-template-columns:repeat(2,minmax(0,1fr))}
  .admin-account-filter{grid-template-columns:repeat(2,minmax(0,1fr))}
  .admin-account-filter input{grid-column:1/-1}
  .admin-account-card__head{grid-template-columns:48px minmax(0,1fr)}
  .admin-account-quicklinks{grid-column:1/-1;justify-content:flex-start;padding-left:63px}
  .admin-account-editor__body{grid-template-columns:1fr}
  .admin-danger-zone{grid-column:auto}
  .admin-assignment-grid{grid-template-columns:1fr}
  .admin-assignment-wide{grid-column:auto}
  .admin-security-summary{grid-template-columns:1fr}
  .admin-security-points{justify-content:flex-start}
}

/* Smartphone */
@media (max-width:760px){
  body.admin-surface .content{padding:14px!important}
  .admin-command-nav{position:relative;top:auto;margin-bottom:14px;padding:8px;border-radius:15px;justify-content:flex-start}
  .admin-command-nav__group{gap:4px}
  .admin-command-nav__label{display:none}
  .admin-command-nav a{min-height:36px;padding:7px 10px;font-size:.8rem}
  .admin-page-hero{padding:20px;border-radius:20px;gap:18px}
  .admin-page-hero h1{font-size:clamp(2rem,10vw,3rem)}
  .admin-page-hero__actions{display:grid;grid-template-columns:1fr;width:100%}
  .admin-page-hero__actions .btn{width:100%}
  .admin-stat-grid,.admin-stat-grid--overview{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .admin-stat-grid article{min-height:98px;padding:14px}
  .admin-stat-grid strong{font-size:1.9rem}
  .admin-stat-grid small{font-size:.72rem}
  .admin-hub-grid{grid-template-columns:1fr;gap:10px}
  .admin-hub-card{grid-template-columns:42px minmax(0,1fr);min-height:0;padding:14px}
  .admin-hub-card__icon{width:42px;height:42px}
  .admin-hub-card>strong{grid-column:2}
  .admin-overview-grid{grid-template-columns:1fr!important}
  .admin-account-filter{grid-template-columns:1fr}
  .admin-account-filter>*{grid-column:auto!important;width:100%!important}
  .admin-create-account__form,.admin-account-form{grid-template-columns:1fr}
  .admin-field-wide{grid-column:auto}
  .password-reveal{grid-template-columns:minmax(0,1fr) auto}
  .password-reveal .btn{width:auto!important;min-width:76px;padding-inline:9px}
  .admin-account-card__head{grid-template-columns:42px minmax(0,1fr);gap:11px;padding:14px}
  .admin-account-avatar{width:42px;height:42px;border-radius:13px}
  .admin-account-title-line{align-items:flex-start}
  .admin-account-title-line h2{width:100%;font-size:1rem}
  .admin-account-meta{display:grid;grid-template-columns:1fr;gap:4px;margin-top:7px}
  .admin-account-meta span+span:before{display:none}
  .admin-account-quicklinks{padding-left:53px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}
  .admin-account-quicklinks .btn{width:100%}
  .admin-account-editor>summary{padding:12px 14px}
  .admin-account-editor__body{padding:12px;gap:10px}
  .admin-account-editor__section{padding:13px;border-radius:15px}
  .admin-danger-zone{display:block}
  .admin-danger-zone form{margin-top:12px}
  .admin-danger-zone .btn{width:100%}
  .admin-workflow-card{display:block;padding:14px!important}
  .admin-workflow-step{margin-bottom:14px}
  .admin-assignment-grid .table-wrap{overflow:auto!important}
  .admin-surface .page-head,.admin-surface .page-hero{padding:18px;border-radius:19px}
  .admin-surface .page-head .actions,.admin-surface .page-hero .actions{display:grid;width:100%;grid-template-columns:1fr}
  .admin-surface .page-head .actions .btn,.admin-surface .page-hero .actions .btn{width:100%}
  .admin-surface table{min-width:680px}
}

@media (max-width:390px){
  .admin-stat-grid,.admin-stat-grid--overview{grid-template-columns:1fr 1fr}
  .admin-stat-grid article{padding:12px;min-height:92px}
  .admin-stat-grid span{font-size:.64rem}
  .admin-stat-grid strong{font-size:1.65rem}
  .admin-account-title-line .role,.admin-account-title-line .pill{font-size:.67rem;padding:5px 8px}
}
