@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary-lighter: #C8FAD6;
  --primary-light: #5BE49B;
  --primary-main: #00A76F;
  --primary-dark: #007867;
  --primary-darker: #004B50;

  --secondary-lighter: #EFD6FF;
  --secondary-light: #C684FF;
  --secondary-main: #8E33FF;
  --secondary-dark: #5119B7;
  --secondary-darker: #27097A;

  --info-lighter: #CAFDF5;
  --info-light: #61F3F3;
  --info-main: #00B8D9;
  --info-dark: #006C9C;
  --info-darker: #003768;

  --success-lighter: #D3FCD2;
  --success-light: #77ED8B;
  --success-main: #22C55E;
  --success-dark: #118D57;
  --success-darker: #065E49;

  --warning-lighter: #FFF5CC;
  --warning-light: #FFD666;
  --warning-main: #FFAB00;
  --warning-dark: #B76E00;
  --warning-darker: #7A4100;

  --error-lighter: #FFE9D5;
  --error-light: #FFAC82;
  --error-main: #FF5630;
  --error-dark: #B71D18;
  --error-darker: #7A0916;

  --grey-0: #FFFFFF;
  --grey-50: #FCFDFD;
  --grey-100: #F9FAFB;
  --grey-200: #F4F6F8;
  --grey-300: #DFE3E8;
  --grey-400: #C4CDD5;
  --grey-500: #919EAB;
  --grey-600: #637381;
  --grey-700: #454F5B;
  --grey-800: #1C252E;
  --grey-900: #141A21;

  --common-black: #000000;
  --common-white: #FFFFFF;

  --bg-primary: #FFFFFF;
  --bg-secondary: #F9FAFB;
  --text-primary: #1C252E;
  --text-secondary: #637381;
  --text-disabled: #919EAB;
  --divider: rgba(145, 158, 171, 0.2);
  --border: rgba(145, 158, 171, 0.16);
  --shadow-sm: 0 1px 2px rgba(145, 158, 171, 0.16);
  --shadow-md: 0 4px 8px rgba(145, 158, 171, 0.16);
  --shadow-lg: 0 8px 24px rgba(145, 158, 171, 0.16);
  --shadow-xl: 0 20px 60px rgba(145, 158, 171, 0.16);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sidebar-width: 280px;
  --header-height: 64px;
}

[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #222;
  --text-primary: #F0F0F0;
  --text-secondary: #aaa;
  --text-disabled: #777;
  --divider: rgba(200, 200, 200, 0.12);
  --border: rgba(200, 200, 200, 0.18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--text-disabled); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }
* { scrollbar-width: thin; scrollbar-color: var(--text-disabled) var(--bg-secondary); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-family);
  font-size: 0.875rem;
  line-height: 1.57143;
  color: var(--text-primary);
  background: var(--bg-secondary);
}

a { color: var(--primary-main); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }

