/* ============================================================
   GRG ERS Submission Portal — Custom Styles
   ============================================================ */

:root {
  --grg-navy:    #1a3a5c;
  --grg-blue:    #2563a8;
  --grg-blue-lt: #3b7dd8;
  --grg-accent:  #4a90d9;
  --grg-light:   #f5f7fa;
  --grg-border:  #dde3ed;
  --grg-text:    #2d3748;
  --grg-muted:   #6b7a94;
}

/* ---------- Base ---------- */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--grg-text);
  background-color: #f0f4f8;
}

/* ---------- Navbar ---------- */
.grg-navbar {
  background: var(--grg-navy);
  border-bottom: 3px solid var(--grg-accent);
  padding: 0.75rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

.grg-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--grg-accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 4px;
}

.grg-logo-mark-lg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: var(--grg-accent);
  color: #fff;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  border-radius: 8px;
}

.grg-nav-title {
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

/* ---------- User profile dropdown ---------- */
.grg-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--grg-accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.grg-user-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 20px;
  padding: 4px 10px 4px 5px;
  transition: background 0.15s;
}
.grg-user-btn:hover,
.grg-user-btn:focus,
.grg-user-btn.show {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}
.grg-user-btn::after { display: none; } /* hide default Bootstrap caret */
.grg-user-btn-name {
  font-size: 0.85rem;
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* small caret shown after name */
.grg-user-btn .grg-user-btn-name::after {
  content: ' ▾';
  font-size: 0.7rem;
  opacity: 0.7;
}

.grg-user-menu {
  min-width: 220px;
  border-radius: 10px;
  border: 1px solid var(--grg-border);
  padding-bottom: 6px;
}

.grg-role-badge-admin {
  background: #e8f0fd;
  color: var(--grg-blue);
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
}

.grg-role-badge-member {
  background: #f0f4f8;
  color: var(--grg-muted);
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
}

/* ---------- Footer ---------- */
.grg-footer {
  background: var(--grg-navy);
  color: rgba(255,255,255,0.5);
  font-size: 0.8rem;
  padding: 0.75rem 0;
  border-top: 2px solid var(--grg-accent);
}

/* ---------- Buttons ---------- */
.btn-grg {
  background: var(--grg-blue);
  border-color: var(--grg-blue);
  color: #fff;
}
.btn-grg:hover,
.btn-grg:focus {
  background: var(--grg-navy);
  border-color: var(--grg-navy);
  color: #fff;
}
.btn-grg:active {
  background: #122a44;
  border-color: #122a44;
  color: #fff;
}

/* ---------- Cards ---------- */
.card {
  border-radius: 10px;
}

/* ---------- Step Card Header ---------- */
.grg-step-header {
  background: var(--grg-navy);
  color: #fff;
  border-radius: 10px 10px 0 0 !important;
  padding: 1rem 1.25rem;
}

.grg-step-header h5 {
  color: #fff;
  font-weight: 700;
}

.grg-step-header-secondary {
  background: var(--grg-blue);
  color: #fff;
  padding: 0.75rem 1.25rem;
}

/* ---------- Step Badge ---------- */
.grg-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ---------- Login card header ---------- */
.grg-card-header {
  background: var(--grg-navy);
  border-bottom: 3px solid var(--grg-accent);
  border-radius: 10px 10px 0 0 !important;
}

/* ---------- Sidebar ---------- */
.grg-sidebar-header {
  background: var(--grg-navy);
  border-radius: 10px 10px 0 0;
  padding: 0.85rem 1rem;
}

a.grg-step-item {
  color: var(--grg-muted);
  transition: all 0.15s;
}

a.grg-step-item:hover {
  background: var(--grg-light);
  color: var(--grg-navy);
}

a.grg-step-item.active {
  background: #e8effe;
  color: var(--grg-blue);
}

a.grg-step-item.done {
  color: #2e7d32;
}

.grg-step-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Section Dividers ---------- */
.section-divider {
  border-bottom: 2px solid var(--grg-border);
  padding-bottom: 0.5rem;
}

.section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--grg-navy);
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- Employee Table ---------- */
.employee-table-wrap {
  overflow-x: auto;
  padding-left: 0;
}

.card-body {
  padding-left: 0;
  padding-right: 0;
}
.employee-table {
  font-size: 0.8rem;
}

.employee-table input.form-control,
.employee-table select.form-select {
  min-width: 60px;
  font-size: 0.78rem;
  padding: 0.2rem 0.4rem;
}

/* Sticky first column */
.employee-table .sticky-col {
  position: sticky !important;
  left: 0 !important;
  z-index: 2;
  background-color: #fff !important;
  box-shadow: 2px 0 5px rgba(0,0,0,.12);
}

.employee-table thead .sticky-col {
  z-index: 3;
  background-color: #212529 !important;
}

