/* CoreStruct global style */

:root{
  --brand:#1f6feb;        
  --bg:#f6f8fa;
  --text:#0f172a;
  --muted:#6b7280;
  --border:#e5e7eb;
  --white:#ffffff;
}

*{box-sizing:border-box}
html,body{
  margin:0;
  padding:0;
  background:var(--bg);
  color:var(--text);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

.header{
  background:var(--white);
  border-bottom:1px solid var(--border);
  padding:14px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.brand{
  font-weight:800;
  letter-spacing:.2px;
}

.brand .logoDot{
  color:var(--brand);
}

.nav a{
  color:var(--text);
  text-decoration:none;
  margin-right:14px;
  font-weight:600;
}

.nav a:hover{
  color:var(--brand);
}

.container{
  max-width:1040px;
  margin:20px auto;
  padding:0 16px;
}

.card{
  background:var(--white);
  border:1px solid var(--border);
  border-radius:12px;
  padding:16px;
}

h1{
  margin:0 0 10px 0;
  font-size:22px;
}

.table{
  width:100%;
  border-collapse:collapse;
  overflow:hidden;
  border-radius:10px;
}

/* allow flexible column sizing and wrapping for responsiveness */
.table { table-layout: auto; }
.table th, .table td { word-break: break-word; white-space: normal; }

/* clickable name cell */
.table td.clickable { cursor: pointer; }
.table td.clickable a.emp-link { color: inherit; text-decoration: none; display:block; padding:4px 0; }

/* icon-sized buttons */
.btn.sm { width:36px; padding:0; display:inline-flex; align-items:center; justify-content:center; }
.btn.sm a, .btn.sm span { line-height:1 }

.table th,
.table td{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  text-align:left;
}

.table th{
  background:#f8fafc;
  font-weight:800;
  color:#334155;
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:38px;
  padding:0 14px;
  border-radius:8px;
  border:1px solid var(--border);
  background:var(--white);
  cursor:pointer;
  font-weight:700;
}

.btn.primary{
  background:var(--brand);
  color:#fff;
  border:none;
}

.btn:disabled{
  opacity:.6;
  cursor:not-allowed;
}

.form-grid{
  display:grid;
  gap:12px;
  grid-template-columns:repeat(12,1fr);
}

.col-12{grid-column:span 12}
.col-6{grid-column:span 6}
.col-4{grid-column:span 4}

@media(max-width:900px){
  .col-6,.col-4{grid-column:span 12}
}

.field{
  display:flex;
  flex-direction:column;
}

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

.input,
.select,
.textarea{
  height:40px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  font-size:14px;
  appearance:none;
}

.textarea{
  height:auto;
  min-height:90px;
  resize:vertical;
}

.help{
  font-size:12px;
  color:var(--muted);
  margin-top:4px;
}

.error{
  color:#dc2626;
}

.footerNote{
  margin-top:12px;
  color:var(--muted);
  font-size:12px;
}

/* ==== CoreStruct Sidebar Layout ==== */
.layout{
  display:flex; min-height:100vh;
}

/* Sidebar */
.sidebar{
  width:220px; flex:0 0 220px;
  background:linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color:#e5e7eb;
  display:flex; flex-direction:column; gap:10px;
  transition:width .15s ease;
  box-shadow:2px 0 12px rgba(0,0,0,0.3);
}
.sidebar .brand{
  font-weight:800; letter-spacing:.2px; padding:16px 16px; 
  border-bottom:2px solid rgba(96,165,250,0.2);
  display:flex; align-items:center; gap:8px;
}
.sidebar .brand img{ width:28px; height:28px; }
.sidebar .brand-text{ font-size:14px; }
.sidebar .brand .logoDot{ color:#60a5fa; font-weight:900; } /* lighter blue accent */

.sidebar nav{ 
  padding:12px 8px; display:flex; flex-direction:column; gap:6px; 
  flex:1; overflow-y:auto;
}
.sidebar a{
  color:#cbd5e1; text-decoration:none; font-weight:600; font-size:14px;
  padding:10px 12px; border-radius:8px; display:flex; gap:10px; align-items:center;
  transition:all .2s ease;
  border-left:3px solid transparent;
  position:relative;
}
.sidebar a:hover{ 
  background:rgba(96,165,250,0.1);
  color:#60a5fa;
  padding-left:16px;
}
.sidebar a.active{ 
  background:rgba(96,165,250,0.2);
  border-left-color:#60a5fa;
  color:#93c5fd;
}
.sidebar a .icon{ 
  font-size:18px; width:24px; height:24px; display:flex; align-items:center; justify-content:center;
  transition:transform .2s ease;
}
.sidebar a:hover .icon{ transform:scale(1.1); }

/* Sidebar polish: smooth animations and responsive behavior */
.sidebar nav { animation: slideInLeft 0.3s ease-out; }
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Main area */
.main{
  flex:1; display:flex; flex-direction:column; gap:12px;
}
.topbar{
  background:var(--white); border-bottom:1px solid var(--border);
  padding:12px 16px; display:flex; align-items:center; justify-content:space-between;
}
/* back button in topbar (consistent placement) */
.topbar .back-btn { margin-left:8px; }
.content{ max-width:none; width:100%; margin:0; padding:16px; }

/* Tables/cards reuse your existing .card, .table etc. */

/* Mobile */
@media (max-width: 900px){
  .sidebar{ position:fixed; z-index:10; height:100vh; left:0; top:0; transform:translateX(-100%); }
  .sidebar.open{ transform:translateX(0); }
  .main{ margin-left:0; }
  .topbar .menu-toggle{
    display:inline-flex; align-items:center; justify-content:center;
    height:36px; padding:0 10px; border:1px solid var(--border); border-radius:8px; background:#fff; cursor:pointer;
  }
}

/* Utility */
.icon{width:20px; display:inline-flex; justify-content:center;}
.text{white-space:nowrap;}

/* ===== Toolbar (below header) ===== */
.toolbar {
  display:flex; gap:10px; align-items:center; flex-wrap:wrap;
  margin: 12px 0 10px 0;
}
.toolbar .input, .toolbar .select { height:36px; }

/* Search input with icon */
.search-wrap { position:relative; }
.search-wrap .search-icon {
  position:absolute; left:10px; top:50%; transform:translateY(-50%);
  color:#64748b; font-size:14px;
}
.search-wrap .input { padding-left:30px; }

/* ===== Table responsiveness ===== */
.table-wrap { width:100%; overflow:auto; border-radius:10px; }
@media (max-width: 640px){
  .table th:nth-child(3), .table td:nth-child(3), /* Gender */
  .table th:nth-child(5), .table td:nth-child(5), /* Position */
  .table th:nth-child(7), .table td:nth-child(7)  /* Status */
  { display:none; }
}

/* ===== Modal (View Employee) ===== */
.modal-backdrop {
  display:none; position:fixed; inset:0; background:rgba(0,0,0,.35); z-index:50;
}
.modal {
  background:#fff; border:1px solid var(--border); border-radius:12px;
  max-width:720px; width:92%; margin:5% auto; padding:16px;
}
.modal-head { display:flex; justify-content:space-between; align-items:center; }
.modal-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:14px; }

/* ===== Toast ===== */
.toast-wrap {
  position:fixed; right:16px; bottom:16px; z-index:60; display:flex; flex-direction:column; gap:8px;
}
.toast {
  background:#0ea5e9; color:#fff; padding:10px 12px; border-radius:10px;
  box-shadow:0 8px 20px rgba(2,6,23,.15);
  display:flex; align-items:center; gap:8px; min-width:220px;
}
.toast.success { background:#10b981; }  /* green */
.toast.error   { background:#ef4444; }  /* red */

/* ===== Sidebar brand with logo (keep logo when collapsed) ===== */
.brand { display:flex; align-items:center; gap:8px; }
.brand-logo { height:28px; width:auto; }
.brand-text { font-weight:800; letter-spacing:.2px; }
.sidebar.collapsed .brand-text { display:none; }  /* collapse text only */

/* ===== Dashboard KPI cards ===== */
.kpi-grid { display:grid; gap:12px; grid-template-columns:repeat(12,1fr); }
.kpi { background:#fff; border:1px solid var(--border); border-radius:12px; padding:14px; }
.kpi .label { font-size:12px; color:var(--muted); }
.kpi .value { font-size:24px; font-weight:800; margin-top:4px; }
.kpi .sub { font-size:12px; color:#64748b; margin-top:2px; }

/* 4-up on desktop, 1-up on mobile */
.kpi-col-3 { grid-column: span 3; }
@media (max-width: 900px){ .kpi-col-3 { grid-column: span 12; } }

/* ===== Section headers ===== */
.section-head { display:flex; justify-content:space-between; align-items:center; margin:14px 0 8px; }
.section-head h2 { margin:0; font-size:18px; }
.section-actions { display:flex; gap:8px; }

/* ===== Chips (status) ===== */
.chip { display:inline-flex; align-items:center; justify-content:center; height:26px; padding:0 12px; border-radius:999px; font-size:12px; font-weight:700; white-space:nowrap; }
.chip.green { background:#dcfce7; color:#166534; border:1px solid #86efac; }
.chip.gray { background:#f3f4f6; color:#374151; border:1px solid #d1d5db; }
.chip.amber { background:#fef3c7; color:#92400e; border:1px solid #fcd34d; }
.chip.red { background:#fee2e2; color:#991b1b; border:1px solid #fca5a5; }

/* ===== Table wrap (already present but ensure) ===== */
.table-wrap { width:100%; overflow:auto; border-radius:10px; }

/* ===== Toolbar link style (remove underline for buttons/links) ===== */
a.btn, a.btn:link, a.btn:visited, a.btn:hover, a.btn:focus { text-decoration: none; }