h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.25; color: var(--text-primary); margin-bottom: 0.5rem; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-muted { color: var(--text-secondary) !important; }
.text-primary { color: var(--primary-main) !important; }
.text-success { color: var(--success-main) !important; }
.text-warning { color: var(--warning-main) !important; }
.text-danger { color: var(--error-main) !important; }
.text-info { color: var(--info-main) !important; }
.text-orange { color: #FF6B35 !important; }
.text-teal { color: #0D9488 !important; }
.text-white { color: #fff !important; }
.text-end { text-align: right !important; }
.text-center { text-align: center !important; }
.text-start { text-align: left !important; }
.fw-medium { font-weight: 500 !important; }
.fw-bold { font-weight: 700 !important; }
.fs-1 { font-size: 2.5rem !important; }
.small { font-size: 0.75rem !important; }
small { font-size: 0.75rem; }

.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-none { display: none !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-column { flex-direction: column !important; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; }

.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }
.gap-4 { gap: 1rem !important; }

.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.ms-auto { margin-left: auto !important; }
.me-auto { margin-right: auto !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }

.p-0 { padding: 0 !important; }
.p-3 { padding: 0.75rem !important; }
.p-4 { padding: 1rem !important; }
.p-5 { padding: 1.5rem !important; }
.pt-2 { padding-top: 0.5rem !important; }
.pt-3 { padding-top: 0.75rem !important; }
.pt-4 { padding-top: 1rem !important; }
.pb-3 { padding-bottom: 0.75rem !important; }
.pb-4 { padding-bottom: 1rem !important; }
.py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
.py-4 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-5 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.px-3 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
.px-4 { padding-left: 1rem !important; padding-right: 1rem !important; }

.rounded { border-radius: var(--radius-md) !important; }
.rounded-circle { border-radius: 50% !important; }
.overflow-hidden { overflow: hidden !important; }
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--divider);
  font-weight: 600;
}
.card-body { padding: 1.25rem; }
.card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--divider);
}

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
table thead th {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: transparent;
  border-bottom: 2px solid var(--divider);
  text-align: left;
  white-space: nowrap;
}
table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}
table tbody tr:hover { background: rgba(0, 167, 111, 0.04); }
table tbody tr:last-child td { border-bottom: none; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  line-height: 1.5;
}
.bg-success { background: var(--success-lighter); color: var(--success-dark); }
.bg-warning { background: var(--warning-lighter); color: var(--warning-dark); }
.bg-danger { background: var(--error-lighter); color: var(--error-dark); }
.bg-info { background: var(--info-lighter); color: var(--info-dark); }
.bg-primary { background: var(--primary-main); color: #fff; }
.bg-secondary { background: var(--grey-200); color: var(--grey-700); }
.bg-light { background: var(--grey-100); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-family);
  white-space: nowrap;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary-main); color: #fff; border-color: var(--primary-main); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: var(--grey-200); color: var(--grey-800); border-color: var(--grey-300); }