/* Column colour coding */
.employee-table .th-fixedpay {
  background: #1b5e20 !important;
  color: #fff;
}
.employee-table .th-sti-target {
  background: #0d47a1 !important;
  color: #fff;
}
.employee-table .th-sti-stretch {
  background: #4a148c !important;
  color: #fff;
}
.employee-table .th-lti {
  background: #b71c1c !important;
  color: #fff;
}

/* ---------- Supporting Doc File Card ---------- */
.btn-xs {
  padding: 0.15rem 0.4rem;
  font-size: 0.72rem;
  line-height: 1.4;
  border-radius: 4px;
}

.doc-file-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 200px;
}

.doc-file-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}

.doc-file-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.doc-file-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.doc-file-name {
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--grg-text);
  max-width: 160px;
}

.doc-file-size {
  font-size: 0.68rem;
  color: var(--grg-muted);
}

.doc-file-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ---------- Current Remuneration Table (#99CCFF theme) ---------- */
.cr-table thead th {
  background-color: #99CCFF !important;
  color: #000 !important;
  font-weight: 700;
  border-color: #6aadee;
  vertical-align: middle;
  text-align: center;
}

.cr-table {
  font-size: 0.78rem;
}

.cr-table td {
  vertical-align: middle;
}

.cr-group-header {
  background-color: #99CCFF !important;
  color: #000 !important;
  font-weight: 700;
  text-align: center;
  border-color: #6aadee;
}

/* ---------- Utility ---------- */
.letter-spacing-1 {
  letter-spacing: 0.06em;
}

/* Alert colour fix for Bootstrap 5 */
.bg-success-subtle { background-color: #d1e7dd !important; }
.bg-warning-subtle { background-color: #fff3cd !important; }
.bg-danger-subtle  { background-color: #f8d7da !important; }

/* ---------- Responsive tweaks ---------- */
@media (max-width: 768px) {
  .grg-nav-title { display: none; }
}

/* ============================================================
   Client Dashboard
   ============================================================ */

/* Outer wrapper — full viewport width, white background.
   min-height fallback ensures white covers body's gray even on short pages. */
.db-wrap {
  background: #fff;
  min-height: 60vh;
}

/* Header band */
.db-header {
  background: #fff;
  border-bottom: 1px solid var(--grg-border);
  padding: 2rem 0 1.75rem;
}

.db-header-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.db-client-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--grg-navy);
  margin: 0 0 0.2rem;
  letter-spacing: -0.01em;
}

.db-client-sub {
  font-size: 0.85rem;
  color: var(--grg-muted);
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.db-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--grg-blue);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.db-role-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 20px;
  padding: 2px 8px;
}
.db-role-pill--admin {
  background: #e8f0fd;
  color: var(--grg-blue);
}
.db-role-pill--member {
  background: #f0f4f8;
  color: var(--grg-muted);
}

.db-new-btn {
  flex-shrink: 0;
  padding: 0.5rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
}

/* Body area */
.db-body {
  max-width: 1060px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

/* Section labels */
.db-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grg-muted);
  margin-bottom: 0.75rem;
}

/* ── Submission cards ── */
.sub-card {
  background: #fff;
  border: 1px solid var(--grg-border);
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  margin-bottom: 0.75rem;
  transition: box-shadow 0.15s;
}

.sub-card:hover {
  box-shadow: 0 4px 16px rgba(26, 58, 92, 0.08);
}

.sub-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.sub-year {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--grg-navy);
}

/* Status badges */
.sub-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.28rem 0.7rem;
  border-radius: 20px;
  letter-spacing: 0.01em;
}

.sub-badge--approved {
  background: #d1f2e0;
  color: #1a6e3a;
}

.sub-badge--submitted {
  background: #fff4d6;
  color: #8a6000;
}

.sub-badge--draft {
  background: #eef0f3;
  color: #5a6475;
}

/* Progress */
.sub-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.sub-progress-bar {
  flex: 1;
  height: 5px;
  background: #e9ecf0;
  border-radius: 99px;
  overflow: hidden;
}

