:root{
  --bg:#0b1220;
  --panel:#0f1b33;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --border:rgba(255,255,255,.12);
  --shadow:0 10px 30px rgba(0,0,0,.35);
  --radius:18px;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
  background: radial-gradient(1200px 700px at 20% 10%, #162a58 0%, var(--bg) 60%);
  color:var(--text);
}

a{color:var(--text);text-decoration:none}

.container{
  max-width:1200px;
  margin:24px auto;
  padding:0 16px 120px;
}

/* ---------- Header ---------- */
.header{
  position:relative;
  background:rgba(15,27,51,.85);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:18px;
  box-shadow:var(--shadow);
}
.header h1{margin:0;font-size:26px}
.sub{margin-top:6px;color:var(--muted);font-size:14px}

.portal-header-main{
  display:flex;
  align-items:center;
  justify-content:space-between;
  text-align:left;
  gap:24px;
}
.login-header{text-align:center}
.login-brand{display:flex;flex-direction:column;align-items:center}
.brand-logo{
  overflow:hidden;
  background:transparent;
}
.brand-logo img{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  object-position:center;
}
.brand-logo--login{width:min(480px,100%);height:150px;margin-bottom:18px}
.brand-logo--portal{width:270px;height:94px;flex:0 0 auto}
.visually-hidden{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  padding:0!important;
  margin:-1px!important;
  overflow:hidden!important;
  clip:rect(0,0,0,0)!important;
  white-space:nowrap!important;
  border:0!important;
}

.toplinks{
  margin-top:12px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.toplinks a{
  padding:10px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.06);
}
.small{font-size:14px}

/* ---------- Suche ---------- */
.search{margin-top:14px}
.search input{
  width:100%;
  max-width:520px;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.35);
  color:var(--text);
}

/* ---------- Sections ---------- */
.section{margin-top:24px}
.section h2{margin:0 0 12px 0;font-size:20px}

/* ---------- Grid ---------- */
.grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
  gap:18px;
}

/* ---------- Cards ---------- */
.card{
  position:relative;
  background:rgba(255,255,255,.05);
  border:1px solid var(--border);
  border-radius:var(--radius);
  overflow:hidden;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
.card::before{
  content:"";
  position:absolute;
  top:0;left:0;right:0;
  height:5px;
  background:var(--accent,#3b82f6);
}
.card a,
.cardbtn{
  width:100%;
  display:flex;
  align-items:center;
  gap:14px;
  padding:20px;
  min-height:86px;
}

/* Button-Kachel (für Passwort & Popup-Viewer) */
.cardbtn{
  background:transparent;
  border:0;
  color:var(--text);
  text-align:left;
  cursor:pointer;
  font:inherit;
}

.icon{
  width:48px;
  height:48px;
  border-radius:16px;
  background:rgba(255,255,255,.14);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  flex-shrink:0;
}

.label{font-weight:800;font-size:17px;line-height:1.2}

/* Linkanzeige ausblenden */
.meta{display:none}

/* Stärkerer Hover */
.card:hover,
.card:focus-within{
  transform: translateY(-6px) scale(1.02);
  background:rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.25);
  box-shadow:
    0 20px 40px rgba(0,0,0,.45),
    0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
}
.card:hover .icon,
.card:focus-within .icon{
  background: color-mix(in srgb, var(--accent) 35%, rgba(255,255,255,.2));
}

/* ---------- Collapsible ---------- */
details{
  background:rgba(255,255,255,.04);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:0 14px 14px;
}
summary{
  padding:16px 2px;
  cursor:pointer;
  font-weight:800;
}

/* ---------- Notices ---------- */
.notice{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.06);
}
.notice.error{border-color:rgba(255,80,80,.45); background:rgba(255,80,80,.10)}
.notice.ok{border-color:rgba(80,255,160,.35); background:rgba(80,255,160,.10)}

/* ---------- Forms ---------- */
.formrow{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.formrow input[type="text"],
.formrow input[type="password"],
.formrow select{
  flex:1;
  min-width:180px;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.35);
  color:var(--text);
}
.formrow input[type="color"]{
  height:44px;
  width:70px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.35);
  padding:6px;
}
.formrow label{color:var(--muted);font-size:14px}
.formrow button{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.10);
  color:var(--text);
  font-weight:800;
  cursor:pointer;
}

