/* =========================================================
   MS ONLINE-QM
   PORTAL MASTER – RC1 / U11
   ========================================================= */

:root{
  --ms-cream:#f6f0e5;
  --ms-cream-2:#fbf8f2;
  --ms-bordeaux:#6f2338;
  --ms-bordeaux-strong:#54192b;
  --ms-gold:#b08c45;
  --ms-gold-soft:#eadfc7;
  --ms-ink:#2d2927;
  --ms-muted:#716860;
  --ms-surface:#ffffff;
  --ms-line:#ded4c7;
  --ms-success:#39704d;
  --ms-warning:#94631c;
  --ms-danger:#9b3035;
}

body.portal-authenticated{
  margin:0;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,
    BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:var(--ms-ink);
  background-color:var(--ms-cream);
}

/* TOPBAR */

.portal-authenticated .topbar{
  position:sticky;
  top:0;
  z-index:50;

  height:70px;
  padding:10px 22px;

  display:flex;
  align-items:center;
  gap:18px;

  background:rgba(246,240,229,.96);
  border-bottom:1px solid var(--ms-line);

  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);

  box-shadow:none;
}

.portal-authenticated .brand-area{
  min-width:0;
}

.portal-authenticated .portal-name strong{
  display:block;
  color:var(--ms-bordeaux);
  font-size:13px;
  font-weight:800;
  letter-spacing:.025em;
}

.portal-authenticated .portal-name small{
  display:block;
  margin-top:2px;
  color:var(--ms-muted);
  font-size:11px;
}

.portal-authenticated .logo-slot{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:10px;
}

.portal-authenticated .logo-slot img{
  width:44px;
  height:44px;
  object-fit:contain;
}

.portal-authenticated .env{
  padding:5px 9px;
  border-radius:999px;
  background:var(--ms-gold-soft);
  color:var(--ms-bordeaux);
  font-size:10px;
  font-weight:800;
}

/* LAYOUT */

.portal-authenticated .shell{
  display:grid;
  grid-template-columns:245px minmax(0,1fr);
  max-width:1500px;
  margin:0 auto;
  min-height:calc(100vh - 70px);
}

/* SIDEBAR */

.portal-authenticated .sidebar{
  position:relative;
  top:auto;
  height:auto;
  min-height:calc(100vh - 70px);

  padding:18px 14px 110px;

  overflow-y:auto;

  background:rgba(251,248,242,.76);
  color:var(--ms-ink);

  border-right:1px solid var(--ms-line);
  box-shadow:none;
}

.portal-authenticated .sidebar:after{
  display:none;
}

.portal-authenticated .sidebar a,
.portal-authenticated .sidebar .linklike{
  display:flex;
  align-items:center;

  min-height:40px;

  margin:2px 0;
  padding:9px 11px;

  border:0;
  border-radius:10px;

  background:transparent;
  color:#574f52;

  text-decoration:none;

  font-family:Inter,ui-sans-serif,system-ui,-apple-system,
    BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-size:14px;
  font-weight:600;

  cursor:pointer;

  transition:.15s ease;
}

.portal-authenticated .sidebar a:hover,
.portal-authenticated .sidebar .linklike:hover{
  background:#fff;
  color:var(--ms-bordeaux);
  transform:none;
}

.portal-authenticated .sidebar a.active{
  background:var(--ms-bordeaux);
  color:#fff;
  font-weight:700;
  box-shadow:none;
}

/* MAIN */

.portal-authenticated main{
  width:100%;
  max-width:none;

  padding:28px clamp(18px,3vw,42px) 90px;
}

.portal-authenticated .pagehead{
  margin-bottom:22px;
}

.portal-authenticated .pagehead h1{
  margin:4px 0;
  color:var(--ms-bordeaux);

  font-family:Inter,ui-sans-serif,system-ui,-apple-system,
    BlinkMacSystemFont,"Segoe UI",sans-serif;

  font-size:clamp(25px,3vw,34px);
  line-height:1.1;
  letter-spacing:-.025em;
}

.portal-authenticated .pagehead p{
  color:var(--ms-muted);
}

.portal-authenticated .eyebrow{
  color:var(--ms-gold);

  font-family:Inter,ui-sans-serif,system-ui,-apple-system,
    BlinkMacSystemFont,"Segoe UI",sans-serif;

  font-size:10px;
  font-weight:800;
  letter-spacing:.1em;
  text-transform:uppercase;
}

