:root {
  --app-font-family: "Inter", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --app-bg: #f5f7fb;
  --app-bg-soft: #eef3f8;
  --app-surface: #ffffff;
  --app-surface-warm: #f8fafc;
  --app-border: #dbe4ee;
  --app-border-strong: #b8c7d9;
  --app-text: #1f2937;
  --app-muted: #64748b;
  --app-primary: #0f766e;
  --app-primary-hover: #115e59;
  --app-primary-soft: #e6fffb;
  --app-accent: #2563eb;
  --app-danger: #b42318;
  --app-radius-sm: 0px;
  --app-radius-md: 0px;
  --app-radius-lg: 0px;
  --app-shadow-sm: 0 6px 18px rgba(15, 23, 42, 0.08);
  --app-shadow-md: 0 22px 55px rgba(15, 23, 42, 0.14);
  --app-focus: 0 0 0 4px rgba(15, 118, 110, 0.18);
}

html,
body {
  font-family: var(--app-font-family);
  color: var(--app-text);
}

body {
  background-color: var(--app-bg);
  letter-spacing: 0;
}

a {
  color: var(--app-primary);
}

a:hover {
  color: var(--app-primary-hover);
}

.btn-primary,
.btn-primary:not(:disabled):not(.disabled):active {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--app-primary-hover);
  border-color: var(--app-primary-hover);
}

.btn:focus,
.btn.focus,
.form-control:focus,
.custom-select:focus,
.select2-container--bootstrap4.select2-container--focus .select2-selection {
  box-shadow: var(--app-focus);
}

.form-control:focus,
.custom-select:focus {
  border-color: var(--app-primary);
}

/* =========================================================
   CREATE PAGE & FORM REDESIGN (Global Theme Alignment)
========================================================= */

/* Card Headers in Create Pages */
.card-header, .app-table-card .card-header {
    border-radius: 12px 12px 0 0 !important;
    padding: 15px 20px !important;
}

/* Form Labels and Required Asterisks */
label, .form-group label {
    color: var(--app-text) !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Required red asterisks/text */
.text-danger, label .text-danger, .required, span[style*="color:red"], span[style*="color: red"] {
    color: #ef4444 !important;
    font-weight: 900;
}

/* Notice text like "***All * marked fields are required***" */
.alert-danger, p.text-danger, div.text-danger {
    background-color: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    color: #b91c1c !important;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 600;
    display: inline-block;
    width: 100%;
    text-align: center;
}

/* Add More Button / Dynamic Table Headers / Print Buttons */
.bg-success, .table .bg-success, .btn-success, form .btn-success, button.btn-success {
    background: linear-gradient(135deg, var(--app-primary) 0%, #0d9488 100%) !important;
    border-color: var(--app-primary) !important;
    color: white !important;
    white-space: nowrap !important;
}

.table thead .bg-success th {
    background: var(--app-primary) !important;
    color: white !important;
    text-align: center;
}

/* Prevent shrinking of card tool buttons on mobile */
.card-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.card-tools .btn {
    white-space: nowrap !important;
    flex: 0 0 auto !important;
}

/* =========================================================
   FORM CONTROL STYLING FOR CREATE PAGES (Global Redesign)
========================================================= */
.form-control,
.custom-select {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.938rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--app-text);
  background-color: var(--app-surface-warm);
  background-clip: padding-box;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03) inset;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.form-control:hover,
.custom-select:hover {
  border-color: var(--app-border-strong);
  background-color: var(--app-surface);
}

.form-control:focus,
.custom-select:focus {
  color: var(--app-text);
  background-color: var(--app-surface);
  border-color: var(--app-primary);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.15);
}

.form-control::placeholder {
  color: #94a3b8;
  opacity: 1;
}

.form-control:disabled,
.form-control[readonly] {
  background-color: #f1f5f9;
  opacity: 1;
  color: var(--app-muted);
}

textarea.form-control {
  min-height: 100px;
  border-radius: 8px;
}

label {
  display: inline-block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  color: var(--app-text);
  font-size: 0.875rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

/* Redesign for card containing the forms */
.card {
  background-color: #fff;
  border: 1px solid var(--app-border);
  border-radius: 12px !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03) !important;
}

.card-header {
  background-color: #fff;
  border-bottom: 1px solid var(--app-border);
  border-top-left-radius: 12px !important;
  border-top-right-radius: 12px !important;
  padding: 1rem 1.25rem;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  background-color: #f8fafc;
  border-top: 1px solid var(--app-border);
  border-bottom-left-radius: 12px !important;
  border-bottom-right-radius: 12px !important;
  padding: 1rem 1.25rem;
}

/* Standard Submit Buttons */
form .btn-success,
form button[type="submit"] {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
  color: white;
  font-weight: 600;
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(15, 118, 110, 0.2);
}

form .btn-success:hover,
form button[type="submit"]:hover {
  background-color: var(--app-primary-hover);
  border-color: var(--app-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(15, 118, 110, 0.3);
}

.card,
.modal-content,
.dropdown-menu {
  border-color: var(--app-border);
  border-radius: var(--app-radius-sm);
  box-shadow: var(--app-shadow-sm);
}

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 18%, rgba(20, 184, 166, 0.16) 0, rgba(20, 184, 166, 0) 32%),
    radial-gradient(circle at 88% 12%, rgba(37, 99, 235, 0.12) 0, rgba(37, 99, 235, 0) 30%),
    linear-gradient(135deg, #f8fafc 0%, #eef3f8 52%, #e6edf5 100%);
}

.auth-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 16px;
  position: relative;
  width: 100%;
}

.auth-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(219, 228, 238, 0.95);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-md);
  max-width: 430px;
  padding: 36px;
  position: relative;
  width: min(100%, 430px);
}

