.users-table thead th {
    position: relative;
    border-top: 2px solid #BBF7D0;
    border-bottom: 3px solid #16A34A;
    border-right: 1px solid #E5E7EB;
}

.users-table thead th:last-child {
    border-right: none;
}

.users-table table.dataTable thead th.sorting,
.users-table table.dataTable thead th.sorting_asc,
.users-table table.dataTable thead th.sorting_desc {
    position: relative;
    padding-right: 32px;
    cursor: pointer;
}

.users-table table.dataTable thead th.sorting_disabled {
    padding-right: 16px;
}

.users-table table.dataTable thead th.sorting:before,
.users-table table.dataTable thead th.sorting_asc:before,
.users-table table.dataTable thead th.sorting_desc:before,
.users-table table.dataTable thead th.sorting:after,
.users-table table.dataTable thead th.sorting_asc:after,
.users-table table.dataTable thead th.sorting_desc:after {
    content: '';
    position: absolute;
    right: 12px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0.4;
    transform: translateY(-50%);
}

.users-table table.dataTable thead th.sorting_disabled:before,
.users-table table.dataTable thead th.sorting_disabled:after {
    display: none;
    content: none;
}

.users-table table.dataTable thead th.sorting:before,
.users-table table.dataTable thead th.sorting_asc:before,
.users-table table.dataTable thead th.sorting_desc:before {
    top: calc(50% - 6px);
    border-bottom: 6px solid #6EE7B7;
}

.users-table table.dataTable thead th.sorting:after,
.users-table table.dataTable thead th.sorting_asc:after,
.users-table table.dataTable thead th.sorting_desc:after {
    top: calc(50% + 6px);
    border-top: 6px solid #6EE7B7;
}

.users-table table.dataTable thead th.sorting_asc:before {
    border-bottom-color: #16A34A;
    opacity: 1;
}

.users-table table.dataTable thead th.sorting_desc:after {
    border-top-color: #16A34A;
    opacity: 1;
}
body {
  margin: 0;
  padding: 0;
  background: #F7F7F7;
  font-family: 'Inter', Arial, sans-serif;
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
  box-sizing: border-box;
  /* WCAG 2.1 SC 1.4.4: Support text resizing up to 200% */
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
}

.sidebar {
  width: 296px;
  height: 100vh;
  background: #FFFFFF;
  border-right: 1px solid #E9EAEB;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  flex: 0 0 296px;
  overflow: hidden;
  z-index: 100;
}
.sidebar nav {
  flex: 1 1 0;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

.sidebar .logo {
  box-sizing: border-box;
  width: 100%;
  padding: 24px 16px 24px 28px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  gap: 8px;
}
.sidebar .logo h1 {
  margin: 0;
  font-size: 2em;
  font-weight: bold;
  letter-spacing: -1px;
}
.sidebar .logo .green {
  color: #16A34A;
}
.sidebar .logo a {
  display: inline-block;
  text-decoration: none;
  line-height: 0;
}
.sidebar .logo img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 60px;
  width: auto;
}
.sidebar .close-sidebar {
  display: none;
  border: 1px solid #E9EAEB;
  background: #FFFFFF;
  color: #111827;
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar nav ul {
  list-style: none;
  margin: 0 0 20px 0;
  padding: 0;
}
.sidebar nav li { list-style: none; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 12px 28px;
  font-size: 1.05em;
  font-weight: 500;
  border-radius: 10px;
  /* Leave space on left and right so highlight does not touch edges */
  margin: 0 12px 6px 12px;
  color: #111827;
  text-decoration: none;
}
.sidebar nav a[aria-current="page"] {
  background: #E8F8F0;
  font-weight: 600;
}
.sidebar nav svg { flex: 0 0 auto; color: #6B7280; }

/* Logout button styling to match nav links */
.sidebar-logout-form {
  display: inline;
  margin: 0;
  padding: 0;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 12px 28px;
  font-size: 1.05em;
  font-weight: 500;
  border-radius: 10px;
  margin: 0 12px 6px 12px;
  color: #111827;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.sidebar-logout-btn:hover {
  background: #F3F4F6;
}

.sidebar-logout-btn:focus-visible {
  outline: 3px solid #111;
  outline-offset: 2px;
}

.sidebar-logout-btn svg {
  flex: 0 0 auto;
  color: #6B7280;
}

.sidebar .tutorial {
  background: #F6F6F6;
  border-radius: 12px;
  padding: 18px 20px;
  margin: 12px 16px 12px 16px;
  flex-shrink: 0;
  flex-grow: 0;
}
.sidebar .tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.08em;
  margin-bottom: 8px;
}
.sidebar .tutorial-header button {
  background: none;
  border: none;
  font-size: 1.3em;
  line-height: 1;
  cursor: pointer;
}
.sidebar .tutorial p {
  margin: 2px 0 12px 0;
  font-size: 1em;
  color: #555659;
}
.sidebar .tutorial-video {
  background: #EEE;
  border-radius: 6px;
  margin-bottom: 10px;
  height: 155px;
  display: block;
  position: relative;
  overflow: hidden;
}
.sidebar .tutorial-video iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 6px;
  display: block;
}
.sidebar .tutorial-video .play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #ffffffcc;
  border: none;
  border-radius: 50%;
  font-size: 2em;
  color: #16A34A;
  cursor: pointer;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar .tutorial-actions {
  display: flex;
  justify-content: flex-start;
  gap: 18px;
  font-size: 1em;
  margin-bottom: 8px;
}
.sidebar .tutorial-actions a {
  color: #16A34A;
  font-weight: 600;
  text-decoration: none;
}
/* Dismiss button styled like a link */
.sidebar .tutorial-actions button.dismiss-btn {
  background: none;
  border: none;
  padding: 0;
  color: #6B7280; /* base */
  cursor: pointer;
}
.sidebar .tutorial-actions button.dismiss-btn { color: #98A2B3; }
.sidebar .tutorial-actions button.dismiss-btn:hover,
.sidebar .tutorial-actions button.dismiss-btn:focus-visible { color: #667085; text-decoration: underline; }
.sidebar .tutorial-actions button.dismiss-btn:hover,
.sidebar .tutorial-actions button.dismiss-btn:focus-visible {
  text-decoration: underline;
}

.sidebar footer {
  margin-top: auto;
  padding: 0 16px 32px 16px;
}
.sidebar .profile {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: #FAFAFA;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
}
.sidebar .profile .icon {
  font-size: 1.6em;
  margin-right: 10px;
  color: #b8babb;
}
.sidebar .profile strong {
  display: block;
  font-size: 1em;
  font-weight: bold;
}
.sidebar .profile span {
  font-size: 0.96em;
  color: #909399;
  display: block;
}

.main-content {
  flex: 1;
  min-height: 100vh;
  background: #F7F7F7;
  display: flex;
  flex-direction: column;
  padding: 32px 32px 32px 328px;
  gap: 24px;
  box-sizing: border-box;
  margin-left: 0;
  /* WCAG 2.1 SC 1.4.4: Prevent horizontal scrolling at 200% zoom */
  max-width: 100%;
  width: 100%;
  overflow-x: hidden !important;
  overflow-y: auto;
  color: #374151;
  font-size: 16px;
  line-height: 1.55;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 0;
  margin-bottom: 8px;
}

.page-header-content {
  padding: 0;
}

.page-header-actions {
  padding: 0 16px;
}
.page-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}
.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mobile { display: none; height: 22px; }
.menu-toggle {
  display: none;
  border: 1px solid #D6D7DA;
  background: #FFF;
  color: #111827;
  border-radius: 8px;
  padding: 8px 10px;
  line-height: 0;
  cursor: pointer;
}
.menu-toggle svg, .menu-toggle img { display: block; outline: none; }
.menu-toggle:focus { outline: none; }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 900;
}
body.sidebar-open .backdrop {
  opacity: 1;
  pointer-events: auto;
}

.submissions-container {
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  padding: 16px 0 8px 0;
  box-sizing: border-box;
  border: 1px solid #EAECF0;
}
.submissions-container header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 32px 24px 0;
}
.submissions-container h2 {
  font-size: 1.8em;
  font-weight: bold;
}
.actions button {
  border: none;
  border-radius: 20px;
  font-size: 1em;
  font-weight: bold;
  margin-left: 10px;
  padding: 10px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.actions .filter {
  background: #FFF;
  color: #333;
  border: 1px solid #D6D7DA;
}
.actions .new-submission {
  background: #16A34A;
  color: #FFF;
}

/* --- Welcome page (standalone welcome.html) --- */
.welcome-card { background: #fff; border-radius: 12px; border: 1px solid #EAECF0; padding: 20px; }
.welcome-card .welcome-content p { margin: 10px 0; color: #374151; }
.welcome-card .welcome-content ul { margin: 10px 0 10px 20px; }
.welcome-footer { display: flex; justify-content: flex-end; margin-top: 16px; }
.continue { background: #16A34A; color: #fff; border: none; border-radius: 20px; padding: 8px 18px; cursor: pointer; font-weight: 600; text-decoration: none; }

/* --- Admin Tools page styles --- */
/* Modern Admin Tools Container */
.tools-container {
  margin: 0 24px 24px 24px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 0;
}

/* Modern Card Style */
.tool-card.modern-card {
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 16px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-height: 160px;
}

.tool-card.modern-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #16A34A 0%, #15803D 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-card.modern-card:hover {
  border-color: #16A34A;
  box-shadow: 0 8px 24px rgba(22, 163, 74, 0.12);
  transform: translateY(-2px);
}

.tool-card.modern-card:hover::before {
  transform: scaleX(1);
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: #16A34A;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.tool-card.modern-card:hover .tool-icon {
  background: linear-gradient(135deg, #DCFCE7 0%, #BBF7D0 100%);
  transform: scale(1.05);
}

.tool-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tool-content h3 {
  margin: 0 0 8px 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.4;
}

.tool-content p {
  margin: 0;
  font-size: 0.875rem;
  color: #6B7280;
  line-height: 1.5;
  flex: 1;
}

.tool-arrow-top {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #16A34A;
  transition: transform 0.3s ease;
  z-index: 1;
}

.tool-card.modern-card:hover .tool-arrow-top {
  transform: translateX(4px);
}

/* Legacy tool-card support (for backwards compatibility) */
.tool-card:not(.modern-card) {
  background: #fff;
  border: 1px solid #EAECF0;
  border-radius: 10px;
  padding: 16px;
}

.tool-card:not(.modern-card) h3 {
  margin: 0 0 8px 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
}

.tool-card:not(.modern-card) p {
  margin: 0 0 12px 0;
  color: #475467;
}

.tool-actions {
  display: flex;
  justify-content: flex-end;
}

.tool-link {
  background: #16A34A;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}

.tool-link:hover {
  background: #15803D;
}

/* Responsive Admin Tools */
@media (max-width: 1024px) {
  .tool-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }

  .tool-card.modern-card {
    padding: 20px;
    min-height: 150px;
  }
}

@media (max-width: 768px) {
  .tools-container {
    margin: 0 16px 16px 16px;
  }

  .tool-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .tool-card.modern-card {
    padding: 20px;
    min-height: auto;
  }

  .tool-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
  }

  .tool-content h3 {
    font-size: 1rem;
  }

  .tool-content p {
    font-size: 0.8125rem;
  }
}

/* Form Button Styles */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: #10B981;
    color: white;
}

.btn-primary:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #F3F4F6;
    color: #374151;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
}

.btn-secondary:hover {
    background: #E5E7EB;
    border-color: #9CA3AF;
}

.btn-cancel {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    background: #EF4444;
    color: white;
    line-height: 1;
}

.btn-cancel:hover {
    background: #DC2626;
    transform: translateY(-1px);
}

/* Breadcrumb Styles */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px 0;
    font-size: 0.875rem;
    color: #6B7280;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb-item:not(:last-child)::after {
    content: "›";
    color: #9CA3AF;
    font-weight: bold;
}