/* KARTEN */

.portal-authenticated .card,
.portal-authenticated .panel,
.portal-authenticated .status-card,
.portal-authenticated .qmcard{
  background:var(--ms-surface);

  border:1px solid var(--ms-line);
  border-radius:16px;

  box-shadow:0 1px 0 rgba(67,47,36,.02);
}

.portal-authenticated .card,
.portal-authenticated .panel{
  padding:19px;
}

.portal-authenticated h2,
.portal-authenticated h3{
  color:var(--ms-bordeaux);

  font-family:Inter,ui-sans-serif,system-ui,-apple-system,
    BlinkMacSystemFont,"Segoe UI",sans-serif;
}

/* LISTEN */

.portal-authenticated .listrow{
  padding:12px 0;
  border-bottom:1px solid var(--ms-line);
}

.portal-authenticated .listrow:last-child{
  border-bottom:0;
}

/* BUTTONS */

.portal-authenticated button{
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,
    BlinkMacSystemFont,"Segoe UI",sans-serif;
}

.portal-authenticated button:not(.qm-ai-launcher):not(.qm-ai-close){
  border-radius:10px;
}

/* FEEDBACK */

.portal-authenticated .feedback-btn{
  right:24px;
  bottom:86px;

  padding:6px 10px;

  border:1px solid var(--ms-line);
  border-radius:999px;

  background:#fff;
  color:var(--ms-bordeaux);

  font-size:10px;
  font-weight:700;

  box-shadow:none;
}

/* QM ASSISTENT AN MASTER ANGLEICHEN */

.portal-authenticated .qm-ai-panel{
  width:min(380px,calc(100vw - 28px));
  height:min(590px,calc(100vh - 110px));

  border:1px solid var(--ms-line);
  border-radius:16px;

  box-shadow:0 18px 50px rgba(73,50,36,.13);
}

.portal-authenticated .qm-ai-header{
  background:var(--ms-bordeaux);
}

.portal-authenticated .qm-ai-quick{
  flex-wrap:wrap;
  overflow:visible;
}

.portal-authenticated .qm-ai-quick button{
  background:#fff;
  border:1px solid var(--ms-line);
  color:var(--ms-bordeaux);
}

.portal-authenticated .qm-ai-form button{
  background:var(--ms-bordeaux);
}

/* LAUNCHER AUSBLENDEN WENN CHAT OFFEN */

body:has(.qm-ai-panel.open) .qm-ai-launcher{
  opacity:0;
  pointer-events:none;
}

/* TABLET */

@media(max-width:1050px){

  .portal-authenticated .shell{
    grid-template-columns:82px 1fr;
  }

  .portal-authenticated .sidebar a{
    justify-content:center;
    font-size:0;
  }
}

/* MOBILE */

@media(max-width:700px){

  .portal-authenticated .shell{
    display:block;
  }

  .portal-authenticated .sidebar{
    display:none;
  }

  .portal-authenticated main{
    padding:18px 14px 100px;
  }

  .portal-authenticated .logo-slot .env{
    display:none;
  }
}

/* =========================================================
   PORTAL MASTER – HEADER / NAVIGATION DETAIL
   ========================================================= */

.portal-authenticated .topbar-spacer{
  flex:1;
}

.portal-authenticated .topbar-user{
  display:flex;
  align-items:center;
  gap:10px;

  padding:7px 11px;

  border:1px solid var(--ms-line);
  border-radius:12px;

  background:rgba(255,255,255,.72);
}

.portal-authenticated .topbar-user-avatar{
  width:36px;
  height:36px;

  display:grid;
  place-items:center;

  border-radius:50%;

  background:var(--ms-bordeaux);
  color:#fff;

  font-size:12px;
  font-weight:800;
}

.portal-authenticated .topbar-user-copy{
  display:flex;
  flex-direction:column;
  min-width:130px;
}

.portal-authenticated .topbar-user-copy strong{
  color:var(--ms-ink);
  font-size:12px;
  line-height:1.2;
}

.portal-authenticated .topbar-user-copy small{
  margin-top:2px;
  color:var(--ms-muted);
  font-size:10px;
}