.auth-panel::before {
  background: linear-gradient(90deg, var(--app-primary), #38bdf8, var(--app-accent));
  border-radius: 999px;
  content: "";
  height: 4px;
  left: 36px;
  position: absolute;
  right: 36px;
  top: 0;
}

.auth-brand {
  margin-bottom: 28px;
  text-align: center;
}

.auth-brand-link {
  align-items: center;
  display: inline-flex;
  justify-content: center;
}

.auth-brand-logo {
  display: block;
  height: auto;
  max-height: 72px;
  max-width: 220px;
  object-fit: contain;
}

.auth-heading {
  margin-bottom: 28px;
  text-align: center;
}

.auth-eyebrow {
  color: var(--app-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.auth-heading h1 {
  color: var(--app-text);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.16;
  margin: 0 0 8px;
}

.auth-heading p:last-child {
  color: var(--app-muted);
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
}

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-field label {
  color: var(--app-text);
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-input-group {
  align-items: center;
  background: var(--app-surface-warm);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-md);
  display: flex;
  min-height: 48px;
  position: relative;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.auth-input-group:focus-within {
  background: var(--app-surface);
  border-color: var(--app-primary);
  box-shadow: var(--app-focus);
}

.auth-input-group .form-control {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--app-text);
  flex: 1;
  font-size: 15px;
  height: 48px;
  padding: 12px 14px;
}

.auth-input-group .form-control::placeholder {
  color: #94a3b8;
}

.auth-input-icon {
  color: var(--app-muted);
  flex: 0 0 auto;
  font-size: 15px;
  padding: 0 15px 0 4px;
}

.auth-actions {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-top: 4px;
}

.auth-check {
  align-items: center;
  color: var(--app-muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  gap: 8px;
  margin: 0;
  user-select: none;
}

.auth-check input {
  accent-color: var(--app-primary);
  height: 16px;
  width: 16px;
}

.auth-submit {
  align-items: center;
  border-radius: var(--app-radius-md);
  display: inline-flex;
  font-size: 15px;
  font-weight: 700;
  gap: 9px;
  justify-content: center;
  min-height: 46px;
  padding: 10px 20px;
}

.auth-submit i {
  font-size: 13px;
}

.auth-security-note {
  align-items: center;
  color: var(--app-muted);
  display: flex;
  font-size: 13px;
  gap: 8px;
  justify-content: center;
  margin-top: 24px;
}

.auth-security-note i {
  color: var(--app-accent);
}

@media (max-width: 480px) {
  .auth-shell {
    padding: 20px 12px;
  }

  .auth-panel {
    border-radius: 16px;
    padding: 28px 20px;
  }

  .auth-panel::before {
    left: 20px;
    right: 20px;
  }

  .auth-heading h1 {
    font-size: 26px;
  }

  .auth-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-submit {
    width: 100%;
  }
}

/* Application Shell: Header + Sidebar */
.main-sidebar {
  background: linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%) !important;
  border-right: 1px solid var(--app-border) !important;
  box-shadow: 8px 0 28px rgba(15, 23, 42, 0.08) !important;
}

.brand-link {
  align-items: center;
  background: #ffffff !important;
  border-bottom: 1px solid var(--app-border) !important;
  box-shadow: none !important;
  display: flex;
  gap: 10px;
  height: 66px !important;
  max-height: 66px !important;
  min-height: 66px !important;
  padding: 10px 16px !important;
  text-decoration: none !important;
  transform: none !important;
  white-space: normal;
}

.brand-link:hover {
  background: var(--app-surface-warm) !important;
}

.brand-image {
  animation: none !important;
  border: 1px solid var(--app-border-strong) !important;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12) !important;
  flex: 0 0 38px;
  height: 38px !important;
  margin: 0 !important;
  object-fit: cover;
  transform: none !important;
  width: 38px !important;
}

.brand-text {
  color: var(--app-text) !important;
  font-size: 13px;
  font-weight: 800 !important;
  line-height: 1.25;
  max-width: 172px;
  overflow-wrap: anywhere;
  text-shadow: none !important;
}

.brand-link:hover .brand-text {
  color: var(--app-primary) !important;
}

.sidebar-user-card {
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--app-border);
  border-radius: 12px;
  display: flex;
  gap: 10px;
  margin: 10px 8px 8px;
  padding: 8px 10px;
}

.sidebar-user-photo {
  border: 2px solid var(--app-border-strong);
  border-radius: 50%;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.10);
  flex: 0 0 38px;
  height: 38px;
  object-fit: cover;
  width: 38px;
}

.sidebar-user-meta {
  min-width: 0;
}