.breadcrumb-link {
    color: #6B7280;
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-link:hover {
    color: #10B981;
}

.breadcrumb-current {
    color: #111827;
    font-weight: 500;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid #E5E7EB;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

/* Responsive Form Buttons */
@media (max-width: 768px) {
    .form-actions {
        flex-direction: row;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .form-actions .tool-link,
    .form-actions .btn-secondary,
    .form-actions .btn-cancel {
        flex: 1;
        min-width: 120px;
        max-width: 200px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .form-actions {
        gap: 6px;
    }

    .form-actions .tool-link,
    .form-actions .btn-secondary,
    .form-actions .btn-cancel {
        padding: 8px 12px;
        font-size: 0.8rem;
        min-width: 100px;
        max-width: 150px;
    }
}

/* Form Container Styles */
.form-container {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    overflow: hidden;
    box-sizing: border-box;
}

.form-section {
    margin-bottom: 24px;
}

.form-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #E5E7EB;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.form-grid.form-grid-three {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 24px;
}

.form-grid .checkbox-group {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding-top: 6px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    margin-top: 10px;
}

.form-group:first-child {
    margin-top: 0;
}

/* Ensure error messages appear below input-wrapper */
.form-group .error-message {
    order: 3;
    width: 100%;
    margin-top: 4px;
    margin-bottom: 0;
    display: block;
    clear: both;
    flex-basis: 100%;
}

.form-label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.form-label svg {
    margin-right: 6px;
    flex-shrink: 0;
    vertical-align: middle;
}

.form-label.required::after {
    content: " *";
    color: #EF4444;
}

.form-input,
.form-select {
    padding: 10px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-input.error,
.form-select.error {
    border-color: #EF4444;
}

.error-message {
    color: #EF4444;
    font-size: 0.75rem;
    margin-top: 4px;
    display: block;
    width: 100%;
    clear: both;
}

/* Image Preview Styles */
.image-preview-container,
.logo-preview-container {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    background: #F9FAFB;
}

.profile-image-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #E5E7EB;
}

.logo-preview {
    width: 150px;
    height: 150px;
    object-fit: contain;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    background: white;
    padding: 8px;
}

.no-image-placeholder,
.no-logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9CA3AF;
    font-size: 0.875rem;
    padding: 20px;
}

/* Checkbox Styles */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-checkbox {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #D1D5DB;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.form-checkbox:checked + .checkbox-label .checkbox-custom {
    background: #10B981;
    border-color: #10B981;
}

.form-checkbox:checked + .checkbox-label .checkbox-custom::after {
    content: "✓";
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
}

.field-help {
    margin-top: 4px;
}

.field-help small {
    color: #6B7280;
    font-size: 0.75rem;
}

/* Responsive Form Styles */
@media (max-width: 1024px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

@media (max-width: 768px) {
    .form-container {
        padding: 16px;
        border-radius: 8px;
    }

    .form-section {
        gap: 16px;
    }

    .form-section h3 {
        font-size: 1rem;
        padding-bottom: 6px;
    }

    .form-group {
        gap: 4px;
        margin-top: 10px;
    }

    .form-group:first-child {
        margin-top: 0;
    }

    .form-label {
        font-size: 0.8rem;
    }

    .form-input,
    .form-select {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .image-preview-container,
    .logo-preview-container {
        padding: 12px;
        flex-direction: column;
        text-align: center;
    }

    .profile-image-preview {
        width: 120px;
        height: 120px;
    }

    .logo-preview {
        width: 150px;
        height: 150px;
    }

    .checkbox-label {
        font-size: 0.8rem;
    }

    .field-help small {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .form-container {
        padding: 12px;
        border-radius: 6px;
    }

    .form-section {
        gap: 12px;
    }

    .form-section h3 {
        font-size: 0.9rem;
        padding-bottom: 4px;
    }

    .form-group {
        gap: 3px;
        margin-top: 10px;
    }

    .form-group:first-child {
        margin-top: 0;
    }

    .form-label {
        font-size: 0.75rem;
    }

    .form-input,
    .form-select {
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    .image-preview-container,
    .logo-preview-container {
        padding: 8px;
    }

    .profile-image-preview {
        width: 100px;
        height: 100px;
    }

    .logo-preview {
        width: 120px;
        height: 120px;
    }

    .no-image-placeholder,
    .no-logo-placeholder {
        padding: 8px;
    }

    .no-image-placeholder svg,
    .no-logo-placeholder svg {
        width: 32px;
        height: 32px;
    }

    .no-image-placeholder span,
    .no-logo-placeholder span {
        font-size: 0.7rem;
    }

    .checkbox-label {
        font-size: 0.75rem;
    }

    .checkbox-custom {
        width: 16px;
        height: 16px;
    }

    .field-help small {
        font-size: 0.65rem;
    }
}

/* Table and DataTable Styles */
.filters-section {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 20px;
    margin-top: 24px;
    margin-bottom: 24px;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.filter-select,
.filter-input {
    padding: 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 0.875rem;
    background: white;
    width: 100%;
    box-sizing: border-box;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.table-container {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    overflow: visible;
    margin: 0 16px;
}

.table-header {
    padding: 20px;
    border-bottom: 1px solid #E5E7EB;
    background: #F9FAFB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    background: #F9FAFB;
    color: #374151;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 12px 16px;
    border-bottom: 1px solid #E5E7EB;
    text-align: left;
}

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #F3F4F6;
    font-size: 0.875rem;
    color: #374151;
}

.data-table tbody tr:hover {
    background: #F9FAFB;
}

.btn-edit,
.btn-archive,
.btn-restore {
    padding: 6px 12px;
    border: none;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 2px;
}

/* Actions column container */
.actions-container {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.btn-edit {
    background: #10B981;
    color: white;
}

.btn-edit:hover {
    background: #059669;
}

.btn-archive {
    background: #EF4444;
    color: white;
}

.btn-archive:hover {
    background: #DC2626;
}

.btn-restore {
    background: #10B981;
    color: white;
}

.btn-restore:hover {
    background: #059669;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-active {
    background: #D1FAE5;
    color: #065F46;
}

.status-inactive {
    background: #FEF3C7;
    color: #92400E;
}

.status-archived {
    background: #FEE2E2;
    color: #991B1B;
}

.access-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.access-user {
    background: #DBEAFE;
    color: #1E40AF;
}

.access-admin {
    background: #FEF3C7;
    color: #92400E;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #F3F4F6;
    border-top: 4px solid #10B981;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* FAQ Module Responsive Styles */
@media (max-width: 1024px) {
    /* FAQ listing page */
    .faq-table-container {
        margin: 0 -16px;
        border-radius: 0;
    }

    .faq-table-header {
        padding: 16px;
    }

    .faq-filters-section {
        padding: 16px;
    }

    /* FAQ form pages */
    .faq-form-container {
        margin: 0 -16px;
        border-radius: 0;
        padding: 16px;
    }

    .faq-page-header {
        padding: 16px;
    }

    .faq-page-header-actions {
        margin-top: 12px;
    }
}

@media (max-width: 768px) {
    /* FAQ listing page */
    .faq-table-container {
        margin: 0 -12px;
    }

    .faq-table-header h2 {
        font-size: 1.1rem;
    }

    .faq-filters-section {
        padding: 12px;
    }

    .faq-filters-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .faq-filter-actions {
        justify-content: flex-start;
    }

    /* FAQ form pages */
    .faq-form-container {
        margin: 0 -12px;
        padding: 12px;
    }

    .faq-page-header {
        padding: 12px;
    }

    .faq-page-header h1 {
        font-size: 1.25rem;
    }

    .faq-page-header p {
        font-size: 0.875rem;
    }

    .faq-form-section h3 {
        font-size: 1rem;
    }

    .faq-form-actions {
        flex-direction: column;
        gap: 12px;
    }

    .faq-form-actions .continue,
    .faq-form-actions .btn-cancel {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    /* FAQ listing page */
    .faq-table-container {
        margin: 0 -8px;
    }

    .faq-table-header {
        padding: 8px;
    }

    .faq-table-header h2 {
        font-size: 1rem;
    }

    .faq-filters-section {
        padding: 8px;
    }

    .faq-filter-group label {
        font-size: 0.8rem;
    }

    .faq-filter-select {
        font-size: 0.875rem;
        padding: 8px 12px;
    }

    .faq-clear-filters-btn {
        font-size: 0.8rem;
        padding: 8px 12px;
    }

    /* FAQ form pages */
    .faq-form-container {
        margin: 0 -8px;
        padding: 8px;
    }

    .faq-page-header {
        padding: 8px;
    }

    .faq-page-header h1 {
        font-size: 1.125rem;
    }

    .faq-page-header p {
        font-size: 0.8rem;
    }

    .faq-form-section {
        gap: 12px;
    }

    .faq-form-section h3 {
        font-size: 0.9rem;
    }

    .faq-form-label {
        font-size: 0.875rem;
    }

    .faq-form-input,
    .faq-form-textarea,
    .faq-form-select {
        font-size: 0.875rem;
        padding: 10px 12px;
    }

    .faq-form-textarea {
        min-height: 120px;
    }

    .faq-checkbox-label {
        font-size: 0.8rem;
    }

    .faq-form-actions {
        gap: 8px;
    }

    .faq-form-actions .continue,
    .faq-form-actions .btn-cancel {
        font-size: 0.875rem;
        padding: 10px 16px;
    }
}

/* Notification Styles */
.notification-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    max-width: 400px;
    width: 100%;
    pointer-events: auto;
    cursor: pointer;
}

.notification-content {
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border-left: 4px solid;
}

.notification-success {
    background-color: #f0fdf4;
    border-left-color: #22c55e;
}

.notification-error {
    background-color: #fef2f2;
    border-left-color: #ef4444;
}

.notification-warning {
    background-color: #fffbeb;
    border-left-color: #f59e0b;
}

.notification-info {
    background-color: #eff6ff;
    border-left-color: #3b82f6;
}

.notification-body {
    padding: 16px;
}

.notification-layout {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.notification-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.notification-success .notification-icon svg {
    color: #16a34a;
}

.notification-error .notification-icon svg {
    color: #dc2626;
}

.notification-warning .notification-icon svg {
    color: #d97706;
}

.notification-info .notification-icon svg {
    color: #2563eb;
}

.notification-message {
    flex: 1;
    padding-top: 2px;
}

.notification-text {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    margin: 0;
}

.notification-success .notification-text {
    color: #14532d;
}

.notification-error .notification-text {
    color: #991b1b;
}

.notification-warning .notification-text {
    color: #92400e;
}

.notification-info .notification-text {
    color: #1e40af;
}

.notification-close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close-btn {
    background: none;
    border: none;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.notification-close-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.notification-success .notification-close-btn {
    color: #15803d;
}

.notification-error .notification-close-btn {
    color: #b91c1c;
}

.notification-warning .notification-close-btn {
    color: #a16207;
}

.notification-info .notification-close-btn {
    color: #1d4ed8;
}

.notification-close-btn:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* DataTable Styling - All Tables */
#clientsTable,
#usersTable,
#companiesTable {
    width: 100% !important;
}

#clientsTable th,
#clientsTable td,
#usersTable th,
#usersTable td,
#companiesTable th,
#companiesTable td {
    width: auto !important;
    min-width: auto !important;
    max-width: none !important;
}

#clientsTable th:last-child,
#usersTable th:last-child,
#companiesTable th:last-child {
    width: auto !important;
    min-width: 200px !important;
    white-space: nowrap;
    text-align: left !important;
}

#clientsTable td:last-child,
#usersTable td:last-child,
#companiesTable td:last-child {
    width: auto !important;
    min-width: 200px !important;
    white-space: nowrap;
    text-align: left !important;
}

/* DataTable Container Styles - Based on Reference */
.clients-container,
.users-container,
.companies-container,
.document-templates-container,
.file-attachments-container,
.sections-container,
.criteria-container {
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    padding: 16px 0 8px 0;
    box-sizing: border-box;
    border: 1px solid #EAECF0;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 24px 12px 24px;
}

.clients-table,
.users-table,
.companies-table,
.document-templates-table,
.file-attachments-table,
.sections-table,
.criteria-table {
    margin: 0 24px 8px 24px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

/* Custom scrollbar styling for better UX */
.clients-table::-webkit-scrollbar,
.users-table::-webkit-scrollbar,
.companies-table::-webkit-scrollbar,
.document-templates-table::-webkit-scrollbar,
.file-attachments-table::-webkit-scrollbar,
.sections-table::-webkit-scrollbar,
.criteria-table::-webkit-scrollbar {
    height: 8px;
}

.clients-table::-webkit-scrollbar-track,
.users-table::-webkit-scrollbar-track,
.companies-table::-webkit-scrollbar-track,
.document-templates-table::-webkit-scrollbar-track,
.file-attachments-table::-webkit-scrollbar-track,
.sections-table::-webkit-scrollbar-track,
.criteria-table::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.clients-table::-webkit-scrollbar-thumb,
.users-table::-webkit-scrollbar-thumb,
.companies-table::-webkit-scrollbar-thumb,
.document-templates-table::-webkit-scrollbar-thumb,
.file-attachments-table::-webkit-scrollbar-thumb,
.sections-table::-webkit-scrollbar-thumb,
.criteria-table::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.clients-table::-webkit-scrollbar-thumb:hover,
.users-table::-webkit-scrollbar-thumb:hover,
.companies-table::-webkit-scrollbar-thumb:hover,
.document-templates-table::-webkit-scrollbar-thumb:hover,
.file-attachments-table::-webkit-scrollbar-thumb:hover,
.sections-table::-webkit-scrollbar-thumb:hover,
.criteria-table::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.clients-table table,
.users-table table,
.companies-table table,
.document-templates-table table,
.file-attachments-table table,
.sections-table table,
.criteria-table table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    background: #fff;
    border-radius: 12px;
    overflow: visible;
    min-width: 800px;
    table-layout: auto;
}

.clients-table th,
.clients-table td,
.users-table th,
.users-table td,
.companies-table th,
.companies-table td,
.criteria-table th,
.criteria-table td {
    padding: 12px 8px;
    text-align: left;
    font-size: 0.95em;
    border-bottom: 1px solid #EAEAEA;
    white-space: nowrap;
    overflow: visible;
    box-sizing: border-box;
}

.sections-table th,
.sections-table td,
.criteria-table th,
.criteria-table td {
    padding: 18px 20px;
    line-height: 1.6;
    vertical-align: top;
    border-bottom: 1px solid #E5E7EB;
}

.sections-table thead th {
    position: relative;
    border-top: 2px solid #BBF7D0;
    border-bottom: 3px solid #16A34A;
    border-right: 1px solid #E5E7EB;
}

.sections-table thead th:last-child {
    border-right: none;
}

.sections-table table.dataTable thead th.sorting,
.sections-table table.dataTable thead th.sorting_asc,
.sections-table table.dataTable thead th.sorting_desc {
    position: relative;
    padding-right: 32px;
    cursor: pointer;
}

.sections-table table.dataTable thead th.sorting_disabled {
    padding-right: 16px;
}

.sections-table table.dataTable thead th.sorting:before,
.sections-table table.dataTable thead th.sorting_asc:before,
.sections-table table.dataTable thead th.sorting_desc:before,
.sections-table table.dataTable thead th.sorting:after,
.sections-table table.dataTable thead th.sorting_asc:after,
.sections-table table.dataTable thead th.sorting_desc:after {
    content: '';
    position: absolute;
    right: 12px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0.4;
    transform: translateY(-50%);
}

.sections-table table.dataTable thead th.sorting_disabled:before,
.sections-table table.dataTable thead th.sorting_disabled:after {
    display: none;
    content: none;
}

.sections-table table.dataTable thead th.sorting:before,
.sections-table table.dataTable thead th.sorting_asc:before,
.sections-table table.dataTable thead th.sorting_desc:before {
    top: calc(50% - 6px);
    border-bottom: 6px solid #6EE7B7;
}

.sections-table table.dataTable thead th.sorting:after,
.sections-table table.dataTable thead th.sorting_asc:after,
.sections-table table.dataTable thead th.sorting_desc:after {
    top: calc(50% + 6px);
    border-top: 6px solid #6EE7B7;
}

.sections-table table.dataTable thead th.sorting_asc:before {
    border-bottom-color: #16A34A;
    opacity: 1;
}

.sections-table table.dataTable thead th.sorting_desc:after {
    border-top-color: #16A34A;
    opacity: 1;
}

.criteria-table thead th {
    position: relative;
    border-top: 2px solid #BBF7D0;
    border-bottom: 3px solid #16A34A;
    border-right: 1px solid #E5E7EB;
}

.criteria-table thead th:last-child {
    border-right: none;
}

.criteria-table table.dataTable thead th.sorting,
.criteria-table table.dataTable thead th.sorting_asc,
.criteria-table table.dataTable thead th.sorting_desc {
    position: relative;
    padding-right: 32px;
    cursor: pointer;
}

.criteria-table table.dataTable thead th.sorting_disabled {
    padding-right: 16px;
}

.criteria-table table.dataTable thead th.sorting:before,
.criteria-table table.dataTable thead th.sorting_asc:before,
.criteria-table table.dataTable thead th.sorting_desc:before,
.criteria-table table.dataTable thead th.sorting:after,
.criteria-table table.dataTable thead th.sorting_asc:after,
.criteria-table table.dataTable thead th.sorting_desc:after {
    content: '';
    position: absolute;
    right: 12px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0.4;
    transform: translateY(-50%);
}

.criteria-table table.dataTable thead th.sorting_disabled:before,
.criteria-table table.dataTable thead th.sorting_disabled:after {
    display: none;
    content: none;
}

.criteria-table table.dataTable thead th.sorting:before,
.criteria-table table.dataTable thead th.sorting_asc:before,
.criteria-table table.dataTable thead th.sorting_desc:before {
    top: calc(50% - 6px);
    border-bottom: 6px solid #6EE7B7;
}

.criteria-table table.dataTable thead th.sorting:after,
.criteria-table table.dataTable thead th.sorting_asc:after,
.criteria-table table.dataTable thead th.sorting_desc:after {
    top: calc(50% + 6px);
    border-top: 6px solid #6EE7B7;
}

.criteria-table table.dataTable thead th.sorting_asc:before {
    border-bottom-color: #16A34A;
    opacity: 1;
}

.criteria-table table.dataTable thead th.sorting_desc:after {
    border-top-color: #16A34A;
    opacity: 1;
}

.companies-table thead th {
    position: relative;
    border-top: 2px solid #BBF7D0;
    border-bottom: 3px solid #16A34A;
    border-right: 1px solid #E5E7EB;
}

.companies-table thead th:last-child {
    border-right: none;
}

.companies-table table.dataTable thead th.sorting,
.companies-table table.dataTable thead th.sorting_asc,
.companies-table table.dataTable thead th.sorting_desc {
    position: relative;
    padding-right: 32px;
    cursor: pointer;
}

.companies-table table.dataTable thead th.sorting_disabled {
    padding-right: 16px;
}

.companies-table table.dataTable thead th.sorting:before,
.companies-table table.dataTable thead th.sorting_asc:before,
.companies-table table.dataTable thead th.sorting_desc:before,
.companies-table table.dataTable thead th.sorting:after,
.companies-table table.dataTable thead th.sorting_asc:after,
.companies-table table.dataTable thead th.sorting_desc:after {
    content: '';
    position: absolute;
    right: 12px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0.4;
    transform: translateY(-50%);
}

.companies-table table.dataTable thead th.sorting_disabled:before,
.companies-table table.dataTable thead th.sorting_disabled:after {
    display: none;
    content: none;
}

.companies-table table.dataTable thead th.sorting:before,
.companies-table table.dataTable thead th.sorting_asc:before,
.companies-table table.dataTable thead th.sorting_desc:before {
    top: calc(50% - 6px);
    border-bottom: 6px solid #6EE7B7;
}

.companies-table table.dataTable thead th.sorting:after,
.companies-table table.dataTable thead th.sorting_asc:after,
.companies-table table.dataTable thead th.sorting_desc:after {
    top: calc(50% + 6px);
    border-top: 6px solid #6EE7B7;
}

.companies-table table.dataTable thead th.sorting_asc:before {
    border-bottom-color: #16A34A;
    opacity: 1;
}

.companies-table table.dataTable thead th.sorting_desc:after {
    border-top-color: #16A34A;
    opacity: 1;
}

#faqsTable thead th {
    position: relative;
    border-top: 2px solid #BBF7D0;
    border-bottom: 3px solid #16A34A;
    border-right: 1px solid #E5E7EB;
}

#faqsTable thead th:last-child {
    border-right: none;
}

#faqsTable.table,
#faqsTable.dataTable {
    width: 100%;
}

#faqsTable.table.dataTable thead th.sorting,
#faqsTable.table.dataTable thead th.sorting_asc,
#faqsTable.table.dataTable thead th.sorting_desc,
#faqsTable.dataTable thead th.sorting,
#faqsTable.dataTable thead th.sorting_asc,
#faqsTable.dataTable thead th.sorting_desc {
    position: relative;
    padding-right: 32px;
    cursor: pointer;
}

#faqsTable.table.dataTable thead th.sorting_disabled,
#faqsTable.dataTable thead th.sorting_disabled {
    padding-right: 16px;
}

#faqsTable.table.dataTable thead th.sorting:before,
#faqsTable.table.dataTable thead th.sorting_asc:before,
#faqsTable.table.dataTable thead th.sorting_desc:before,
#faqsTable.table.dataTable thead th.sorting:after,
#faqsTable.table.dataTable thead th.sorting_asc:after,
#faqsTable.table.dataTable thead th.sorting_desc:after,
#faqsTable.dataTable thead th.sorting:before,
#faqsTable.dataTable thead th.sorting_asc:before,
#faqsTable.dataTable thead th.sorting_desc:before,
#faqsTable.dataTable thead th.sorting:after,
#faqsTable.dataTable thead th.sorting_asc:after,
#faqsTable.dataTable thead th.sorting_desc:after {
    content: '';
    position: absolute;
    right: 12px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0.4;
    transform: translateY(-50%);
}

#faqsTable.table.dataTable thead th.sorting_disabled:before,
#faqsTable.table.dataTable thead th.sorting_disabled:after,
#faqsTable.dataTable thead th.sorting_disabled:before,
#faqsTable.dataTable thead th.sorting_disabled:after {
    display: none;
    content: none;
}

#faqsTable.table.dataTable thead th.sorting:before,
#faqsTable.table.dataTable thead th.sorting_asc:before,
#faqsTable.table.dataTable thead th.sorting_desc:before,
#faqsTable.dataTable thead th.sorting:before,
#faqsTable.dataTable thead th.sorting_asc:before,
#faqsTable.dataTable thead th.sorting_desc:before {
    top: calc(50% - 6px);
    border-bottom: 6px solid #6EE7B7;
}

#faqsTable.table.dataTable thead th.sorting:after,
#faqsTable.table.dataTable thead th.sorting_asc:after,
#faqsTable.table.dataTable thead th.sorting_desc:after,
#faqsTable.dataTable thead th.sorting:after,
#faqsTable.dataTable thead th.sorting_asc:after,
#faqsTable.dataTable thead th.sorting_desc:after {
    top: calc(50% + 6px);
    border-top: 6px solid #6EE7B7;
}

