:root{
  --navy:#0F1F3D;
  --navy-panel:#152A52;
  --red:#C41E3A;
  --white:#FFFFFF;
  --bg:#F3F4F7;
  --ink:#1B2534;
  --muted:#727C8C;
  --line:#E4E6EC;
  --green:#1E8A5F;
}
*{margin:0;padding:0;box-sizing:border-box;}
body{
  font-family:'Segoe UI','Helvetica Neue',Arial,sans-serif;
  background:var(--bg);
  color:var(--ink);
}
a{text-decoration:none;color:inherit;}
button{font-family:inherit;cursor:pointer;}

/* ---------------- login screen ---------------- */
.login-screen{
  min-height:100vh;
  display:flex;
}
.login-side{
  flex:1;
  background:var(--navy);
  color:var(--white);
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding:4rem 5vw;
  position:relative;
  overflow:hidden;
}
.login-side::after{
  content:"";
  position:absolute;
  right:-120px;top:-120px;
  width:340px;height:340px;
  border:70px solid var(--red);
  border-radius:50%;
  opacity:0.15;
}
.login-side .crest{
  width:46px;height:46px;border:2px solid var(--red);
  display:flex;align-items:center;justify-content:center;
  font-size:0.85rem;letter-spacing:0.03em;margin-bottom:2rem;
}
.login-side h1{font-size:2rem;font-weight:600;max-width:14ch;line-height:1.2;}
.login-side p{color:#B9C1D1;margin-top:1rem;max-width:34ch;line-height:1.6;}

.login-form-wrap{
  width:440px;
  max-width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:3rem;
  background:var(--white);
}
.login-form{width:100%;max-width:320px;}
.login-form h2{font-size:1.4rem;margin-bottom:0.4rem;}
.login-form .hint{color:var(--muted);font-size:0.88rem;margin-bottom:2rem;}
.field{margin-bottom:1.2rem;}
.field label{display:block;font-size:0.82rem;color:var(--navy);margin-bottom:0.4rem;font-weight:600;}
.field input,.field select{
  width:100%;padding:0.75rem 0.9rem;border:1px solid var(--line);border-radius:6px;font-size:0.95rem;
}
.field input:focus,.field select:focus{outline:none;border-color:var(--navy);box-shadow:0 0 0 3px rgba(15,31,61,0.1);}
.login-btn{
  width:100%;padding:0.85rem;background:var(--red);color:var(--white);
  border:none;border-radius:6px;font-size:0.95rem;font-weight:600;margin-top:0.6rem;
}
.login-btn:hover{background:var(--navy);}
.demo-note{
  margin-top:1.6rem;padding:0.9rem 1rem;background:var(--bg);border-radius:6px;
  font-size:0.82rem;color:var(--muted);border-left:3px solid var(--red);
}
.role-tabs{display:flex;gap:0.5rem;margin-bottom:1.6rem;}
.role-tabs button{
  flex:1;padding:0.55rem;border:1px solid var(--line);background:var(--white);
  border-radius:6px;font-size:0.82rem;color:var(--muted);
}
.role-tabs button.active{border-color:var(--navy);color:var(--navy);background:#EEF1F7;font-weight:600;}

@media (max-width:800px){
  .login-screen{flex-direction:column;}
  .login-side{padding:3rem 6vw;}
  .login-form-wrap{width:100%;}
}

/* ---------------- dashboard app shell ---------------- */
.app-shell{display:flex;min-height:100vh;}
.sidebar{
  width:250px;flex-shrink:0;
  background:var(--navy);color:#C9D1E0;
  display:flex;flex-direction:column;
  position:sticky;top:0;height:100vh;
}
.sidebar .brand{
  display:flex;align-items:center;gap:0.7rem;
  padding:1.6rem 1.4rem;border-bottom:1px solid rgba(255,255,255,0.08);
}
.sidebar .brand .crest{width:32px;height:32px;border:2px solid var(--red);display:flex;align-items:center;justify-content:center;font-size:0.65rem;color:var(--white);flex-shrink:0;}
.sidebar .brand .txt{font-size:0.82rem;line-height:1.3;color:var(--white);}
.sidebar nav{flex:1;padding:1.2rem 0.8rem;display:flex;flex-direction:column;gap:0.2rem;}
.sidebar nav a{
  padding:0.75rem 1rem;border-radius:6px;font-size:0.9rem;
  display:flex;align-items:center;gap:0.7rem;color:#C9D1E0;
}
.sidebar nav a .dot{width:6px;height:6px;border-radius:50%;background:transparent;flex-shrink:0;}
.sidebar nav a:hover{background:var(--navy-panel);color:var(--white);}
.sidebar nav a.active{background:var(--navy-panel);color:var(--white);}
.sidebar nav a.active .dot{background:var(--red);}
.sidebar .logout{padding:1.2rem;border-top:1px solid rgba(255,255,255,0.08);}
.sidebar .logout a{color:#C9D1E0;font-size:0.88rem;}
.sidebar .logout a:hover{color:var(--red);}

.main{flex:1;min-width:0;}
.topbar{
  background:var(--white);border-bottom:1px solid var(--line);
  padding:1.1rem 2.2rem;display:flex;justify-content:space-between;align-items:center;
}
.topbar h1{font-size:1.15rem;font-weight:600;}
.topbar .who{display:flex;align-items:center;gap:0.7rem;font-size:0.88rem;color:var(--muted);}
.topbar .avatar{width:34px;height:34px;border-radius:50%;background:var(--navy);color:var(--white);display:flex;align-items:center;justify-content:center;font-size:0.8rem;font-weight:600;}

.content{padding:2.2rem;}
.section-panel{display:none;}
.section-panel.active{display:block;}

.stat-cards{display:grid;grid-template-columns:repeat(4,1fr);gap:1.2rem;margin-bottom:2rem;}
.stat-card{background:var(--white);border-radius:10px;padding:1.4rem;border:1px solid var(--line);}
.stat-card .label{font-size:0.8rem;color:var(--muted);}
.stat-card .value{font-size:1.6rem;font-weight:700;color:var(--navy);margin-top:0.3rem;}
.stat-card .value.red{color:var(--red);}
.stat-card .value.green{color:var(--green);}

.panel-card{background:var(--white);border-radius:10px;border:1px solid var(--line);padding:1.6rem;margin-bottom:1.6rem;}
.panel-card h3{font-size:1rem;margin-bottom:1rem;}

table{width:100%;border-collapse:collapse;font-size:0.9rem;}
th{text-align:left;color:var(--muted);font-weight:600;padding:0.6rem 0.8rem;border-bottom:1px solid var(--line);font-size:0.8rem;}
td{padding:0.7rem 0.8rem;border-bottom:1px solid var(--line);}
tr:last-child td{border-bottom:none;}
.badge{padding:0.25rem 0.6rem;border-radius:20px;font-size:0.76rem;font-weight:600;}
.badge.green{background:#E4F5EC;color:var(--green);}
.badge.red{background:#FBE7EA;color:var(--red);}
.badge.grey{background:#EEF0F4;color:var(--muted);}

.announce-item{padding:1rem 0;border-bottom:1px solid var(--line);}
.announce-item:last-child{border-bottom:none;}
.announce-item .date{font-size:0.78rem;color:var(--muted);}
.announce-item h4{font-size:0.95rem;margin:0.3rem 0;}
.announce-item p{font-size:0.88rem;color:var(--muted);}

@media (max-width:960px){
  .stat-cards{grid-template-columns:repeat(2,1fr);}
}
@media (max-width:760px){
  .sidebar{position:fixed;left:-260px;z-index:40;transition:left 0.25s ease;}
  .sidebar.open{left:0;}
  .content{padding:1.4rem;}
  .stat-cards{grid-template-columns:1fr;}
  #mobileMenuBtn{display:block!important;}
  .topbar .who span{display:none;}
}