.sidebar-user-name {
  color: var(--app-text);
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-role {
  color: var(--app-muted);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.25;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-status {
  align-items: center;
  color: #2f9e62;
  display: inline-flex;
  font-size: 9.5px;
  font-weight: 800;
  gap: 5px;
  line-height: 1;
  margin-top: 5px;
  text-transform: uppercase;
}

.sidebar-user-status::before {
  background: #2f9e62;
  border-radius: 50%;
  content: "";
  height: 7px;
  width: 7px;
}

.sidebar {
  padding: 4px 10px 14px;
  scrollbar-color: var(--app-border-strong) #f5f7fb;
  scrollbar-width: thin;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: #f5f7fb;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--app-border-strong);
  border-radius: 999px;
}

.nav-sidebar {
  padding: 0;
}

.nav-sidebar .nav-item {
  margin: 1px 0 !important;
  perspective: none !important;
}

.nav-sidebar .nav-link {
  align-items: center;
  background: transparent !important;
  border: 1px solid transparent;
  border-radius: 10px !important;
  box-shadow: none !important;
  color: var(--app-muted) !important;
  margin: 0 !important;
  min-height: 40px;
  overflow: hidden;
  padding: 8px 12px !important;
  transform: none !important;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.nav-sidebar .nav-link:hover {
  background: #ffffff !important;
  border-color: var(--app-border);
  color: var(--app-primary) !important;
}

.nav-sidebar .nav-link.active {
  background: var(--app-primary-soft) !important;
  border-color: var(--app-border-strong) !important;
  border-left: 4px solid var(--app-primary) !important;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08) !important;
  color: var(--app-text) !important;
}

.nav-sidebar .nav-icon {
  animation: none !important;
  color: var(--app-primary) !important;
  font-size: 1rem;
  margin-right: 11px;
  transform: none !important;
  width: 20px;
}

.nav-sidebar p {
  color: inherit !important;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
  transform: none !important;
}

.nav-sidebar .right {
  color: #94a3b8;
}

.nav-treeview {
  animation: none !important;
  border-left: 1px solid var(--app-border);
  margin: 2px 0 5px 22px;
  padding-left: 8px;
}

.nav-treeview .nav-link {
  background: transparent !important;
  min-height: 36px;
  padding: 8px 10px !important;
}

.nav-treeview .nav-link.active {
  background: #ffffff !important;
  border-left: 3px solid var(--app-primary) !important;
}

.nav-link .badge,
.right-badge {
  animation: none !important;
  background: var(--app-danger) !important;
  border-radius: 999px !important;
}

.royal-navbar {
  background: rgba(255, 255, 255, 0.94) !important;
  border-bottom: 1px solid var(--app-border) !important;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08) !important;
  height: 66px;
  min-height: 66px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.navbar-left,
.navbar-right {
  align-items: center;
  display: flex;
}

.navbar-left {
  flex: 1;
}

.royal-menu-toggle,
.royal-search-toggle,
.royal-fullscreen,
.royal-notification-toggle {
  align-items: center;
  border-radius: 10px;
  color: var(--app-muted) !important;
  display: inline-flex !important;
  height: 40px;
  justify-content: center;
  margin-right: 6px;
  padding: 0 !important;
  width: 40px;
}

.royal-menu-toggle:hover,
.royal-search-toggle:hover,
.royal-fullscreen:hover,
.royal-notification-toggle:hover {
  background: var(--app-primary-soft) !important;
  color: var(--app-primary) !important;
}

.royal-menu-icon {
  display: flex;
  flex-direction: column;
  height: 18px;
  justify-content: space-between;
  width: 24px;
}

.royal-menu-icon span {
  background: var(--app-text) !important;
  border-radius: 999px;
  display: block;
  height: 2px;
}

.royal-home-link {
  align-items: center;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  color: var(--app-text) !important;
  display: flex !important;
  min-height: 42px;
  padding: 7px 12px !important;
}

.royal-home-link:hover {
  background: var(--app-primary-soft) !important;
  border-color: var(--app-border-strong);
  color: var(--app-primary) !important;
}

.royal-home-icon {
  align-items: center;
  background: var(--app-primary-soft);
  border-radius: 8px;
  color: var(--app-primary);
  display: flex;
  height: 28px;
  justify-content: center;
  margin-right: 8px;
  width: 28px;
}

.royal-link-text,
.royal-breadcrumb .breadcrumb-item.active {
  color: var(--app-text) !important;
  font-weight: 800;
}

.royal-breadcrumb {
  border-left: 1px solid var(--app-border);
  margin-left: 18px;
  padding-left: 18px;
}

.royal-breadcrumb .breadcrumb {
  background: transparent;
  margin-bottom: 0;
  padding: 0;
}

.royal-breadcrumb .breadcrumb-item a,
.royal-breadcrumb .breadcrumb-item+.breadcrumb-item::before {
  color: var(--app-muted) !important;
}

.royal-breadcrumb .breadcrumb-item a:hover {
  background: var(--app-primary-soft) !important;
  border-radius: 6px;
  color: var(--app-primary) !important;
}

.royal-quick-actions {
  margin-right: 10px;
}

.royal-quick-btn {
  background: var(--app-primary-soft) !important;
  border: 1px solid var(--app-border-strong) !important;
  border-radius: 10px !important;
  color: var(--app-primary) !important;
  height: 40px;
  padding: 0 13px !important;
}

.royal-notification-icon {
  align-items: center;
  color: var(--app-muted);
  display: flex;
  font-size: 1.15rem;
  height: 28px;
  justify-content: center;
  position: relative;
  width: 28px;
}

.royal-notification-badge {
  align-items: center;
  animation: none !important;
  background: var(--app-danger) !important;
  border: 2px solid #ffffff;
  border-radius: 999px;
  color: #ffffff !important;
  display: flex;
  font-size: 0.65rem !important;
  font-weight: 800;
  height: 20px;
  justify-content: center;
  min-width: 20px;
  padding: 0 5px;
  position: absolute;
  right: -7px;
  top: -7px;
}

.royal-notification-dropdown {
  border: 1px solid var(--app-border);
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.14);
  margin-top: 12px;
  overflow: hidden;
  width: 380px;
}

.royal-notification-header,
.royal-notification-footer {
  background: var(--app-surface-warm);
  border-color: var(--app-border);
  padding: 14px 16px;
}

.royal-notification-header {
  align-items: center;
  border-bottom: 1px solid var(--app-border);
  display: flex;
  justify-content: space-between;
}

.royal-notification-title {
  align-items: center;
  color: var(--app-text);
  display: flex;
  font-weight: 800;
  gap: 8px;
}

.royal-notification-title i,
.royal-notification-time i,
.royal-view-all,
.royal-notification-footer-link {
  color: var(--app-primary);
}

.royal-notification-count {
  background: var(--app-danger);
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.7rem;
  padding: 2px 9px;
}

.royal-notification-body {
  max-height: 400px;
  overflow-y: auto;
}

.royal-notification-item {
  align-items: center;
  border-bottom: 1px solid var(--app-border);
  color: inherit;
  display: flex;
  padding: 14px 16px;
  text-decoration: none;
}

.royal-notification-item:hover {
  background: var(--app-surface-warm);
}

.royal-notification-icon-wrapper {
  margin-right: 12px;
}

.royal-notification-item-icon {
  align-items: center;
  background: var(--app-primary-soft);
  border-radius: 10px;
  color: var(--app-primary);
  display: flex;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.royal-notification-content {
  flex: 1;
  min-width: 0;
}

.royal-notification-content .royal-notification-title {
  color: var(--app-text);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.royal-notification-content .badge {
  border-radius: 999px;
  font-size: 0.65rem;
  margin-left: 5px;
  padding: 2px 7px;
}

.badge-pending,
.pending-icon {
  background: #f59e0b !important;
  color: #ffffff !important;
}

.badge-approved,
.approved-icon {
  background: #2f9e62 !important;
  color: #ffffff !important;
}

.badge-rejected,
.rejected-icon {
  background: var(--app-danger) !important;
  color: #ffffff !important;
}

.history-icon {
  background: #eef2f6 !important;
  color: var(--app-muted) !important;
}

.royal-notification-text,
.royal-notification-time,
.royal-notification-empty-subtext {
  color: var(--app-muted);
  font-size: 0.82rem;
}

.royal-notification-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.royal-notification-action {
  color: var(--app-muted);
  font-size: 0.8rem;
}

.royal-notification-empty {
  padding: 42px 18px;
  text-align: center;
}

.royal-notification-empty-icon {
  color: var(--app-muted);
  font-size: 2.3rem;
  margin-bottom: 12px;
  opacity: 0.45;
}

.royal-notification-empty-text {
  color: var(--app-text);
  font-weight: 800;
}

.royal-notification-footer {
  border-top: 1px solid var(--app-border);
}

.royal-notification-footer-link {
  align-items: center;
  display: flex;
  font-weight: 700;
  gap: 8px;
  justify-content: center;
}

.royal-user-toggle {
  align-items: center;
  background: var(--app-surface-warm) !important;
  border: 1px solid var(--app-border);
  border-radius: 12px;
  color: var(--app-text) !important;
  display: flex !important;
  min-height: 42px;
  padding: 4px 10px 4px 5px !important;
}

.royal-user-toggle:hover {
  background: #ffffff !important;
  border-color: var(--app-border-strong);
}

.royal-user-avatar {
  margin-right: 9px;
  position: relative;
}

.royal-user-image {
  border: 2px solid var(--app-border-strong);
  border-radius: 50%;
  height: 32px;
  object-fit: cover;
  width: 32px;
}

.royal-user-status {
  background: #2f9e62;
  border: 2px solid #ffffff;
  border-radius: 50%;
  bottom: 0;
  height: 10px;
  position: absolute;
  right: 0;
  width: 10px;
}

.royal-user-name {
  color: var(--app-text);
  font-size: 13px;
  font-weight: 800;
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.royal-user-role {
  color: var(--app-muted);
  font-size: 11px;
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.royal-user-arrow {
  color: var(--app-muted);
  margin-left: 7px;
}

.royal-user-toggle:hover .royal-user-arrow {
  color: var(--app-danger);
}

.royal-search-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--app-border);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.10);
  display: none;
  left: 0;
  padding: 12px 24px;
  position: absolute;
  right: 0;
  top: 66px;
  z-index: 1020;
}

.royal-search-bar.active {
  display: flex;
}

.royal-search-input {
  background: var(--app-surface-warm) !important;
  border-color: var(--app-border) !important;
  color: var(--app-text) !important;
}

.royal-search-btn {
  background: var(--app-primary) !important;
  border-color: var(--app-primary) !important;
  color: #ffffff !important;
}

.royal-search-close {
  background: #ffffff !important;
  border-color: var(--app-border) !important;
  color: var(--app-muted) !important;
}

body.sidebar-collapse .main-sidebar>.brand-link {
  padding: 10px 0 !important;
}

body.sidebar-collapse .main-sidebar>.brand-link .brand-text,
body.sidebar-collapse .sidebar-user-meta {
  display: none !important;
}

body.sidebar-collapse .sidebar-user-card {
  justify-content: center;
  margin-left: 8px;
  margin-right: 8px;
  padding: 8px 0;
}

@media (min-width: 768px) {

  body.sidebar-collapse .main-sidebar:hover>.brand-link,
  body.sidebar-collapse .main-sidebar.sidebar-focused>.brand-link {
    background: #ffffff !important;
    padding: 10px 16px !important;
    width: 250px !important;
  }

  body.sidebar-collapse .main-sidebar:hover>.brand-link .brand-text,
  body.sidebar-collapse .main-sidebar.sidebar-focused>.brand-link .brand-text,
  body.sidebar-collapse .main-sidebar:hover .sidebar-user-meta,
  body.sidebar-collapse .main-sidebar.sidebar-focused .sidebar-user-meta {
    display: block !important;
  }

  body.sidebar-collapse .main-sidebar:hover .sidebar-user-card,
  body.sidebar-collapse .main-sidebar.sidebar-focused .sidebar-user-card {
    justify-content: flex-start;
    margin-left: 10px;
    margin-right: 10px;
    padding: 10px;
  }
}

@media (max-width: 767.98px) {
  .royal-navbar {
    padding: 0 16px;
  }

  .royal-breadcrumb,
  .royal-link-text,
  .royal-user-role,
  .royal-user-name,
  .royal-quick-actions,
  .royal-search-toggle {
    display: none !important;
  }

  .royal-user-profile .royal-user-toggle {
    min-width: 116px;
    padding: 4px 9px 4px 5px !important;
  }

  .royal-user-profile .royal-user-info {
    display: none !important;
  }

  .royal-user-profile .royal-user-arrow {
    align-items: center;
    color: var(--app-danger) !important;
    display: inline-flex !important;
    font-size: 13px;
    font-weight: 800;
    gap: 5px;
    margin-left: 7px;
    white-space: nowrap;
  }

  .royal-user-profile .royal-user-arrow::after {
    content: "Sign out";
    font-size: 11px;
    line-height: 1;
  }
}

/* DASHBOARD STYLES MOVED FROM BoXinfo.Doel.php */

/* ------------------------------------------------------
           DASHBOARD STYLING - MATCHING SIDEBAR THEME
           Fixed text contrast for better visibility
        ------------------------------------------------------ */
:root {
  --sidebar-primary: #0f172a;
  --sidebar-secondary: #1e293b;
  --sidebar-accent: #0f766e;
  --sidebar-highlight: #115e59;
  --sidebar-text: #f8fafc;
  --sidebar-text-muted: #94a3b8;
  --sidebar-border: rgba(15, 118, 110, 0.18);
  --sidebar-success: #27ae60;
  /* Green - success states */
  --sidebar-warning: #d97706;
  --sidebar-danger: #dc2626;
  --sidebar-gradient-start: #f5f7fb;
  --sidebar-gradient-end: #eef3f8;

  /* Semantic mappings - with improved contrast */
  --primary: var(--app-accent);
  --primary-light: var(--app-primary-hover);
  --primary-soft: rgba(15, 118, 110, 0.1);
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-500: #dc2626;
  --red-600: #b91c1c;
  --green-500: #27ae60;
  /* Using sidebar success */
  --green-600: #229954;
  /* Darker green */
  --blue-50: rgba(37, 99, 235, 0.1);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.03);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --radius-sm: 0px;
  --radius: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
}

/* reset / base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, var(--sidebar-gradient-start) 0%, var(--sidebar-gradient-end) 100%);
  color: var(--gray-800);
  /* Darker text for better contrast */
  line-height: 1.5;
  min-height: 100vh;
}

