/* =========================================================
   PCS Census — Professional Admin & Data Entry console
   ========================================================= */

:root {
  --staff-sidebar: #1a2f5a;
  --staff-sidebar-2: #243b6e;
  --staff-accent: #3b5998;
  --staff-accent-soft: #e8eef8;
  --staff-bg: #eef2f7;
  --staff-surface: #ffffff;
  --staff-border: #d8e0ec;
  --staff-text: #0f172a;
  --staff-muted: #64748b;
  --staff-success: #059669;
  --staff-warning: #d97706;
  --staff-danger: #dc2626;
  --staff-radius: 14px;
  --staff-shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
}

body.staff-app {
  background: var(--staff-bg);
  min-height: 100vh;
  color: var(--staff-text);
}

body.staff-app .site-footer {
  margin-left: 0;
}

/* ----- Shell ----- */
.staff-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.staff-sidebar {
  background: linear-gradient(180deg, var(--staff-sidebar) 0%, #12203f 100%);
  color: #fff;
  padding: 1.25rem 1rem 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.staff-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.staff-brand img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #fff;
  padding: 3px;
  object-fit: contain;
}

.staff-brand h1 {
  font-size: 1rem;
  color: #fff;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.staff-brand p {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.staff-nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.staff-nav button,
.staff-nav a {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  text-align: left;
  padding: 0.72rem 0.85rem;
  border-radius: 10px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.staff-nav button:hover,
.staff-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.staff-nav button.active,
.staff-nav a.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.staff-nav .nav-ico {
  width: 1.35rem;
  text-align: center;
  opacity: 0.9;
}

.staff-userbox {
  margin-top: auto;
  padding: 0.85rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.staff-userbox .name {
  font-weight: 700;
  font-size: 0.9rem;
}

.staff-userbox .role {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 0.15rem;
}

.staff-userbox .logout {
  display: inline-block;
  margin-top: 0.65rem;
  color: #fde68a;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

/* ----- Main ----- */
.staff-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.staff-topbar {
  background: var(--staff-surface);
  border-bottom: 1px solid var(--staff-border);
  padding: 0.95rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.staff-topbar h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--staff-sidebar);
  letter-spacing: -0.02em;
}

.staff-topbar .subtitle {
  margin: 0.15rem 0 0;
  color: var(--staff-muted);
  font-size: 0.86rem;
  font-weight: 500;
}

.staff-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.staff-content {
  padding: 1.25rem 1.5rem 2.5rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Login gate centered */
.staff-login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(59, 89, 152, 0.14), transparent 55%),
    var(--staff-bg);
}

.staff-login-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--staff-shadow);
  border: 1px solid var(--staff-border);
  overflow: hidden;
}

.staff-login-card .head {
  padding: 1.35rem 1.4rem 1.1rem;
  background: linear-gradient(135deg, #1a2f5a, #3b5998);
  color: #fff;
  text-align: center;
}

.staff-login-card .head img {
  width: 56px;
  height: 56px;
  background: #fff;
  border-radius: 12px;
  padding: 4px;
  object-fit: contain;
  margin-bottom: 0.65rem;
}

.staff-login-card .head h1 {
  color: #fff;
  font-size: 1.2rem;
  margin: 0;
}

.staff-login-card .head p {
  color: rgba(255, 255, 255, 0.85);
  margin: 0.3rem 0 0;
  font-size: 0.88rem;
}

.staff-login-card .body {
  padding: 1.25rem 1.4rem 1.5rem;
}

/* Stats */
.staff-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.staff-stat {
  background: var(--staff-surface);
  border: 1px solid var(--staff-border);
  border-radius: var(--staff-radius);
  padding: 1rem 1.1rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.staff-stat .num {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--staff-sidebar);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.staff-stat .lbl {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--staff-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.staff-stat.pending .num { color: var(--staff-warning); }
.staff-stat.approved .num { color: var(--staff-success); }
.staff-stat.alert .num { color: var(--staff-danger); }

/* Panels / cards */
.staff-panel {
  background: var(--staff-surface);
  border: 1px solid var(--staff-border);
  border-radius: var(--staff-radius);
  box-shadow: var(--staff-shadow);
  overflow: hidden;
}

.staff-panel + .staff-panel {
  margin-top: 1rem;
}

.staff-panel-head {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--staff-border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.staff-panel-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--staff-sidebar);
}

.staff-panel-head p {
  margin: 0.2rem 0 0;
  font-size: 0.84rem;
  color: var(--staff-muted);
}

.staff-panel-body {
  padding: 1.15rem 1.25rem 1.35rem;
}

/* Toolbar */
.staff-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 1rem;
}

.staff-toolbar input[type="search"],
.staff-toolbar input[type="text"],
.staff-toolbar select {
  min-width: 160px;
  max-width: 240px;
  padding: 0.58rem 0.8rem;
  border: 1.5px solid var(--staff-border);
  border-radius: 10px;
  font: inherit;
  font-size: 0.9rem;
  background: #fff;
}

.staff-toolbar input[type="search"] {
  min-width: 220px;
  flex: 1;
  max-width: 320px;
}

/* Table */
.staff-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--staff-border);
  border-radius: 12px;
}

.staff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.staff-table th {
  text-align: left;
  padding: 0.75rem 0.85rem;
  background: #f1f5f9;
  color: var(--staff-sidebar);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--staff-border);
  white-space: nowrap;
}

.staff-table td {
  padding: 0.8rem 0.85rem;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
}

.staff-table tr:last-child td {
  border-bottom: 0;
}

.staff-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.staff-table tbody tr:hover td {
  background: #f8fafc;
}

.staff-table .member-cell {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.staff-table .avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--staff-accent-soft);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--staff-border);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--staff-accent);
  font-size: 0.85rem;
}