#faqsTable.table.dataTable thead th.sorting_asc:before,
#faqsTable.dataTable thead th.sorting_asc:before {
    border-bottom-color: #16A34A;
    opacity: 1;
}

#faqsTable.table.dataTable thead th.sorting_desc:after,
#faqsTable.dataTable thead th.sorting_desc:after {
    border-top-color: #16A34A;
    opacity: 1;
}

.document-templates-table thead th {
    position: relative;
    border-top: 2px solid #BBF7D0;
    border-bottom: 3px solid #16A34A;
    border-right: 1px solid #E5E7EB;
}

.document-templates-table thead th:last-child {
    border-right: none;
}

.document-templates-table table.dataTable thead th.sorting,
.document-templates-table table.dataTable thead th.sorting_asc,
.document-templates-table table.dataTable thead th.sorting_desc {
    position: relative;
    padding-right: 32px;
    cursor: pointer;
}

.document-templates-table table.dataTable thead th.sorting_disabled {
    padding-right: 16px;
}

.document-templates-table table.dataTable thead th.sorting:before,
.document-templates-table table.dataTable thead th.sorting_asc:before,
.document-templates-table table.dataTable thead th.sorting_desc:before,
.document-templates-table table.dataTable thead th.sorting:after,
.document-templates-table table.dataTable thead th.sorting_asc:after,
.document-templates-table table.dataTable thead th.sorting_desc:after {
    content: '';
    position: absolute;
    right: 12px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0.4;
    transform: translateY(-50%);
}

.document-templates-table table.dataTable thead th.sorting_disabled:before,
.document-templates-table table.dataTable thead th.sorting_disabled:after {
    display: none;
    content: none;
}

.document-templates-table table.dataTable thead th.sorting:before,
.document-templates-table table.dataTable thead th.sorting_asc:before,
.document-templates-table table.dataTable thead th.sorting_desc:before {
    top: calc(50% - 6px);
    border-bottom: 6px solid #6EE7B7;
}

.document-templates-table table.dataTable thead th.sorting:after,
.document-templates-table table.dataTable thead th.sorting_asc:after,
.document-templates-table table.dataTable thead th.sorting_desc:after {
    top: calc(50% + 6px);
    border-top: 6px solid #6EE7B7;
}

.document-templates-table table.dataTable thead th.sorting_asc:before {
    border-bottom-color: #16A34A;
    opacity: 1;
}

.document-templates-table table.dataTable thead th.sorting_desc:after {
    border-top-color: #16A34A;
    opacity: 1;
}

.file-attachments-table thead th {
    position: relative;
    border-top: 2px solid #BBF7D0;
    border-bottom: 3px solid #16A34A;
    border-right: 1px solid #E5E7EB;
}

.file-attachments-table thead th:last-child {
    border-right: none;
}

.file-attachments-table table.dataTable thead th.sorting,
.file-attachments-table table.dataTable thead th.sorting_asc,
.file-attachments-table table.dataTable thead th.sorting_desc {
    position: relative;
    padding-right: 32px;
    cursor: pointer;
}

.file-attachments-table table.dataTable thead th.sorting_disabled {
    padding-right: 16px;
}

.file-attachments-table table.dataTable thead th.sorting:before,
.file-attachments-table table.dataTable thead th.sorting_asc:before,
.file-attachments-table table.dataTable thead th.sorting_desc:before,
.file-attachments-table table.dataTable thead th.sorting:after,
.file-attachments-table table.dataTable thead th.sorting_asc:after,
.file-attachments-table table.dataTable thead th.sorting_desc:after {
    content: '';
    position: absolute;
    right: 12px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0.4;
    transform: translateY(-50%);
}

.file-attachments-table table.dataTable thead th.sorting_disabled:before,
.file-attachments-table table.dataTable thead th.sorting_disabled:after {
    display: none;
    content: none;
}

.file-attachments-table table.dataTable thead th.sorting:before,
.file-attachments-table table.dataTable thead th.sorting_asc:before,
.file-attachments-table table.dataTable thead th.sorting_desc:before {
    top: calc(50% - 6px);
    border-bottom: 6px solid #6EE7B7;
}

.file-attachments-table table.dataTable thead th.sorting:after,
.file-attachments-table table.dataTable thead th.sorting_asc:after,
.file-attachments-table table.dataTable thead th.sorting_desc:after {
    top: calc(50% + 6px);
    border-top: 6px solid #6EE7B7;
}

.file-attachments-table table.dataTable thead th.sorting_asc:before {
    border-bottom-color: #16A34A;
    opacity: 1;
}

.file-attachments-table table.dataTable thead th.sorting_desc:after {
    border-top-color: #16A34A;
    opacity: 1;
}
.clients-table thead th {
    position: relative;
    border-top: 2px solid #BBF7D0;
    border-bottom: 3px solid #16A34A;
    border-right: 1px solid #E5E7EB;
}

.clients-table thead th:last-child {
    border-right: none;
}

.clients-table table.dataTable thead th.sorting,
.clients-table table.dataTable thead th.sorting_asc,
.clients-table table.dataTable thead th.sorting_desc {
    position: relative;
    padding-right: 32px;
    cursor: pointer;
}

.clients-table table.dataTable thead th.sorting_disabled {
    padding-right: 16px;
}

.clients-table table.dataTable thead th.sorting:before,
.clients-table table.dataTable thead th.sorting_asc:before,
.clients-table table.dataTable thead th.sorting_desc:before,
.clients-table table.dataTable thead th.sorting:after,
.clients-table table.dataTable thead th.sorting_asc:after,
.clients-table table.dataTable thead th.sorting_desc:after {
    content: '';
    position: absolute;
    right: 12px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0.4;
    transform: translateY(-50%);
}

.clients-table table.dataTable thead th.sorting_disabled:before,
.clients-table table.dataTable thead th.sorting_disabled:after {
    display: none;
    content: none;
}

.clients-table table.dataTable thead th.sorting:before,
.clients-table table.dataTable thead th.sorting_asc:before,
.clients-table table.dataTable thead th.sorting_desc:before {
    top: calc(50% - 6px);
    border-bottom: 6px solid #6EE7B7;
}

.clients-table table.dataTable thead th.sorting:after,
.clients-table table.dataTable thead th.sorting_asc:after,
.clients-table table.dataTable thead th.sorting_desc:after {
    top: calc(50% + 6px);
    border-top: 6px solid #6EE7B7;
}

.clients-table table.dataTable thead th.sorting_asc:before {
    border-bottom-color: #16A34A;
    opacity: 1;
}

.clients-table table.dataTable thead th.sorting_desc:after {
    border-top-color: #16A34A;
    opacity: 1;
}




.clients-table th,
.users-table th,
.companies-table th {
    font-weight: bold;
    background: #FFFFFF;
    color: #475467;
}

.clients-table thead th,
.users-table thead th,
.companies-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #FFFFFF;
}

/* Desktop column widths - auto layout for better content fitting */
.clients-table th:nth-child(1),
.clients-table td:nth-child(1) {
    min-width: 180px;
    width: 180px;
}

.clients-table th:nth-child(2),
.clients-table td:nth-child(2) {
    min-width: 150px;
    width: 150px;
}

.clients-table th:nth-child(3),
.clients-table td:nth-child(3) {
    min-width: 120px;
    width: 120px;
}

.clients-table th:nth-child(4),
.clients-table td:nth-child(4) {
    min-width: 120px;
    width: 120px;
}

.clients-table th:nth-child(5),
.clients-table td:nth-child(5) {
    min-width: 150px;
    width: 150px;
}

/* Client Modal Header Styles */
.modal-header h2 {
    color: white !important;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-header-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.modal-header-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-header-close svg {
    color: white;
    stroke: white;
}

/* Responsive styles for clients table */
@media (max-width: 1023px) {
    .clients-container {
        margin: 0 8px;
    }

    .clients-table th,
    .clients-table td {
        word-break: break-word;
        hyphens: auto;
    }

    .clients-table th:nth-child(1),
    .clients-table td:nth-child(1) { min-width: 160px; width: 160px; }
    .clients-table th:nth-child(2),
    .clients-table td:nth-child(2) { min-width: 130px; width: 130px; }
    .clients-table th:nth-child(3),
    .clients-table td:nth-child(3) { min-width: 100px; width: 100px; }
    .clients-table th:nth-child(4),
    .clients-table td:nth-child(4) { min-width: 100px; width: 100px; }
    .clients-table th:nth-child(5),
    .clients-table td:nth-child(5) { min-width: 130px; width: 130px; }

    /* Ensure DataTable controls are visible */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        margin: 8px 0;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .clients-container,
    .users-container,
    .companies-container,
    .document-templates-container,
    .file-attachments-container {
        margin: 0 4px;
        border-radius: 8px;
    }

    .clients-table,
    .users-table,
    .companies-table,
    .document-templates-table,
    .file-attachments-table {
        margin: 0 12px 8px 12px;
    }
    .clients-table table,
    .users-table table,
    .companies-table table,
    .document-templates-table table {
        min-width: 800px;
    }
    .clients-table th,
    .clients-table td,
    .users-table th,
    .users-table td,
    .companies-table th,
    .companies-table td,
    .document-templates-table th,
    .document-templates-table td {
        padding: 8px 4px;
        font-size: 0.85em;
    }
    .clients-table th:nth-child(1),
    .clients-table td:nth-child(1) { min-width: 140px; width: 140px; }
    .clients-table th:nth-child(2),
    .clients-table td:nth-child(2) { min-width: 110px; width: 110px; }
    .clients-table th:nth-child(3),
    .clients-table td:nth-child(3) { min-width: 90px; width: 90px; }
    .clients-table th:nth-child(4),
    .clients-table td:nth-child(4) { min-width: 90px; width: 90px; }
    .clients-table th:nth-child(5),
    .clients-table td:nth-child(5) { min-width: 110px; width: 110px; }

    /* Users table column widths */
    .users-table th:nth-child(1),
    .users-table td:nth-child(1) { min-width: 50px; width: 50px; }
    .users-table th:nth-child(2),
    .users-table td:nth-child(2) { min-width: 120px; width: 120px; }
    .users-table th:nth-child(3),
    .users-table td:nth-child(3) { min-width: 150px; width: 150px; }
    .users-table th:nth-child(4),
    .users-table td:nth-child(4) { min-width: 100px; width: 100px; }
    .users-table th:nth-child(5),
    .users-table td:nth-child(5) { min-width: 120px; width: 120px; }
    .users-table th:nth-child(6),
    .users-table td:nth-child(6) { min-width: 100px; width: 100px; }
    .users-table th:nth-child(7),
    .users-table td:nth-child(7) { min-width: 80px; width: 80px; }
    .users-table th:nth-child(8),
    .users-table td:nth-child(8) { min-width: 90px; width: 90px; }
    /* Archived Users table - 9th column (Archived date) */
    .users-table th:nth-child(9),
    .users-table td:nth-child(9) { min-width: 90px; width: 90px; }

    /* Companies table column widths */
    .companies-table th:nth-child(1),
    .companies-table td:nth-child(1) { min-width: 50px; width: 50px; }
    .companies-table th:nth-child(2),
    .companies-table td:nth-child(2) { min-width: 80px; width: 80px; }
    .companies-table th:nth-child(3),
    .companies-table td:nth-child(3) { min-width: 150px; width: 150px; }
    .companies-table th:nth-child(4),
    .companies-table td:nth-child(4) { min-width: 100px; width: 100px; }
    .companies-table th:nth-child(5),
    .companies-table td:nth-child(5) { min-width: 90px; width: 90px; }

    /* Document Templates table column widths */
    .document-templates-table th:nth-child(1),
    .document-templates-table td:nth-child(1) { min-width: 50px; width: 50px; }
    .document-templates-table th:nth-child(2),
    .document-templates-table td:nth-child(2) { min-width: 200px; width: 200px; }
    .document-templates-table th:nth-child(3),
    .document-templates-table td:nth-child(3) { min-width: 120px; width: 120px; }
    .document-templates-table th:nth-child(4),
    .document-templates-table td:nth-child(4) { min-width: 100px; width: 100px; }
    .document-templates-table th:nth-child(5),
    .document-templates-table td:nth-child(5) { min-width: 100px; width: 100px; }

    /* DataTable controls for tablet */
    .dataTables_wrapper {
        margin: 0 16px;
    }

    .dataTables_wrapper .dataTables-top,
    .dataTables_wrapper .dataTables-bottom {
        padding: 0 4px;
        margin-bottom: 12px;
        margin-top: 12px;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        margin: 6px 0;
        font-size: 13px;
        padding: 8px 0;
    }

    .dataTables_wrapper .dataTables_length select,
    .dataTables_wrapper .dataTables_filter input {
        font-size: 13px;
        padding: 4px 6px;
        min-width: 150px;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        margin: 6px 0;
        font-size: 12px;
        padding: 8px 0;
    }

    /* Action buttons for tablet - side by side */
    .action-buttons {
        flex-direction: row;
        gap: 6px;
        justify-content: flex-start;
    }

    .action-buttons .btn-edit,
    .action-buttons .btn-archive,
    .action-buttons .btn-print,
    .action-buttons .btn-delete,
    .action-buttons .btn-pdf,
    .action-buttons .btn-download,
    .action-buttons .btn-reopen {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .clients-container,
    .users-container,
    .companies-container,
    .document-templates-container {
        margin: 0 2px;
        border-radius: 6px;
        padding: 12px 0 6px 0;
    }

    .card-title {
        margin: 0 16px 8px 16px;
        font-size: 14px;
    }

    .clients-table,
    .users-table,
    .companies-table,
    .document-templates-table {
        margin: 0 8px 6px 8px;
    }
    .clients-table table,
    .users-table table,
    .companies-table table,
    .document-templates-table table {
        min-width: 800px;
    }
    .clients-table th,
    .clients-table td,
    .users-table th,
    .users-table td,
    .companies-table th,
    .companies-table td,
    .document-templates-table th,
    .document-templates-table td {
        padding: 6px 3px;
        font-size: 0.8em;
    }
    .clients-table th:nth-child(1),
    .clients-table td:nth-child(1) { min-width: 120px; width: 120px; }
    .clients-table th:nth-child(2),
    .clients-table td:nth-child(2) { min-width: 90px; width: 90px; }
    .clients-table th:nth-child(3),
    .clients-table td:nth-child(3) { min-width: 80px; width: 80px; }
    .clients-table th:nth-child(4),
    .clients-table td:nth-child(4) { min-width: 80px; width: 80px; }
    .clients-table th:nth-child(5),
    .clients-table td:nth-child(5) { min-width: 90px; width: 90px; }

    /* Users table mobile column widths */
    .users-table th:nth-child(1),
    .users-table td:nth-child(1) { min-width: 40px; width: 40px; }
    .users-table th:nth-child(2),
    .users-table td:nth-child(2) { min-width: 100px; width: 100px; }
    .users-table th:nth-child(3),
    .users-table td:nth-child(3) { min-width: 120px; width: 120px; }
    .users-table th:nth-child(4),
    .users-table td:nth-child(4) { min-width: 80px; width: 80px; }
    .users-table th:nth-child(5),
    .users-table td:nth-child(5) { min-width: 100px; width: 100px; }
    .users-table th:nth-child(6),
    .users-table td:nth-child(6) { min-width: 80px; width: 80px; }
    .users-table th:nth-child(7),
    .users-table td:nth-child(7) { min-width: 60px; width: 60px; }
    .users-table th:nth-child(8),
    .users-table td:nth-child(8) { min-width: 70px; width: 70px; }
    /* Archived Users table - 9th column (Archived date) */
    .users-table th:nth-child(9),
    .users-table td:nth-child(9) { min-width: 70px; width: 70px; }

    /* Companies table mobile column widths */
    .companies-table th:nth-child(1),
    .companies-table td:nth-child(1) { min-width: 40px; width: 40px; }
    .companies-table th:nth-child(2),
    .companies-table td:nth-child(2) { min-width: 60px; width: 60px; }
    .companies-table th:nth-child(3),
    .companies-table td:nth-child(3) { min-width: 120px; width: 120px; }
    .companies-table th:nth-child(4),
    .companies-table td:nth-child(4) { min-width: 80px; width: 80px; }
    .companies-table th:nth-child(5),
    .companies-table td:nth-child(5) { min-width: 70px; width: 70px; }

    /* Document Templates table mobile column widths */
    .document-templates-table th:nth-child(1),
    .document-templates-table td:nth-child(1) { min-width: 40px; width: 40px; }
    .document-templates-table th:nth-child(2),
    .document-templates-table td:nth-child(2) { min-width: 150px; width: 150px; }
    .document-templates-table th:nth-child(3),
    .document-templates-table td:nth-child(3) { min-width: 100px; width: 100px; }
    .document-templates-table th:nth-child(4),
    .document-templates-table td:nth-child(4) { min-width: 80px; width: 80px; }
    .document-templates-table th:nth-child(5),
    .document-templates-table td:nth-child(5) { min-width: 80px; width: 80px; }

    /* DataTable controls for mobile */
    .dataTables_wrapper {
        margin: 0 12px;
    }

    .dataTables_wrapper .dataTables-top,
    .dataTables_wrapper .dataTables-bottom {
        padding: 0 2px;
        margin-bottom: 8px;
        margin-top: 8px;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        margin: 4px 0;
        font-size: 12px;
        padding: 6px 0;
    }

    .dataTables_wrapper .dataTables_length select,
    .dataTables_wrapper .dataTables_filter input {
        font-size: 12px;
        padding: 3px 4px;
        min-height: 28px;
        min-width: 120px;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        margin: 4px 0;
        font-size: 11px;
        padding: 6px 0;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.3em 0.6em;
        font-size: 11px;
    }

    /* Action buttons responsive - keep side by side on mobile */
    .action-buttons {
        flex-direction: row;
        gap: 4px;
        justify-content: flex-start;
    }

    .action-buttons .btn-edit,
    .action-buttons .btn-archive,
    .action-buttons .btn-print,
    .action-buttons .btn-delete,
    .action-buttons .btn-pdf,
    .action-buttons .btn-download,
    .action-buttons .btn-reopen {
        padding: 4px 8px;
        font-size: 11px;
        flex: 1;
        min-width: 0;
    }

    .action-buttons .btn-edit span,
    .action-buttons .btn-archive span,
    .action-buttons .btn-print span,
    .action-buttons .btn-delete span,
    .action-buttons .btn-pdf span,
    .action-buttons .btn-download span {
        display: none;
    }
}

/* Extra small screens (320px and below) */
@media (max-width: 320px) {
    .clients-container,
    .users-container,
    .companies-container,
    .document-templates-container {
        margin: 0 1px;
        padding: 8px 0 4px 0;
    }

    .card-title {
        margin: 0 12px 6px 12px;
        font-size: 13px;
    }

    .clients-table,
    .users-table,
    .companies-table,
    .document-templates-table {
        margin: 0 6px 4px 6px;
    }

    .clients-table th,
    .clients-table td,
    .users-table th,
    .users-table td,
    .companies-table th,
    .companies-table td,
    .document-templates-table th,
    .document-templates-table td {
        padding: 4px 2px;
        font-size: 0.75em;
    }

    .clients-table th:nth-child(1),
    .clients-table td:nth-child(1) { min-width: 100px; width: 100px; }
    .clients-table th:nth-child(2),
    .clients-table td:nth-child(2) { min-width: 80px; width: 80px; }
    .clients-table th:nth-child(3),
    .clients-table td:nth-child(3) { min-width: 70px; width: 70px; }
    .clients-table th:nth-child(4),
    .clients-table td:nth-child(4) { min-width: 70px; width: 70px; }
    .clients-table th:nth-child(5),
    .clients-table td:nth-child(5) { min-width: 80px; width: 80px; }

    /* Users table extra small column widths */
    .users-table th:nth-child(1),
    .users-table td:nth-child(1) { min-width: 35px; width: 35px; }
    .users-table th:nth-child(2),
    .users-table td:nth-child(2) { min-width: 80px; width: 80px; }
    .users-table th:nth-child(3),
    .users-table td:nth-child(3) { min-width: 100px; width: 100px; }
    .users-table th:nth-child(4),
    .users-table td:nth-child(4) { min-width: 70px; width: 70px; }
    .users-table th:nth-child(5),
    .users-table td:nth-child(5) { min-width: 80px; width: 80px; }
    .users-table th:nth-child(6),
    .users-table td:nth-child(6) { min-width: 70px; width: 70px; }
    .users-table th:nth-child(7),
    .users-table td:nth-child(7) { min-width: 50px; width: 50px; }
    .users-table th:nth-child(8),
    .users-table td:nth-child(8) { min-width: 60px; width: 60px; }
    /* Archived Users table - 9th column (Archived date) */
    .users-table th:nth-child(9),
    .users-table td:nth-child(9) { min-width: 60px; width: 60px; }

    /* Companies table extra small column widths */
    .companies-table th:nth-child(1),
    .companies-table td:nth-child(1) { min-width: 35px; width: 35px; }
    .companies-table th:nth-child(2),
    .companies-table td:nth-child(2) { min-width: 50px; width: 50px; }
    .companies-table th:nth-child(3),
    .companies-table td:nth-child(3) { min-width: 100px; width: 100px; }
    .companies-table th:nth-child(4),
    .companies-table td:nth-child(4) { min-width: 70px; width: 70px; }
    .companies-table th:nth-child(5),
    .companies-table td:nth-child(5) { min-width: 60px; width: 60px; }

    /* Document Templates table extra small column widths */
    .document-templates-table th:nth-child(1),
    .document-templates-table td:nth-child(1) { min-width: 35px; width: 35px; }
    .document-templates-table th:nth-child(2),
    .document-templates-table td:nth-child(2) { min-width: 120px; width: 120px; }
    .document-templates-table th:nth-child(3),
    .document-templates-table td:nth-child(3) { min-width: 80px; width: 80px; }
    .document-templates-table th:nth-child(4),
    .document-templates-table td:nth-child(4) { min-width: 70px; width: 70px; }
    .document-templates-table th:nth-child(5),
    .document-templates-table td:nth-child(5) { min-width: 70px; width: 70px; }

    /* DataTable controls for extra small screens */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        font-size: 11px;
    }

    .dataTables_wrapper .dataTables_length select,
    .dataTables_wrapper .dataTables_filter input {
        font-size: 11px;
        padding: 2px 3px;
        min-height: 24px;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        font-size: 10px;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.2em 0.4em;
        font-size: 10px;
    }
}

/* Ensure page layout is responsive */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 0 16px;
    }

    .page-header-actions {
        width: 100%;
    }

    .filters-section {
        margin: 0 16px;
    }

    .filters-row {
        flex-direction: column;
        gap: 8px;
    }

    .filter-group {
        width: 100%;
    }

    .filter-actions {
        width: 100%;
        justify-content: center;
    }
}