/* main content section */
.content {
  padding: 2rem;
  background: var(--gray-50);
  min-height: 100vh;
  border-radius: var(--radius-lg) 0 0 0;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
}

.auth-password-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: #64748b;
  cursor: pointer;
  display: flex;
  height: 100%;
  justify-content: center;
  min-width: 48px;
  padding: 0 16px;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 2;
}
.auth-password-toggle:hover, .auth-password-toggle:focus { color: #0f766e; outline: none; }
.auth-input-group:has(.auth-password-toggle) .form-control { padding-right: 50px; }
.auth-help-row { display: flex; justify-content: flex-end; margin-top: -4px; }
.auth-help-row a, .auth-forgot-link { color: #0f766e; font-size: 14px; font-weight: 700; }
.auth-help-center { justify-content: center; margin-top: 22px; }
.auth-submit-wide { justify-content: center; margin-top: 6px; width: 100%; }
.auth-dev-link { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; color: #1e3a8a; font-size: 13px; margin-top: 18px; padding: 12px; word-break: break-word; }

.container-fluid {
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* card – clean, minimal, elevated with theme accents */
.card {
  background: var(--app-surface) !important;
  border-radius: 12px !important;
  border: 1px solid var(--app-border) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03) !important;
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  margin-bottom: 1.5rem;
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--app-accent), var(--app-primary-hover));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover::before {
  opacity: 1;
}

.card-header {
  padding: 1.25rem 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--app-surface) !important;
  border-bottom: none !important;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--app-primary);
  /* Dark navy for better contrast */
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-title i {
  color: var(--app-accent);
  transition: transform 0.3s ease;
}

.card:hover .card-title i {
  transform: scale(1.1) rotate(5deg);
}

.card-tools {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-tool {
  background: transparent;
  border: none;
  color: var(--gray-600);
  /* Darker icon color */
  padding: 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-tool:hover {
  background: var(--primary-soft);
  color: var(--app-accent);
  transform: rotate(90deg);
}

.card-body {
  padding: 2rem;
}

.card-footer {
  padding: 1.25rem 2rem;
  background: var(--app-bg);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: flex-end;
}

/* buttons with theme colors */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  background: var(--app-bg);
  color: var(--gray-800);
  /* Darker text */
  border-color: var(--gray-300);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(15, 118, 110, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
  z-index: 0;
}

.btn:hover::before {
  width: 200px;
  height: 200px;
}

.btn:hover {
  background: var(--app-bg);
  border-color: var(--app-accent);
  color: var(--app-primary);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(15, 118, 110, 0.18);
}

.btn-primary {
  background: linear-gradient(90deg, var(--app-accent), var(--app-primary-hover));
  color: white;
  border-color: transparent;
}

.btn-primary:hover {
  background: linear-gradient(90deg, var(--app-primary-hover), var(--app-accent));
  color: white;
  border-color: transparent;
}

.btn-warning {
  background: var(--app-bg);
  color: #c75d0d;
  /* Darker orange for contrast */
  border-color: var(--gray-300);
}

.btn-warning:hover {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #c75d0d;
}

.btn-danger {
  background: var(--app-bg);
  color: #b33c2e;
  /* Darker red for contrast */
  border-color: var(--gray-300);
}

.btn-danger:hover {
  background: var(--red-50);
  border-color: var(--app-danger);
  color: #b33c2e;
}

/* grid system */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: -0.75rem;
}

.col-12,
.col-md-6,
.col-md-3,
.col-xl-3,
.col-xl-4,
.col-xl-6,
.col-xl-8,
.col-md-4,
.col-md-2 {
  padding: 0.75rem;
  width: 100%;
}

.col-12 {
  flex: 0 0 100%;
}

@media (min-width: 768px) {
  .col-md-2 {
    flex: 0 0 16.666%;
  }

  .col-md-3 {
    flex: 0 0 25%;
  }

  .col-md-4 {
    flex: 0 0 33.333%;
  }

  .col-md-6 {
    flex: 0 0 50%;
  }
}

@media (min-width: 1200px) {
  .col-xl-3 {
    flex: 0 0 25%;
  }

  .col-xl-4 {
    flex: 0 0 33.333%;
  }

  .col-xl-6 {
    flex: 0 0 50%;
  }

  .col-xl-8 {
    flex: 0 0 66.666%;
  }
}

/* form groups / labels - IMPROVED CONTRAST */
.form-group {
  margin-bottom: 0;
}

label,
.metric-label,
.stat-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-700);
  /* Darker for better contrast */
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.metric-value {
  font-size: 2rem;
  font-weight: 600;
  color: var(--app-primary);
  /* Dark navy */
  line-height: 1.2;
}

/* dashboard custom widgets with theme colors */
.metric-card {
  background: var(--app-bg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: none;
  border: none;
  /* Removed heavy border */
  transition: all 0.2s;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;

  border-radius: 0 !important;
  border: 1px solid var(--app-border) !important;
  box-shadow: none !important;
}

.metric-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--app-accent), var(--app-primary-hover));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.metric-card:hover::after {
  transform: scaleX(1);
}

