:root{
  --qc-red:#c81024;
  --qc-red-dark:#9f0d1e;
  --qc-red-soft:#fff2f4;
  --qc-red-line:#f1ccd2;
  --qc-bg:#f5f6f8;
  --qc-panel:#ffffff;
  --qc-text:#17202b;
  --qc-muted:#7a8491;
  --qc-line:#e6e9ed;
  --qc-shadow:0 6px 20px rgba(24,31,40,.055);
}

*{box-sizing:border-box}

html,body{
  margin:0;
  padding:0;
  min-height:100%;
}

body{
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
  color:var(--qc-text);
  background:var(--qc-bg);
  -webkit-font-smoothing:antialiased;
}

a{
  color:inherit;
  text-decoration:none;
}

button,input,select{
  font:inherit;
}

button{cursor:pointer}

/* HEADER */
.topbar{
  height:64px;
  background:#fff;
  border-bottom:1px solid var(--qc-line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 28px;
  position:sticky;
  top:0;
  z-index:20;
}

.brand-lockup{
  display:flex;
  align-items:center;
  gap:11px;
  min-width:220px;
}

.brand-logo-crop{
  width:42px;
  height:42px;
  border-radius:11px;
  overflow:hidden;
  position:relative;
  flex:0 0 auto;
  background:var(--qc-red);
  box-shadow:0 5px 14px rgba(200,16,36,.18);
}

.brand-logo-crop img{
  position:absolute;
  width:108%;
  height:108%;
  object-fit:cover;
  left:-4%;
  top:-4%;
}

.brand-text{
  display:flex;
  flex-direction:column;
  line-height:1.05;
}

.brand-text strong{
  color:var(--qc-red);
  font-size:17px;
  letter-spacing:.55px;
  font-weight:900;
}

.brand-text small{
  color:var(--qc-muted);
  font-size:11px;
  margin-top:4px;
  font-weight:600;
}

.topbar-actions{
  display:flex;
  align-items:center;
  gap:12px;
}

.nav-action{
  display:inline-flex;
  align-items:center;
  gap:7px;
  color:#4f5966;
  font-size:13px;
  font-weight:800;
}

.nav-action svg{
  width:17px;
  height:17px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.header-separator{
  width:1px;
  height:26px;
  background:var(--qc-line);
}

.user-chip{
  display:flex;
  align-items:center;
  gap:9px;
}

.avatar{
  width:34px;
  height:34px;
  border-radius:50%;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:var(--qc-red-soft);
  color:var(--qc-red);
  border:1px solid #f2d4da;
  font-weight:900;
  flex:0 0 auto;
}

.user-text{
  display:flex;
  flex-direction:column;
  min-width:74px;
  line-height:1.05;
}

.user-text b{
  font-size:13px;
}

.user-text small{
  color:var(--qc-muted);
  margin-top:4px;
  font-size:10.5px;
}

.btn{
  border:0;
  border-radius:10px;
  padding:8px 11px;
  font-weight:800;
}

.logout-btn{
  display:inline-flex;
  align-items:center;
  gap:7px;
  background:#fff;
  color:var(--qc-red);
  border:1px solid var(--qc-red-line);
  font-size:12px;
}

.logout-btn:hover{
  background:var(--qc-red-soft);
}

.logout-btn svg{
  width:16px;
  height:16px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.9;
  stroke-linecap:round;
  stroke-linejoin:round;
}

/* DASHBOARD */
.workspace{
  width:min(1380px,calc(100% - 44px));
  margin:0 auto;
  padding:18px 0 26px;
}

.welcome-strip{
  min-height:66px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  padding:12px 18px;
  background:#fff;
  border:1px solid var(--qc-line);
  border-radius:15px;
  box-shadow:0 4px 16px rgba(24,31,40,.035);
}

.welcome-main{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
}

.welcome-icon{
  width:38px;
  height:38px;
  border-radius:50%;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:var(--qc-red-soft);
  color:var(--qc-red);
  border:1px solid #f2d4da;
  flex:0 0 auto;
}

.welcome-icon svg{
  width:21px;
  height:21px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.7;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.welcome-title{
  font-size:17px;
  font-weight:800;
  white-space:nowrap;
}

.welcome-title strong{
  color:var(--qc-red);
}

.welcome-divider{
  width:1px;
  height:28px;
  background:var(--qc-line);
  flex:0 0 auto;
}

.welcome-subtitle{
  color:var(--qc-muted);
  font-size:13px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.internal-pill{
  flex:0 0 auto;
  padding:8px 12px;
  border-radius:999px;
  background:#fff;
  border:1px solid var(--qc-red-line);
  color:var(--qc-red);
  font-size:10.5px;
  font-weight:900;
  letter-spacing:.3px;
}

.app-section{
  margin-top:16px;
}

.section-head{
  min-height:24px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin:0 2px 8px;
}

.section-title-wrap{
  display:flex;
  align-items:center;
  gap:8px;
}

.section-marker{
  width:8px;
  height:8px;
  border-radius:2px;
  background:var(--qc-red);
  box-shadow:0 0 0 3px rgba(200,16,36,.08);
}

.section-head h2{
  font-size:15px;
  font-weight:900;
  margin:0;
}

.section-head>span{
  font-size:10.5px;
  color:#98a0aa;
}

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

.app-card{
  min-height:86px;
  position:relative;
  display:flex;
  align-items:center;
  gap:13px;
  padding:14px 44px 14px 14px;
  background:#fff;
  border:1px solid var(--qc-line);
  border-radius:14px;
  box-shadow:0 3px 12px rgba(24,31,40,.03);
  transition:.16s ease;
}

.app-card:hover{
  transform:translateY(-1px);
  border-color:#efc7ce;
  box-shadow:0 8px 22px rgba(24,31,40,.07);
}

.app-icon{
  width:48px;
  height:48px;
  border-radius:12px;
  background:var(--qc-red-soft);
  color:var(--qc-red);
  border:1px solid #f4d8dd;
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}

.app-icon svg{
  width:25px;
  height:25px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.app-copy{
  min-width:0;
}

.app-copy h3{
  font-size:14.5px;
  margin:0 0 4px;
  font-weight:900;
}

.app-copy p{
  margin:0;
  font-size:11.5px;
  line-height:1.35;
  color:var(--qc-muted);
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.arrow{
  position:absolute;
  right:14px;
  top:50%;
  transform:translateY(-50%);
  display:flex;
  align-items:center;
  justify-content:center;
  color:#8d96a1;
}

.arrow svg{
  width:18px;
  height:18px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.9;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.empty-state{
  text-align:center;
  padding:70px 20px;
}

.empty-state .empty-icon{
  font-size:40px;
}

.empty-state h3{
  margin:10px 0 6px;
}

.empty-state p{
  color:var(--qc-muted);
}

/* LOGIN PAGE */
.login-page{
  min-height:100vh;
  background:
    radial-gradient(circle at 20% 10%,rgba(200,16,36,.10),transparent 28%),
    linear-gradient(135deg,#f7f8fa,#eceff3);
  display:grid;
  place-items:center;
  padding:30px;
}

.login-shell{
  width:min(960px,100%);
  min-height:580px;
  background:#fff;
  border:1px solid var(--qc-line);
  border-radius:28px;
  overflow:hidden;
  box-shadow:0 26px 70px rgba(28,34,43,.14);
  display:grid;
  grid-template-columns:1.05fr .95fr;
}

.brand-panel{
  padding:60px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  background:
    radial-gradient(circle at 20% 25%,rgba(255,255,255,.12),transparent 28%),
    linear-gradient(150deg,var(--qc-red),var(--qc-red-dark));
  color:#fff;
}

.brand-mark{
  width:74px;
  height:74px;
  border-radius:22px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#fff;
  color:var(--qc-red);
  font-weight:900;
  font-size:26px;
}

.brand-panel h1{
  font-size:36px;
  letter-spacing:2px;
  margin:22px 0 3px;
}

.brand-panel>p{
  margin:0;
  opacity:.8;
}

.brand-note{
  margin-top:65px;
  padding-top:20px;
  border-top:1px solid rgba(255,255,255,.22);
  font-size:14px;
  line-height:1.6;
  opacity:.9;
}

.login-card{
  padding:60px;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.eyebrow{
  font-size:12px;
  font-weight:900;
  letter-spacing:1.7px;
  color:var(--qc-red);
}

.login-card h2{
  font-size:30px;
  margin:5px 0 7px;
}

.muted{color:var(--qc-muted)}

.stack{
  display:grid;
  gap:15px;
  margin-top:24px;
}

label{
  font-size:12px;
  font-weight:800;
  color:#4f5b68;
}

input,select{
  width:100%;
  margin-top:6px;
  border:1px solid #dfe4e9;
  border-radius:11px;
  padding:11px 12px;
  background:#fff;
  outline:none;
  color:var(--qc-text);
}

input:focus,select:focus{
  border-color:#d68c99;
  box-shadow:0 0 0 3px rgba(200,16,36,.08);
}

.btn.primary{
  background:var(--qc-red);
  color:#fff;
}

.btn.primary:hover{
  background:var(--qc-red-dark);
}

.btn.ghost{
  background:#fff;
  color:var(--qc-text);
  border:1px solid var(--qc-line);
}

.alert{
  padding:12px 14px;
  border-radius:12px;
  margin:12px 0;
  font-size:14px;
}

.alert.error{
  background:#fff0f1;
  color:#a80d23;
  border:1px solid #ffd4db;
}

.alert.success{
  background:#eefaf3;
  color:#14753a;
  border:1px solid #cbeed8;
}

/* ADMIN */
.admin-wrap{
  width:min(1180px,calc(100% - 40px));
  margin:0 auto;
  padding:30px 0 60px;
}

.admin-title h1{
  margin:4px 0 5px;
  font-size:32px;
}

.admin-title p{
  margin:0;
  color:var(--qc-muted);
}

.panel{
  background:#fff;
  border:1px solid var(--qc-line);
  border-radius:18px;
  margin-top:18px;
  box-shadow:0 4px 18px rgba(20,28,38,.035);
  overflow:hidden;
}

.panel-head{
  padding:20px 22px;
  border-bottom:1px solid var(--qc-line);
}

.panel-head h2{
  margin:0 0 4px;
  font-size:17px;
}

.panel-head p{
  margin:0;
  color:var(--qc-muted);
  font-size:12.5px;
}

.form-grid{
  padding:20px 22px;
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
}

.form-action{
  display:flex;
  align-items:end;
}

.user-list{padding:8px}

.user-row{
  border-bottom:1px solid var(--qc-line);
}

.user-row:last-child{border-bottom:0}

.user-row summary{
  list-style:none;
  cursor:pointer;
  padding:14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.user-row summary::-webkit-details-marker{display:none}

.summary-user{
  display:flex;
  align-items:center;
  gap:11px;
}

.summary-user>div{
  display:flex;
  flex-direction:column;
}

.summary-user small{
  font-size:11.5px;
  color:var(--qc-muted);
  margin-top:3px;
}

.status{
  font-size:11px;
  font-weight:800;
  padding:6px 9px;
  border-radius:999px;
}

.status.on{
  background:#eefaf3;
  color:#14753a;
}

.status.off{
  background:#f1f3f5;
  color:#6d7783;
}

.user-detail{
  background:#fafbfc;
  border-radius:12px;
  margin:0 10px 12px;
  padding:14px;
}

.permission-form{
  display:grid;
  gap:12px;
}

.check-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:8px;
}

.check-card{
  display:flex;
  align-items:center;
  gap:8px;
  background:#fff;
  border:1px solid var(--qc-line);
  border-radius:10px;
  padding:9px;
}

.check-card input{
  width:auto;
  margin:0;
}

.inline-actions{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:end;
  margin-top:12px;
}

.inline-actions form{
  display:flex;
  gap:8px;
  align-items:end;
}

.inline-actions input{
  min-width:220px;
}

.apps-admin{
  padding:16px;
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
}

.app-admin-card{
  border:1px solid var(--qc-line);
  border-radius:14px;
  padding:16px;
  display:grid;
  gap:10px;
}

.app-admin-title{
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--qc-muted);
}

.big-emoji{font-size:26px}

.mini-grid{
  display:grid;
  grid-template-columns:.55fr 1.2fr .6fr;
  gap:8px;
}

.toggle-row{
  display:flex;
  gap:16px;
}

.toggle-row label{
  display:flex;
  align-items:center;
  gap:7px;
}

.toggle-row input{
  width:auto;
  margin:0;
}

.table-wrap{overflow:auto}

table{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}

th,td{
  text-align:left;
  padding:10px 12px;
  border-bottom:1px solid var(--qc-line);
  white-space:nowrap;
}

th{
  background:#fafbfc;
  color:#596472;
}

/* RESPONSIVE */
@media (max-width:900px){
  .app-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .welcome-subtitle,
  .welcome-divider{
    display:none;
  }
  .form-grid{
    grid-template-columns:repeat(2,1fr);
  }
  .check-grid{
    grid-template-columns:repeat(2,1fr);
  }
  .apps-admin{
    grid-template-columns:1fr;
  }
  .login-shell{
    grid-template-columns:1fr;
  }
  .brand-panel{
    min-height:230px;
    padding:34px;
  }
  .brand-note{
    margin-top:25px;
  }
  .login-card{
    padding:38px;
  }
}

@media (max-width:620px){
  .topbar{
    height:60px;
    padding:0 14px;
  }
  .brand-lockup{
    min-width:0;
  }
  .brand-logo-crop{
    width:38px;
    height:38px;
  }
  .brand-text strong{
    font-size:14px;
  }
  .brand-text small{
    font-size:10px;
  }
  .nav-action span,
  .user-text,
  .logout-btn span,
  .header-separator{
    display:none;
  }
  .workspace{
    width:calc(100% - 20px);
    padding-top:10px;
  }
  .welcome-strip{
    min-height:60px;
    padding:10px 12px;
  }
  .internal-pill{
    display:none;
  }
  .welcome-title{
    font-size:15px;
  }
  .app-grid{
    grid-template-columns:1fr;
  }
  .form-grid{
    grid-template-columns:1fr;
  }
  .check-grid{
    grid-template-columns:1fr;
  }
  .inline-actions{
    align-items:stretch;
    flex-direction:column;
  }
  .inline-actions form{
    width:100%;
  }
  .inline-actions input{
    min-width:0;
  }
  .login-page{
    padding:12px;
  }
  .brand-panel{
    display:none;
  }
  .login-card{
    padding:34px 24px;
  }
}