.sub-progress-fill {
  height: 100%;
  background: var(--grg-blue);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.sub-progress-fill--complete {
  background: #2e7d32;
}

.sub-progress-label {
  font-size: 0.75rem;
  color: var(--grg-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Footer row */
.sub-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sub-meta {
  font-size: 0.78rem;
  color: var(--grg-muted);
}

.sub-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-icon-trash {
  background: none;
  border: none;
  color: #adb5bd;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: color 0.15s, background 0.15s;
}

.btn-icon-trash:hover {
  color: #c0392b;
  background: #fdecea;
}

.sub-locked {
  font-size: 0.78rem;
  color: var(--grg-muted);
}

/* ── Empty state ── */
.db-empty {
  background: #fafbfc;
  border: 1px dashed var(--grg-border);
  border-radius: 10px;
  text-align: center;
  padding: 3.5rem 2rem;
}

.db-empty-icon {
  font-size: 2.2rem;
  color: #c8d0dc;
  margin-bottom: 1rem;
}

.db-empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--grg-navy);
  margin-bottom: 0.4rem;
}

.db-empty-body {
  font-size: 0.85rem;
  color: var(--grg-muted);
  margin-bottom: 0;
}

/* ── New sidebar components ── */
.sb-card {
  background: #fff;
  border: 1px solid var(--grg-border);
  border-radius: 12px;
  overflow: hidden;
}
.sb-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0f4f8;
}
.sb-card-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--grg-text);
  display: flex;
  align-items: center;
}
.sb-head-link {
  font-size: 0.72rem;
  color: var(--grg-blue);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: .8;
  transition: opacity .15s;
}
.sb-head-link:hover { opacity: 1; text-decoration: none; }

.sb-empty {
  padding: 1.6rem 1rem;
  text-align: center;
}
.sb-empty-icon {
  display: block;
  font-size: 1.6rem;
  color: #c8d0df;
  margin-bottom: 0.5rem;
}
.sb-empty-text {
  font-size: 0.8rem;
  color: var(--grg-muted);
  margin: 0 0 0.4rem;
}
.sb-empty-link {
  font-size: 0.78rem;
  color: var(--grg-blue);
  text-decoration: none;
  font-weight: 500;
}
.sb-empty-link:hover { text-decoration: underline; }

/* Team action row */
.sb-action-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: #fff;
  border: 1px solid var(--grg-border);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: background .12s, border-color .12s;
}
.sb-action-row:hover {
  background: #f6f9ff;
  border-color: #b8d0f0;
  color: inherit;
  text-decoration: none;
}
.sb-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #deeafc;
  color: var(--grg-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.sb-action-body { flex: 1; }
.sb-action-title {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--grg-text);
  line-height: 1.2;
}
.sb-action-sub {
  font-size: 0.72rem;
  color: var(--grg-muted);
}
.sb-action-arrow {
  color: #c0cad8;
  font-size: 0.75rem;
}

/* ERS Hub card */
.sb-hub-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  background: var(--grg-navy);
  border-radius: 12px;
  text-decoration: none;
  transition: background .15s;
}
.sb-hub-card:hover {
  background: #142d4a;
  text-decoration: none;
}
.sb-hub-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--grg-accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: .06em;
  flex-shrink: 0;
}
.sb-hub-body { flex: 1; min-width: 0; }
.sb-hub-title {
  font-size: 0.83rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.sb-hub-desc {
  font-size: 0.72rem;
  color: rgba(255,255,255,.5);
  margin: 0;
}
.sb-hub-ext {
  font-size: 0.72rem;
  color: rgba(255,255,255,.4);
  flex-shrink: 0;
}

/* Support strip */
.sb-support {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  background: #fff;
  border: 1px solid var(--grg-border);
  border-radius: 12px;
}
.sb-support-label {
  font-size: 0.78rem;
  color: var(--grg-muted);
}
.sb-support-link {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--grg-blue);
  text-decoration: none;
  display: flex;
  align-items: center;
}
.sb-support-link:hover { text-decoration: underline; }

/* ── Sidebar cards (legacy, kept for compat) ── */
.db-sidebar-card {
  background: #fff;
  border: 1px solid var(--grg-border);
  border-radius: 10px;
  overflow: hidden;
}

.db-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.db-file-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--grg-border);
}

.db-file-row:last-child {
  border-bottom: none;
}

.db-file-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.db-file-info {
  overflow: hidden;
  min-width: 0;
}

.db-file-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--grg-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.db-file-meta {
  font-size: 0.7rem;
  color: var(--grg-muted);
}

.db-sidebar-foot {
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--grg-border);
}

.db-sidebar-link {
  font-size: 0.78rem;
  color: var(--grg-blue);
  text-decoration: none;
  font-weight: 500;
}

.db-sidebar-link:hover {
  text-decoration: underline;
}

.db-sidebar-empty {
  padding: 1.4rem 1rem;
  text-align: center;
  color: var(--grg-muted);
  font-size: 0.82rem;
}

.db-sidebar-empty p {
  margin-bottom: 0.4rem;
}

/* Support card */
.db-support-card {
  padding: 1.1rem 1.2rem;
}

.db-support-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--grg-navy);
  margin-bottom: 0.3rem;
}

.db-support-body {
  font-size: 0.8rem;
  color: var(--grg-muted);
  margin-bottom: 0.65rem;
}

.db-support-email {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  color: var(--grg-blue);
  text-decoration: none;
  font-weight: 500;
}

.db-support-email:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .db-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .db-client-name {
    font-size: 1.3rem;
  }

  .db-new-btn {
    width: 100%;
    text-align: center;
  }

  .sub-card-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}