.metric-card:hover {
  box-shadow: none;
  border-color: var(--app-accent);
  transform: translateY(-2px);
}

.metric-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.metric-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-soft);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--app-accent);
  font-size: 1.5rem;
  transition: all 0.3s ease;
}

.metric-card:hover .metric-icon {
  transform: scale(1.1) rotate(5deg);
  background: var(--app-accent);
  color: white;
}

.metric-icon-danger {
  background: var(--red-50);
  color: var(--app-danger);
}

.metric-icon-danger:hover {
  background: var(--app-danger);
  color: white;
}

.metric-icon-success {
  background: rgba(39, 174, 96, 0.1);
  color: #2f9e62;
}

.metric-icon-success:hover {
  background: #2f9e62;
  color: white;
}

.metric-icon-warning {
  background: rgba(243, 156, 18, 0.1);
  color: #f59e0b;
}

.metric-icon-warning:hover {
  background: #f59e0b;
  color: white;
}

/* IMPROVED PROGRESS SECTION TEXT CONTRAST */
.progress-section {
  margin-top: 0.5rem;
}

.progress-section .small-stat {
  color: var(--gray-700);
  /* Darker text */
  font-weight: 500;
}

.progress {
  background: var(--gray-300);
  /* Darker background for better visibility */
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
  margin: 0.75rem 0;
}

.progress-bar {
  background: linear-gradient(90deg, var(--app-accent), var(--app-primary-hover));
  height: 100%;
  border-radius: 20px;
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  /* Bolder for better readability */
  background: var(--gray-200);
  color: var(--gray-800);
  /* Darker text */
  transition: all 0.2s ease;
}

.badge-success {
  background: rgba(39, 174, 96, 0.15);
  color: #1e7b4c;
  /* Darker green */
  font-weight: 600;
}

.badge-danger {
  background: rgba(231, 76, 60, 0.15);
  color: #b33c2e;
  /* Darker red */
  font-weight: 600;
}

.badge-warning {
  background: rgba(243, 156, 18, 0.15);
  color: #b35f0d;
  /* Darker orange */
  font-weight: 600;
}

.badge-info {
  background: var(--primary-soft);
  color: #1a5a8c;
  /* Darker blue */
  font-weight: 600;
}

.badge:hover {
  transform: scale(1.05);
}

/* IMPROVED TABLE CONTRAST */
.table-modern {
  width: 100%;
  border-collapse: collapse;
}

.table-modern th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-800);
  /* Darker header text */
  text-transform: uppercase;
  letter-spacing: 0.025em;
  border-bottom: 2px solid var(--gray-400);
  /* Thicker, darker border */
  background: var(--gray-100);
}

.table-modern td {
  padding: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  color: var(--gray-800);
  /* Darker text */
  font-size: 0.938rem;
  font-weight: 500;
}

.table-modern tr {
  transition: all 0.2s ease;
}

.table-modern tr:hover td {
  background: var(--primary-soft);
  color: var(--app-primary);
}

.table-modern tr:last-child td {
  border-bottom: none;
}

/* IMPROVED LIST ITEM CONTRAST */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  color: var(--gray-800);
  /* Darker text */
  font-weight: 500;
}

.list-item:hover {
  background: var(--primary-soft);
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  border-radius: var(--radius);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item .text-muted {
  color: var(--gray-600);
  /* Darker muted text */
  font-weight: 400;
}

/* TEXT UTILITIES - IMPROVED CONTRAST */
.text-muted {
  color: var(--gray-600) !important;
  /* Darker muted text */
  font-weight: 400;
}

.text-primary {
  color: var(--app-accent) !important;
  font-weight: 600;
}

.text-success {
  color: #1e7b4c !important;
  /* Darker green */
  font-weight: 600;
}

.text-danger {
  color: #b33c2e !important;
  /* Darker red */
  font-weight: 600;
}

.text-warning {
  color: #b35f0d !important;
  /* Darker orange */
  font-weight: 600;
}

.fw-600 {
  font-weight: 600;
}

.fw-500 {
  font-weight: 500;
}

.small-stat {
  font-size: 0.875rem;
  color: var(--gray-700);
  /* Darker text */
  font-weight: 500;
}

/* STAT CARD TEXT IMPROVEMENTS */
.stat-label {
  color: var(--gray-700);
  font-weight: 600;
  font-size: 0.8rem;
}

.stat-value {
  color: var(--app-primary);
  font-weight: 700;
  font-size: 1.5rem;
}

.stat-change {
  font-size: 0.875rem;
  font-weight: 600;
}

.stat-change.positive {
  color: #1e7b4c;
}

.stat-change.negative {
  color: #b33c2e;
}

/* animations exactly like edit form */
.row>[class*="col-"] {
  animation: slideUp 0.4s ease forwards;
  opacity: 0;
}

.row>[class*="col-"]:nth-child(1) {
  animation-delay: 0.05s;
}

.row>[class*="col-"]:nth-child(2) {
  animation-delay: 0.1s;
}

.row>[class*="col-"]:nth-child(3) {
  animation-delay: 0.15s;
}

.row>[class*="col-"]:nth-child(4) {
  animation-delay: 0.2s;
}

.row>[class*="col-"]:nth-child(5) {
  animation-delay: 0.25s;
}

.row>[class*="col-"]:nth-child(6) {
  animation-delay: 0.3s;
}

.row>[class*="col-"]:nth-child(n+7) {
  animation-delay: 0.35s;
}

@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

.pulse-animation {
  animation: pulse 2s infinite;
}

/* Status indicators */
.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  animation: pulse 2s infinite;
}

.status-online {
  background: #2f9e62;
}

.status-away {
  background: #f59e0b;
}

.status-busy {
  background: var(--app-danger);
}

/* Responsive fine-tune */
@media (max-width: 768px) {
  .content {
    padding: 1rem;
  }

  .card-header {
    padding: 1rem 1.5rem;
  }

  .card-body {
    padding: 1.5rem;
  }

  .metric-value {
    font-size: 1.5rem;
  }
}

