/* Sistem Penugasan Pengawal — ATSN Johor */
:root {
  --bg: #e8f0e8;
  --card: #ffffff;
  --card2: #f4f7f4;
  --border: #b8cdb8;
  --text: #1a2e1a;
  --muted: #5a6f5a;
  --primary: #2d5a27;
  --primary-hover: #234a1f;
  --success: #15803d;
  --warning: #ca8a04;
  --danger: #b91c1c;
  --info: #0369a1;
  --shadow: 0 4px 6px -1px rgba(45, 90, 39, 0.12);
  --shadow-lg: 0 10px 15px -3px rgba(45, 90, 39, 0.15);
  --gradient-primary: linear-gradient(135deg, #2d5a27 0%, #1e4620 100%);
  --gradient-bg: linear-gradient(135deg, #e8f0e8 0%, #f0f4f0 50%, #dce8dc 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gradient-bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); font-size: 13px; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; min-width: 250px; flex: 0 0 250px;
  background: linear-gradient(180deg, #fff 0%, #f8faf8 100%);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  z-index: 100;
}
.main { flex: 1; padding: 20px 24px; min-width: 0; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px;
}
.menu-btn {
  display: none; border: 1px solid var(--border); background: var(--card);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.sideOverlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 90;
}
.sideOverlay.show { display: block; }

.logo {
  background: var(--gradient-primary); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow-lg);
}
.logo b { display: block; font-size: 14px; color: #fff; font-weight: 700; line-height: 1.3; }
.logo .muted { color: rgba(255,255,255,.85); font-size: 11px; margin-top: 4px; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav a, .nav-disabled {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 10px; font-size: 13px;
  border: 1px solid transparent; transition: .15s;
}
.nav a:hover { background: var(--card2); border-color: var(--border); }
.nav a.active {
  background: rgba(45, 90, 39, 0.1); border-color: var(--primary); color: var(--primary);
  font-weight: 600;
}
.nav-disabled { opacity: .45; cursor: not-allowed; }
.nav .left { display: flex; align-items: center; gap: 10px; }
.nav .icon { font-size: 18px; width: 28px; text-align: center; }
.nav .title { font-weight: 600; font-size: 13px; }
.nav .desc { font-size: 11px; color: var(--muted); }
.nav .chev { color: var(--muted); }
.nav-module-break { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.nav-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 4px 12px; }
.nav-section-label--muted { opacity: .7; }

.sideFooter { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.sf-logout {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--danger);
}
.sf-logout:hover { background: rgba(185,28,28,.08); }
.sf-unit { font-size: 10px; color: var(--muted); padding: 8px 12px; line-height: 1.4; }

.content-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.content-header h1 { font-size: 1.5rem; font-weight: 700; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 1rem; font-weight: 700; }
.card-filter { padding: 16px 20px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px; display: flex; gap: 14px; align-items: center;
  box-shadow: var(--shadow);
}
.stat-card--primary { border-left: 4px solid var(--primary); }
.stat-card--success { border-left: 4px solid var(--success); }
.stat-card--warning { border-left: 4px solid var(--warning); }
.stat-card--danger { border-left: 4px solid var(--danger); }
.stat-icon { font-size: 28px; }
.stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--card2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tfoot th { background: var(--card2); }
tbody tr:hover { background: rgba(45,90,39,.03); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: none; font-size: 13px;
  font-weight: 600; cursor: pointer; transition: .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--card2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e8ede8; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 8px; }
.btn-link { background: none; border: none; color: var(--primary); padding: 9px 8px; }

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.form-control {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; background: #fff;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(45,90,39,.12); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-group--full { grid-column: 1 / -1; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-row .form-control { max-width: 220px; }

.alert {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.alert-info { background: #e0f2fe; color: #075985; border: 1px solid #7dd3fc; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 700; background: var(--card2); border: 1px solid var(--border);
}
.status-pill {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 700;
}
.status-aktif { background: #dcfce7; color: #166534; }
.status-cuti { background: #fef9c3; color: #854d0e; }
.status-mc { background: #fee2e2; color: #991b1b; }
.status-kursus { background: #e0f2fe; color: #075985; }
.status-tugas_luar { background: #f3e8ff; color: #6b21a8; }
.status-tidak_aktif { background: #f1f5f9; color: #64748b; }

.avatar-thumb { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.avatar-placeholder {
  display: inline-flex; width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
code { background: var(--card2); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

.actions-cell { white-space: nowrap; }
.inline-form { display: inline; }

.phase-list { list-style: none; padding: 16px 20px; }
.phase-list li { padding: 8px 0; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.phase-done { color: var(--success); }
.phase-pending { color: var(--muted); }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 20px; }

/* Login */
.login-container {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 32px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg);
}
.login-badge { font-size: 48px; text-align: center; margin-bottom: 12px; }
.login-title { font-size: 1.25rem; text-align: center; margin-bottom: 4px; }
.login-subtitle { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 24px; line-height: 1.4; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay[hidden] { display: none !important; }
.modal-dialog {
  background: var(--card); border-radius: 12px; padding: 24px;
  width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-dialog--wide { max-width: 560px; }
.modal-dialog__hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-dialog__hdr h2 { font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }

@media (max-width: 768px) {
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed; left: -280px; transition: left .25s; z-index: 100;
    height: 100vh; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .filter-row .form-control { max-width: 100%; flex: 1; }
  .grid-roster-top { grid-template-columns: 1fr; }
}

/* Roster edit */
.grid-roster-top { display: grid; grid-template-columns: 1fr 280px; gap: 16px; margin-bottom: 16px; }
.card-body-form { padding: 16px 20px 20px; }
.card-footer-stats { padding: 12px 20px; border-top: 1px solid var(--border); font-size: 13px; }
.table-compact th, .table-compact td { padding: 8px 12px; }
.roster-kawasan-card { margin-bottom: 16px; }
.roster-edit-table .form-control-sm { font-size: 11px; padding: 4px 6px; min-width: 120px; }
.roster-actions-bar { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.roster-actions-bar--secondary { padding-top: 0; border-top: 1px solid var(--border); padding-top: 16px; }
.btn-group-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.08); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { filter: brightness(1.08); }
.form-control-sm { font-size: 12px; padding: 6px 8px; }
.code-block {
  background: var(--card2); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; font-size: 11px; overflow-x: auto; margin-bottom: 12px;
}