.btn-secondary:hover { background: var(--grey-300); }
.btn-success { background: var(--success-main); color: #fff; border-color: var(--success-main); }
.btn-danger { background: var(--error-main); color: #fff; border-color: var(--error-main); }
.btn-warning { background: var(--warning-main); color: #fff; border-color: var(--warning-main); }
.btn-info { background: var(--info-main); color: #fff; border-color: var(--info-main); }
.btn-outline-primary { background: transparent; color: var(--primary-main); border-color: var(--primary-main); }
.btn-outline-primary:hover { background: var(--primary-main); color: #fff; }
.btn-outline-secondary { background: transparent; color: var(--grey-600); border-color: var(--grey-400); }
.btn-outline-secondary:hover { background: var(--grey-200); border-color: var(--grey-500); }
.btn-outline-danger { background: transparent; color: var(--error-main); border-color: var(--error-main); }
.btn-outline-danger:hover { background: var(--error-main); color: #fff; }
.btn-outline-info { background: transparent; color: var(--info-main); border-color: var(--info-main); }
.btn-outline-info:hover { background: var(--info-main); color: #fff; }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255,255,255,0.5); }
.btn-outline-light:hover { background: rgba(255,255,255,0.1); }
.btn-sm { padding: 0.3125rem 0.625rem; font-size: 0.75rem; }
.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.btn-group .btn:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.btn-group .btn + .btn { margin-left: -1px; }

.form-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
}
.form-control, .form-select {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary-main);
  box-shadow: 0 0 0 3px rgba(0, 167, 111, 0.12);
}
.form-control::placeholder { color: var(--text-disabled); }
.form-control-lg { padding: 0.625rem 1rem; font-size: 1rem; }
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-select { appearance: none; 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='%23637381' 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; padding-right: 2.5rem; }
.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check-input { width: 1rem; height: 1rem; accent-color: var(--primary-main); }
.form-check-label { font-size: 0.875rem; }
.input-group { display: flex; align-items: stretch; }
.input-group .form-control { flex: 1; min-width: 0; }
.input-group-text {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  background: var(--grey-100);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}
.input-group .form-control:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group .input-group-text:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

code {
  padding: 0.125rem 0.375rem;
  background: var(--grey-100);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--error-main);
}

.row { display: flex; flex-wrap: wrap; margin: -0.5rem; }
.row.g-3 { margin: -0.75rem; }
.row.g-3 > [class*="col-"] { padding: 0.75rem; }
.row > [class*="col-"] { padding: 0.5rem; }
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-sm-12 { flex: 0 0 100%; max-width: 100%; }
@media (min-width: 576px) {
  .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
}
@media (min-width: 768px) {
  .col-md-3 { flex: 0 0 25%; max-width: 25%; }
  .col-md-4 { flex: 0 0 33.33333%; max-width: 33.33333%; }
  .col-md-5 { flex: 0 0 41.66667%; max-width: 41.66667%; }
  .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  .col-md-8 { flex: 0 0 66.66667%; max-width: 66.66667%; }
}
@media (min-width: 992px) {
  .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
  .col-lg-4 { flex: 0 0 33.33333%; max-width: 33.33333%; }
  .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
  .col-lg-8 { flex: 0 0 66.66667%; max-width: 66.66667%; }
}
@media (min-width: 1200px) {
  .col-xl-3 { flex: 0 0 25%; max-width: 25%; }
  .col-xl-4 { flex: 0 0 33.33333%; max-width: 33.33333%; }
  .col-xl-6 { flex: 0 0 50%; max-width: 50%; }
  .col-xl-8 { flex: 0 0 66.66667%; max-width: 66.66667%; }
}

.container-fluid { width: 100%; padding-right: 1rem; padding-left: 1rem; margin-right: auto; margin-left: auto; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.875rem;
}
.alert-danger { background: var(--error-lighter); color: var(--error-dark); border-color: var(--error-light); }
.alert-warning { background: var(--warning-lighter); color: var(--warning-dark); border-color: var(--warning-light); }
.alert-success { background: var(--success-lighter); color: var(--success-dark); border-color: var(--success-light); }
.alert-info { background: var(--info-lighter); color: var(--info-dark); border-color: var(--info-light); }
.alert ul { margin: 0.5rem 0 0 1.25rem; }
.alert h5 { margin-bottom: 0.25rem; }

.avatar-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-main);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8125rem;
}

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1000;
  min-width: 200px;
  padding: 0.5rem 0;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  color: var(--text-primary);
  font-size: 0.8125rem;
  transition: background 0.15s;
}
.dropdown-item:hover { background: rgba(0, 167, 111, 0.04); }
.dropdown-item.text-danger:hover { background: rgba(255, 86, 48, 0.08); color: var(--error-main); }
.dropdown-header {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.dropdown-item-text {
  padding: 0.25rem 1rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.dropdown-divider {
  height: 1px;
  margin: 0.375rem 0;
  background: var(--divider);
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width, 280px);
  background: var(--sidebar-bg, var(--bg-primary));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width 0.25s ease;
  transition: transform 0.3s ease;
}
.sidebar-logo {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  border-bottom: 1px solid var(--divider);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--sidebar-logo-text, var(--text-primary));
}
.sidebar-logo-icon { display: flex; align-items: center; gap: 0.75rem; }
.sidebar-logo-icon i { font-size: 1.5rem; color: var(--primary-main); }
.sidebar-toggle-collapse {
  background: none; border: none; color: var(--sidebar-logo-text, #fff); cursor: pointer; padding: 0.25rem; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); transition: all 0.15s; width: 28px; height: 28px; flex-shrink: 0;
}
.sidebar-toggle-collapse:hover { background: rgba(255,255,255,0.08); }
.sidebar-toggle-collapse i { font-size: 1rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.75rem 0.75rem; }
.sidebar-nav .nav-group { margin-bottom: 0.25rem; }
.sidebar-nav .nav-section { font-size: 0.6875rem; font-weight: 600; color: var(--sidebar-section-text, var(--text-secondary)); padding: 0.75rem 0.75rem 0.375rem; text-transform: uppercase; letter-spacing: 0.08em; display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; }
.sidebar-nav .nav-section i { font-size: 0.6rem; transition: transform 0.2s ease; opacity: 0.5; }
.sidebar-nav .nav-section.open i { transform: rotate(180deg); opacity: 0.8; }
.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--sidebar-text, var(--text-secondary));
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  text-decoration: none;
}
.sidebar-nav .nav-item:hover { background: var(--sidebar-hover-bg, rgba(0, 167, 111, 0.04)); color: var(--sidebar-active-text, var(--text-primary)); }
.sidebar-nav .nav-item.active { background: var(--sidebar-active-bg, rgba(218, 4, 42, 0.12)); color: var(--sidebar-active-text, var(--text-primary)); font-weight: 600; }
.sidebar-nav .nav-item i { font-size: 1.125rem; width: 1.25rem; text-align: center; }
.sidebar-nav .nav-item i.bi-speedometer2 { color: #00A76F; }
.sidebar-nav .nav-item i.bi-cart-plus { color: #22C55E; }
.sidebar-nav .nav-item i.bi-cart-check { color: #16A34A; }
.sidebar-nav .nav-item i.bi-people { color: #0EA5E9; }
.sidebar-nav .nav-item i.bi-building { color: #8B5CF6; }
.sidebar-nav .nav-item i.bi-box-seam { color: #F59E0B; }
.sidebar-nav .nav-item i.bi-tags { color: #EC4899; }
.sidebar-nav .nav-item i.bi-tag { color: #F97316; }
.sidebar-nav .nav-item i.bi-rulers { color: #14B8A6; }
.sidebar-nav .nav-item i.bi-cash-stack { color: #10B981; }
.sidebar-nav .nav-item i.bi-file-earmark-text { color: #6366F1; }
.sidebar-nav .nav-item i.bi-gear { color: #94A3B8; }
.sidebar-nav .nav-item i.bi-person { color: #E2E8F0; }
.sidebar-nav .nav-item.active i { color: inherit !important; }
.sidebar-nav .nav-item .arrow { margin-left: auto; transition: transform 0.2s; }
.sidebar-nav .nav-item .arrow.open { transform: rotate(90deg); }
.sidebar-nav .nav-sub { padding-left: 1.75rem; display: none; }
.sidebar-nav .nav-sub.open { display: block; }
.sidebar-nav .nav-sub .nav-item { font-size: 0.75rem; padding: 0.375rem 0.75rem; }

.sidebar-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--divider);
  font-size: 0.75rem;
  color: var(--sidebar-text, var(--text-secondary));
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width, 280px);
  display: flex;
  transition: margin-left 0.25s ease;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  height: var(--header-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-header .header-left { display: flex; align-items: center; gap: 0.75rem; flex: 1; }
.app-header .header-right { display: flex; align-items: center; gap: 0.5rem; }
.app-header .page-title { font-size: 1.125rem; font-weight: 700; }

.app-content {
  flex: 1;
  padding: 1.5rem;
}

.app-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--divider);
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  overflow: hidden;
}
.toast-header {
  display: flex;
  align-items: center;
  padding: 0.625rem 1rem;
  gap: 0.5rem;
  border-bottom: 1px solid var(--divider);
  font-weight: 600;
  font-size: 0.8125rem;
}
.toast-header.bg-danger { background: var(--error-main); color: #fff; }
.toast-header.bg-success { background: var(--success-main); color: #fff; }
.toast-header.bg-info { background: var(--info-main); color: #fff; }
.toast-body { padding: 0.75rem 1rem; font-size: 0.8125rem; color: var(--text-secondary); }
.toast .btn-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  opacity: 0.7;
}
.toast .btn-close:hover { opacity: 1; }
.toast .btn-close-white { color: #fff; }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
  display: none;
  pointer-events: none;
}
.sidebar-overlay.show { display: block; pointer-events: auto; }
.sidebar-expand-btn { display: none; }
body.sidebar-collapsed .sidebar-expand-btn { display: inline-flex; }

/* Collapsed sidebar */
body.sidebar-collapsed .sidebar { width: 72px; }
body.sidebar-collapsed .sidebar-logo { justify-content: center; padding: 0.75rem 0; gap: 0; }
body.sidebar-collapsed .sidebar-logo-icon { gap: 0; }
body.sidebar-collapsed .sidebar-logo-icon span { display: none; }
body.sidebar-collapsed .sidebar-nav .nav-section { display: none; }
body.sidebar-collapsed .sidebar-nav .nav-sub { display: block; padding-left: 0; }
body.sidebar-collapsed .sidebar-nav .nav-item { justify-content: center; padding: 0.625rem 0.5rem; font-size: 0; gap: 0; }
body.sidebar-collapsed .sidebar-nav .nav-item i { font-size: 1.25rem; width: auto; }
body.sidebar-collapsed .sidebar-nav .nav-item.active::after { display: none; }
body.sidebar-collapsed .sidebar-footer { display: none; }
body.sidebar-collapsed .app-main { margin-left: 72px; }
body.sidebar-collapsed .sidebar-toggle-collapse i { transform: rotate(180deg); }

@media (max-width: 768px) {
  body.sidebar-collapsed .sidebar { width: var(--sidebar-width, 280px); transform: translateX(-100%); }
  body.sidebar-collapsed .sidebar.show { transform: translateX(0); }
  body.sidebar-collapsed .sidebar-logo { justify-content: flex-start; padding: 1rem 1.25rem; }
  body.sidebar-collapsed .sidebar-logo-icon span { display: inline; }
  body.sidebar-collapsed .sidebar-nav .nav-section { display: block; }
  body.sidebar-collapsed .sidebar-nav .nav-item { justify-content: flex-start; padding: 0.5rem 0.75rem; font-size: 0.8125rem; gap: 0.75rem; }
  body.sidebar-collapsed .sidebar-nav .nav-item i { font-size: 1.125rem; width: 1.25rem; }
  body.sidebar-collapsed .sidebar-footer { display: block; }
  body.sidebar-collapsed .app-main { margin-left: 0; }
}

.my-3 { margin-top: 0.75rem; margin-bottom: 0.75rem; }
.fw-normal { font-weight: 400 !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

kbd {
  padding: 0.125rem 0.375rem;
  background: var(--grey-200);
  border: 1px solid var(--grey-300);
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-family);
}

hr { border: none; border-top: 1px solid var(--divider); margin: 1rem 0; }

.table-light { background: var(--grey-100); }

.pagination { display: flex; gap: 0.25rem; align-items: center; list-style: none; }
.page-item { display: inline-flex; }
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--bg-primary);
  transition: all 0.15s;
}
.page-link:hover { border-color: var(--primary-main); color: var(--primary-main); }
.page-item.active .page-link { background: var(--primary-main); border-color: var(--primary-main); color: #fff; }
.page-item.disabled .page-link { opacity: 0.5; pointer-events: none; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 999; padding: 1rem; }
.modal-overlay > .modal { background: var(--bg-primary); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto; }

.modal.fade { display: none; position: fixed; inset: 0; z-index: 999; background: rgba(0,0,0,0.4); align-items: center; justify-content: center; padding: 1rem; }
.modal.fade.show { display: flex; }
.modal-dialog { background: var(--bg-primary); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-dialog.modal-lg { max-width: 700px; }
.modal-content { background: var(--bg-primary); border-radius: var(--radius-xl); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--divider); font-weight: 600; font-size: 1rem; }
.modal-header .modal-title { font-weight: 600; font-size: 1rem; }
.modal-body { padding: 1.5rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 1rem 1.5rem; border-top: 1px solid var(--divider); }
.btn-close { background: none; border: none; cursor: pointer; font-size: 1.25rem; padding: 0.25rem; color: var(--text-secondary); line-height: 1; }
.btn-close:hover { color: var(--text-primary); }
body.modal-open { overflow: hidden; }

/* --- Template Thumbnail Selector --- */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.template-card { cursor: pointer; border: 2px solid var(--divider); border-radius: var(--radius-lg); overflow: hidden; transition: all 0.2s; background: var(--bg-primary); }
.template-card:hover { border-color: var(--primary-light, #5c6bc0); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.template-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light, rgba(13,110,253,0.25)); }
.template-preview { height: 140px; display: flex; flex-direction: column; padding: 8px; position: relative; overflow: hidden; }
.template-preview .tp-header { padding: 4px 6px; border-radius: 3px 3px 0 0; margin: -8px -8px 4px -8px; display: flex; justify-content: space-between; align-items: center; }
.template-preview .tp-header .tp-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.6); display: inline-block; }
.template-preview .tp-name { font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.template-preview .tp-divider { height: 1px; margin: 3px 0; }
.template-preview .tp-row { display: flex; gap: 3px; margin-bottom: 2px; }
.template-preview .tp-row span { flex: 1; height: 5px; border-radius: 2px; }
.template-preview .tp-row .tp-sm { flex: 0.4; }
.template-preview .tp-row .tp-lg { flex: 1.5; }
.template-preview .tp-grand { margin-top: auto; padding: 3px 6px; border-radius: 3px; display: flex; justify-content: space-between; align-items: center; font-size: 6px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.template-card .template-label { padding: 6px 8px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--divider); font-size: 11px; font-weight: 500; }
.template-card .template-label .t-badge { font-size: 9px; padding: 1px 6px; border-radius: 10px; font-weight: 600; }
.template-card .template-label .t-badge.popular { background: #d1e7ff; color: #0d6efd; }
.template-card .template-label .t-badge.new { background: #d1fae5; color: #059669; }
.template-card .template-label .t-badge.minimal { background: #f3f4f6; color: #6b7280; }
.template-card .template-label .t-badge.prof { background: #e8eaf6; color: #1a237e; }
.template-card .template-label .t-badge.dark { background: #e2e8f0; color: #1e293b; }
.template-card .template-label .t-badge.teal { background: #e0f2f1; color: #00897b; }

.nav-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--divider); margin-bottom: 1rem; }
.nav-tabs .nav-link {
  padding: 0.625rem 1rem;
  border: none;
  background: none;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
  font-family: var(--font-family);
}
.nav-tabs .nav-link:hover { color: var(--text-primary); }
.nav-tabs .nav-link.active { color: var(--primary-main); border-bottom-color: var(--primary-main); }
.tab-content > .tab-pane { display: none; }
.tab-content > .tab-pane.active { display: block; }

.form-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; background: var(--grey-300); border-radius: 3px; outline: none; cursor: pointer;
}
.form-range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; }
.form-range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--grey-300); }
.form-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--primary-main); border: 3px solid #fff; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.25); margin-top: -7px;
}
.form-range::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: var(--primary-main); border: 3px solid #fff; cursor: pointer;
}
.form-range:hover::-webkit-slider-thumb { box-shadow: 0 2px 8px rgba(0,167,111,0.4); }
.form-range:focus { outline: none; }
.form-range:focus::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(0,167,111,0.25); }

.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check.form-switch { gap: 0.5rem; }
.form-check-input[type="checkbox"] { width: 1rem; height: 1rem; accent-color: var(--primary-main); cursor: pointer; }
.form-switch .form-check-input[type="checkbox"] {
  width: 2em; height: 1em; -webkit-appearance: none; appearance: none; background: var(--grey-300); border-radius: 1em; position: relative; cursor: pointer; transition: 0.2s; outline: none; flex-shrink: 0;
}
.form-switch .form-check-input[type="checkbox"]::before {
  content: ''; position: absolute; width: 0.75em; height: 0.75em; border-radius: 50%; top: 0.125em; left: 0.125em; background: #fff; transition: 0.2s;
}
.form-switch .form-check-input[type="checkbox"]:checked { background: var(--primary-main); }
.form-switch .form-check-input[type="checkbox"]:checked::before { left: 1.125em; }

.form-control-color {
  width: 3rem; height: 2.5rem; padding: 0.25rem; cursor: pointer; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-primary);
}
.form-control-color::-webkit-color-swatch-wrapper { padding: 0; }
.form-control-color::-webkit-color-swatch { border: none; border-radius: var(--radius-sm); }

.select2, .dataTables_wrapper, .swal2-popup { font-family: var(--font-family); }

/* Form validation states */
.was-validated .form-control:invalid,
.was-validated .form-select:invalid { border-color: #FF5630; }
.was-validated .form-control:valid,
.was-validated .form-select:valid { border-color: #22C55E; }
.was-validated .form-control:invalid:focus,
.was-validated .form-select:invalid:focus { box-shadow: 0 0 0 3px rgba(255,86,48,0.15); }
.invalid-feedback { display: none; width: 100%; margin-top: 0.25rem; font-size: 0.8125rem; color: #FF5630; }
.was-validated .form-control:invalid ~ .invalid-feedback,
.was-validated .form-select:invalid ~ .invalid-feedback { display: block; }
.form-control.is-invalid { border-color: #FF5630; }
.form-control.is-valid { border-color: #22C55E; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .app-main { margin-left: 0; }
  .row > [class*="col-"] { flex: 0 0 100%; max-width: 100%; }
}