/* Custom scrollbar matching theme */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-200);
}

::-webkit-scrollbar-thumb {
  background: var(--app-accent);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--app-primary-hover);
}

/* STYLES MOVED FROM Home.Doel.php */

/* =========================================================
   MODERN TABLE STYLING
========================================================= */
.table {
  width: 100%;
  margin-bottom: 1rem;
  color: var(--app-text);
  vertical-align: middle;
  border-collapse: separate;
  border-spacing: 0;
}

.table th {
  padding: 12px 16px !important;
  vertical-align: middle;
  font-weight: 700;
  font-size: 13px;
  color: var(--app-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--app-border) !important;
  background-color: var(--app-surface-warm);
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  white-space: nowrap;
}

.table td {
  padding: 14px 16px !important;
  vertical-align: middle;
  font-size: 14px;
  font-weight: 500;
  color: var(--app-text);
  border-bottom: 1px solid var(--app-border) !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  background-color: var(--app-surface);
  transition: background-color 0.2s ease;
}

.table tbody tr:hover td {
  background-color: var(--app-bg-soft) !important;
}

.table tbody tr:last-child td {
  border-bottom: none !important;
}

/* DataTables specific overrides */
table.dataTable {
  margin-top: 15px !important;
  margin-bottom: 15px !important;
  border-collapse: separate !important;
}

table.dataTable thead th {
  border-bottom: 2px solid var(--app-border) !important;
}

table.dataTable.no-footer {
  border-bottom: 1px solid var(--app-border) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--app-primary) !important;
  color: white !important;
  border: 1px solid var(--app-primary) !important;
  border-radius: 6px;
  font-weight: 600;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 6px;
  border: 1px solid transparent !important;
  transition: all 0.2s;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--app-primary-soft) !important;
  color: var(--app-primary) !important;
  border: 1px solid var(--app-border) !important;
}

/* Button group in tables */
.table .btn-group-sm>.btn,
.table .btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.2s;
}

.table .btn-primary {
  background: var(--app-primary);
  border-color: var(--app-primary);
  color: white;
}

.table .btn-primary:hover {
  background: var(--app-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(15, 118, 110, 0.2);
}

.table .btn-secondary {
  background: var(--app-muted);
  border-color: var(--app-muted);
  color: white;
}

.table .btn-secondary:hover {
  background: #475569;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(100, 116, 139, 0.2);
}

.table .btn-danger {
  background: var(--app-danger);
  border-color: var(--app-danger);
  color: white;
}

.table .btn-danger:hover {
  background: #991b1b;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(180, 35, 24, 0.2);
}

/* Status Badges */
.table .badge {
  padding: 6px 10px;
  font-weight: 700;
  font-size: 12px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.table .badge-warning {
  background-color: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
}

.table .badge-info {
  background-color: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.table .badge-success {
  background-color: #dcfce7;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

/* =========================================================
   DATATABLES WRAPPER & TOOLBAR (app-dt-*)
========================================================= */

/* Ensure the outer wrapper doesn't constrain or scroll */
.table-responsive {
  border-radius: 8px;
  border: 1px solid var(--app-border);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
  background: var(--app-surface);
  overflow: visible !important;
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* Ensure dataTables_wrapper can flex correctly inside table-responsive */
.dataTables_wrapper {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

/* Toolbar Layout */
.app-dt-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
  flex: 0 0 auto;
}

.app-dt-actions {
  flex: 1 1 auto;
}

.app-dt-actions .dt-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* DT Buttons (Copy, CSV, etc) */
.app-dt-actions .btn,
.dt-buttons .btn {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.app-dt-actions .btn:hover,
.dt-buttons .btn:hover {
  transform: translateY(-1px);
}


.app-dt-length select {
  padding: 6px 12px;
  border: 1px solid var(--app-border-strong);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--app-text) !important;
  background-color: var(--app-surface);
}

.app-dt-search {
  flex: 0 0 auto;
}

.app-dt-search input {
  padding: 7px 14px;
  border: 1px solid var(--app-border-strong);
  border-radius: 6px;
  font-size: 13px;
  width: 200px;
  background-color: var(--app-surface);
  transition: all 0.2s;
}

.app-dt-search input:focus {
  border-color: var(--app-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

/* Table Wrapper for Horizontal and Vertical Scroll */
.app-dt-table {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  display: flex;
  flex: 1 1 auto;
  min-height: 400px;
  /* Minimum height before scrolling */
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  margin-bottom: 16px;
  background: var(--app-surface);
}

/* Make table header sticky during vertical scroll */
.app-dt-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--app-surface-warm) !important;
  box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
  /* Subtle shadow for sticky header */
}

table.dataTable {
  margin: 0 !important;
  border-bottom: none !important;
}

/* Footer Layout */
.app-dt-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 15px;
  /* Added spacing */
}

.app-dt-info {
  font-size: 13px;
  color: var(--app-muted);
}

.app-dt-pagination {
  display: flex;
  align-items: center;
}

/* Ensure pagination buttons are visible */
.dataTables_wrapper .dataTables_paginate {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 !important;
}

.dataTables_wrapper .dataTables_paginate .pagination {
  margin: 0;
  display: flex;
  padding-left: 0;
  list-style: none;
  border-radius: 0.25rem;
}

.dataTables_wrapper .dataTables_paginate .page-item .page-link,
.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 6px 12px;
  margin: 0 2px;
  border-radius: 6px !important;
  border: 1px solid transparent;
  color: var(--app-text) !important;
  background: var(--app-surface) !important;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link,
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--app-primary) !important;
  color: white !important;
  border-color: var(--app-primary) !important;
}

.dataTables_wrapper .dataTables_paginate .page-item:not(.active) .page-link:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button:not(.current):hover {
  background: var(--app-primary-soft) !important;
  color: var(--app-primary) !important;
  border-color: var(--app-border) !important;
}

.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  color: var(--app-muted) !important;
  background: transparent !important;
  border-color: transparent !important;
  cursor: not-allowed;
  box-shadow: none;
}

/* Mobile optimizations */
@media (max-width: 768px) {

  .table td,
  .table th {
    padding: 10px 12px !important;
    font-size: 13px;
    white-space: nowrap;
  }

  .app-dt-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .app-dt-actions,
  .app-dt-length,
  .app-dt-search {
    width: 100%;
    display: flex;
  }

  .app-dt-actions .dt-buttons {
    width: 100%;
    justify-content: center;
  }

  .app-dt-length {
    justify-content: center;
  }

  .app-dt-search input {
    width: 100%;
  }

  .app-dt-footer {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }

/* Force button text to show globally on mobile (Fixes Print buttons and Action buttons) */
  .btn span.d-none,
  .btn span.d-sm-none,
  .btn span.d-md-none,
  .btn span.d-lg-none,
  .btn span.d-sm-inline,
  .btn span.d-md-inline,
  .btn span.d-lg-inline {
    display: inline !important;
  }
}

/* =========================================================
   CONTENT HEADER STYLING (Professional & Consistent)
========================================================= */
.royal-content-header {
  padding: 20px 24px;
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.royal-page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--app-text);
  display: flex;
  align-items: center;
  letter-spacing: -0.01em;
}