.portal-authenticated .nav-section-label{
  margin:7px 10px 8px;

  color:var(--ms-gold);

  font-size:9px;
  font-weight:900;
  letter-spacing:.15em;
}

.portal-authenticated .nav-section-gap{
  margin-top:22px;
}

.portal-authenticated .sidebar a,
.portal-authenticated .sidebar .linklike{
  gap:9px;
}

.portal-authenticated .nav-icon{
  width:18px;

  display:inline-flex;
  justify-content:center;
  align-items:center;

  flex:0 0 18px;

  font-size:12px;
  line-height:1;
}

.portal-authenticated .sidebar a.active .nav-icon{
  color:#fff;
}

.portal-authenticated .sidebar form{
  margin:0;
}

.portal-authenticated .sidebar form .linklike{
  width:100%;
  text-align:left;
}

.portal-authenticated .side-claim{
  position:absolute;
  left:24px;
  bottom:30px;

  color:var(--ms-bordeaux);

  font-family:Georgia,"Times New Roman",serif;
  font-size:18px;
  font-style:italic;
  font-weight:700;
  line-height:1.22;
}

.portal-authenticated .side-claim:after{
  content:"";
  display:block;

  width:54px;
  height:2px;

  margin-top:10px;

  background:var(--ms-gold);
}

/* Assistent im Portal immer sichtbar */

.portal-authenticated .qm-ai-launcher{
  display:flex !important;
  visibility:visible !important;
  opacity:1;
  z-index:500;
}

.portal-authenticated:has(.qm-ai-panel.open) .qm-ai-launcher{
  opacity:0 !important;
  pointer-events:none;
}

.portal-authenticated .qm-ai-panel{
  z-index:510;
}

/* Mobil */

@media(max-width:900px){
  .portal-authenticated .topbar-user-copy{
    display:none;
  }

  .portal-authenticated .topbar-user{
    padding:5px;
  }
}

/* =========================================================
   DASHBOARD MASTER – RC1 / U11
   ========================================================= */

.ms-dashboard-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
}

.ms-dashboard-head p{
  margin:6px 0 0;
}

.ms-qm-overview{
  margin-bottom:16px;
}

.ms-qm-score{
  display:grid;
  grid-template-columns:180px 1fr;
  align-items:center;
  gap:28px;

  padding:22px 24px;

  border:1px solid var(--ms-line);
  border-radius:16px;

  background:#fff;
}

.ms-qm-score > div:first-child{
  display:flex;
  flex-direction:column;
}

.ms-overline{
  color:var(--ms-gold);

  font-size:9px;
  font-weight:900;
  letter-spacing:.14em;
  text-transform:uppercase;
}

.ms-qm-score strong{
  margin-top:2px;

  color:var(--ms-bordeaux);

  font-size:38px;
  line-height:1;
}

.ms-qm-score small{
  margin-top:5px;
  color:var(--ms-muted);
  font-size:10px;
}

.ms-qm-progress{
  display:grid;
  grid-template-columns:minmax(200px,1fr) 210px;
  align-items:center;
  gap:20px;
}

.ms-progress-track{
  height:10px;
  overflow:hidden;

  border-radius:999px;

  background:#eee7dc;
}

.ms-progress-track span{
  display:block;
  height:100%;

  border-radius:999px;

  background:linear-gradient(
    90deg,
    var(--ms-bordeaux),
    var(--ms-gold)
  );
}

.ms-progress-copy{
  display:flex;
  flex-direction:column;
}

.ms-progress-copy strong{
  margin:0;
  color:var(--ms-ink);
  font-size:13px;
}

.ms-progress-copy small{
  margin-top:3px;
}

.ms-kpi-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;

  margin-bottom:16px;
}

.ms-kpi-card{
  display:flex;
  align-items:center;
  gap:13px;

  min-height:92px;
  padding:16px;

  border:1px solid var(--ms-line);
  border-radius:15px;

  background:#fff;
  color:var(--ms-ink);

  text-decoration:none;

  transition:
    border-color .15s ease,
    transform .15s ease,
    box-shadow .15s ease;
}

.ms-kpi-card:hover{
  border-color:rgba(111,35,56,.3);
  transform:translateY(-1px);

  box-shadow:0 8px 22px rgba(60,40,30,.05);
}