.staff-table .m-name {
  font-weight: 700;
  color: var(--staff-text);
}

.staff-table .m-meta {
  font-size: 0.78rem;
  color: var(--staff-muted);
  margin-top: 0.1rem;
}

.staff-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Buttons */
.sbtn {
  appearance: none;
  border: 1px solid var(--staff-border);
  background: #fff;
  color: var(--staff-sidebar);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.48rem 0.85rem;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  line-height: 1.2;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.1s ease;
}

.sbtn:hover {
  background: #f8fafc;
  border-color: #b6c3d9;
}

.sbtn:active {
  transform: translateY(1px);
}

.sbtn-primary {
  background: var(--staff-accent);
  border-color: var(--staff-accent);
  color: #fff;
}

.sbtn-primary:hover {
  background: #2d4373;
  border-color: #2d4373;
  color: #fff;
}

.sbtn-success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.sbtn-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.sbtn-ghost {
  background: transparent;
}

.sbtn-lg {
  padding: 0.72rem 1.2rem;
  font-size: 0.92rem;
}

.sbtn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Badges */
.sbadge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.sbadge-pending { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.sbadge-approved { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.sbadge-rejected { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.sbadge-role { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* ----- Full-page form ----- */
.form-workspace {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  align-items: start;
}

.form-toc {
  position: sticky;
  top: 5.2rem;
  background: var(--staff-surface);
  border: 1px solid var(--staff-border);
  border-radius: var(--staff-radius);
  padding: 0.85rem;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.form-toc h4 {
  margin: 0 0 0.55rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--staff-muted);
}

.form-toc button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--staff-text);
  cursor: pointer;
}

.form-toc button:hover,
.form-toc button.active {
  background: var(--staff-accent-soft);
  color: var(--staff-accent);
}

.form-sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.form-section {
  background: var(--staff-surface);
  border: 1px solid var(--staff-border);
  border-radius: var(--staff-radius);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  scroll-margin-top: 5.5rem;
}

.form-section-head {
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--staff-border);
  background: linear-gradient(180deg, #fff, #f8fafc);
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.form-section-head .step {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--staff-accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.form-section-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--staff-sidebar);
}

.form-section-head p {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  color: var(--staff-muted);
}

.form-section-body {
  padding: 1.15rem 1.2rem 1.3rem;
}

.staff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.95rem 1.1rem;
}

.staff-grid .full {
  grid-column: 1 / -1;
}

.staff-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.staff-field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--staff-sidebar);
}

.staff-field label .req {
  color: var(--staff-danger);
}

.staff-field .hint {
  font-size: 0.75rem;
  color: var(--staff-muted);
  font-weight: 500;
}

.staff-field input,
.staff-field select,
.staff-field textarea {
  width: 100%;
  padding: 0.68rem 0.85rem;
  border: 1.5px solid var(--staff-border);
  border-radius: 10px;
  font: inherit;
  font-size: 0.92rem;
  background: #fff;
  color: var(--staff-text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.staff-field input:focus,
.staff-field select:focus,
.staff-field textarea:focus {
  outline: none;
  border-color: var(--staff-accent);
  box-shadow: 0 0 0 3px rgba(59, 89, 152, 0.15);
}

.staff-field input:disabled,
.staff-field select:disabled {
  background: #f1f5f9;
  color: var(--staff-muted);
}

.photo-upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.photo-upload-card {
  border: 1.5px dashed #b6c3d9;
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  background: #fafbfd;
}

.photo-upload-card img,
.photo-upload-card .ph {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 0.75rem;
  display: grid;
  place-items: center;
  background: var(--staff-accent-soft);
  color: var(--staff-accent);
  font-size: 1.6rem;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--staff-border);
}

.photo-upload-card h4 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--staff-sidebar);
}

.children-editor {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.child-line {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
}

.form-sticky-bar {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--staff-border);
  padding: 0.85rem 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0.25rem;
  border-radius: 0 0 var(--staff-radius) var(--staff-radius);
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.05);
  z-index: 15;
}

.form-sticky-bar .status-msg {
  margin-right: auto;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--staff-muted);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  background: #f8fafc;
  border: 1px solid var(--staff-border);
  border-radius: 10px;
}

.check-row input {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
  accent-color: var(--staff-accent);
}

.check-row label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--staff-text);
  cursor: pointer;
}

/* Pending cards */
.pending-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.pending-card {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border: 1px solid var(--staff-border);
  border-radius: 12px;
  background: #fff;
}

.pending-card:hover {
  border-color: #b6c3d9;
  background: #fafbfd;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--staff-muted);
}

.empty-state .big {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

/* Mobile */
.staff-menu-btn {
  display: none;
  border: 1px solid var(--staff-border);
  background: #fff;
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 980px) {
  .staff-shell {
    grid-template-columns: 1fr;
  }

  .staff-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(280px, 86vw);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    height: 100vh;
  }

  .staff-shell.sidebar-open .staff-sidebar {
    transform: translateX(0);
  }

  .staff-shell.sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 40;
  }

  .staff-menu-btn {
    display: inline-flex;
  }

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

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

  .form-toc {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .form-toc h4 {
    width: 100%;
  }

  .form-toc button {
    width: auto;
  }

  .staff-grid,
  .photo-upload-row {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .staff-content {
    padding: 1rem 0.85rem 2rem;
  }

  .staff-topbar {
    padding: 0.85rem 0.9rem;
  }

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

.hidden {
  display: none !important;
}

.staff-alert-host {
  position: sticky;
  top: 4.2rem;
  z-index: 25;
  padding: 0 1.5rem;
  max-width: 1280px;
  margin: 0.65rem auto 0;
  width: 100%;
  box-sizing: border-box;
}

.staff-alert-host .alert {
  margin: 0;
}