.royal-page-title i {
  color: var(--app-primary);
  font-size: 1.25rem;
  margin-right: 12px;
}

.royal-breadcrumb-header {
  background: transparent;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.royal-breadcrumb-header .breadcrumb-item {
  font-size: 0.875rem;
  font-weight: 600;
}

.royal-breadcrumb-header .breadcrumb-item a {
  color: var(--app-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s;
}

.royal-breadcrumb-header .breadcrumb-item a:hover {
  color: var(--app-primary);
}

.royal-breadcrumb-header .breadcrumb-item.active {
  color: var(--app-primary);
}

.royal-breadcrumb-header .breadcrumb-item+.breadcrumb-item::before {
  content: "\f105";
  /* FontAwesome angle-right */
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
  font-weight: 900;
  color: var(--app-border-strong);
  padding: 0 8px;
}

/* =========================================================
   GLOBAL CREATE / EDIT FORM SYSTEM
========================================================= */
.content form.app-form {
  display: block;
}

.content .app-form-card {
  background: #ffffff !important;
  border: 1px solid var(--app-border) !important;
  border-radius: 14px !important;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08) !important;
  overflow: hidden;
}

.app-form-card > .card-header {
  background: #ffffff !important;
  border-bottom: 1px solid #e8eef5 !important;
  min-height: 64px;
  padding: 14px 18px !important;
}

.app-form-card > .card-header .card-title {
  align-items: center;
  color: var(--app-text) !important;
  display: flex;
  font-size: 18px !important;
  font-weight: 850 !important;
  gap: 10px;
  margin: 0;
}

.app-form-card .btn-tool[data-card-widget] {
  display: none !important;
}

.app-form-card .card-body {
  padding: 18px !important;
}

.app-form .row {
  margin-left: -8px;
  margin-right: -8px;
}

.app-form [class*="col-"] {
  padding-left: 8px;
  padding-right: 8px;
}

.app-form .form-group {
  margin-bottom: 16px;
}

.app-form label,
.app-form .font-weight-bold {
  color: #263446;
  display: block;
  font-size: 12px;
  font-weight: 850 !important;
  letter-spacing: 0.03em;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.app-form .text-danger {
  color: #dc2626 !important;
}

.app-form .form-control,
.app-form .custom-select,
.app-form textarea,
.app-form input[type="file"],
.app-form .select2-container--default .select2-selection--single,
.app-form .select2-container--default .select2-selection--multiple,
.app-form .select2-container--bootstrap4 .select2-selection {
  background: #f8fafc !important;
  border: 1px solid #dbe4ee !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  color: var(--app-text) !important;
  font-size: 14px !important;
  min-height: 44px !important;
  outline: 0 !important;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
  width: 100% !important;
}

.app-form .form-control,
.app-form .custom-select,
.app-form input[type="file"] {
  padding: 9px 12px !important;
}

.app-form input[type="file"],
input[type="file"].form-control,
input[type="file"].form-control-file {
  align-items: center;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1px solid #dbe4ee !important;
  border-radius: 10px !important;
  color: #475569 !important;
  cursor: pointer;
  display: flex;
  font-size: 13px !important;
  font-weight: 700;
  min-height: 44px !important;
  padding: 6px 10px !important;
}

.app-form input[type="file"]::file-selector-button,
input[type="file"].form-control::file-selector-button,
input[type="file"].form-control-file::file-selector-button {
  background: var(--app-primary);
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  margin-right: 12px;
  min-height: 30px;
  padding: 6px 12px;
  transition: background-color 160ms ease, transform 160ms ease;
}

.app-form input[type="file"]::file-selector-button:hover,
input[type="file"].form-control::file-selector-button:hover,
input[type="file"].form-control-file::file-selector-button:hover {
  background: var(--app-primary-hover);
  transform: translateY(-1px);
}

.app-form input[type="file"]:focus,
input[type="file"].form-control:focus,
input[type="file"].form-control-file:focus {
  border-color: var(--app-primary) !important;
  box-shadow: var(--app-focus) !important;
}

.app-form img,
.app-table-card img {
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #dbe4ee, 0 8px 18px rgba(15, 23, 42, 0.12);
  object-fit: cover;
}

.app-form textarea.form-control {
  min-height: 112px !important;
  resize: vertical;
}

.app-form .form-control:focus,
.app-form .custom-select:focus,
.app-form textarea:focus,
.app-form .select2-container--open .select2-selection,
.app-form .select2-container--focus .select2-selection {
  background: #ffffff !important;
  border-color: var(--app-primary) !important;
  box-shadow: var(--app-focus) !important;
}

.app-form .select2-container {
  width: 100% !important;
}

.app-form .select2-selection__rendered {
  color: var(--app-text) !important;
  line-height: 42px !important;
  padding-left: 12px !important;
}

.app-form .select2-selection__arrow {
  min-height: 42px !important;
}

.app-form .app-required-note,
.app-form .alert-danger {
  align-items: center;
  background: #fff7ed !important;
  border: 1px solid #fed7aa !important;
  border-radius: 12px !important;
  color: #9a3412 !important;
  display: flex;
  font-size: 13px !important;
  font-weight: 800 !important;
  justify-content: center;
  margin: 0 0 18px !important;
  min-height: 46px;
  padding: 10px 14px !important;
}

.app-form-validation-note,
#workordervalidity {
  font-size: 14px !important;
  line-height: 1.4 !important;
  min-height: 0 !important;
}

.app-form .btn {
  align-items: center;
  border-radius: 10px !important;
  display: inline-flex;
  font-size: 14px !important;
  font-weight: 850 !important;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px !important;
}

.app-form .btn-warning,
.app-form .btn-secondary {
  background: #ffffff !important;
  border: 1px solid #dbe4ee !important;
  color: #475569 !important;
}

.app-form .btn-warning:hover,
.app-form .btn-secondary:hover {
  background: #f8fafc !important;
  color: var(--app-primary) !important;
}

.app-form .btn-primary,
.app-form input.btn-primary {
  background: var(--app-primary) !important;
  border: 1px solid var(--app-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.18);
}

.app-form .btn-primary:hover,
.app-form input.btn-primary:hover {
  background: var(--app-primary-hover) !important;
  border-color: var(--app-primary-hover) !important;
}

.app-form .btn-danger,
.app-form .ibtnDel,
.app-form .deleteRow {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
}

.app-form h4.card-title,
.app-form p.font-weight-bold {
  color: var(--app-primary) !important;
  font-size: 16px !important;
  margin: 8px 0 14px !important;
  text-transform: none;
}

.app-form-table-scroll,
.app-form .table-responsive {
  background: #ffffff;
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  overflow: auto !important;
  width: 100%;
}

.app-form-order-table,
.app-form table.order-list {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  margin: 0 !important;
  min-width: 1160px;
  width: 100% !important;
}

.app-form-order-table thead th,
.app-form table.order-list thead th {
  background: #f8fafc !important;
  border-bottom: 1px solid #dbe4ee !important;
  color: #64748b !important;
  font-size: 12px !important;
  font-weight: 850 !important;
  letter-spacing: 0.04em;
  padding: 12px !important;
  text-transform: uppercase;
  white-space: nowrap;
}

.app-form-order-table tbody td,
.app-form table.order-list tbody td {
  background: #ffffff !important;
  border-top: 1px solid #e8eef5 !important;
  padding: 9px 10px !important;
  vertical-align: middle !important;
}

.app-form table.order-list .form-control,
.app-form table.order-list .custom-select,
.app-form table.order-list .select2-container {
  min-width: 120px !important;
}

.app-form table.order-list td:first-child .form-control,
.app-form table.order-list td:first-child .select2-container,
.app-form table.order-list td:first-child select {
  min-width: 260px !important;
}

.app-form table.order-list input[placeholder],
.app-form table.order-list textarea[placeholder] {
  text-overflow: clip;
}

.app-form table.order-list td[style],
.app-form table.order-list th[style],
.app-form table.order-list select[style],
.app-form table.order-list input[style] {
  width: 100% !important;
}

.app-form table.order-list select[style],
.app-form table.order-list input[style],
.app-form table.order-list textarea[style] {
  min-width: 120px !important;
}

.app-form table.order-list td:first-child select[style],
.app-form table.order-list td:first-child input[style],
.app-form table.order-list td:first-child textarea[style],
.app-form table.order-list td:first-child .form-control,
.app-form table.order-list td:first-child .select2-container {
  min-width: 260px !important;
}

.app-form table.order-list input[type="button"].btn-block,
.app-form #addrow {
  border-radius: 0 !important;
  min-height: 46px !important;
  width: 100% !important;
}

