:root {
    --sidebar-bg: #d3e8f3;
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --primary: #005986;
    --primary-hover: #02547d;
    --excel: #a3cd4b;
    --excel-hover: #a3cd4b;
    --text: #0f172a;
    --text-light: #64748b;
    --border: #e2e8f0;
    --bg: #f1f5f9;
    --card: #ffffff;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Roboto", sans-serif;
}

/* Define Regular Weight */
@font-face {
  font-family: "Roboto";
  src: url("../fonts/Roboto-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}

/* Define Bold Weight */
@font-face {
  font-family: "Roboto";
  src: url("../fonts/Roboto-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
  font-family: "Roboto", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.card {
  width: 100% !important;
  border-radius: 20px !important;
}

iframe {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  display: block;
  overflow: auto;
}

.embedded-page {
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}

/** Login start **/
.login-title {
  font-weight: 700;
  color: var(--text);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--sidebar-bg), #e8f6ca);
  padding: 1rem;
}

.login-card {
  background: var(--card);
  padding: 2rem;
  border-radius: 15px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  height: auto;
  max-width: 450px;
}

.login-logo {
  text-align: center;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: center;
}

.login-logo .image-container {
  width: 160px;
  height: 80px;
  background-color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: 8px;
}

.login-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.captcha-box {
  background: #f8fafc;
  border: 1px dashed var(--border);
  padding: 8px;
  text-align: center;
  font-size: 25px;
  font-weight: bold;
  letter-spacing: 5px;
  color: var(--primary);
  user-select: none;
  border-radius: 8px;
  margin-bottom: 5px;
  font-family: "Courier New", Courier, monospace;
  flex: 1;
}

.captcha-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.captcha-img {
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex: 1;
  background-color: #fff;
}

.refresh-captcha-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  padding: 0 16px;
  align-self: stretch;
  margin-bottom: 5px;
}

.refresh-captcha-btn:hover {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}
.forgot-password-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}

    .forgot-password-container p {
        margin: 0;
    }
/* Loginend*/
/* Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 998;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Sidebar */
.sidebar {
  width: 250px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--sidebar-bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  z-index: 999;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
}

.logo {
  height: 76px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-container {
  width: 190px;
  height: 56px;
  background-color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: 8px;
  padding: 4px 8px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-menu {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-menu::-webkit-scrollbar {
  width: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.nav-link,
.dropdown-btn {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: #475569;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  transition: all 0.2s ease;
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: 6px;
  cursor: pointer;
}

.nav-link {
  justify-content: flex-start;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #475569;
  transition: color 0.2s ease;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.nav-icon-sm {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #64748b;
  transition: color 0.2s ease;
}

.nav-icon-sm svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.nav-icon i {
  font-size: 18px;
  line-height: 1;
  text-align: center;
}

.nav-icon-sm i {
  font-size: 14px;
  line-height: 1;
  text-align: center;
}

.nav-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  font-weight: 600;
}

.nav-link.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(0, 89, 134, 0.25);
}

.nav-link.active .nav-icon,
.nav-link.active .nav-icon svg,
.nav-link.active .nav-icon i {
  color: var(--white);
  fill: var(--white);
}

.nav-link:hover,
.dropdown-btn:hover {
  background: rgba(255, 255, 255, 0.6);
  color: var(--primary);
}

.nav-link:hover .nav-icon,
.dropdown-btn:hover .nav-icon {
  color: var(--primary);
}

.sidebar-dropdown {
  position: relative;
  margin-bottom: 6px;
}

.dropdown-btn .label {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.dropdown-btn .arrow {
  transition: transform 0.3s ease;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-dropdown.active .dropdown-btn .arrow {
  transform: rotate(180deg);
}

/* Expanded accordion submenu (default expanded sidebar) */
.sidebar:not(.collapsed) .submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding-left: 12px;
}

.sidebar:not(.collapsed) .sidebar-dropdown.active .submenu {
  max-height: 2000px; /* tall enough for long groups (e.g. Master); .sidebar-menu scrolls */
}

.sidebar:not(.collapsed) .submenu .submenu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin-top: 4px;
  font-size: 13.5px;
  color: #64748b;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-weight: 550;
}

.sidebar:not(.collapsed) .submenu .submenu-link:hover,
.sidebar:not(.collapsed) .submenu .submenu-link.active {
  background: rgba(255, 255, 255, 0.7);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.8);
  transition: var(--transition);
}

.sidebar-profile img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
  flex-shrink: 0;
}

.sidebar-profile h6 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.sidebar-profile small {
  color: #64748b;
  font-size: 11.5px;
  display: block;
}

/* =========================================================
   COLLAPSED SIDEBAR (Desktop & Tablet)
   ========================================================= */
.sidebar.collapsed {
  width: 76px;
}

.sidebar.collapsed .logo {
  padding: 10px 12px;
}

.sidebar.collapsed .logo .image-container {
  width: 48px;
  height: 48px;
  padding: 3px;
  border-radius: 8px;
}

.sidebar.collapsed .nav-link,
.sidebar.collapsed .dropdown-btn {
  justify-content: center;
  padding: 12px 0;
  position: relative;
}

.sidebar.collapsed .nav-text,
.sidebar.collapsed .dropdown-btn .label .nav-text,
.sidebar.collapsed .dropdown-btn .arrow,
.sidebar.collapsed .sidebar-profile .profile-info {
  display: none !important;
}

.sidebar.collapsed .dropdown-btn .label {
  justify-content: center;
  gap: 0;
}

.sidebar.collapsed .sidebar-profile {
  justify-content: center;
  padding: 8px;
}

/* Collapsed Dropdown Popover Flyout */
.sidebar.collapsed .sidebar-dropdown {
  position: relative;
}

.sidebar.collapsed .sidebar-dropdown .submenu {
  position: absolute;
  left: 78px;
  top: 0;
  min-width: 190px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 8px;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  max-height: none;
}

.sidebar.collapsed .sidebar-dropdown:hover .submenu,
.sidebar.collapsed .sidebar-dropdown.active .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

.sidebar.collapsed .sidebar-dropdown .submenu .submenu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--text);
  margin-top: 2px;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.sidebar.collapsed .sidebar-dropdown .submenu .submenu-link .nav-text {
  display: inline-block !important;
  color: var(--text);
}

.sidebar.collapsed .sidebar-dropdown .submenu .submenu-link:hover,
.sidebar.collapsed .sidebar-dropdown .submenu .submenu-link.active {
  background-color: #f1f5f9;
  color: var(--primary);
}

.sidebar.collapsed .sidebar-dropdown .submenu .submenu-link:hover .nav-text,
.sidebar.collapsed .sidebar-dropdown .submenu .submenu-link.active .nav-text {
  color: var(--primary);
  font-weight: 600;
}

/* Main Content Area */
.main {
  margin-left: 250px;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .main,
.main.collapsed {
  margin-left: 76px;
}

/* Topbar */
.topbar {
  height: 76px;
  min-height: 76px;
  max-height: 76px;
  flex-shrink: 0;
  background: #EDF5E8;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
  z-index: 10;
}

.menu-toggle {
  display: flex !important;
  width: 40px;
  height: 40px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.menu-toggle:hover {
  background: #f1f5f9;
  border-color: var(--primary);
  transform: scale(1.05);
}

.menu-toggle svg {
  width: 22px;
  height: 22px;
  fill: var(--primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.user-info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.user-info p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-light);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: #fee2e2;
  color: #ef4444;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.logout-btn svg {
  width: 18px;
  height: 18px;
  fill: #ef4444;
  transition: var(--transition);
}

.logout-btn:hover {
  background: #ef4444;
  color: #fff;
}

.logout-btn:hover svg {
  fill: #ffffff;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  margin: 0;
}

.page-subtitle {
  color: var(--text-light);
  font-size: 14px;
  margin-top: 4px;
}

/* Content Area - Scrollable Body */
.content {
  flex: 1 1 0%;
  width: 100%;
  min-height: 0;
  height: calc(100vh - 76px - 56px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 32px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.content::-webkit-scrollbar {
  width: 6px;
}

.content::-webkit-scrollbar-track {
  background: transparent;
}

.content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 6px;
}

.content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-details h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-details h2 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1;
}

.stat-details p {
  font-size: 13px;
  font-weight: 500;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Chart Section */
.chart-card {
  background: var(--card);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.chart-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
}

.chart-placeholder {
  height: 300px;
  background: var(--bg);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  border: 1px dashed #cbd5e1;
}

.chart-placeholder i {
  font-size: 48px;
  margin-bottom: 16px;
  color: #94a3b8;
}

/* Footer - Fixed at Bottom */
.footer {
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  flex-shrink: 0;
  background: #EDF5E8;
  border-top: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-light);
  font-size: 14px;
  font-weight: 500;
  z-index: 10;
}

.custom-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.custom-card-header {
  background: linear-gradient(135deg, var(--sidebar-bg), var(--primary));
  color: var(--white);
  padding: 1.5rem 2rem;
  border-bottom: none;
}

.custom-card-header h4 {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.custom-card-header p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
}

.custom-label {
  font-size: 0.9rem;
  font-weight: bold;
  color: #11161e;
  margin-bottom: 0.4rem;
  display: block;
}

.custom-input,
.custom-textarea,
.form-select.custom-input {
  background-color: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 35px;
  padding: 0.4rem 1rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
  transition: all 0.3s ease;
  color: var(--text);
  font-size: 0.85rem;
}

.custom-textarea {
  min-height: 120px;
  resize: vertical;
}

.custom-input::placeholder,
.custom-textarea::placeholder {
  color: #94a3b8;
  opacity: 1;
}

.custom-input:focus,
.custom-textarea:focus,
.form-select.custom-input:focus {
  border-color: var(--primary);
  box-shadow:
    0 0 0 4px rgba(0, 89, 134, 0.15),
    inset 0 2px 4px rgba(0, 0, 0, 0.02);
  background-color: var(--white);
  outline: none;
}

/* Custom File Upload Button */
input[type="file"].custom-input {
  padding: 0.3rem 1rem;
  height: auto;
}

input[type="file"].custom-input::file-selector-button {
  background-color: var(--sidebar-bg);
  color: var(--primary);
  border: none;
  border-radius: 0px;
  padding: 0.4rem 1rem;
  margin-right: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

input[type="file"].custom-input::file-selector-button:hover {
  background-color: var(--primary);
  color: #0f172a;
}

.custom-radio-group {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
}

.custom-radio {
  border-color: var(--text-light);
  cursor: pointer;
  width: 1em;
  height: 1em;
  margin-top: 0.15em;
}

.custom-radio:checked {
  background-color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 89, 134, 0.15);
}

.custom-check {
  margin-left: 20px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.custom-check .form-check-input {
  border-color: var(--border);
  width: 1.25em;
  height: 1.25em;
  margin-top: 0;
  cursor: pointer;
}

.custom-check .form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 89, 134, 0.15);
}

.custom-check .form-check-label {
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
}

.custom-btn-primary {
  background: var(--primary);
  border: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.85rem;
  height: 40px;
  transition: var(--transition);
}

.custom-btn-primary:hover {
  background: var(--primary-hover);
}

.custom-btn-secondary {
  background: #e2e8f0;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.85rem;
  height: 40px;
  color: var(--text);
  transition: var(--transition);
}

.custom-btn-secondary:hover {
  background: #cbd5e1;
  color: var(--text);
}

/* --- BOOTSTRAP 5 to 4 POLYFILLS --- */
.gap-1 {
  gap: 0.25rem !important;
}

.gap-2 {
  gap: 0.5rem !important;
}

.gap-3 {
  gap: 1rem !important;
}

.gap-4 {
  gap: 1.5rem !important;
}

.gap-5 {
  gap: 3rem !important;
}

.row.g-4 > [class*="col-"] {
  padding-bottom: 1.5rem;
}

.row.g-4 {
  margin-bottom: -1.5rem;
}

.form-select {
  display: block;
  width: 100%;
  padding: 0.375rem 2.25rem 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #495057;
  vertical-align: middle;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.form-check {
  display: flex;
  align-items: center;
  padding-left: 0;
}

.form-check-input {
  position: static;
  margin-top: 0;
  margin-left: 0;
}

.form-check-inline {
  display: inline-flex;
  margin-right: 1rem;
}

/* =========================================================
   RESPONSIVE BREAKPOINTS
   ========================================================= */

/* Tablet & Small Desktop (<= 1024px) */
@media (max-width: 1024px) {
  .topbar {
    padding: 0 20px;
  }
  .content {
    padding: 24px 20px;
  }
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

/* Mobile (<= 768px) */
@media (max-width: 768px) {
  .sidebar {
    width: 250px !important;
    transform: translateX(-100%);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.25);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main {
    margin-left: 0 !important;
    height: 100vh;
    max-height: 100vh;
    min-width: 0;
    overflow: hidden;
  }

  .topbar {
    height: 68px;
    min-height: 68px;
    max-height: 68px;
    flex-shrink: 0;
    padding: 0 16px;
  }

  .user-info {
    display: none;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 998;
  }

  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  /* Reset collapsed rules in mobile drawer */
  .sidebar.collapsed {
    width: 250px !important;
  }

  .sidebar.collapsed .logo .image-container {
    width: 190px !important;
    height: 56px !important;
  }

  .sidebar.collapsed .nav-link,
  .sidebar.collapsed .dropdown-btn {
    justify-content: flex-start !important;
    padding: 12px 14px !important;
  }

  .sidebar.collapsed .nav-text,
  .sidebar.collapsed .dropdown-btn .label .nav-text,
  .sidebar.collapsed .dropdown-btn .arrow,
  .sidebar.collapsed .sidebar-profile .profile-info {
    display: block !important;
  }

  .sidebar.collapsed .dropdown-btn .label {
    justify-content: flex-start !important;
    gap: 12px !important;
  }

  .sidebar.collapsed .sidebar-dropdown .submenu {
    position: static !important;
    width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    padding-left: 12px !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    pointer-events: auto !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: transparent !important;
  }

  .sidebar.collapsed .sidebar-dropdown.active .submenu {
    max-height: 2000px !important;
  }

  .sidebar-profile {
    justify-content: flex-start !important;
  }

  .content {
    flex: 1 1 0%;
    min-height: 0;
    height: calc(100vh - 68px - 50px);
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    padding: 16px 12px;
    -webkit-overflow-scrolling: touch;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .stat-card,
  .chart-card {
    padding: 18px;
  }

  .footer {
    height: auto;
    min-height: 50px;
    flex-shrink: 0;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    padding: 8px 12px;
    font-size: 11.5px;
  }

  .card {
    margin-left: 0.5rem !important;
    margin-right: 0.5rem !important;
  }

  .card-body {
    padding: 1rem !important;
  }

  .custom-card-header {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .custom-check {
    margin-left: 0;
  }

  .login-card {
    padding: 1.5rem;
  }
}

/* Extra Small (<= 420px) */
@media (max-width: 420px) {
  .topbar {
    padding: 0 12px;
  }

  .logout-btn span {
    display: none;
  }

  .captcha-container {
    gap: 8px;
  }

  .refresh-captcha-btn {
    padding: 0 10px;
  }
}

/* =========================================================
   MENUS & ROLES MODAL / WIZARD / FORM COMPONENTS
   ========================================================= */

/* Wizard Step Header & Indicators (Menus Modal) */
.wizard-step-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  border-bottom: 1px solid #e2e8f0;
  background-color: #f8fafc;
}

.wizard-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: 20px;
  transition: all 0.2s ease;
  user-select: none;
}

.wizard-step-item.active {
  color: var(--primary);
  background-color: #eaf3f8;
}

.wizard-step-item .step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #e2e8f0;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.wizard-step-item.active .step-number {
  background-color: var(--primary);
  color: #ffffff;
}

.wizard-step-divider {
  flex: 1;
  max-width: 60px;
  height: 2px;
  background-color: #e2e8f0;
  margin: 0 10px;
}

/* Icon Select Component */
.icon-select-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.icon-preview-box {
  width: 42px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

/* Role Checkbox Cards Grid */
.roles-checkbox-container {
  max-height: 280px;
  overflow-y: auto;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
}

.role-checkbox-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  background-color: #ffffff;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.role-checkbox-card:hover {
  border-color: var(--primary);
  background-color: #f0f7fb;
}

.role-checkbox-card.selected {
  border-color: var(--primary);
  background-color: #eaf3f8;
}

.role-checkbox-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
}

.role-checkbox-label {
  margin-bottom: 0;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  font-size: 13px;
  color: var(--text);
}

/* Modal Target Summary Banner */
.target-menu-summary-banner {
  background-color: #eaf3f8;
  border: 1px solid rgba(0, 89, 134, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.target-menu-url-badge {
  background: #ffffff;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: inherit;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid #cbd5e1;
}

.cursor-pointer {
  cursor: pointer !important;
}

.select-icon-dropdown {
  width: 100%;
}

/* Excel Download Button Primary */
.download-btn-primary,
.btn.download-btn-primary {
  background: #0b6b04 !important;
  border: none !important;
  border-radius: 6px !important;
  font-weight: 500 !important;
  font-size: 0.85rem !important;
  height: 40px !important;
  color: var(--white) !important;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.download-btn-primary:hover,
.btn.download-btn-primary:hover,
.download-btn-primary:focus,
.btn.download-btn-primary:focus {
  background: #0b6b04 !important;
  color: var(--white) !important;
  opacity: 0.95;
}