/* Screen reader only class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Client Modal Form Validation Styles */
.modal-form-input.error,
.modal-form-select.error,
.modal-form-textarea.error {
    border-color: #DC2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

.error-message {
    color: #DC2626;
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.error-message:empty {
    display: none !important;
}

/* Override for login page - ensure errors are visible when they have content */
.login-page .error-message:not(:empty) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  overflow: visible !important;
}

.error-message:not(:empty)::before {
    content: "⚠";
    font-size: 14px;
}

/* Force hide empty error messages with JavaScript */
.error-message[style*="display: none"] {
    display: none !important;
}

.error-message[style*="display: none"]::before {
    display: none !important;
}

/* Autofill detection animations */
@keyframes onAutoFillStart {
    from { /**/ }
    to { /**/ }
}

@keyframes onAutoFillCancel {
    from { /**/ }
    to { /**/ }
}

/* Apply animations to form inputs for autofill detection */
.form-input:-webkit-autofill {
    animation-name: onAutoFillStart;
    animation-duration: 0.001s;
}

.form-input:not(:-webkit-autofill) {
    animation-name: onAutoFillCancel;
    animation-duration: 0.001s;
}

/* Action Buttons Styling */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
}

.action-buttons .btn-edit,
.action-buttons .btn-archive,
.action-buttons .btn-print,
.action-buttons .btn-delete,
.action-buttons .btn-pdf,
.action-buttons .btn-download,
.action-buttons .btn-view,
.action-buttons .btn-reopen {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.2;
}


.action-buttons .btn-edit {
    background-color: #10B981;
    color: white;
}

.action-buttons .btn-edit:hover {
    background-color: #059669;
}

.action-buttons .btn-archive {
    background-color: #DC2626;
    color: white;
}

.action-buttons .btn-archive:hover {
    background-color: #B91C1C;
}

.action-buttons .btn-edit svg,
.action-buttons .btn-archive svg,
.action-buttons .btn-print svg,
.action-buttons .btn-delete svg,
.action-buttons .btn-pdf svg,
.action-buttons .btn-download svg,
.action-buttons .btn-view svg,
.action-buttons .btn-reopen svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}


.action-buttons .btn-print,
.action-buttons .btn-pdf {
    background-color: #6B7280;
    color: white;
}

.action-buttons .btn-print:hover,
.action-buttons .btn-pdf:hover {
    background-color: #4B5563;
}

.action-buttons .btn-delete {
    background-color: #EF4444;
    color: white;
}

.action-buttons .btn-delete:hover {
    background-color: #DC2626;
}

.action-buttons .btn-download {
    background-color: #10B981;
    color: white;
}

.action-buttons .btn-download:hover {
    background-color: #059669;
}

.action-buttons .btn-reopen {
    background-color: #3B82F6;
    color: white;
}

.action-buttons .btn-reopen:hover {
    background-color: #2563EB;
}

/* Ensure action column has enough space */
.submissions-table th.action-column,
.submissions-table td.action-column,
.submissions-table th:last-child,
.submissions-table td:last-child {
  width: auto !important;
  min-width: 200px !important;
  white-space: normal !important;
  overflow: visible !important;
  padding: 12px 10px !important;
  vertical-align: top;
}

/* Tablet Action Buttons - Show only icons (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .submissions-table td:last-child .action-buttons .btn-edit span,
    .submissions-table td:last-child .action-buttons .btn-archive span,
    .submissions-table td:last-child .action-buttons .btn-print span,
    .submissions-table td:last-child .action-buttons .btn-delete span,
    .submissions-table td:last-child .action-buttons .btn-pdf span,
    .submissions-table td:last-child .action-buttons .btn-download span,
    .submissions-table td:last-child .action-buttons .btn-view span,
    .submissions-table td:last-child .action-buttons .btn-reopen span {
        display: none !important;
    }

    .submissions-table td:last-child .action-buttons .btn-edit,
    .submissions-table td:last-child .action-buttons .btn-archive,
    .submissions-table td:last-child .action-buttons .btn-print,
    .submissions-table td:last-child .action-buttons .btn-delete,
    .submissions-table td:last-child .action-buttons .btn-pdf,
    .submissions-table td:last-child .action-buttons .btn-download,
    .submissions-table td:last-child .action-buttons .btn-view,
    .submissions-table td:last-child .action-buttons .btn-reopen {
        padding: 6px 10px !important;
        justify-content: center !important;
        min-width: 36px !important;
    }
}

/* Responsive Action Buttons */
@media (max-width: 768px) {
    .action-buttons {
        flex-direction: row;
        gap: 6px;
        justify-content: flex-start;
    }

    .action-buttons .btn-edit,
    .action-buttons .btn-archive,
    .action-buttons .btn-print,
    .action-buttons .btn-delete,
    .action-buttons .btn-pdf,
    .action-buttons .btn-download,
    .action-buttons .btn-view,
    .action-buttons .btn-reopen {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }

}

@media (max-width: 480px) {
    .action-buttons {
        flex-direction: row;
        gap: 4px;
        justify-content: flex-start;
    }

    .action-buttons .btn-edit span,
    .action-buttons .btn-archive span,
    .action-buttons .btn-print span,
    .action-buttons .btn-delete span,
    .action-buttons .btn-pdf span,
    .action-buttons .btn-download span,
    .action-buttons .btn-view span,
    .action-buttons .btn-reopen span {
        display: none;
    }

    .action-buttons .btn-edit,
    .action-buttons .btn-archive,
    .action-buttons .btn-print,
    .action-buttons .btn-delete,
    .action-buttons .btn-pdf,
    .action-buttons .btn-download,
    .action-buttons .btn-view,
    .action-buttons .btn-reopen {
        padding: 4px 8px;
        flex: 1;
        min-width: 0;
    }
}

/* Email Template Edit Page Styles */
.email-template-edit-container {
    display: flex;
    gap: 24px;
    margin: 24px;
}

.email-template-form {
    flex: 2;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    border: 1px solid #EAECF0;
    padding: 24px;
}

.merge-fields-panel {
    flex: 1;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    border: 1px solid #EAECF0;
    height: fit-content;
}

.merge-fields-header {
    background: #10B981;
    color: white;
    padding: 16px 20px;
    border-radius: 12px 12px 0 0;
}

.merge-fields-header h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.merge-fields-header p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.merge-fields-table {
    padding: 20px;
}

.merge-fields-table table {
    width: 100%;
    border-collapse: collapse;
}

.merge-fields-table th,
.merge-fields-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #EAECF0;
    font-size: 14px;
}

.merge-fields-table th {
    background: #F9FAFB;
    font-weight: 600;
    color: #374151;
}

.merge-fields-table td:first-child {
    font-family: 'Courier New', monospace;
    background: #F3F4F6;
    color: #1F2937;
    font-weight: 500;
}

.merge-fields-table code {
    background: #F3F4F6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #1F2937;
}

/* Responsive Email Template Edit */
@media (max-width: 1024px) {
    .email-template-edit-container {
        flex-direction: column;
        gap: 16px;
        margin: 16px;
    }

    .email-template-form {
        flex: none;
    }

    .merge-fields-panel {
        flex: none;
    }
}

@media (max-width: 768px) {
    .email-template-edit-container {
        margin: 8px;
        gap: 12px;
    }

    .email-template-form {
        padding: 16px;
    }

    .merge-fields-header {
        padding: 12px 16px;
    }

    .merge-fields-table {
        padding: 16px;
    }

    .merge-fields-table th,
    .merge-fields-table td {
        padding: 6px 8px;
        font-size: 13px;
    }
}

/* Responsive Notification Styles */
@media (max-width: 640px) {
    .notification-container {
        left: 16px;
        right: 16px;
        max-width: calc(100% - 32px);
    }
}

/* File Attachments Styles */
.file-preview-container {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 16px;
    background: #F9FAFB;
    border-radius: 8px;
    border: 1px solid #EAECF0;
}

.file-preview-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #EAECF0;
}

.file-preview-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    border-radius: 8px;
    border: 1px solid #EAECF0;
    color: #6B7280;
}

.file-info {
    flex: 1;
}

.file-name {
    margin: 0 0 4px 0;
    font-weight: 600;
    color: #1F2937;
    font-size: 14px;
}

.file-size {
    margin: 0 0 8px 0;
    color: #6B7280;
    font-size: 12px;
}

.file-download-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #10B981;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.file-download-link:hover {
    color: #059669;
}

.form-help {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #6B7280;
}

/* Action Buttons - View and Download */
.btn-view {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    background-color: #3B82F6;
    color: white;
    transition: background-color 0.2s ease;
}

.btn-view:hover {
    background-color: #2563EB;
}

.action-buttons .btn-view {
    background-color: #3B82F6;
    color: white;
}

.action-buttons .btn-view:hover {
    background-color: #2563EB;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    background-color: #10B981;
    color: white;
    transition: background-color 0.2s ease;
}

.btn-download:hover {
    background-color: #059669;
}

.btn-view svg,
.btn-download svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-print {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    background-color: #6B7280;
    color: white;
    transition: background-color 0.2s ease;
}

.btn-print:hover {
    background-color: #4B5563;
}

.btn-delete {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    background-color: #EF4444;
    color: white;
    transition: background-color 0.2s ease;
}

.btn-delete:hover {
    background-color: #DC2626;
}

.btn-print svg,
.btn-delete svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-pdf {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    background-color: #6B7280;
    color: white;
    transition: background-color 0.2s ease;
}

.btn-pdf:hover {
    background-color: #4B5563;
}

