:root{
  --navy:#0b1f3a;
  --blue:#123e68;
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#142033;
  --muted:#68758a;
  --border:#e3e8f0;
  --green:#18864b;
  --red:#c83b3b;
  --amber:#a66b00;
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  font-family:Arial,Helvetica,sans-serif;
  background:var(--bg);
  color:var(--text);
}

button,
input,
select,
textarea{
  font:inherit;
}

button{
  cursor:pointer;
}

.hidden{
  display:none!important;
}


/* LOGIN */

.login-shell{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
  background:
    linear-gradient(
      135deg,
      #0b1f3a,
      #163f66
    );
}

.login-card{
  width:min(440px,100%);
  background:#fff;
  border-radius:24px;
  padding:34px;
  box-shadow:
    0 25px 70px #0003;
}

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

.brand img{
  width:44px;
  height:44px;
  object-fit:contain;
  border-radius:8px;
}

.brand strong{
  display:block;
  letter-spacing:.8px;
  color:var(--navy);
}

.brand span{
  display:block;
  color:var(--muted);
  font-size:12px;
  margin-top:3px;
}

.login-card h1{
  margin:30px 0 7px;
}

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

label{
  display:block;
  font-size:13px;
  font-weight:700;
  margin:16px 0;
}

input,
select,
textarea{
  width:100%;
  margin-top:7px;
  padding:12px 13px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  outline:none;
}

input:focus,
select:focus,
textarea:focus{
  border-color:#5783aa;
  box-shadow:
    0 0 0 3px #5783aa18;
}

textarea{
  min-height:110px;
  resize:vertical;
}


/* BUTTONS */

.primary{
  border:0;
  background:var(--navy);
  color:#fff;
  border-radius:10px;
  padding:12px 16px;
  font-weight:700;
}

.secondary{
  border:1px solid var(--border);
  background:#fff;
  color:var(--navy);
  border-radius:10px;
  padding:11px 14px;
  font-weight:700;
}

.danger{
  border:0;
  background:#fff0f0;
  color:var(--red);
  border-radius:10px;
  padding:10px 12px;
  font-weight:700;
}

.ghost{
  border:1px solid var(--border);
  background:#fff;
  color:var(--navy);
  border-radius:9px;
  padding:9px 13px;
  font-weight:700;
}

.full{
  width:100%;
  margin-top:8px;
}

.error{
  color:var(--red);
  font-size:13px;
  margin-top:10px;
  min-height:18px;
}


/* TOPBAR */

.topbar{
  height:72px;
  background:#fff;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 24px;
  position:sticky;
  top:0;
  z-index:10;
}

.top-actions{
  display:flex;
  align-items:center;
  gap:14px;
  font-size:13px;
}


/* LAYOUT */

.layout{
  display:flex;
  min-height:calc(100vh - 72px);
}

.sidebar{
  width:245px;
  background:var(--navy);
  color:#fff;
  padding:20px 14px;
  flex:0 0 245px;
}

.nav-btn{
  width:100%;
  text-align:left;
  background:transparent;
  border:0;
  color:#dce8f5;
  padding:12px 13px;
  border-radius:9px;
  margin:2px 0;
}

.nav-btn:hover,
.nav-btn.active{
  background:#ffffff14;
  color:#fff;
}


/* MAIN */

.main{
  flex:1;
  padding:28px;
  max-width:1500px;
  margin:auto;
  width:100%;
}

.page-head{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:flex-start;
  margin-bottom:22px;
}

.page-head h1{
  margin:0 0 6px;
  font-size:28px;
}

.page-head p{
  margin:0;
  color:var(--muted);
}

.actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}


/* DASHBOARD */

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

.stat,
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:18px;
  box-shadow:
    0 4px 18px #14203308;
}

.stat .label{
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}

.stat .value{
  font-size:28px;
  font-weight:800;
  margin-top:8px;
  color:var(--navy);
}

.cards{
  display:grid;
  grid-template-columns:
    repeat(2,minmax(0,1fr));
  gap:16px;
  margin-top:18px;
}


/* TABLE */

.table-wrap{
  overflow:auto;
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
}

.table{
  width:100%;
  border-collapse:collapse;
  min-width:760px;
}

.table th,
.table td{
  padding:12px 13px;
  border-bottom:1px solid var(--border);
  text-align:left;
  font-size:13px;
  vertical-align:top;
}

.table th{
  background:#f8fafc;
  color:#526071;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.5px;
}


/* BADGES */

.badge{
  display:inline-block;
  padding:5px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  background:#eef3f8;
  color:#42546a;
}

.badge.green{
  background:#eaf8f0;
  color:var(--green);
}

.badge.red{
  background:#fff0f0;
  color:var(--red);
}

.badge.amber{
  background:#fff7e8;
  color:var(--amber);
}


/* FORMS */

.form-grid{
  display:grid;
  grid-template-columns:
    repeat(2,minmax(0,1fr));
  gap:0 16px;
}