.app-form #totalPrice,
.app-form input[readonly] {
  background: #eef3f8 !important;
  color: #64748b !important;
  font-weight: 800;
}

.app-form-card > .card-footer,
.app-form-actions {
  align-items: center;
  background: #f8fafc !important;
  border-top: 1px solid #e8eef5 !important;
  display: flex !important;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 18px !important;
}

@media (max-width: 767.98px) {
  .content .app-form-card {
    border-radius: 12px !important;
  }

  .app-form-card .card-body {
    padding: 14px !important;
  }

  .app-form-card > .card-footer,
  .app-form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .app-form .btn {
    width: 100%;
  }
}

/* =========================================================
   FORM DETAIL / PRINT-LIKE PAGE POLISH
========================================================= */
.app-form-card .card-body {
  padding: 14px 16px !important;
}

.app-form .row {
  row-gap: 8px;
}

.app-form .form-group {
  margin-bottom: 12px;
}

.app-form p:not(.app-required-note):not(.font-weight-bold) {
  color: var(--app-text);
  font-weight: 700;
  line-height: 1.45;
  margin: 0;
}

.app-form .details-div-area,
.content .details-div-area {
  background: #f8fafc !important;
  border: 1px solid #dbe4ee !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  margin: 0 0 14px !important;
  padding: 10px 12px !important;
}

.app-form .details-div-area table,
.content .details-div-area table {
  margin: 0 !important;
  width: 100% !important;
}

.app-form .details-div-area td,
.content .details-div-area td {
  border: 0 !important;
  border-bottom: 1px solid #e8eef5 !important;
  color: #475569 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  padding: 5px 8px !important;
  vertical-align: top !important;
}

.app-form .details-div-area tr:last-child td,
.content .details-div-area tr:last-child td {
  border-bottom: 0 !important;
}

.app-form .details-div-area .data-row,
.content .details-div-area .data-row {
  color: var(--app-text) !important;
  font-weight: 850 !important;
}

.app-form table.order-list thead th {
  padding: 10px 12px !important;
}

.app-form table.order-list tbody td {
  padding: 8px 10px !important;
}

.app-form table.order-list .form-control,
.app-form table.order-list .custom-select {
  min-height: 38px !important;
  padding: 7px 10px !important;
}

.app-form table.order-list .select2-container--default .select2-selection--single,
.app-form table.order-list .select2-container--bootstrap4 .select2-selection {
  min-height: 38px !important;
}

.app-form table.order-list .select2-selection__rendered {
  line-height: 36px !important;
}

.app-form table.order-list .select2-selection__arrow {
  min-height: 36px !important;
}

.app-form table.order-list input[type="checkbox"] {
  accent-color: var(--app-primary);
  height: 18px;
  width: 18px;
}

.app-form table.order-list td:last-child {
  min-width: 84px;
  text-align: center;
  white-space: nowrap;
}

.app-form table.order-list td:last-child label,
.app-form table.order-list td:last-child .form-check-label {
  color: var(--app-text) !important;
  display: inline-flex !important;
  font-size: 11px !important;
  justify-content: center;
  letter-spacing: 0;
  margin: 0 !important;
  text-transform: none;
}

@media screen {
  .content .div-design-print,
  .app-form .div-design-print {
    background: #ffffff !important;
    border: 1px solid #dbe4ee !important;
    border-radius: 14px !important;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08) !important;
    margin: 0 auto 16px !important;
    max-width: 1180px !important;
    padding: 18px !important;
    width: min(100%, 1180px) !important;
  }

  .content .div-design-print h1,
  .content .div-design-print h2,
  .content .div-design-print h3,
  .app-form .div-design-print h1,
  .app-form .div-design-print h2,
  .app-form .div-design-print h3 {
    color: var(--app-text) !important;
    font-weight: 850 !important;
    letter-spacing: 0 !important;
  }

  .content .div-design-print h1,
  .app-form .div-design-print h1 {
    font-size: 24px !important;
    line-height: 1.2 !important;
  }

  .content .div-design-print h2,
  .app-form .div-design-print h2 {
    font-size: 20px !important;
    line-height: 1.25 !important;
  }

  .content .div-design-print h3,
  .app-form .div-design-print h3 {
    font-size: 18px !important;
    line-height: 1.3 !important;
  }

  .content .div-design-print table,
  .app-form .div-design-print table {
    width: 100% !important;
  }

  .content .div-design-print td,
  .app-form .div-design-print td {
    border-color: #e8eef5 !important;
    color: var(--app-text) !important;
    line-height: 1.35 !important;
    padding: 5px 8px !important;
  }

  .content .information-area,
  .app-form .information-area {
    background: #f8fafc !important;
    border: 1px solid #dbe4ee !important;
    border-radius: 12px !important;
    margin: 12px 0 !important;
    padding: 12px !important;
  }
}

@media print {
  .main-header,
  .main-sidebar,
  .main-footer,
  .control-sidebar,
  .royal-navbar,
  .royal-content-header,
  .content-header,
  .royal-page-title,
  .royal-breadcrumb,
  .royal-breadcrumb-header,
  .breadcrumb,
  .navbar,
  .sidebar,
  #royalNavbar,
  #printpagebutton,
  .d-print-none,
  .no-print,
  .card-header.d-print-none {
    display: none !important;
  }

  .content-wrapper,
  .content,
  .container,
  .container-fluid {
    background: #ffffff !important;
    box-shadow: none !important;
    margin: 0 !important;
    max-width: none !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .content .div-design-print,
  .app-form .div-design-print {
    border: 0 !important;
    box-shadow: none !important;
    max-width: none !important;
  }
}

body,
.content-wrapper,
.main-footer {
  background: var(--app-bg) !important;
}

.content {
  background: transparent !important;
  box-shadow: none !important;
}