.btn-pdf svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Responsive Table Styles */
@media (max-width: 1024px) {
    .filters-row {
        grid-template-columns: 1fr 1fr;
    }

    /* Tablet table actions and pagination */
    .table-actions {
        padding: 0 16px;
    }

    .dataTables_wrapper .dataTables_paginate {
        padding: 12px 16px;
    }

    .dataTables_wrapper .dataTables_info {
        padding: 8px 16px;
    }

    /* Tablet page header content */
    .page-header-content {
        padding: 0 16px;
    }

    .page-header-actions {
        padding: 0 16px;
    }

    /* Tablet DataTables - Proper layout fix */
    .dataTables_wrapper .row {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .dataTables_wrapper .col-sm-6 {
        width: 100% !important;
        text-align: center !important;
        float: none !important;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none !important;
        text-align: center !important;
        width: 100% !important;
        margin: 0 !important;
    }
}

@media (max-width: 768px) {
    .filters-section {
        padding: 16px;
        border-radius: 8px;
    }

    .filters-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .table-container {
        border-radius: 8px;
        margin: 0 12px;
    }

    .table-header {
        padding: 16px;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .table-header h2 {
        font-size: 1rem;
    }

    .data-table thead th {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .data-table tbody td {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .actions-container {
        gap: 2px;
    }

    .btn-edit,
    .btn-archive,
    .btn-restore {
        padding: 4px 8px;
        font-size: 0.7rem;
        border-radius: 16px;
    }

    .btn-cancel {
        border-radius: 20px;
    }

    .status-badge,
    .access-badge {
        padding: 3px 6px;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .filters-section {
        padding: 12px;
        border-radius: 6px;
    }

    .filters-row {
        gap: 8px;
    }

    .filter-label {
        font-size: 0.8rem;
    }

    .filter-select {
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .table-container {
        border-radius: 6px;
        margin: 0 8px;
    }

    .table-header {
        padding: 12px;
    }

    .table-header h2 {
        font-size: 0.9rem;
    }

    .data-table thead th {
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    .data-table tbody td {
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    .actions-container {
        gap: 1px;
    }

    .btn-edit,
    .btn-archive,
    .btn-restore {
        padding: 3px 6px;
        font-size: 0.65rem;
        border-radius: 12px;
    }

    .btn-cancel {
        border-radius: 20px;
    }

    .status-badge,
    .access-badge {
        padding: 2px 4px;
        font-size: 0.65rem;
    }
}

/* Welcome logos using icon sprites (from icons folder) */
.welcome-logos-row { display:flex; align-items:center; gap:18px; margin-bottom: 12px; }
.logo-sprite { display:inline-block; background-repeat:no-repeat; background-position:center; background-size:contain; height:42px; }
.logo-sport { width: 190px; background-image: url('assets/logo/sport-england.png'); }
.logo-uk-sport { width: 150px; background-image: url('assets/logo/uk-sport.png'); }
.logo-sport-wales { width: 150px; background-image: url('assets/logo/sport-wales.png'); filter: brightness(0) saturate(100%) invert(27%) sepia(8%) saturate(1000%) hue-rotate(169deg) brightness(95%) contrast(89%); }
.logo-act { width: 220px; background-image: url('assets/logo/green-logo.png'); height: 28px; }
.submissions-table {
  /* margin: 0 24px 8px 24px; */
  overflow-x: auto;
  overflow-y: hidden;
  width: calc(100% - 48px);
  max-width: 100%;
}

/* Ensure table can scroll horizontally */
.submissions-table table {
  width: 100%;
  table-layout: auto;
  min-width: 800px;
}

/* DataTables scroll wrapper adjustments */
.submissions-table .dataTables_wrapper {
  overflow-x: auto;
}

.dataTables_scrollBody {
  overflow-x: auto !important;
}

/* Custom scrollbar styling for better UX */
.submissions-table::-webkit-scrollbar {
  height: 8px;
}

.submissions-table::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.submissions-table::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.submissions-table::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
.submissions-table table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  background: #fff;
  border-radius: 12px;
  overflow: visible;
  table-layout: auto;
  max-width: 100%;
}

/* Modern flexible column approach */
.submissions-table thead th,
.submissions-table tbody td {
  box-sizing: border-box;
}
.submissions-table th,
.submissions-table td {
  padding: 12px 8px;
  text-align: left;
  font-size: 0.95em;
  border-bottom: 1px solid #EAEAEA;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

/* Striped table rows - odd/even highlighting for DataTable listing tables only */
/* Only apply to tables that are DataTables (have dataTable class) or are in listing containers */
.data-table tbody tr:nth-child(odd),
.data-table tbody tr.odd,
.data-table table.dataTable tbody tr:nth-child(odd),
.data-table table.dataTable tbody tr.odd,
.submissions-table tbody tr:nth-child(odd),
.submissions-table tbody tr.odd,
.submissions-table table.dataTable tbody tr:nth-child(odd),
.submissions-table table.dataTable tbody tr.odd,
.users-table tbody tr:nth-child(odd),
.users-table tbody tr.odd,
.users-table table.dataTable tbody tr:nth-child(odd),
.users-table table.dataTable tbody tr.odd,
.clients-table tbody tr:nth-child(odd),
.clients-table tbody tr.odd,
.clients-table table.dataTable tbody tr:nth-child(odd),
.clients-table table.dataTable tbody tr.odd,
.companies-table tbody tr:nth-child(odd),
.companies-table tbody tr.odd,
.companies-table table.dataTable tbody tr:nth-child(odd),
.companies-table table.dataTable tbody tr.odd,
.file-attachments-table tbody tr:nth-child(odd),
.file-attachments-table tbody tr.odd,
.file-attachments-table table.dataTable tbody tr:nth-child(odd),
.file-attachments-table table.dataTable tbody tr.odd,
.document-templates-table tbody tr:nth-child(odd),
.document-templates-table tbody tr.odd,
.document-templates-table table.dataTable tbody tr:nth-child(odd),
.document-templates-table table.dataTable tbody tr.odd,
.sections-table tbody tr:nth-child(odd),
.sections-table tbody tr.odd,
.sections-table table.dataTable tbody tr:nth-child(odd),
.sections-table table.dataTable tbody tr.odd,
/* Only apply to criteria-table when it contains a DataTable (listing pages) */
.criteria-table table.dataTable tbody tr:nth-child(odd),
.criteria-table table.dataTable tbody tr.odd,
.intros-table tbody tr:nth-child(odd),
.intros-table tbody tr.odd,
.intros-table table.dataTable tbody tr:nth-child(odd),
.intros-table table.dataTable tbody tr.odd {
  background-color: #FFFFFF;
}

.data-table tbody tr:nth-child(even),
.data-table tbody tr.even,
.data-table table.dataTable tbody tr:nth-child(even),
.data-table table.dataTable tbody tr.even,
.submissions-table tbody tr:nth-child(even),
.submissions-table tbody tr.even,
.submissions-table table.dataTable tbody tr:nth-child(even),
.submissions-table table.dataTable tbody tr.even,
.users-table tbody tr:nth-child(even),
.users-table tbody tr.even,
.users-table table.dataTable tbody tr:nth-child(even),
.users-table table.dataTable tbody tr.even,
.clients-table tbody tr:nth-child(even),
.clients-table tbody tr.even,
.clients-table table.dataTable tbody tr:nth-child(even),
.clients-table table.dataTable tbody tr.even,
.companies-table tbody tr:nth-child(even),
.companies-table tbody tr.even,
.companies-table table.dataTable tbody tr:nth-child(even),
.companies-table table.dataTable tbody tr.even,
.file-attachments-table tbody tr:nth-child(even),
.file-attachments-table tbody tr.even,
.file-attachments-table table.dataTable tbody tr:nth-child(even),
.file-attachments-table table.dataTable tbody tr.even,
.document-templates-table tbody tr:nth-child(even),
.document-templates-table tbody tr.even,
.document-templates-table table.dataTable tbody tr:nth-child(even),
.document-templates-table table.dataTable tbody tr.even,
.sections-table tbody tr:nth-child(even),
.sections-table tbody tr.even,
.sections-table table.dataTable tbody tr:nth-child(even),
.sections-table table.dataTable tbody tr.even,
.criteria-table table.dataTable tbody tr:nth-child(even),
.criteria-table table.dataTable tbody tr.even,
.intros-table tbody tr:nth-child(even),
.intros-table tbody tr.even,
.intros-table table.dataTable tbody tr:nth-child(even),
.intros-table table.dataTable tbody tr.even {
  background-color: #F9FAFB;
}

.data-table tbody tr:hover,
.data-table table.dataTable tbody tr:hover,
.submissions-table tbody tr:hover,
.submissions-table table.dataTable tbody tr:hover,
.users-table tbody tr:hover,
.users-table table.dataTable tbody tr:hover,
.clients-table tbody tr:hover,
.clients-table table.dataTable tbody tr:hover,
.companies-table tbody tr:hover,
.companies-table table.dataTable tbody tr:hover,
.file-attachments-table tbody tr:hover,
.file-attachments-table table.dataTable tbody tr:hover,
.document-templates-table tbody tr:hover,
.document-templates-table table.dataTable tbody tr:hover,
.sections-table tbody tr:hover,
.sections-table table.dataTable tbody tr:hover,
.criteria-table table.dataTable tbody tr:hover,
.intros-table tbody tr:hover,
.intros-table table.dataTable tbody tr:hover {
  background-color: #F3F4F6 !important;
}

/* Modern flexible column approach */
.submissions-table th:not(.action-column),
.submissions-table td:not(.action-column) {
  width: auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Action column - always visible and properly sized */
.submissions-table th.action-column,
.submissions-table td.action-column,
.submissions-table th:last-child,
.submissions-table td:last-child {
  width: 220px !important;
  min-width: 220px !important;
  max-width: 220px !important;
  white-space: nowrap !important;
  overflow: visible !important;
}

/* Flexible approach - other columns use available space */
.submissions-table th:not(.action-column):not(:last-child):not(:first-child),
.submissions-table td:not(.action-column):not(:last-child):not(:first-child) {
  width: auto;
  max-width: 13%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Owner column (first column) - allow more space for names */
.submissions-table th:first-child,
.submissions-table td:first-child {
  width: auto;
  min-width: 150px;
  max-width: 20%;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* DataTables responsive styles */
.dataTables_wrapper {
  position: relative;
  clear: both;
  zoom: 1;
  padding: 0;
  margin: 0 20px;
}

/* DataTable top and bottom sections with proper spacing */
.dataTables_wrapper .dataTables-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 0 8px;
}

.dataTables_wrapper .dataTables-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding: 0 8px;
}

/* Ensure search and pagination have proper spacing */
.dataTables_wrapper .dataTables_filter {
  margin-left: auto;
  margin-right: 0;
}

.dataTables_wrapper .dataTables_paginate {
  margin-left: auto;
  margin-right: 0;
}

/* Ensure DataTable controls are not cut off */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  padding: 12px 0;
  margin: 0;
}

.dataTables_wrapper .dataTables_filter input {
  margin-left: 8px;
  padding: 6px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  min-width: 200px;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  padding: 12px 0;
  margin: 0;
}

.dataTables_wrapper .dataTables_paginate {
  text-align: right;
}

/* Submissions Module Styles */
.submissions-container {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  overflow: visible;
  /* margin: 0 16px; */
}

.submissions-table {
  padding: 0;
}

.submissions-table table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

.submissions-table th,
.submissions-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #E5E7EB;
}

.submissions-table th {
  background: #F9FAFB;
  font-weight: 600;
  color: #374151;
  font-size: 14px;
  border-top: 2px solid #BBF7D0;
  border-bottom: 3px solid #16A34A;
}

.submissions-table td {
  font-size: 14px;
  color: #6B7280;
}

.submissions-table table.dataTable thead th.sorting,
.submissions-table table.dataTable thead th.sorting_asc,
.submissions-table table.dataTable thead th.sorting_desc {
  position: relative;
  padding-right: 32px;
  cursor: pointer;
}

.submissions-table table.dataTable thead th.sorting_disabled {
  padding-right: 16px;
}

.submissions-table table.dataTable thead th.sorting:before,
.submissions-table table.dataTable thead th.sorting_asc:before,
.submissions-table table.dataTable thead th.sorting_desc:before,
.submissions-table table.dataTable thead th.sorting:after,
.submissions-table table.dataTable thead th.sorting_asc:after,
.submissions-table table.dataTable thead th.sorting_desc:after {
  content: '';
  position: absolute;
  right: 12px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  opacity: 0.4;
  transform: translateY(-50%);
}

.submissions-table table.dataTable thead th.sorting_disabled:before,
.submissions-table table.dataTable thead th.sorting_disabled:after {
  display: none;
  content: none;
}

.submissions-table table.dataTable thead th.sorting:before,
.submissions-table table.dataTable thead th.sorting_asc:before,
.submissions-table table.dataTable thead th.sorting_desc:before {
  top: calc(50% - 6px);
  border-bottom: 6px solid #6EE7B7;
}

.submissions-table table.dataTable thead th.sorting:after,
.submissions-table table.dataTable thead th.sorting_asc:after,
.submissions-table table.dataTable thead th.sorting_desc:after {
  top: calc(50% + 6px);
  border-top: 6px solid #6EE7B7;
}

.submissions-table table.dataTable thead th.sorting_asc:before {
  border-bottom-color: #16A34A;
  opacity: 1;
}

.submissions-table table.dataTable thead th.sorting_desc:after {
  border-top-color: #16A34A;
  opacity: 1;
}



/* User Avatar */
.user-avatar {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
}

.user-avatar svg {
  width: 24px;
  height: 24px;
  color: #6B7280;
}

.user-info {
  display: inline-block;
}

.user-name {
  font-weight: 500;
  color: #374151;
  display: block;
}

/* Archived user styling */
.user-name.archived-user,
.archived-user {
  color: #EF4444 !important;
  font-weight: 500;
  cursor: help;
  position: relative;
}

.user-name.archived-user:hover,
.archived-user:hover {
  color: #DC2626 !important;
  text-decoration: underline;
}

.reassign-wrapper {
  display: block;
  margin-top: 4px;
}

.reassign-link {
  color: #6B7280;
  font-size: 12px;
  text-decoration: none;
  display: inline-block;
}

.reassign-link:hover {
  color: #16A34A;
}

/* Progress Stepper */
.progress-stepper {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  margin: 0 16px 24px;
  padding: 24px;
}

.stepper-container {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0;
  width: 100%;
}

.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  padding: 0 4px;
}

.step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #F3F4F6;
  color: #6B7280;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  border: 2px solid #E5E7EB;
  transition: all 0.3s ease;
}

.stepper-step.current .step-circle {
  background: #16A34A;
  color: white;
  border-color: #16A34A;
}

.stepper-step.completed .step-circle {
  background: #16A34A;
  color: white;
  border-color: #16A34A;
}

/* Make stepper steps clickable */
.stepper-step {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.stepper-step:hover {
  opacity: 0.8;
}

.stepper-step:hover .step-circle {
  transform: scale(1.05);
}

/* Make Submission step non-clickable */
.stepper-step[data-step="submission"] {
  cursor: default;
}

.stepper-step[data-step="submission"]:hover {
  opacity: 1;
}

.stepper-step[data-step="submission"]:hover .step-circle {
  transform: none;
}

.step-label {
  margin-top: 8px;
  font-size: 12px;
  color: #6B7280;
  text-align: center;
  max-width: 140px;
  line-height: 1.35;
  word-break: break-word;
  word-wrap: break-word;
  white-space: normal;
}

.stepper-line {
  flex: 1 1 0;
  max-width: 60px;
  height: 2px;
  background: #E5E7EB;
  margin: 0 8px;
  flex-shrink: 1;
  align-self: center;
}

.stepper-step.completed + .stepper-line {
  background: #16A34A;
}

/* Mobile Responsive Styles for Progress Stepper */
@media (max-width: 768px) {
  .progress-stepper {
    margin: 0 8px 16px;
    padding: 16px 8px;
  }

  .stepper-container {
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #D1D5DB transparent;
  }

  .stepper-container::-webkit-scrollbar {
    height: 4px;
  }

  .stepper-container::-webkit-scrollbar-track {
    background: transparent;
  }

  .stepper-container::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 2px;
  }

  .stepper-step {
    flex-shrink: 0;
    flex: 0 0 auto;
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 50px;
    padding-top: 0;
  }

  .step-circle {
    width: 24px;
    height: 24px;
    font-size: 11px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    top: 0;
    border-width: 1.5px;
  }

  .step-label {
    font-size: 9px;
    margin-top: 4px;
    text-align: center;
    line-height: 1.3;
    position: relative;
    top: 0;
    max-width: 70px;
    word-break: break-word;
    word-wrap: break-word;
    white-space: normal;
    overflow-wrap: break-word;
  }

  .stepper-line {
    display: block;
    width: 20px;
    height: 2px;
    background: #E5E7EB;
    margin: 0 4px;
    flex-shrink: 0;
    align-self: center;
  }

  .stepper-step.completed + .stepper-line {
    background: #16A34A;
  }
}

.sections-table thead th:nth-child(4),
.sections-table tbody td:nth-child(4) {
    width: 36%;
}
.sections-table thead th:nth-child(3),
.sections-table tbody td:nth-child(3) {
    width: 20%;
}
.sections-table thead th:nth-child(2),
.sections-table tbody td:nth-child(2) {
    width: 12%;
}
.sections-table thead th:nth-child(1),
.sections-table tbody td:nth-child(1) {
    width: 8%;
}
.sections-table thead th:nth-child(5),
.sections-table tbody td:nth-child(5) {
    width: 17%;
}

.criteria-table thead th:nth-child(1),
.criteria-table tbody td:nth-child(1) {
    width: 12%;
}

.criteria-table thead th:nth-child(2),
.criteria-table tbody td:nth-child(2) {
    width: 50%;
    white-space: normal;
    word-break: break-word;
}

.criteria-table thead th:nth-child(3),
.criteria-table tbody td:nth-child(3) {
    width: 18%;
}

.criteria-table thead th:nth-child(4),
.criteria-table tbody td:nth-child(4) {
    width: 20%;
}

.criteria-table th,
.criteria-table td {
    white-space: normal;
    overflow: visible;
}
/* Tablet Responsive Styles for Progress Stepper */
@media (min-width: 769px) and (max-width: 1024px) {
  .progress-stepper {
    margin: 0 12px 20px;
    padding: 20px 12px;
  }

  .stepper-container {
    gap: 6px;
  }

  .step-circle {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .step-label {
    font-size: 11px;
    margin-top: 6px;
    max-width: 120px;
    word-break: break-word;
    word-wrap: break-word;
    white-space: normal;
    overflow-wrap: break-word;
    line-height: 1.35;
  }

  .stepper-line {
    width: 30px;
    height: 2px;
    margin: 0 6px;
  }

  .stepper-step.completed + .stepper-line {
    background: #16A34A;
  }
}

/* Section Content */
.submission-content {
  margin: 0 16px;
}

.section-content {
  display: none;
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.section-content.active {
  display: block;
}

.section-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #E5E7EB;
}

.section-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 8px 0;
}

.section-description {
  color: #6B7280;
  margin: 0;
  line-height: 1.5;
}

/* Criteria Table */
.criteria-container {
  margin-top: 24px;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.criteria-container h3 {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 2px solid #E5E7EB;
}

.criteria-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.criteria-table th,
.criteria-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #E5E7EB;
}

.criteria-table th {
  background: #F9FAFB;
  font-weight: 600;
  color: #374151;
  font-size: 14px;
}

.criteria-table td {
  font-size: 14px;
  color: #6B7280;
  vertical-align: top;
}

.criteria-table td:first-child {
  font-weight: 500;
  color: #111827;
  width: 80px;
}

.criteria-table td:nth-child(2) {
  max-width: 300px;
  word-wrap: break-word;
}

/* Admin Section */
.admin-section {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 24px;
  margin-top: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.admin-section h3 {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 2px solid #E5E7EB;
}

.admin-section .form-group {
  margin-bottom: 20px;
  margin-top: 10px;
}

.admin-section .form-group:first-child {
  margin-top: 0;
}

.admin-section .form-group:last-of-type {
  margin-bottom: 0;
}

.btn-save-section {
  background: #16A34A;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s;
  margin-top: 16px;
}

.btn-save-section:hover {
  background: #15803D;
}

/* User Response */
.user-response p {
  margin: 0 0 8px 0;
  font-size: 13px;
}

.user-response p:last-child {
  margin-bottom: 0;
}

.user-response strong {
  color: #374151;
  font-weight: 500;
}

/* Overall Assessment */
.overall-assessment {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 24px;
  margin-top: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.overall-assessment h3 {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 2px solid #E5E7EB;
}

/* Navigation Buttons */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 16px;
  padding: 0 16px;
}

.btn-previous,
.btn-next {
  background: #16A34A;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-previous:disabled {
  background: #D1D5DB;
  color: #9CA3AF;
  cursor: not-allowed;
}

.btn-previous:not(:disabled):hover,
.btn-next:hover {
  background: #15803D;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #E5E7EB;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.close-modal {
  background: none;
  border: none;
  color: #6B7280;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

.close-modal:hover {
  color: #374151;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #E5E7EB;
}

/* Badge Styles */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  /* No visible borders in normal mode - accessibility provided by text labels and aria-labels */
}

.badge-success {
  background: #D1FAE5;
  color: #065F46;
}

.badge-warning {
  background: #FEF3C7;
  color: #92400E;
}

.badge-danger {
  background: #FEE2E2;
  color: #991B1B;
}

.badge-secondary {
  background: #F3F4F6;
  color: #374151;
}

/* Responsive Design */
@media (max-width: 768px) {
    .submissions-container,
    .progress-stepper,
    .submission-content,
    .overall-assessment {
        margin: 0 8px;
    }

    .stepper-container {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 8px;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #D1D5DB transparent;
        gap: 4px;
    }

    .stepper-container::-webkit-scrollbar {
        height: 4px;
    }

    .stepper-container::-webkit-scrollbar-track {
        background: transparent;
    }

    .stepper-container::-webkit-scrollbar-thumb {
        background: #D1D5DB;
        border-radius: 2px;
    }

    .stepper-step {
        flex-shrink: 0;
        flex: 0 0 auto;
        min-width: 60px;
    }

    .step-label {
        max-width: 70px;
        word-break: break-word;
        word-wrap: break-word;
        white-space: normal;
        overflow-wrap: break-word;
        line-height: 1.3;
    }

    .stepper-line {
        display: block;
        width: 20px;
        height: 2px;
        background: #E5E7EB;
        margin: 0 4px;
        flex-shrink: 0;
        align-self: center;
    }

    .stepper-step.completed + .stepper-line {
        background: #16A34A;
    }

    /* Criteria table wrapper for horizontal scrolling */
    .criteria-container {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        margin: 0 -8px;
        padding: 0 8px;
        width: 100%;
        max-width: 100%;
        position: relative;
    }

    .criteria-container::-webkit-scrollbar {
        height: 6px;
    }

    .criteria-container::-webkit-scrollbar-track {
        background: #F3F4F6;
        border-radius: 3px;
    }

    .criteria-container::-webkit-scrollbar-thumb {
        background: #D1D5DB;
        border-radius: 3px;
    }

    .criteria-container::-webkit-scrollbar-thumb:hover {
        background: #9CA3AF;
    }

    .criteria-table {
        font-size: 12px;
        min-width: 800px;
        width: 100%;
        table-layout: auto;
    }

    .criteria-table th,
    .criteria-table td {
        white-space: nowrap;
    }

    .criteria-table td:nth-child(2) {
        white-space: normal;
        word-wrap: break-word;
        max-width: 300px;
    }

    .criteria-table th,
    .criteria-table td {
        padding: 8px 12px;
    }

    .nav-buttons {
        flex-direction: column;
        gap: 12px;
        margin: 16px 8px;
    }

    .btn-previous,
    .btn-next {
        width: 100%;
        justify-content: center;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }
}

/* Tablet Responsive Design */
@media (min-width: 769px) and (max-width: 1024px) {
    .stepper-container {
        gap: 6px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .stepper-step {
        flex-shrink: 0;
    }

    .step-circle {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }

    .step-label {
        font-size: 11px;
        line-height: 1.35;
        white-space: normal;
        word-break: break-word;
        word-wrap: break-word;
    }

    .stepper-line {
        width: 30px;
        margin: 0 6px;
    }

    /* Criteria table wrapper for horizontal scrolling on tablet */
    .criteria-container {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
        width: 100%;
        max-width: 100%;
        position: relative;
    }

    .criteria-container::-webkit-scrollbar {
        height: 6px;
    }

    .criteria-container::-webkit-scrollbar-track {
        background: #F3F4F6;
        border-radius: 3px;
    }

    .criteria-container::-webkit-scrollbar-thumb {
        background: #D1D5DB;
        border-radius: 3px;
    }

    .criteria-container::-webkit-scrollbar-thumb:hover {
        background: #9CA3AF;
    }

    .criteria-table {
        min-width: 900px;
        width: 100%;
        table-layout: auto;
    }

    .criteria-table th,
    .criteria-table td {
        white-space: nowrap;
    }

    .criteria-table td:nth-child(2) {
        white-space: normal;
        word-wrap: break-word;
        max-width: 350px;
    }
}


/* Ensure table doesn't cause overflow */
.dataTables_wrapper .dataTables_scroll {
  overflow-x: auto;
}

.dataTables_wrapper table {
  width: 100% !important;
  max-width: 100%;
}

/* Fix for table container overflow */
.table-container .dataTables_wrapper {
  overflow: visible;
}

.table-container table {
  table-layout: auto;
  width: 100%;
}

/* Override DataTables default layout for better mobile alignment */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  box-sizing: border-box;
}


.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
  color: #333;
}

.dataTables_wrapper .dataTables_paginate {
  float: right;
  text-align: right;
  padding-top: 0.25em;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  box-sizing: border-box;
  display: inline-block;
  min-width: 1.5em;
  padding: 0.5em 1em;
  margin-left: 2px;
  text-align: center;
  text-decoration: none !important;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: #333 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  color: #333 !important;
  border: 1px solid #979797;
  background-color: white;
  background: linear-gradient(to bottom, #fff 0%, #dcdcdc 100%);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
  cursor: default;
  color: #666 !important;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  color: white !important;
  border: 1px solid #111;
  background-color: #585858;
  background: linear-gradient(to bottom, #585858 0%, #111 100%);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:active {
  outline: none;
  background-color: #2b2b2b;
  background: linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%);
  box-shadow: inset 0 0 3px #111;
}

/* Responsive table styles */
.dtr-details {
  width: 100%;
}

.dtr-details li {
  border-bottom: 1px solid #f0f0f0;
  padding: 0.5em 0;
}

.dtr-details li:last-child {
  border-bottom: none;
}

.dtr-title {
  font-weight: bold;
  color: #333;
}

.dtr-data {
  margin-left: 1em;
}

/* Client Module Styles */
.client-details-bar {
  background: #16A34A;
  color: white;
  padding: 8px 16px;
  margin: 16px 0;
  border-radius: 4px;
  font-weight: 600;
}

.details-button {
  margin: 16px 0;
}

.edit-indicator {
  color: #6B7280;
  font-style: italic;
  margin: 8px 0 24px 0;
}

.form-section {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #E5E7EB;
}

.form-section:last-child {
  border-bottom: none;
}

.form-section h3 {
  color: #374151;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #16A34A;
}

.form-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
}

.form-textarea--tall {
  min-height: 280px;
}

/* Textarea with icon - add left padding to avoid icon overlap */
.input-wrapper .form-textarea {
  padding-left: 48px;
  padding-top: 16px;
}

.input-wrapper .admin-narrative-textarea {
  padding-left: 48px !important;
  padding-top: 16px !important;
}

.form-textarea:focus {
  outline: none;
  border-color: #16A34A;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

/* Admin Narrative Textarea - Prevent cutting and boundary issues */
.admin-narrative-textarea {
  width: 100% !important;
  box-sizing: border-box !important;
  resize: vertical !important;
  overflow-y: auto !important;
  word-wrap: break-word !important;
  white-space: pre-wrap !important;
  overflow-x: hidden !important;
  max-width: 100% !important;
  min-height: 100px !important;
  max-height: 500px !important;
  padding: 12px !important;
  border: 1px solid #D1D5DB !important;
  border-radius: 6px !important;
  font-size: 0.875rem !important;
  font-family: inherit !important;
  line-height: 1.5 !important;
}

.admin-narrative-textarea:focus {
  outline: none !important;
  border-color: #16A34A !important;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1) !important;
}

/* CKEditor Integration */
.ck-editor__editable {
  border: 1px solid #D1D5DB !important;
  border-radius: 6px !important;
  font-family: inherit !important;
  font-size: 0.875rem !important;
  min-height: 200px !important;
}

.ck-editor__editable:focus {
  border-color: #16A34A !important;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1) !important;
}

.ck-editor__main {
  border-radius: 6px !important;
}

.ck-editor__top {
  border-radius: 6px 6px 0 0 !important;
}

/* Rich Text Display */
.richtext-display {
  line-height: 1.6;
  color: #374151;
}

.richtext-display h1,
.richtext-display h2,
.richtext-display h3,
.richtext-display h4,
.richtext-display h5,
.richtext-display h6 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: #111827;
}

.richtext-display h1:first-child,
.richtext-display h2:first-child,
.richtext-display h3:first-child,
.richtext-display h4:first-child,
.richtext-display h5:first-child,
.richtext-display h6:first-child {
  margin-top: 0;
}

.richtext-display p {
  margin-bottom: 1rem;
}

.richtext-display p:last-child {
  margin-bottom: 0;
}

.richtext-display ul,
.richtext-display ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.richtext-display li {
  margin-bottom: 0.25rem;
}

.richtext-display a {
  color: #16A34A;
  text-decoration: underline;
}

.richtext-display a:hover {
  color: #15803D;
}

/* Content Preview Styling */
.content-preview {
  line-height: 1.5;
  color: #374151;
  max-width: 100%;
  word-wrap: break-word;
}

.content-preview p {
  margin-bottom: 0.5rem;
}

.content-preview p:last-child {
  margin-bottom: 0;
}

/* Empty State Styling */
.empty-state {
  padding: 2rem;
  text-align: center;
  color: #6B7280;
}

.empty-icon {
  color: #D1D5DB;
  margin-bottom: 1rem;
}

.empty-state p {
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #374151;
}

.empty-state small {
  color: #6B7280;
  font-size: 0.875rem;
}

/* Text Muted */
.text-muted {
  color: #6B7280;
}

/* Text Center */
.text-center {
  text-align: center;
}

/* Radio Button Styles */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.radio-option {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 8px 0;
}

.radio-option input[type="radio"] {
  margin: 0;
  margin-right: 12px;
  width: 16px;
  height: 16px;
  accent-color: #16A34A;
}

.radio-label {
  font-size: 0.875rem;
  color: #374151;
  user-select: none;
}

.radio-option:hover .radio-label {
  color: #16A34A;
}

/* Checkbox Styles */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.checkbox-option {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 8px 0;
}

.checkbox-option input[type="checkbox"] {
  margin: 0;
  margin-right: 12px;
  width: 16px;
  height: 16px;
  accent-color: #16A34A;
}

.checkbox-label {
  font-size: 0.875rem;
  color: #374151;
  user-select: none;
}

.checkbox-option:hover .checkbox-label {
  color: #16A34A;
}

/* Badge Styles */
.badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-info {
  background-color: #DBEAFE;
  color: #1E40AF;
}

.badge-success {
  background-color: #D1FAE5;
  color: #065F46;
}

.badge-secondary {
  background-color: #F3F4F6;
  color: #374151;
}

/* Intro Pages Responsive Styles */
@media (max-width: 768px) {
  /* Intro index page responsive */
  .table-container {
    margin: 0;
    border-radius: 8px;
  }

  .table-header {
    padding: 16px;
  }

  .table-responsive {
    border-radius: 0 0 8px 8px;
  }

  /* Make table more mobile-friendly */
  .table-responsive table {
    font-size: 0.875rem;
  }

  .table-responsive th,
  .table-responsive td {
    padding: 8px;
  }

  /* Stack action button on mobile */
  .table-responsive .tool-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.875rem;
    padding: 6px 12px;
  }

  .table-responsive .tool-link svg {
    width: 14px;
    height: 14px;
  }
}

@media (max-width: 480px) {
  /* Intro index page mobile */
  .table-container {
    margin: 0;
  }

  .table-header {
    padding: 12px;
  }

  .table-header h2 {
    font-size: 1.125rem;
  }

  .table-responsive table {
    font-size: 0.8rem;
  }

  .table-responsive th,
  .table-responsive td {
    padding: 6px;
  }

  /* Make action column narrower on mobile */
  .table-responsive th:last-child,
  .table-responsive td:last-child {
    width: 80px;
  }

  .table-responsive .tool-link {
    font-size: 0.8rem;
    padding: 4px 8px;
  }

  .table-responsive .tool-link svg {
    width: 12px;
    height: 12px;
  }

  /* Hide text on very small screens, show only icon */
  .table-responsive .tool-link span {
    display: none;
  }
}

/* Intro edit page responsive */
@media (max-width: 768px) {
  .form-container {
    margin: 0;
    border-radius: 8px;
    padding: 16px;
  }

  .form-section h3 {
    font-size: 1.125rem;
  }

  .form-textarea {
    font-size: 0.875rem;
  }

  .input-wrapper .form-textarea {
    padding-left: 48px;
    padding-top: 16px;
  }

  /* CKEditor responsive */
  .ck-editor__editable {
    font-size: 0.875rem !important;
    min-height: 150px !important;
  }

  .ck-editor__toolbar {
    flex-wrap: wrap;
  }

  .ck-editor__toolbar .ck-toolbar__separator {
    display: none;
  }
}

@media (max-width: 480px) {
  .form-container {
    margin: 0;
    padding: 12px;
  }

  .form-section h3 {
    font-size: 1rem;
  }

  .form-label {
    font-size: 0.875rem;
  }

  .form-textarea {
    font-size: 0.8rem;
    padding: 8px;
  }

  .input-wrapper .form-textarea {
    padding-left: 40px;
    padding-top: 12px;
  }

  /* CKEditor mobile */
  .ck-editor__editable {
    font-size: 0.8rem !important;
    min-height: 120px !important;
    padding: 8px !important;
  }

  .ck-editor__toolbar {
    padding: 4px !important;
  }

  .ck-editor__toolbar .ck-button {
    padding: 4px !important;
  }

  /* Form actions mobile */
  .form-actions.right-aligned {
    flex-direction: column;
    gap: 8px;
  }

  .form-actions .btn-cancel,
  .form-actions .tool-link {
    width: 100%;
    justify-content: center;
  }
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #E5E7EB;
  background: #16A34A;
  color: white;
  border-radius: 8px 8px 0 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #E5E7EB;
  background: #F9FAFB;
  border-radius: 0 0 8px 8px;
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid #E5E7EB;
  margin-bottom: 24px;
}

.tab-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6B7280;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab-button:hover {
  color: #374151;
  background: #F3F4F6;
}

.tab-button.active {
  color: #16A34A;
  border-bottom-color: #16A34A;
  background: #F0FDF4;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Table Controls */
.table-controls {
  margin-bottom: 20px;
}

.table-controls-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.table-controls-bottom {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.table-controls-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.entries-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: #6B7280;
}

.search-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: #6B7280;
}

.pagination-controls {
  display: flex;
  gap: 8px;
}

.btn-pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: white;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  color: #374151;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-pagination:hover:not(:disabled) {
  background: #F3F4F6;
  border-color: #9CA3AF;
}

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

.table-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #E5E7EB;
  font-size: 0.875rem;
  color: #6B7280;
}

.table-info-left {
  flex: 1;
}

.table-info-right {
  display: flex;
  align-items: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 20px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 16px;
  }

  .modal-tabs {
    flex-wrap: wrap;
  }

  .tab-button {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }

  .table-controls-top,
  .table-controls-bottom {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .table-controls-left,
  .table-controls-right {
    justify-content: center;
  }

  .table-info {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .form-section {
    margin-bottom: 24px;
  }
}

.submissions-table th {
  font-weight: bold;
  background: #FFFFFF;
  color: #475467;
}
.submissions-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #FFFFFF;
}
.avatar {
  display: inline-block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.avatar-text {
  display: inline-block;
  background: #C7C2D0;
  color: #FFF;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  line-height: 36px;
  text-align: center;
  font-weight: bold;
  font-size: 0.85em;
  flex-shrink: 0;
}
.active {
  border: 1.5px solid #16A34A;
  background: #FFF;
  color: #16A34A;
  border-radius: 22px;
  font-weight: bold;
  padding: 6px 18px;
  cursor: pointer;
}
.menu {
  width: 32px;
  height: 32px;
  border: 1px solid #EAECF0;
  background: #FFFFFF;
  border-radius: 50%;
  color: #555;
  margin-right: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.menu:hover { background: #F9FAFB; }
.row-actions { position: relative; display: inline-block; }
.menu-popover { position: fixed; background: #FFFFFF; border: 1px solid #EAECF0; border-radius: 8px; min-width: 200px; box-shadow: 0 16px 40px rgba(16,24,40,0.16); padding: 6px; z-index: 1200; overflow: visible; }
.menu-popover[hidden] { display: none; }
.menu-popover button { width: 100%; background: none; border: none; text-align: left; padding: 10px 10px; border-radius: 6px; color: #111827; font-size: 0.95rem; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.menu-popover button:hover { background: #F3F4F6; }
.menu-popover button.danger { color: #DC2626; }
.menu-popover a { width: 100%; background: none; border: none; text-align: left; padding: 10px 10px; border-radius: 6px; color: #111827; font-size: 0.95rem; cursor: pointer; display: flex; align-items: center; gap: 10px; text-decoration: none; }
.menu-popover a:hover { background: #F3F4F6; }
.menu-popover .icon { width: 18px; height: 18px; background-color: currentColor; display: inline-block; }
.menu-popover .icon.mask { -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; }
.menu:focus-visible, .active:focus-visible, .actions button:focus-visible, .sidebar nav a:focus-visible, .sidebar-logout-btn:focus-visible, .tutorial-header button:focus-visible, .play:focus-visible, .profile button:focus-visible, .skip-link:focus { outline: 3px solid #111; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: 8px; background: #fff; color: #111; padding: 8px 12px; border-radius: 6px; transform: translateY(-120%); }
.skip-link:focus { transform: translateY(0); }
  /* Prevent page-level horizontal scrolling; limit it to table wrapper only */
  html, body { overflow-x: hidden; }
  .main-content { overflow-x: hidden; }
  .submissions-container {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
  }

  .submissions-table {
    /* margin: 0 16px 8px 16px; */
    width: calc(100% - 32px);
    max-width: 100%;
  }
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 24px 12px 27px;
}
.submissions-table td:first-child {
  /* display: flex; */
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: visible;
}
.submissions-table td:last-child {
  white-space: nowrap;
  overflow: visible;
  padding: 8px 4px;
}

.submissions-table td:last-child .action-buttons {
  display: flex !important;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap !important;
  width: 100%;
  max-width: 100%;
  justify-content: flex-start;
}

/* Ensure action buttons don't shrink */
.submissions-table td:last-child .action-buttons .btn-view,
.submissions-table td:last-child .action-buttons .btn-pdf,
.submissions-table td:last-child .action-buttons .btn-edit,
.submissions-table td:last-child .action-buttons .btn-delete,
.submissions-table td:last-child .action-buttons .btn-download {
  flex-shrink: 0;
}
.submissions-table td:nth-child(2),
.submissions-table td:nth-child(3),
.submissions-table td:nth-child(4),
.submissions-table td:nth-child(5),
.submissions-table td:nth-child(6),
.submissions-table td:nth-child(7),
.submissions-table th:nth-child(2),
.submissions-table th:nth-child(3),
.submissions-table th:nth-child(4),
.submissions-table th:nth-child(5),
.submissions-table th:nth-child(6),
.submissions-table th:nth-child(7) {
  white-space: nowrap;
  overflow: visible;
}

/* Additional responsive fixes */
@media (max-width: 1023px) {
  .submissions-table th,
  .submissions-table td {
    word-break: break-word;
    hyphens: auto;
  }

  /* Ensure proper spacing for action column */
  .submissions-table td:last-child {
    white-space: nowrap;
    overflow: visible;
    min-width: 140px !important;
  }

  .submissions-table td:last-child .action-buttons {
    flex-wrap: nowrap !important;
    gap: 4px;
  }

  /* Better text handling for date columns */
  .submissions-table td:nth-child(2),
  .submissions-table td:nth-child(5),
  .submissions-table td:nth-child(6),
  .submissions-table td:nth-child(7) {
    white-space: nowrap;
    overflow: visible;
    text-align: center;
  }
}
/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
  .submissions-table table {
    table-layout: auto;
    width: 100%;
  }
  .submissions-table th,
  .submissions-table td {
    padding: 14px 12px;
    font-size: 1em;
  }
  .submissions-table th:last-child,
  .submissions-table td:last-child {
    min-width: 220px !important;
  }
}

/* Desktop (1200px - 1399px) */
@media (min-width: 1200px) and (max-width: 1399px) {
  .submissions-table table {
    table-layout: auto;
    width: 100%;
  }
  .submissions-table th,
  .submissions-table td {
    padding: 12px 10px;
    font-size: 0.95em;
  }
  .submissions-table th:last-child,
  .submissions-table td:last-child {
    min-width: 200px;
  }
}

/* Large Tablet (1024px - 1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {
  .sidebar { width: 240px; flex: 0 0 240px; }
  .submissions-table table {
    table-layout: auto;
    width: 100%;
  }
  .submissions-table th,
  .submissions-table td {
    padding: 10px 6px;
    font-size: 0.9em;
  }
  .submissions-table th:last-child,
  .submissions-table td:last-child {
    min-width: 200px !important;
  }
}

.content-preview-text,
.content-full-text {
    color: #374151;
}

.content-toggle {
    margin-top: 8px;
    background: none;
    border: none;
    padding: 0;
    color: #16A34A;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
}

.content-toggle:focus {
    outline: 2px solid #16A34A;
    outline-offset: 2px;
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .sidebar { width: 240px; flex: 0 0 240px; }
  .submissions-table {
    margin: 0 16px 8px 16px;
    width: calc(100% - 32px);
  }
  .submissions-table table {
    table-layout: auto;
    width: 100%;
  }
  .submissions-table th,
  .submissions-table td {
    padding: 8px 4px;
    font-size: 0.85em;
  }
  .submissions-table th:last-child,
  .submissions-table td:last-child {
    min-width: 120px;
  }
  /* Hide button text, show only icons on tablet */
  .submissions-table td:last-child .action-buttons .btn-edit span,
  .submissions-table td:last-child .action-buttons .btn-archive span,
  .submissions-table td:last-child .action-buttons .btn-print span,
  .submissions-table td:last-child .action-buttons .btn-delete span,
  .submissions-table td:last-child .action-buttons .btn-pdf span,
  .submissions-table td:last-child .action-buttons .btn-download span,
  .submissions-table td:last-child .action-buttons .btn-view span,
  .submissions-table td:last-child .action-buttons .btn-reopen span {
    display: none !important;
  }
  .submissions-table td:last-child .action-buttons .btn-edit,
  .submissions-table td:last-child .action-buttons .btn-archive,
  .submissions-table td:last-child .action-buttons .btn-print,
  .submissions-table td:last-child .action-buttons .btn-delete,
  .submissions-table td:last-child .action-buttons .btn-pdf,
  .submissions-table td:last-child .action-buttons .btn-download,
  .submissions-table td:last-child .action-buttons .btn-view,
  .submissions-table td:last-child .action-buttons .btn-reopen {
    padding: 6px 10px !important;
    justify-content: center !important;
    min-width: 36px !important;
  }
  .avatar, .avatar-text {
    width: 32px;
    height: 32px;
    line-height: 32px;
    font-size: 0.8em;
  }
}
/* Expand rail: hidden by default (shown only when sidebar collapsed on desktop) */
.sidebar-expand-rail {
  display: none !important;
}

@media (min-width: 769px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex !important;
    transform: none !important;
    width: 296px;
    flex: 0 0 296px;
    box-shadow: none;
    z-index: 100;
    transition: transform 0.2s ease;
  }
  /* Collapse button: same look and placement as expand button (top-right of sidebar) */
  .sidebar .logo { padding: 8px 8px 16px 28px; gap: 8px; align-items: flex-start; }
  .sidebar .close-sidebar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    flex-shrink: 0;
    margin-top: 0;
    margin-right: 0;
  }
  .sidebar .close-sidebar:hover { background: #F3F4F6; color: #16A34A; }
  .sidebar .close-sidebar:focus-visible { outline: 2px solid #16A34A; outline-offset: 2px; }
  /* Collapsed: hide sidebar off-screen */
  body.sidebar-collapsed .sidebar {
    transform: translateX(-100%) !important;
  }
  /* Expand rail (Jira-style): thin strip on the left when sidebar is collapsed; button at top */
  .sidebar-expand-rail {
    display: none !important;
    position: fixed;
    left: 0;
    top: 0;
    width: 48px;
    height: 100vh;
    background: #FFFFFF;
    border-right: 1px solid #E9EAEB;
    z-index: 101;
    align-items: center;
    justify-content: flex-start;
    flex-direction: column;
    padding-top: 8px;
  }
  body.sidebar-collapsed .sidebar-expand-rail {
    display: flex !important;
  }
  .sidebar-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #E9EAEB;
    background: #FFFFFF;
    color: #111827;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .sidebar-expand-btn:hover {
    background: #F3F4F6;
    color: #16A34A;
  }
  .sidebar-expand-btn:focus-visible {
    outline: 2px solid #16A34A;
    outline-offset: 2px;
  }
  /* When collapsed: main content has margin from expand rail and around inner content */
  body.sidebar-collapsed .main-content {
    margin-left: 0;
    padding-left: 64px;
    padding-right: 24px;
    padding-top: 24px;
    padding-bottom: 24px;
    margin-top: 16px;
    margin-right: 16px;
    margin-bottom: 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  body.sidebar-open .backdrop { display: none; }
  /* Ensure desktop/laptop title is left aligned */
  .page-header h1 { text-align: left; margin-left: 0; }
  /* Hide mobile-only header row on desktop; expand rail is the collapse/expand control */
  .header-row { display: none; }
  /* Slightly reduced left padding to nudge the title further left */
  .page-header { padding: 0 24px 0 12px; }
}
/* Mobile (under 768px) - Modern Responsive Table */
@media (max-width: 768px) {
  .sidebar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 272px;
    height: auto;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 1000;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
  }
  .sidebar.is-open { transform: translateX(0); }
  /* Add balanced horizontal padding for welcome page content */
  .main-content { padding: 0 16px; margin-left: 0; }
  /* Keep submissions table wrapper margins controlled separately */
  .submissions-container { margin-left: 0; margin-right: 0; }
  /* Mobile header: white bar touches top/left/right; only bottom spacing */
  .page-header { padding: 0; margin: 0 -16px 10px -16px; flex-direction: column; align-items: stretch; gap: 6px; }
  .header-row { display: flex; align-items: center; justify-content: space-between; background: #FFFFFF; padding: 10px 14px; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); }
  .brand-mobile { display: inline-block; }
  .menu-toggle { display: inline-flex; margin-left: 12px; margin-right: 12px; }
  .page-header h1 { font-size: 22px; }
  .page-header-content { padding: 0 16px; }
  .page-header-content p { margin: 0 0 10px 0; padding: 0; }
  .page-header-actions { padding: 0 16px; }
  .sidebar .close-sidebar { display: inline-flex; }
  .actions { width: 100%; }

  /* Mobile table actions and pagination */
  .table-actions {
    flex-direction: row;
    justify-content: flex-end;
    padding: 0 16px;
  }

  /* Mobile DataTables - Proper layout fix */
  .dataTables_wrapper .row {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .dataTables_wrapper .col-sm-6 {
    width: 100% !important;
    text-align: center !important;
    float: none !important;
  }

  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    float: none !important;
    text-align: center !important;
    width: 100% !important;
    margin: 0 !important;
  }

  /* Mobile table - fit screen width */
  .submissions-table {
    margin: 0 8px 8px 8px;
    width: calc(100% - 16px);
  }
  .submissions-table table {
    table-layout: auto;
    width: 100%;
  }
  .submissions-table th,
  .submissions-table td {
    padding: 6px 3px;
    font-size: 0.75em;
  }
  .submissions-table th:last-child,
  .submissions-table td:last-child {
    min-width: 140px;
  }

  /* On mobile, reduce action button size */
  .submissions-table td:last-child .action-buttons {
    gap: 4px;
  }

  .submissions-table td:last-child .action-buttons .btn-view,
  .submissions-table td:last-child .action-buttons .btn-pdf,
  .submissions-table td:last-child .action-buttons .btn-edit,
  .submissions-table td:last-child .action-buttons .btn-delete,
  .submissions-table td:last-child .action-buttons .btn-download,
  .submissions-table td:last-child .action-buttons .btn-reopen {
    padding: 4px 8px;
    font-size: 12px;
  }

  .avatar, .avatar-text {
    width: 24px;
    height: 24px;
    line-height: 24px;
    font-size: 0.7em;
  }

  /* Mobile-specific button adjustments */
  .active {
    padding: 4px 12px;
    font-size: 0.75em;
  }
  .menu {
    width: 24px;
    height: 24px;
  }
  .menu svg {
    width: 14px;
    height: 14px;
  }

  /* Sidebar mobile styles */
  .sidebar nav a { font-size: 0.9rem; padding: 10px 12px 10px 24px; }
  .sidebar-logout-btn { font-size: 0.9rem; padding: 10px 12px 10px 24px; }
  .sidebar .tutorial-header { font-size: 1rem; }
  .sidebar .tutorial p { font-size: 0.9rem; }
  .sidebar .profile strong { font-size: 0.9rem; }
  .sidebar .profile span { font-size: 0.875rem; }
  .sidebar .logo img { max-height: 20px; }
}

/* --- FAQs page styles --- */
/* Hide vertical scrollbar on FAQ page but keep scrolling functionality */
body:has(.faq-container),
html:has(.faq-container) {
  overflow-y: auto !important;
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* IE and Edge */
}

body:has(.faq-container)::-webkit-scrollbar,
html:has(.faq-container)::-webkit-scrollbar {
  display: none !important; /* Chrome, Safari, Opera */
  width: 0 !important;
}

.main-content:has(.faq-container) {
  overflow-y: auto !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.main-content:has(.faq-container)::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
}

.faq-container {
  background: #fff;
  border: 1px solid #EAECF0;
  border-radius: 12px;
  padding: 16px;
}

.faq-lead { padding: 12px 16px; border-bottom: 1px solid #F2F4F7; margin-bottom: 8px; }
.faq-lead h3 { margin: 0 0 8px 0; font-size: 16px; font-weight: 600; }
.faq-lead p { margin: 8px 0; color: #475467; }
.faq-list { list-style: none; margin: 0; padding: 0; }
.faq-item { border-top: 1px solid #F2F4F7; }
.faq-item:first-child { border-top: none; }
.faq-q { width: 100%; background: #fff; border: none; padding: 14px 12px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; text-align: left; font-weight: 600; color: #111827; font-size: 1rem; }
.faq-q img { flex: 0 0 auto; opacity: 0.7; }
.faq-a { padding: 0 12px 14px 12px; color: #374151; }
.faq-item[aria-expanded="true"] .faq-icon { content: url("assets/icons/minus-circle.svg"); }
.faq-item[aria-expanded="true"] .faq-a { display: block; }

@media (max-width: 768px) {
  .faq-container { padding: 12px; }
  .faq-q { padding: 12px 8px; }
  .faq-a { padding: 0 8px 12px 8px; }
}

/* --- Submission Edit page styles --- */
.progress-stepper {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 20px;
}

.stepper-container {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0;
  flex-wrap: nowrap;
  width: 100%;
}

.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  padding: 0 4px;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  border: 2px solid #D1D5DB;
  background: #fff;
  color: #6B7280;
}

.stepper-step.completed .step-circle {
  background: #16A34A;
  border-color: #16A34A;
  color: #fff;
}

.stepper-step.current .step-circle {
  border-color: #16A34A;
  color: #16A34A;
}

.step-label {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #6B7280;
  text-align: center;
  line-height: 1.35;
  max-width: 140px;
  word-break: break-word;
  word-wrap: break-word;
  white-space: normal;
}

.stepper-line {
  flex: 1 1 0;
  max-width: 60px;
  height: 2px;
  background: #D1D5DB;
  margin: 0 8px;
  align-self: center;
}

.stepper-step.completed + .stepper-line {
  background: #16A34A;
}

.criteria-container {
  background: #fff;
  border: 1px solid #EAECF0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.criteria-table {
  width: 100%;
  border-collapse: collapse;
}

.criteria-table th {
  background: #fff;
  padding: 16px 12px;
  text-align: left;
  font-weight: 600;
  color: #111827;
  border-bottom: 1px solid #EAECF0;
  font-size: 14px;
}

.criteria-table td {
  padding: 16px 12px;
  border-bottom: 1px solid #F2F4F7;
  color: #374151;
  font-size: 14px;
}

.criteria-table td:nth-child(2) {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.criteria-table td:last-child {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.btn-edit {
  background: #fff;
  border: 1px solid #D1D5DB;
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-edit:hover {
  background: #F9FAFB;
  border-color: #9CA3AF;
}

.btn-assign {
  background: #16A34A;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-assign:hover {
  background: #15803D;
}

.btn-assign.btn-remove {
  background: #EF4444;
}

.btn-assign.btn-remove:hover {
  background: #DC2626;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
}

.btn-previous {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #D1D5DB;
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-previous:hover {
  background: #F9FAFB;
  border-color: #9CA3AF;
}

.btn-next {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #16A34A;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-next:hover {
  background: #15803D;
}

.btn-next img {
  filter: brightness(0) invert(1);
}

@media (max-width: 768px) {
  .stepper-container {
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .stepper-step {
    flex-shrink: 0;
  }

  .step-circle {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .step-label {
    font-size: 10px;
    margin-top: 4px;
    line-height: 1.3;
    max-width: 80px;
    white-space: normal;
    word-break: break-word;
    word-wrap: break-word;
  }

  .stepper-line {
    display: none;
  }

  .criteria-table {
    font-size: 12px;
  }

  .criteria-table th,
  .criteria-table td {
    padding: 12px 8px;
  }

  .criteria-table td:last-child {
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
  }

  .btn-edit,
  .btn-assign {
    width: 100%;
    justify-content: center;
  }

  .nav-buttons {
    flex-direction: column;
    gap: 12px;
  }

  .btn-previous,
  .btn-next {
    width: 100%;
    justify-content: center;
  }
}

/* Small Mobile (under 480px) */
@media (max-width: 480px) {
  .submissions-table table {
    table-layout: auto;
    width: 100%;
  }
  .submissions-table th,
  .submissions-table td {
    padding: 4px 2px;
    font-size: 0.7em;
  }
  .submissions-table th:last-child,
  .submissions-table td:last-child {
    min-width: 100px;
  }

  /* On small mobile, make action buttons even smaller */
  .submissions-table td:last-child .action-buttons {
    gap: 3px;
    flex-wrap: wrap;
  }

  .submissions-table td:last-child .action-buttons .btn-view,
  .submissions-table td:last-child .action-buttons .btn-pdf,
  .submissions-table td:last-child .action-buttons .btn-edit,
  .submissions-table td:last-child .action-buttons .btn-delete,
  .submissions-table td:last-child .action-buttons .btn-download,
  .submissions-table td:last-child .action-buttons .btn-reopen {
    padding: 3px 6px;
    font-size: 11px;
  }

  .submissions-table td:last-child .action-buttons .btn-view span,
  .submissions-table td:last-child .action-buttons .btn-pdf span,
  .submissions-table td:last-child .action-buttons .btn-edit span,
  .submissions-table td:last-child .action-buttons .btn-delete span,
  .submissions-table td:last-child .action-buttons .btn-download span,
  .submissions-table td:last-child .action-buttons .btn-reopen span {
    display: none;
  }

  .avatar, .avatar-text {
    width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: 0.65em;
  }

  .active {
    padding: 3px 8px;
    font-size: 0.7em;
  }
  .menu {
    width: 20px;
    height: 20px;
  }
  .menu svg {
    width: 12px;
    height: 12px;
  }
}

/* — Login page styles — */
.login-page {
  background: linear-gradient(135deg, #F7F7F7 0%, #E8F8F0 100%);
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  overflow: hidden;
}

/* Prevent scrollbars on login page */
.login-page body,
.login-page html {
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

.login-container {
  width: 100%;
  max-width: 420px;
  max-height: 100vh;
  position: relative;
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.login-card {
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  padding: 40px;
  border: 1px solid #E9EAEB;
  max-height: calc(100vh - 40px);
  box-sizing: border-box;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #D1D5DB transparent;
}

/* Custom scrollbar for login card */
.login-card::-webkit-scrollbar {
  width: 6px;
}

.login-card::-webkit-scrollbar-track {
  background: transparent;
}

.login-card::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 3px;
}

.login-card::-webkit-scrollbar-thumb:hover {
  background: #9CA3AF;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  max-height: 80px;
  width: auto;
  margin-bottom: 20px;
}

.login-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 8px 0;
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 16px;
  color: #6B7280;
  margin: 0;
  font-weight: 400;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  margin-top: 10px;
}

.form-group:first-child {
  margin-top: 0;
}

/* Ensure error messages appear below input-wrapper in login form */
.login-form .form-group .error-message {
  order: 10;
  width: 100%;
  margin-top: 4px;
  margin-bottom: 0;
  display: block;
  clear: both;
}

.form-label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
}

.form-label svg {
  margin-right: 6px;
  flex-shrink: 0;
  vertical-align: middle;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  flex-shrink: 0;
}

.input-wrapper.no-icon {
  padding-left: 0;
}

.input-wrapper.no-icon .input-icon {
  display: none;
}

.input-wrapper.no-icon .form-input {
  padding-left: 16px;
}

.form-input {
  width: 100%;
  padding: 12px 16px 12px 48px;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  font-size: 16px;
  font-family: 'Inter', Arial, sans-serif;
  background: #FFFFFF;
  color: #111827;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: #16A34A;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.form-input::placeholder {
  color: #9CA3AF;
}

.form-input.error {
  border-color: #EF4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-icon {
  position: absolute;
  left: 16px;
  color: #6B7280;
  pointer-events: none;
  z-index: 1;
}

.password-toggle {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: #6B7280;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s ease;
}

.password-toggle:hover {
  color: #16A34A;
}

/* Login page specific error messages */
.login-page .error-message {
  font-size: 14px;
  color: #EF4444;
  margin-top: 4px;
  line-height: 1.2;
  width: 100%;
  clear: both;
}

/* Hide when empty */
.login-page .error-message:empty {
  display: none !important;
  min-height: 0;
  visibility: hidden;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

/* Show when has content */
.login-page .error-message:not(:empty) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  overflow: visible !important;
  min-height: 16px;
}

/* Ensure error messages with content are visible - override any hiding rules */
.login-page .error-message:not(:empty),
.error-message:not(:empty) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  overflow: visible !important;
  width: 100% !important;
}

/* Override inline style display:none for error messages with content */
.login-page .error-message[style*="display: none"]:not(:empty) {
  display: block !important;
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 6px 0;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
}

.checkbox-wrapper input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid #D1D5DB;
  border-radius: 4px;
  background: #FFFFFF;
  position: relative;
  transition: all 0.2s ease;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkbox-custom {
  background: #16A34A;
  border-color: #16A34A;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #FFFFFF;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.forgot-password {
  font-size: 14px;
  color: #16A34A;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.forgot-password:hover {
  color: #15803D;
  text-decoration: underline;
}

.login-button {
  width: 100%;
  padding: 14px 24px;
  background: #16A34A;
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Inter', Arial, sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.login-button:hover:not(:disabled) {
  background: #15803D;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.login-button:active:not(:disabled) {
  transform: translateY(0);
}

.login-button:disabled {
  background: #9CA3AF;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #E5E7EB;
}

.login-footer p {
  font-size: 14px;
  color: #6B7280;
  margin: 0;
}

.signup-link {
  color: #16A34A;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.signup-link:hover {
  color: #15803D;
  text-decoration: underline;
}

.login-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.background-pattern {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 25% 25%, rgba(22, 163, 74, 0.05) 0%, transparent 50%),
              radial-gradient(circle at 75% 75%, rgba(22, 163, 74, 0.03) 0%, transparent 50%);
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -30px) rotate(120deg); }
  66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* Login page responsive styles */
@media (max-width: 480px) {
  .login-page {
    padding: 16px;
    height: 100vh;
    overflow: hidden;
  }

  .login-container {
    max-height: calc(100vh - 32px);
  }

  .login-card {
    padding: 24px;
    border-radius: 12px;
    max-height: calc(100vh - 32px);
  }

  .login-header {
    margin-bottom: 20px;
  }

  .login-header h1 {
    font-size: 24px;
  }

  .login-subtitle {
    font-size: 14px;
  }

  .form-input {
    padding: 12px 16px 12px 44px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .input-icon {
    left: 14px;
  }

  .password-toggle {
    right: 14px;
  }

  .login-form {
    gap: 18px;
  }
}

@media (max-width: 360px) {
  .login-page {
    padding: 12px;
  }

  .login-container {
    max-height: calc(100vh - 24px);
  }

  .login-card {
    padding: 20px;
    max-height: calc(100vh - 24px);
  }

  .login-header {
    margin-bottom: 20px;
  }

  .login-header h1 {
    font-size: 22px;
  }

  .login-header {
    margin-bottom: 18px;
  }

  .login-form {
    gap: 16px;
  }

  .form-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* Modal Tab Styles */
.modal-tabs .tab-button.active {
  color: #16A34A !important;
  border-bottom: 2px solid #16A34A !important;
  background: #fff !important;
}

.modal-tabs .tab-button:hover {
  color: #16A34A !important;
  background: #F0FDF4 !important;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Form field focus states */
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #16A34A !important;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1) !important;
}

/* Required field indicator */
.form-label.required::after {
  content: " *";
  color: #DC2626;
  font-weight: 600;
}

/* GDPR page layout - show sidebar with footer content only */

/* Modal Styles */
.modal-content {
  max-width: 700px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #E5E7EB;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
}

.modal-header .btn-cancel {
  padding: 8px 16px;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 0;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid #E5E7EB;
  background: #F9FAFB;
}

.tab-button {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.875rem;
  color: #6B7280;
  border-bottom: 2px solid transparent;
}

.modal-content-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.modal-form-group {
  margin-bottom: 20px;
}

.modal-form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #374151;
}

.modal-form-input-wrapper {
  position: relative;
}

.modal-form-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9CA3AF;
  pointer-events: none;
  width: 20px;
  height: 20px;
}

.modal-form-icon.textarea-icon {
  top: 16px;
  transform: none;
}

.modal-form-input,
.modal-form-select,
.modal-form-textarea {
  width: calc(100% - 44px);
  padding: 12px 12px 12px 44px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-size: 0.875rem;
  background: #fff;
  box-sizing: border-box;
}

.modal-form-select {
  appearance: none;
  background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23666" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}

.modal-form-textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-form-textarea.large {
  min-height: 100px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #E5E7EB;
  background: #F9FAFB;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

.modal-footer .btn-cancel,
.modal-footer .tool-link {
  padding: 10px 20px;
  font-size: 0.875rem;
}

/* ============================================
   WCAG 2.1 SC 1.4.4: TEXT RESIZING (200% ZOOM SUPPORT)
   ============================================ */

/* Prevent horizontal scrolling at high zoom levels */
html {
  overflow-x: hidden !important;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Ensure all containers respect max-width at zoom */
/* Note: box-sizing: border-box is already applied globally via base styles */

/* Prevent fixed-width containers from causing horizontal scroll */
.container,
.wrapper,
.page-container,
.content-container {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

/* Ensure tables can scroll horizontally if needed, but don't break layout */
table {
  max-width: 100%;
  table-layout: auto;
}

/* DataTables container - allow horizontal scroll for tables but not page */
.dataTables_wrapper {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.dataTables_wrapper .dataTables_scroll {
  max-width: 100%;
}

/* Form elements scale properly */
input,
textarea,
select,
button {
  max-width: 100%;
  box-sizing: border-box;
}

/* Images scale with zoom */
img {
  max-width: 100%;
  height: auto;
}

/* ============================================
   WCAG 2.2 AA HIGH CONTRAST MODE
   ============================================ */

/* High Contrast Mode - System Preference */
@media (prefers-contrast: high) {
  /* Base Colors */
  body {
    background: #000000 !important;
    color: #FFFFFF !important;
  }

  /* Sidebar */
  .sidebar {
    background: #1A1A1A !important;
    border-right: 2px solid #FFFFFF !important;
  }

  .sidebar nav a {
    color: #FFFFFF !important;
    border: 1px solid transparent;
  }

  .sidebar nav a:hover,
  .sidebar nav a:focus,
  .sidebar-logout-btn:hover,
  .sidebar-logout-btn:focus {
    background: #333333 !important;
    border-color: #FFFFFF !important;
    outline: 2px solid #FFFF00 !important;
  }

  .sidebar nav a[aria-current="page"] {
    background: #333333 !important;
    border: 2px solid #FFFFFF !important;
    color: #FFFFFF !important;
  }

  .sidebar nav svg {
    color: #FFFFFF !important;
  }

  /* Main Content */
  .main-content {
    background: #000000 !important;
    color: #FFFFFF !important;
  }

  /* Headings */
  h1, h2, h3, h4, h5, h6 {
    color: #FFFFFF !important;
  }

  /* Links */
  a {
    color: #00FFFF !important;
    text-decoration: underline !important;
  }

  a:visited {
    color: #FF00FF !important;
  }

  a:hover,
  a:focus {
    color: #FFFFFF !important;
    background: #333333 !important;
    outline: 2px solid #FFFF00 !important;
    outline-offset: 2px !important;
  }

  /* Focus Indicators - Enhanced for High Contrast */
  *:focus {
    outline: 2px solid #FFFF00 !important;
    outline-offset: 2px !important;
  }

  button:focus,
  input:focus,
  select:focus,
  textarea:focus,
  a:focus {
    outline: 3px solid #FFFF00 !important;
    outline-offset: 3px !important;
    background: #333333 !important;
  }

  /* Forms */
  .form-input,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="tel"],
  input[type="url"],
  textarea,
  select {
    background: #000000 !important;
    color: #FFFFFF !important;
    border: 2px solid #FFFFFF !important;
  }

  .form-input:focus,
  input:focus,
  textarea:focus,
  select:focus {
    border: 3px solid #FFFF00 !important;
    outline: 2px solid #FFFF00 !important;
    background: #1A1A1A !important;
  }

  /* Buttons */
  .btn-primary,
  .continue,
  button[type="submit"],
  .btn-edit,
  .btn-view,
  .btn-download {
    background: #000000 !important;
    color: #FFFFFF !important;
    border: 2px solid #FFFFFF !important;
  }

  .btn-primary:hover,
  .btn-primary:focus,
  .continue:hover,
  .continue:focus,
  button[type="submit"]:hover,
  button[type="submit"]:focus {
    background: #333333 !important;
    border-color: #FFFF00 !important;
    outline: 3px solid #FFFF00 !important;
  }

  .btn-secondary,
  .btn-cancel {
    background: #1A1A1A !important;
    color: #FFFFFF !important;
    border: 2px solid #FFFFFF !important;
  }

  .btn-secondary:hover,
  .btn-secondary:focus,
  .btn-cancel:hover,
  .btn-cancel:focus {
    background: #333333 !important;
    border-color: #FFFF00 !important;
  }

  /* Tables */
  table {
    border: 2px solid #FFFFFF !important;
  }

  th {
    background: #1A1A1A !important;
    color: #FFFFFF !important;
    border: 1px solid #FFFFFF !important;
  }

  td {
    background: #000000 !important;
    color: #FFFFFF !important;
    border: 1px solid #FFFFFF !important;
  }

  tr:nth-child(even) td {
    background: #1A1A1A !important;
  }

  /* Badges - High Contrast Mode */
  .badge {
    border: 2px solid #FFFFFF !important;
    font-weight: 700 !important;
    padding: 4px 10px !important;
  }

  .badge-success {
    background: #000000 !important;
    color: #FFFFFF !important;
    border-color: #00FF00 !important;
  }

  .badge-warning {
    background: #000000 !important;
    color: #FFFFFF !important;
    border-color: #FFFF00 !important;
  }

  .badge-danger {
    background: #000000 !important;
    color: #FFFFFF !important;
    border-color: #FF0000 !important;
  }

  .badge-secondary {
    background: #000000 !important;
    color: #FFFFFF !important;
    border-color: #FFFFFF !important;
  }

  /* Cards and Containers */
  .card,
  .filters-section,
  .clients-container,
  .users-container,
  .companies-container,
  .document-templates-container,
  .submissions-container {
    background: #000000 !important;
    border: 2px solid #FFFFFF !important;
    color: #FFFFFF !important;
  }

  /* Cards Titles */
  .card-title {
    color: #FFFFFF !important;
    border-bottom: 2px solid #FFFFFF !important;
  }

  /* Error Messages */
  .error-message,
  .text-red-600,
  .text-danger {
    color: #FF0000 !important;
    background: #1A1A1A !important;
    border: 1px solid #FF0000 !important;
    padding: 4px 8px !important;
  }

  /* Success Messages */
  .text-success,
  .text-green-600 {
    color: #00FF00 !important;
  }

  /* Skip Link */
  .skip-link {
    background: #FFFF00 !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    font-weight: 700 !important;
  }

  /* Notifications */
  .notification-content {
    border: 3px solid #FFFFFF !important;
  }

  .notification-success {
    background: #000000 !important;
    border-color: #00FF00 !important;
    color: #FFFFFF !important;
  }

  .notification-error {
    background: #000000 !important;
    border-color: #FF0000 !important;
    color: #FFFFFF !important;
  }

  .notification-warning {
    background: #000000 !important;
    border-color: #FFFF00 !important;
    color: #FFFFFF !important;
  }

  .notification-info {
    background: #000000 !important;
    border-color: #00FFFF !important;
    color: #FFFFFF !important;
  }

  /* Breadcrumbs */
  .breadcrumb-link {
    color: #00FFFF !important;
  }

  .breadcrumb-current {
    color: #FFFFFF !important;
  }

  /* Page Header */
  .page-header h1 {
    color: #FFFFFF !important;
  }

  .page-header p {
    color: #CCCCCC !important;
  }

  /* View Only Fields */
  .view-only-field {
    background: #1A1A1A !important;
    border: 2px solid #FFFFFF !important;
    color: #FFFFFF !important;
  }

  /* Modals */
  .modal {
    background: rgba(0, 0, 0, 0.9) !important;
  }

  .modal-content {
    background: #000000 !important;
    border: 3px solid #FFFFFF !important;
    color: #FFFFFF !important;
  }

  /* Disabled Elements */
  input:disabled,
  button:disabled,
  select:disabled,
  textarea:disabled {
    background: #333333 !important;
    color: #999999 !important;
    border: 1px solid #666666 !important;
    opacity: 1 !important;
  }
}

.login-page .error-message:not(:empty) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  overflow: visible !important;
}

.login-page .success-message {
  display: block;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  background-color: #ECFDF3;
  color: #15803D;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
  border: 1px solid #A7F3D0;
}

#documentTemplatesTable td:last-child {
    width: auto !important;
    min-width: 200px !important;
    white-space: nowrap;
    text-align: left !important;
}

#documentTemplatesTable th:last-child {
    width: auto !important;
    min-width: 200px !important;
    white-space: nowrap;
    text-align: left !important;
}

.modal-form-input,
.modal-form-select,
.modal-form-textarea {
  width: calc(100% - 44px);
  padding: 12px 12px 12px 44px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-size: 0.875rem;
  background: #fff;
  box-sizing: border-box;
}

.modal-error-message {
  color: #EF4444;
  font-size: 0.8125rem;
  font-weight: 400;
  margin-top: 6px;
  display: block;
}