.form-grid .wide{
  grid-column:1/-1;
}

.toolbar{
  display:flex;
  gap:10px;
  align-items:end;
  flex-wrap:wrap;
  margin-bottom:16px;
}

.toolbar label{
  margin:0;
  min-width:180px;
}


/* MODAL */

.modal{
  position:fixed;
  inset:0;
  background:#06132488;
  display:grid;
  place-items:center;
  padding:20px;
  z-index:30;
}

.modal-card{
  width:min(760px,100%);
  max-height:90vh;
  overflow:auto;
  background:#fff;
  border-radius:18px;
  padding:24px;
}

.modal-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.modal-head h2{
  margin:0;
}

.modal-close{
  border:0;
  background:#eef2f6;
  border-radius:8px;
  padding:8px 12px;
  font-size:18px;
}


/* OTHER */

.toast{
  position:fixed;
  right:20px;
  bottom:20px;
  background:#142033;
  color:#fff;
  padding:12px 15px;
  border-radius:10px;
  display:none;
  z-index:50;
}

.empty{
  padding:30px;
  text-align:center;
  color:var(--muted);
}

.resume-frame{
  width:100%;
  height:70vh;
  border:1px solid var(--border);
  border-radius:10px;
}

.kpi-row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:16px;
}

.kpi{
  padding:10px 13px;
  background:#f7f9fc;
  border:1px solid var(--border);
  border-radius:10px;
}

.small{
  font-size:12px;
  color:var(--muted);
}


/* RESPONSIVE */

@media(max-width:900px){

  .sidebar{
    width:70px;
    flex-basis:70px;
  }

  .nav-btn{
    font-size:0;
    text-align:center;
  }

  .nav-btn::first-letter{
    font-size:18px;
  }

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

  .cards{
    grid-template-columns:1fr;
  }

  .main{
    padding:18px;
  }

  .topbar{
    padding:0 14px;
  }

  .top-actions span{
    display:none;
  }
}

@media(max-width:600px){

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

  .form-grid{
    grid-template-columns:1fr;
  }

  .page-head{
    flex-direction:column;
  }

  .topbar .brand span{
    display:none;
  }

  .topbar .brand strong{
    font-size:13px;
  }

  .login-card{
    padding:24px;
  }
}


/* =========================================================
   ADMIN / EMPLOYEE CHAT
========================================================= */

.chat-layout{
  display:grid;
  grid-template-columns:300px minmax(0,1fr);
  gap:18px;
  align-items:stretch;
}

.chat-contacts{
  background:#fff;
  border:1px solid #e3eaed;
  border-radius:16px;
  padding:12px;
  max-height:700px;
  overflow:auto;
}

.chat-contact-title{
  padding:10px 8px 7px;
  color:#71818a;
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.05em;
}

.chat-contact{
  width:100%;
  display:flex;
  flex-direction:column;
  gap:4px;
  text-align:left;
  border:1px solid transparent;
  background:transparent;
  border-radius:11px;
  padding:11px;
  margin-bottom:5px;
  cursor:pointer;
  color:#173b49;
}

.chat-contact:hover,
.chat-contact.active{
  background:#edf4f6;
  border-color:#d6e4e8;
}

.chat-contact b{
  font-size:13px;
}

.chat-contact span{
  font-size:11px;
  color:#778992;
}

.chat-card{
  background:#fff;
  border:1px solid #e3eaed;
  border-radius:16px;
  padding:16px;
  min-width:0;
}

.chat-header{
  padding:4px 4px 14px;
  border-bottom:1px solid #edf1f3;
}

.chat-messages{
  min-height:380px;
  max-height:520px;
  overflow:auto;
  padding:16px 5px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.chat-message{
  max-width:78%;
  padding:10px 13px;
  border-radius:13px;
  background:#f1f5f6;
  align-self:flex-start;
}

.chat-message.mine{
  align-self:flex-end;
  background:#082d3d;
  color:#fff;
}

.chat-message-meta{
  font-size:10px;
  opacity:.7;
  margin-bottom:4px;
}

.chat-message-body{
  font-size:13px;
  line-height:1.5;
  white-space:pre-wrap;
  word-break:break-word;
}

.chat-form{
  display:grid;
  grid-template-columns:1fr auto;
  gap:10px;
  align-items:end;
  border-top:1px solid #edf1f3;
  padding-top:14px;
}

.chat-form textarea{
  width:100%;
  resize:vertical;
  min-height:70px;
  border:1px solid #d8e2e6;
  border-radius:11px;
  padding:11px;
  font:inherit;
}

.chat-empty{
  margin:auto;
  color:#7a8b92;
  font-size:13px;
}

@media(max-width:800px){
  .chat-layout{
    grid-template-columns:1fr;
  }

  .chat-contacts{
    max-height:260px;
  }

  .chat-form{
    grid-template-columns:1fr;
  }

  .chat-message{
    max-width:92%;
  }
}