/* ---------- Modal (Popup) ---------- */
body.modal-open{overflow:hidden}

.modal{
  position:fixed;
  inset:0;
  z-index:9999;
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
  background:rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
}
.modal.is-open{display:flex}

.modal__panel{
  width:100%;
  max-width:520px;
  background:rgba(15,27,51,.97);
  border:1px solid var(--border);
  border-radius:22px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  overflow:hidden;
}

.modal__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 18px;
  border-bottom:1px solid var(--border);
}
.modal__title{font-weight:900;font-size:16px}
.modal__x{
  background:rgba(255,255,255,.08);
  border:1px solid var(--border);
  border-radius:12px;
  color:var(--text);
  width:40px;
  height:40px;
  cursor:pointer;
}
.viewer__close-actions{display:flex;align-items:center;gap:12px}
.viewer__esc-hint{font-size:14px;font-weight:800;color:#fff}
.modal__x--viewer{
  width:48px;
  height:48px;
  border:2px solid #fff;
  border-radius:14px;
  background:#dc2626;
  color:#fff;
  font-size:25px;
  font-weight:900;
  box-shadow:0 0 0 3px rgba(220,38,38,.28),0 6px 18px rgba(0,0,0,.45);
}
.modal__x--viewer:hover,
.modal__x--viewer:focus-visible{background:#ef4444;transform:scale(1.06);outline:3px solid #fca5a5;outline-offset:2px}

.modal__body{padding:18px}
.modal__row{display:flex;gap:12px;align-items:center}
.modal__icon{
  width:48px;height:48px;border-radius:16px;
  background:rgba(255,255,255,.12);
  display:flex;align-items:center;justify-content:center;
  font-size:22px;
}
.modal__label{font-weight:900;font-size:18px}
.modal__hint{margin-top:4px;color:var(--muted);font-size:13px}

.modal__form{margin-top:14px}
.modal__form input[type="password"]{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.35);
  color:var(--text);
}

.modal__actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  margin-top:12px;
}

/* Buttons im Modal */
.btn{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.10);
  color:var(--text);
  font-weight:900;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
}
.btn.ghost{background:rgba(255,255,255,.06)}

/* ---------- Viewer (iFrame in der Seite) ---------- */
.viewer__panel{
  width:calc(100vw - 32px);
  height:calc(100vh - 32px);
  min-width:85vw;
  min-height:85vh;
  max-width:none;
  display:flex;
  flex-direction:column;
}
.viewer__body{
  flex:1;
  min-height:0;
  background:rgba(0,0,0,.25);
}
.viewer__body iframe{
  width:100%;
  height:100%;
  border:0;
  background:#fff;
  border-bottom-left-radius:22px;
  border-bottom-right-radius:22px;
}

/* ---------- Mobile Bottom Nav ---------- */
.mobile-nav{display:none}

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

  .card:hover{transform:none}
  .card:active{transform:scale(0.98); background:rgba(255,255,255,.12)}

  .modal__panel{max-width:none}
  .viewer__panel{max-width:none}
  .portal-header-main{align-items:center}
  .brand-logo--portal{width:190px;height:76px}
  .viewer__esc-hint{font-size:12px}

  .mobile-nav{
    display:flex;
    position:fixed;
    left:12px;
    right:12px;
    bottom:12px;
    gap:10px;
    background:rgba(15,27,51,.9);
    border:1px solid var(--border);
    border-radius:18px;
    padding:10px;
    box-shadow:var(--shadow);
  }
  .mobile-nav a{
    flex:1;
    text-align:center;
    padding:12px;
    border-radius:14px;
    background:rgba(255,255,255,.08);
    font-weight:900;
  }
}

@media (max-width: 480px){
  .portal-header-main{gap:12px}
  .portal-header-main > div:first-child{min-width:0}
  .portal-header-main h1{font-size:20px}
  .brand-logo--portal{width:120px;height:58px}
}
