:root{
  --bg:#0b1020;
  --panel:#0f182b;
  --panel2:#0c1426;
  --line:#1a2a44;
  --text:#e8f0ff;
  --muted:#a9bddb;
  --brand:#4da3ff;
  --good:#22c55e;
  --warn:#f59e0b;
  --bad:#ef4444;
  --info:#38bdf8;
  --chip:#122243;
  --shadow:0 18px 50px rgba(0,0,0,.35);
  --r:16px;
}

*{box-sizing:border-box}

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 800px at 20% 10%, #11224a 0%, var(--bg) 50%), var(--bg);
  color: var(--text);
}

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

.app{
  min-height:100vh;
  display:flex;
}

.container{
  max-width: 560px;
  margin: 60px auto;
  padding: 0 16px;
}

.sidebar{
  width:260px;
  padding:18px 14px;
  background: linear-gradient(180deg, #0b142a 0%, #091022 100%);
  border-right:1px solid var(--line);
  position:sticky;
  top:0;
  height:100vh;
}

.logo{
  display:flex;
  gap:12px;
  align-items:center;
  padding:12px;
  border:1px solid var(--line);
  border-radius:18px;
  background: rgba(255,255,255,0.02);
  box-shadow: var(--shadow);
}

.logo-mark{
  width:38px;height:38px;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  color:#08101f;
  background: linear-gradient(135deg, #66c2ff 0%, #3a7bff 60%, #2a4fff 100%);
}

.logo-name{ font-weight:800; letter-spacing:.2px; }
.logo-sub{ font-size:12px; color: var(--muted); margin-top:2px; }

.nav{ margin-top:16px; display:flex; flex-direction:column; gap:8px; }
.nav-link{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid transparent;
  color: var(--muted);
  background: transparent;
}
.nav-link:hover{ background: rgba(255,255,255,0.03); border-color: rgba(77,163,255,0.25); color: var(--text); }
.nav-link.active{ background: rgba(77,163,255,0.10); border-color: rgba(77,163,255,0.35); color: var(--text); }

.sidebar-foot{
  position:absolute;
  left:14px; right:14px;
  bottom:14px;
}

.main{
  flex:1;
  min-width:0;
}

.header{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  padding:22px 26px 14px 26px;
  border-bottom:1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%);
}

.h-title{ font-size:22px; font-weight:800; letter-spacing:.2px; }
.h-sub{ font-size:12px; color: var(--muted); margin-top:4px; }
.h-right{ display:flex; gap:10px; align-items:center; }

.chip{
  padding:8px 12px;
  border-radius:999px;
  background: var(--chip);
  border:1px solid var(--line);
  color: var(--muted);
  font-size:12px;
}

.content{ padding:22px 26px 40px 26px; max-width: 1240px; }

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

@media (max-width: 1100px){
  .grid-4{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px){
  .sidebar{ display:none; }
  .content{ padding:18px 16px 40px 16px; }
  .grid-4, .grid-2{ grid-template-columns: 1fr; }
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%), var(--panel);
  border:1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

.card-h{
  padding:14px 16px;
  border-bottom:1px solid rgba(26,42,68,0.7);
  display:flex;
  justify-content:space-between;
  align-items:center;
}
.card-t{ font-weight:800; }
.card-b{ padding:16px; }

.stat{
  padding:16px;
}
.stat .k{ font-size:12px; color: var(--muted); }
.stat .v{ font-size:26px; font-weight:900; margin-top:8px; }
.stat .s{ font-size:12px; color: var(--muted); margin-top:6px; }

.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  font-size:12px;
  color: var(--text);
  background: rgba(255,255,255,0.02);
}
.dot{ width:8px; height:8px; border-radius:99px; background: var(--muted); }
.b-online .dot{ background: var(--good); }
.b-away .dot{ background: var(--warn); }
.b-break .dot{ background: var(--info); }
.b-offline .dot{ background: var(--bad); }
.b-off_hours .dot{ background: #a78bfa; }
.b-inactive .dot{ background: #64748b; }

table{ width:100%; border-collapse: collapse; }
th, td{ text-align:left; padding:12px 10px; border-bottom:1px solid rgba(26,42,68,0.7); font-size:13px; }
th{ color: var(--muted); font-weight:700; }

pre.mini{
  margin:0;
  white-space:pre-wrap;
  font-size:12px;
  color: var(--muted);
  background: rgba(0,0,0,0.20);
  border:1px solid var(--line);
  padding:10px;
  border-radius:14px;
}

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

.row{ display:flex; gap:12px; align-items:center; justify-content:space-between; }
.left{ display:flex; gap:10px; align-items:center; }

.input, input, textarea{
  width:100%;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background: rgba(0,0,0,0.18);
  color: var(--text);
  outline:none;
}
textarea{ min-height: 110px; }
label{ display:block; margin:10px 0 6px; color: var(--muted); font-size:12px; }

.btn, button{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(77,163,255,0.35);
  background: rgba(77,163,255,0.16);
  color: var(--text);
  cursor:pointer;
  font-weight:700;
}
.btn:hover, button:hover{ filter:brightness(1.05); }

.btn-ghost{
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.pill{
  display:inline-flex;
  align-items:center;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,0.02);
  color: var(--muted);
  font-size:12px;
}

.callout{
  padding:12px 14px;
  border-radius:16px;
  border:1px solid var(--line);
  background: rgba(255,255,255,0.02);
  color: var(--muted);
  font-size:12px;
}

.callout.good{ border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.08); color: #c9f7d8; }
.callout.bad{ border-color: rgba(239,68,68,0.35); background: rgba(239,68,68,0.08); color: #ffd1d1; }

/* backward compatible classes */
.ok{ padding:12px 14px; border-radius:16px; border:1px solid rgba(34,197,94,0.35); background: rgba(34,197,94,0.08); color: #c9f7d8; font-size:12px; }
.alert{ padding:12px 14px; border-radius:16px; border:1px solid rgba(239,68,68,0.35); background: rgba(239,68,68,0.08); color: #ffd1d1; font-size:12px; }

.nowrap{ white-space:nowrap; }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

.rowform{ display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; }
.rowform > *{ flex:1; min-width: 220px; }

.grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
@media(max-width:1100px){.grid-3{grid-template-columns:1fr}}
.stat .k{color:var(--muted);font-size:13px}
.stat .v{font-size:34px;font-weight:800;margin:6px 0}
.stat .s{color:var(--muted);font-size:12px}

.pill.ok{border-color:rgba(34,197,94,.45);color:#bbf7d0;background:rgba(34,197,94,.08)}
.pill.bad{border-color:rgba(239,68,68,.45);color:#fecaca;background:rgba(239,68,68,.08)}


.btn-danger{background:#b91c1c;color:#fff;border:1px solid rgba(255,255,255,.2)}
.btn-danger:hover{filter:brightness(1.05)}


/* employee groups */

.emp-group{ border:1px solid rgba(255,255,255,0.08); border-radius:14px; padding:10px 12px; margin-bottom:12px; background: rgba(255,255,255,0.02); }
.emp-group-summary{ cursor:pointer; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:6px 4px; list-style:none; }
.emp-group-summary::-webkit-details-marker{ display:none; }
.emp-group-title{ font-weight:700; }
.emp-group-body{ margin-top:10px; }
.row-actions{ display:flex; gap:10px; flex-wrap:nowrap; align-items:center; justify-content:flex-end; }
.row-actions form{ margin:0; }


/* === Custom dark dropdown (cselect) === */
.cselect{ position: relative; display:inline-block; min-width: 220px; }
.cselect--sm{ min-width: 140px; }
.cselect-btn{
  width:100%;
  text-align:left;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 8px 34px 8px 12px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  outline: none;
}
.cselect--sm .cselect-btn{ padding: 7px 30px 7px 10px; font-size: 12px; border-radius: 11px; }
.cselect-btn:hover{ border-color: rgba(88,166,255,0.35); background: rgba(255,255,255,0.07); }
.cselect-btn:focus{ border-color: rgba(88,166,255,0.55); box-shadow: 0 0 0 3px rgba(88,166,255,0.15); }

.cselect-caret{
  position:absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  opacity: .8;
  pointer-events:none;
}

.cselect-menu{
  position:absolute;
  left:0;
  right:0;
  top: calc(100% + 6px);
  z-index: 120;
  padding: 6px;
  background: rgba(10,16,30,0.98);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(0,0,0,0.45);
  display:none;
}
.cselect.open .cselect-menu{ display:flex; flex-direction:column; gap:4px; }

.cselect-option{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor:pointer;
  color: var(--text);
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
}
.cselect-option .muted{ white-space:nowrap; opacity:.85; }

.cselect--sm .cselect-option{ font-size: 12px; padding: 7px 9px; }
.cselect-option:hover{ background: rgba(88,166,255,0.14); border-color: rgba(88,166,255,0.22); }
.cselect-option.selected{ background: rgba(88,166,255,0.22); border-color: rgba(88,166,255,0.38); }
.cselect-option.selected::after{ content:"✓"; opacity:.9; }

/* Shift cell layout */
.shift-form{ display:flex; align-items:center; gap:10px; }

/* Fix action buttons alignment */
table{ width:100%; }
th:last-child, td:last-child{ width: 170px; }
.row-actions{ display:flex; gap:10px; flex-wrap:nowrap; align-items:center; justify-content:flex-end; }
.row-actions form{ display:inline-flex; margin:0; }
.row-actions .btn{ padding: 6px 10px; font-size: 12px; border-radius: 12px; }


/* Hard guarantee for custom select */
.cselect-menu[hidden]{ display:none !important; }
.cselect.open .cselect-menu{ display:block !important; }

/* Employees table actions alignment */
td.row-actions{ display:flex; justify-content:flex-end; gap:10px; align-items:center; }
td.row-actions form{ margin:0; }


/* ===== cselect menu visual hardening (v4) ===== */
.cselect-menu{
  background: rgba(24, 36, 56, 0.98) !important;
  border: 1px solid rgba(88,166,255,0.75) !important;
  outline: 1px solid rgba(0,0,0,0.55) !important;
  box-shadow: 0 18px 45px rgba(0,0,0,0.55) !important;
  padding: 8px !important;
}

.cselect-option{
  background: rgba(255,255,255,0.07) !important;
  border: 1px solid rgba(88,166,255,0.22) !important;
  border-radius: 10px !important;
  padding: 9px 12px !important;
  margin: 0 !important;
}

.cselect-option + .cselect-option{
  margin-top: 6px !important;
}

.cselect-option:hover{
  background: rgba(88,166,255,0.16) !important;
  border-color: rgba(88,166,255,0.55) !important;
}

.cselect-option.selected{
  background: rgba(88,166,255,0.22) !important;
  border-color: rgba(88,166,255,0.70) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10) !important;
}

.cselect-option .muted{
  opacity: .88 !important;
  color: rgba(255,255,255,0.85) !important;
}

/* Make the dropdown feel like a normal listbox */
.cselect-menu[role="listbox"]{
  max-height: 260px !important;
  overflow-y: auto !important;
}

/* Slightly stronger caret contrast */
.cselect-caret{ opacity: .95 !important; }


/* cselect dropup support */
.cselect--up .cselect-menu{ top:auto; bottom: calc(100% + 6px); }