.ms-kpi-icon{
  width:36px;
  height:36px;

  display:grid;
  place-items:center;

  flex:0 0 36px;

  border-radius:10px;

  background:var(--ms-cream);
  color:var(--ms-bordeaux);

  font-size:15px;
  font-weight:800;
}

.ms-kpi-card > div{
  display:flex;
  flex-direction:column;
}

.ms-kpi-card strong{
  color:var(--ms-bordeaux);
  font-size:25px;
  line-height:1;
}

.ms-kpi-card span:not(.ms-kpi-icon){
  margin-top:4px;
  font-size:12px;
  font-weight:700;
}

.ms-kpi-card small{
  margin-top:3px;
  color:var(--ms-muted);
  font-size:9px;
}

.ms-dashboard-grid{
  display:grid;
  grid-template-columns:minmax(0,1.15fr) minmax(330px,.85fr);
  gap:16px;
}

.ms-dashboard-card{
  min-width:0;

  padding:18px;

  border:1px solid var(--ms-line);
  border-radius:16px;

  background:#fff;
}

.ms-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;

  margin-bottom:10px;
}

.ms-card-head h2{
  margin:3px 0 0;

  color:var(--ms-bordeaux);

  font-size:20px;
}

.ms-text-link{
  margin-top:4px;

  color:var(--ms-bordeaux);

  font-size:10px;
  font-weight:800;
  text-decoration:none;
}

.ms-priority-row{
  display:grid;
  grid-template-columns:42px minmax(0,1fr) auto;
  align-items:center;
  gap:11px;

  min-height:61px;

  border-bottom:1px solid var(--ms-line);

  color:var(--ms-ink);
  text-decoration:none;
}

.ms-priority-row:last-child{
  border-bottom:0;
}

.ms-priority-row:hover{
  background:var(--ms-cream-2);
}

.ms-priority-badge{
  justify-self:start;

  min-width:31px;

  padding:4px 6px;

  border-radius:999px;

  text-align:center;

  font-size:9px;
  font-weight:900;
}

.ms-priority-badge.critical{
  background:#b94b4b;
  color:#fff;
}

.ms-priority-badge.normal{
  background:var(--ms-gold-soft);
  color:var(--ms-bordeaux);
}

.ms-priority-main{
  display:flex;
  min-width:0;
  flex-direction:column;
}

.ms-priority-main strong{
  overflow:hidden;

  font-size:12px;
  line-height:1.25;

  text-overflow:ellipsis;
  white-space:nowrap;
}

.ms-priority-main small{
  margin-top:3px;
  color:var(--ms-muted);
  font-size:9px;
}

.ms-priority-date{
  color:#514b47;
  font-size:10px;
  font-weight:700;
}

.ms-check-row{
  display:grid;
  grid-template-columns:76px minmax(0,1fr) 14px;
  align-items:center;
  gap:12px;

  min-height:72px;

  border-bottom:1px solid var(--ms-line);
}

.ms-check-row:last-child{
  border-bottom:0;
}

.ms-check-date,
.ms-check-copy{
  display:flex;
  flex-direction:column;
}

.ms-check-date strong{
  color:var(--ms-bordeaux);
  font-size:12px;
}

.ms-check-date small,
.ms-check-copy small{
  margin-top:3px;
  color:var(--ms-muted);
  font-size:9px;
}

.ms-check-copy strong{
  font-size:12px;
}

.ms-status-dot{
  width:8px;
  height:8px;

  border-radius:50%;
}

.ms-status-dot.due{
  background:#b94b4b;
}

.ms-status-dot.planned{
  background:var(--ms-gold);
}

.ms-empty-state{
  padding:28px 8px;

  display:flex;
  flex-direction:column;

  color:var(--ms-muted);
}

.ms-empty-state strong{
  color:var(--ms-ink);
  font-size:12px;
}

.ms-empty-state small{
  margin-top:5px;
  font-size:10px;
}

@media(max-width:1050px){

  .ms-kpi-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .ms-dashboard-grid{
    grid-template-columns:1fr;
  }

  .ms-qm-score{
    grid-template-columns:1fr;
  }

  .ms-qm-progress{
    grid-template-columns:1fr;
  }
}

@media(max-width:620px){

  .ms-kpi-grid{
    grid-template-columns:1fr;
  }

  .ms-priority-row{
    grid-template-columns:38px minmax(0,1fr);
  }

  .ms-priority-date{
    grid-column:2;
  }
}
