/* ============ Admin Panel – Main Stylesheet ============ */
:root {
  --sidebar-bg: #1e293b;
  --sidebar-brand: #172032;
  --sidebar-hover: #2a3a52;
  --sidebar-active: #334155;
  --sidebar-text: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4fd0;
  --primary-soft: #e8efff;
  --body-bg: #f1f5f9;
  --card-border: #e2e8f0;
  --input-border: #cbd5e1;
  --text: #1e293b;
  --muted: #64748b;
  --sidebar-w: 270px;
  --sidebar-mini-w: 72px;
  --topbar-h: 66px;
  --radius: 6px;
}

* { box-sizing: border-box; }
html, body { overflow-x: hidden; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--body-bg);
  color: var(--text);
  font-size: 14px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  overflow-y: auto; overflow-x: hidden;
  z-index: 1050;
  transition: width .25s ease, transform .25s ease;
  display: flex; flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: #3b4a63; border-radius: 4px; }

.sidebar .brand {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; color: #fff; font-weight: 700; font-size: 18px;
  background: var(--sidebar-brand);
  white-space: nowrap;
}
.sidebar .brand i.logo { color: #60a5fa; font-size: 22px; }
.sidebar .sidebar-close {
  display: none; margin-left: auto; background: rgba(255,255,255,.08); border: 0; color: #fff;
  width: 34px; height: 34px; border-radius: 8px; font-size: 18px; line-height: 1;
  align-items: center; justify-content: center;
}

.sidebar .menu { list-style: none; margin: 0; padding: 8px 6px; flex: 1; }
.sidebar .menu > li { position: relative; margin-bottom: 1px; }

.sidebar .menu a.menu-link {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px; border-radius: 6px;
  color: var(--sidebar-text); text-decoration: none; font-weight: 500; font-size: 14px;
  transition: background .15s, color .15s; white-space: normal; line-height: 1.35;
}
.sidebar .menu a.menu-link .label { min-width: 0; overflow-wrap: anywhere; }
.sidebar .menu a.menu-link i.icon { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar .menu a.menu-link i.icon.text-red { color: #ef4444; }
.sidebar .menu a.menu-link .chev { margin-left: auto; font-size: 11px; transition: transform .2s; }
.sidebar .menu a.menu-link[aria-expanded="true"] .chev { transform: rotate(-90deg); }
.sidebar .menu a.menu-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar .menu a.menu-link.active { background: var(--sidebar-active); color: #fff; }

.sidebar .submenu { list-style: none; padding: 2px 0 6px 0; margin: 0; }
.sidebar .submenu a {
  display: block; padding: 8px 14px 8px 48px; border-radius: 6px;
  color: #cbd5e1; text-decoration: none; font-size: 13.5px; white-space: normal; line-height: 1.35;
}
.sidebar .submenu a:hover { color: #fff; background: var(--sidebar-hover); }
.sidebar .submenu a.active { color: #fff; font-weight: 600; }

.sidebar .sidebar-footer {
  padding: 14px 18px 18px; border-top: 1px solid rgba(255,255,255,.08); color: var(--sidebar-text);
  line-height: 1.35; white-space: nowrap; overflow: hidden;
}
.sidebar .sidebar-footer small { color: #94a3b8; display: block; }
.sidebar .storage-bar { height: 4px; background: #334155; border-radius: 4px; margin-top: 10px; overflow: hidden; }
.sidebar .storage-bar span { display: block; height: 100%; width: 100%; background: var(--primary); }

/* overlay (mobile) */
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 1045;
  opacity: 0; visibility: hidden; transition: opacity .25s;
}

/* ---------- Main area ---------- */
.main-wrapper { margin-left: var(--sidebar-w); min-height: 100vh; transition: margin .25s ease; }

.topbar {
  position: sticky; top: 0; z-index: 1030;
  height: var(--topbar-h); background: #fff;
  border-bottom: 1px solid var(--card-border);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
}
.topbar .toggle-btn { background: none; border: 0; font-size: 22px; color: #334155; padding: 4px 6px; border-radius: 6px; }
.topbar .toggle-btn:hover { background: var(--body-bg); }
.topbar .search-box { position: relative; flex: 1; max-width: 400px; }
.topbar .search-box input {
  background: #eff2f6; border: 1px solid transparent;
  border-radius: 8px; padding: 10px 40px 10px 16px; width: 100%; font-size: 14px;
}
.topbar .search-box input:focus { outline: none; border-color: var(--primary); background: #fff; }
.topbar .search-box i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: #334155; }
.topbar .quick-add {
  width: 36px; height: 36px; border-radius: 50%; border: 0; flex-shrink: 0;
  background: var(--primary); color: #fff; font-size: 22px;
  display: grid; place-items: center; box-shadow: 0 2px 6px rgba(37,99,235,.35);
}
.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar .icon-btn {
  width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--card-border);
  background: #fff; color: #334155; display: grid; place-items: center; position: relative; font-size: 16px;
}
.topbar .icon-btn:hover { background: var(--body-bg); }
.topbar .icon-btn.plain { border: 0; }
.topbar .icon-btn .dot {
  position: absolute; top: 7px; right: 8px; width: 8px; height: 8px;
  background: #ef4444; border-radius: 50%; border: 2px solid #fff;
}

/* profile avatar + dropdown */
.profile-toggle { border: 0; background: none; padding: 0; border-radius: 50%; }
.profile-toggle::after { display: none; }
.profile-toggle img.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block;
  border: 2px solid var(--primary); background: #fff; padding: 1px;
}
.profile-menu {
  min-width: 210px; padding: 6px 0; border: 1px solid var(--card-border); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15,23,42,.14); margin-top: 10px !important;
}
.profile-menu .profile-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px 12px; border-bottom: 1px solid var(--card-border); margin-bottom: 4px; }
.profile-menu .profile-head img { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--primary); padding: 1px; }
.profile-menu .profile-head strong { display: block; line-height: 1.2; }
.profile-menu .profile-head small { color: var(--muted); }
.profile-menu .dropdown-item { padding: 8px 16px; font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 10px; }
.profile-menu .dropdown-item i { color: var(--muted); width: 16px; }
.profile-menu .dropdown-item:hover { background: var(--primary-soft); color: var(--primary); }
.profile-menu .dropdown-item:hover i { color: var(--primary); }
.profile-menu .dropdown-item.logout { color: #dc2626; }
.profile-menu .dropdown-item.logout i { color: #dc2626; }
.profile-menu .dropdown-item.logout:hover { background: #fef2f2; }
.dropdown-submenu { position: relative; }
.dropdown-submenu > .dropdown-item .arrow { margin-left: auto; font-size: 10px; }
.dropdown-submenu > .sub {
  display: none; position: absolute; right: 100%; top: -6px; min-width: 150px;
  background: #fff; border: 1px solid var(--card-border); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15,23,42,.14); padding: 6px 0; margin-right: 4px;
}
.dropdown-submenu:hover > .sub, .dropdown-submenu.open > .sub { display: block; }
.dropdown-submenu .sub .dropdown-item.checked::after { content: '\F26E'; font-family: 'bootstrap-icons'; margin-left: auto; color: var(--primary); }

.content { padding: 28px 30px 90px; }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 18px; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--card-border); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(15,23,42,.04); background: #fff;
}
.card-header { background: #fff; border-bottom: 1px solid var(--card-border); padding: 14px 20px; font-weight: 600; }
.card-body { padding: 22px 24px; }

.stat-card { padding: 20px; display: flex; flex-direction: row; align-items: center; gap: 16px; }
.stat-card .stat-icon { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; font-size: 24px; flex-shrink: 0; }
.stat-card h3 { margin: 0; font-size: 24px; font-weight: 700; }
.stat-card p { margin: 0; color: var(--muted); font-size: 13px; }
.bg-soft-blue   { background: #e8efff; color: #2563eb; }
.bg-soft-green  { background: #dcfce7; color: #16a34a; }
.bg-soft-orange { background: #ffedd5; color: #ea580c; }
.bg-soft-purple { background: #f3e8ff; color: #9333ea; }
.bg-soft-red    { background: #fee2e2; color: #dc2626; }
.bg-soft-gray   { background: #e2e8f0; color: #475569; }

/* ---------- Forms ---------- */
.form-label { font-weight: 500; margin-bottom: 6px; font-size: 14px; }
.form-label .req { color: #ef4444; margin-right: 3px; }
.form-control, .form-select {
  border-radius: var(--radius); border: 1px solid var(--input-border);
  padding: 8px 14px; font-size: 14px; min-height: 38px; color: var(--text);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-control::placeholder { color: #94a3b8; }
.form-check-input { border-color: var(--input-border); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input.green:checked { background-color: #22c55e; border-color: #22c55e; }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(37,99,235,.15); border-color: var(--primary); }

.input-group .btn.btn-icon {
  border: 1px solid var(--input-border); background: #fff; color: #334155; padding: 0 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.input-group .btn.btn-icon:hover { background: var(--body-bg); }

.nav-tabs { border-bottom: 1px solid var(--card-border); padding: 0 16px; }
.nav-tabs .nav-link { border: 0; color: #334155; padding: 15px 14px; font-weight: 500; margin-bottom: -1px; }
.nav-tabs .nav-link:hover { color: var(--primary); }
.nav-tabs .nav-link.active { color: var(--primary); border-bottom: 2px solid var(--primary); background: transparent; }

.progress { height: 12px; border-radius: 6px; background: #eef2f6; }
.progress-bar.soft-green { background: #86efac; }

.editor-box { border: 1px solid var(--input-border); border-radius: var(--radius); overflow: hidden; }
.editor-box .editor-menu { padding: 8px 12px; border-bottom: 1px solid #eef2f6; display: flex; gap: 18px; color: #334155; flex-wrap: wrap; }
.editor-box .editor-tools { padding: 8px 12px; border-bottom: 1px solid #eef2f6; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.editor-box .editor-tools button { border: 0; background: none; padding: 4px 8px; border-radius: 6px; color: #334155; }
.editor-box .editor-tools button:hover { background: var(--body-bg); }
.editor-box textarea { border: 0; width: 100%; min-height: 160px; padding: 14px; resize: vertical; }
.editor-box textarea:focus { outline: none; }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--radius); font-weight: 500; padding: 8px 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-light.border { border-color: var(--input-border) !important; background: #fff; }
.btn-light.border:hover { background: var(--body-bg); }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; }
.table thead th {
  background: #fff; color: var(--text); font-weight: 600; font-size: 14px;
  border-bottom: 1px solid var(--card-border); border-top: 1px solid var(--card-border); padding: 12px 14px; white-space: nowrap;
}
.table td { padding: 12px 14px; vertical-align: middle; border-color: #eef2f6; }
.table tbody tr { background: #fff; transition: background .12s; }
.table tbody tr:hover { background: #f3f8ff; }
.table.plain tbody tr { background: transparent; }
.table.plain tbody tr:hover { background: #f8fbff; }
.table a { color: var(--primary); text-decoration: none; }
.table a:hover { text-decoration: underline; }
.dotted { border-bottom: 1px dashed currentColor; }

.badge-soft { padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 500; border: 1px solid; background: transparent; display: inline-flex; align-items: center; gap: 6px; line-height: 1.5; }
.badge-soft.info    { color: #0891b2; border-color: #67d4e8; background: #ecfeff; }
.badge-soft.success { color: #16a34a; border-color: #86e0a6; background: #f0fdf4; }
.badge-soft.warning { color: #d97706; border-color: #fcd34d; background: #fffbeb; }
.badge-soft.danger  { color: #dc2626; border-color: #fca5a5; background: #fef2f2; }
.badge-soft.gray    { color: #475569; border-color: #cbd5e1; background: #f8fafc; }
.badge-soft.dropdown-toggle::after { margin-left: 2px; }

.avatar-sm { width: 34px; height: 34px; border-radius: 50%; background: #e2e8f0; display: grid; place-items: center; color: #94a3b8; overflow: hidden; }
.avatar-sm img { width: 100%; height: 100%; object-fit: cover; }

.pagination .page-link { color: var(--muted); border-color: var(--card-border); }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Sticky action bar ---------- */
.action-bar {
  position: fixed; bottom: 0; right: 0; left: var(--sidebar-w);
  background: #fff; border-top: 1px solid var(--card-border);
  padding: 10px 28px; display: flex; justify-content: flex-end; gap: 10px; z-index: 1020;
  transition: left .25s ease;
}

/* ====================== Select2 theme ====================== */
.select2-container { width: 100%; font-size: 14px; }
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  border: 1px solid var(--input-border); border-radius: var(--radius); background: #fff; min-height: 38px;
  transition: border-color .15s, box-shadow .15s;
}
.select2-container--default .select2-selection--single { display: flex; align-items: center; }
.select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--text); padding-left: 14px; padding-right: 36px; line-height: 36px; width: 100%; }
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: #94a3b8; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; right: 8px; top: 0; width: 22px; }
.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border: 0; width: 10px; height: 10px; margin: 0; left: 50%; top: 50%; transform: translate(-50%,-70%) rotate(45deg);
  border-right: 1.6px solid #334155; border-bottom: 1.6px solid #334155; width: 7px; height: 7px;
}
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b { transform: translate(-50%,-20%) rotate(225deg); border-width: 0 1.6px 1.6px 0; border-color: #334155; }
.select2-container--default .select2-selection--single .select2-selection__clear { color: #94a3b8; margin-right: 8px; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.select2-container--default.select2-container--disabled .select2-selection--single { background: #f1f5f9; cursor: not-allowed; }
.select2-container--default .select2-selection--multiple { padding: 2px 8px 2px 6px; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered { padding: 0; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background: var(--primary-soft); color: var(--primary); border: 1px solid #c7d7fb; border-radius: 6px; margin: 2px 0; padding: 2px 8px; font-size: 13px; display: inline-flex; flex-direction: row-reverse; gap: 6px; align-items: center;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { color: var(--primary); border: 0; margin: 0; padding: 0; background: none; position: static; font-weight: 700; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { color: #dc2626; background: none; }
.select2-container--default .select2-search--inline .select2-search__field { margin-top: 0; font-family: inherit; min-height: 28px; }
.select2-container--default .select2-selection--multiple .select2-selection__placeholder { color: #94a3b8; margin-top: 0; }

.select2-dropdown { border: 1px solid var(--input-border); border-radius: var(--radius); box-shadow: 0 10px 28px rgba(15,23,42,.12); overflow: hidden; z-index: 2000; }
.select2-container--open .select2-dropdown--below { margin-top: 4px; }
.select2-container--open .select2-dropdown--above { margin-bottom: 4px; }
.select2-container--default .select2-search--dropdown { padding: 8px; }
.select2-container--default .select2-search--dropdown .select2-search__field { border: 1px solid var(--input-border); border-radius: var(--radius); padding: 6px 10px; outline: none; }
.select2-container--default .select2-search--dropdown .select2-search__field:focus { border-color: var(--primary); }
.select2-results__option { padding: 8px 14px; color: var(--text); }
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--primary-soft); color: var(--primary); }
.select2-container--default .select2-results__option--selected { background: var(--primary); color: #fff; }
.select2-container--default .select2-results__option--selected.select2-results__option--highlighted { background: var(--primary-dark); color: #fff; }
.select2-container--default .select2-results__option--disabled { color: #94a3b8; }

.select2-sm + .select2-container .select2-selection--single { min-height: 34px; border-radius: 8px; }
.select2-sm + .select2-container .select2-selection__rendered { line-height: 32px !important; font-size: 13px; padding-left: 11px !important; }
.select2-sm + .select2-container .select2-selection__arrow { height: 32px !important; }
.w-auto-s2 + .select2-container { width: auto !important; min-width: 80px; }

/* flatpickr */
.flatpickr-calendar { border-radius: 8px; box-shadow: 0 10px 30px rgba(15,23,42,.15); border: 1px solid var(--card-border); font-family: inherit; }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--primary); border-color: var(--primary); }

/* ====================== Desktop collapsed (mini) ====================== */
@media (min-width: 992px) {
  body.sidebar-mini .sidebar { width: var(--sidebar-mini-w); overflow: visible; }
  body.sidebar-mini .main-wrapper { margin-left: var(--sidebar-mini-w); }
  body.sidebar-mini .action-bar { left: var(--sidebar-mini-w); }

  body.sidebar-mini .sidebar .brand { justify-content: center; padding: 0; }
  body.sidebar-mini .sidebar .brand .brand-text { display: none; }
  body.sidebar-mini .sidebar .menu { padding: 8px 10px; }
  body.sidebar-mini .sidebar .menu a.menu-link { justify-content: center; padding: 11px 0; gap: 0; }
  body.sidebar-mini .sidebar .menu a.menu-link .chev { display: none; }
  body.sidebar-mini .sidebar .menu a.menu-link .label { display: none; }

  /* hover flyout: label + submenu */
  body.sidebar-mini .sidebar .menu > li:hover > a.menu-link .label {
    display: flex; align-items: center; position: absolute; left: 100%; top: 0; height: 42px;
    padding: 0 18px 0 14px; margin-left: 0; background: var(--sidebar-active); color: #fff;
    border-radius: 0 8px 8px 0; box-shadow: 4px 4px 14px rgba(0,0,0,.2); min-width: 150px; z-index: 5;
  }
  body.sidebar-mini .sidebar .menu > li:hover > .submenu {
    display: block !important; position: absolute; left: 100%; top: 42px; min-width: 190px; height: auto !important;
    background: #263449; border-radius: 0 0 8px 0; padding: 4px 6px 8px; box-shadow: 4px 8px 16px rgba(0,0,0,.25); z-index: 5;
  }
  body.sidebar-mini .sidebar .submenu a { padding: 8px 14px; }
  body.sidebar-mini .sidebar .sidebar-footer { padding: 14px 6px; text-align: center; }
  body.sidebar-mini .sidebar .sidebar-footer .foot-text { display: none; }
  body.sidebar-mini .sidebar .sidebar-footer .storage-bar { margin: 0 10px; }
}

/* ====================== Tablet / Mobile ====================== */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); width: 270px; box-shadow: none; }
  .sidebar .sidebar-close { display: inline-flex; }
  .main-wrapper { margin-left: 0; }
  .action-bar { left: 0; padding: 10px 14px; }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,.35); }
  body.sidebar-open .sidebar-overlay { opacity: 1; visibility: visible; }
  body.sidebar-open { overflow: hidden; }
  .content { padding: 20px 14px 90px; }
  .topbar { padding: 0 12px; gap: 10px; }
}

@media (max-width: 575.98px) {
  .topbar .hide-xs { display: none !important; }
  .topbar .actions { gap: 8px; }
  .card-body { padding: 16px; }
  .page-title { font-size: 18px; }
  .profile-menu { min-width: 200px; }
  .dropdown-submenu > .sub { position: static; display: none; box-shadow: none; border: 0; margin: 0; padding: 0 0 0 28px; }
  .dropdown-submenu.open > .sub { display: block; }
  .dropdown-submenu:hover > .sub { display: none; }
  .dropdown-submenu.open:hover > .sub { display: block; }
  .stat-card { padding: 14px; }
}

/* select2 multiple – keep to one line, compact */
.select2-container--default .select2-selection--multiple .select2-selection__rendered { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px 0; }
.select2-container--default .select2-selection--multiple .select2-search--inline { flex: 1 1 60px; float: none; margin: 0; }
.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field { width: 100% !important; min-width: 40px; margin: 0; padding: 0 4px; height: 28px; line-height: 28px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice { float: none; }
.select2-container--default .select2-selection--multiple .select2-selection__clear { display: none; }

/* select2 4.1: search box is a sibling of the choices list */
.select2-container--default .select2-selection--multiple { display: flex !important; flex-wrap: wrap; align-items: center; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered { width: auto; flex: 0 1 auto; padding: 0; }
.select2-container--default .select2-selection--multiple .select2-search--inline { flex: 1 1 60px; display: block; }
.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field { width: 100% !important; }
.select2-container--default .select2-selection--multiple::after, .select2-container--default .select2-selection--multiple::before { display: none !important; }
.select2-container--default .select2-selection--multiple { padding: 3px 8px 3px 6px; min-height: 38px; }
.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field { height: 26px; line-height: 26px; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered { margin: 0 !important; }

/* list tables: clean white rows, row actions on hover */
.table tbody td { border-bottom: 1px solid #edf1f6; color: var(--text); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr .row-actions { opacity: 0; transition: opacity .12s; }
.table tbody tr:hover .row-actions { opacity: 1; }
@media (hover: none) { .table tbody tr .row-actions { opacity: 1; } }
.table tbody tr.row-selected, .table tbody tr:has(> td:first-child > .form-check-input:checked) { background: #eaf2ff; }

/* live clock */
.live-clock { display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 12px; background: var(--body-bg); border: 1px solid var(--card-border); border-radius: 10px; margin-right: 6px; white-space: nowrap; }
.live-clock > i { font-size: 20px; color: var(--primary); }
.live-clock strong { display: block; font-size: 14px; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.live-clock small { display: block; font-size: 11px; color: var(--muted); line-height: 1.2; }
@media (max-width: 767.98px) { .live-clock small { display: none; } .live-clock { padding: 6px 10px; } }
@media (max-width: 575.98px) { .live-clock.hide-xs { display: none !important; } }

/* ====================== Modal ====================== */
.modal-content { border: 0; border-radius: 6px; box-shadow: 0 20px 50px rgba(15,23,42,.25); }
.modal-header { padding: 16px 24px; border-bottom: 1px solid var(--card-border); }
.modal-title { font-size: 18px; font-weight: 600; color: var(--text); }
.modal-header .btn-close { opacity: .55; box-shadow: none; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 12px 24px; border-top: 1px solid var(--card-border); gap: 8px; }
.modal-footer > * { margin: 0; }
.modal-topline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--card-border); }
.modal-topline .link { margin-left: auto; color: var(--primary); text-decoration: none; cursor: pointer; }
.modal-backdrop.show { opacity: .5; }
.is-invalid + .select2-container .select2-selection, .select2-container.is-invalid .select2-selection { border-color: #dc2626; }
.pw-wrap { position: relative; }
.pw-wrap .form-control { padding-right: 46px; }
.pw-wrap .pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); padding: 6px 10px; }
.pw-wrap .pw-toggle:hover { color: var(--primary); }
.form-switch .form-check-input { width: 2.4em; height: 1.2em; }

/* ====================== Roles & permissions ====================== */
.role-list .role-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 0; border-left: 3px solid transparent; border-bottom: 1px solid #edf1f6; background: #fff; width: 100%; text-align: left; color: var(--text); }
.role-list .role-item:last-child { border-bottom: 0; }
.role-list .role-item:hover { background: #f8fbff; }
.role-list .role-item.active { background: var(--primary-soft); border-left-color: var(--primary); }
.role-list .role-item .ic { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: #e2e8f0; color: #475569; flex-shrink: 0; }
.role-list .role-item.active .ic { background: var(--primary); color: #fff; }
.role-list .role-item strong { display: block; line-height: 1.2; }
.role-list .role-item small { color: var(--muted); }
.perm-table th, .perm-table td { text-align: center; }
.perm-table th:first-child, .perm-table td:first-child { text-align: left; }
.perm-table td .form-check-input { width: 1.15em; height: 1.15em; margin: 0; cursor: pointer; }
.perm-table td .form-check-input:disabled { cursor: not-allowed; opacity: .35; }
.perm-table .mod-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); display: inline-grid; place-items: center; margin-right: 10px; vertical-align: middle; }
.perm-table tbody tr:hover { background: #f8fbff; }
.perm-table .na { color: #cbd5e1; }

/* ====================== Invoice paper & print ====================== */
.invoice-paper { max-width: 900px; margin: 0 auto; background: #fff; border: 1px solid var(--card-border); border-radius: var(--radius); padding: 44px 48px; position: relative; overflow: hidden; }
.invoice-paper h2 { font-size: 28px; font-weight: 700; letter-spacing: 1px; margin: 0; }
.invoice-paper .meta-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px; }
.invoice-paper .items thead th { background: #f8fafc; }
.invoice-paper .totals td { padding: 6px 0; border: 0; }
.invoice-paper .stamp { position: absolute; top: 24px; left: -58px; transform: rotate(-35deg); padding: 3px 46px; font-weight: 700; letter-spacing: 1px; font-size: 13px; color: #fff; }
.stamp.paid { background: #16a34a; } .stamp.unpaid { background: #d97706; } .stamp.overdue { background: #dc2626; }
@media (max-width: 575.98px) { .invoice-paper { padding: 24px 18px; } }
@media print {
  .sidebar, .sidebar-overlay, .topbar, .no-print, .action-bar { display: none !important; }
  .main-wrapper { margin: 0 !important; }
  body { background: #fff; }
  .content { padding: 0 !important; }
  .invoice-paper { border: 0; max-width: none; padding: 0; }
  .stamp { display: none; }
}

/* ====================== ID CARD PREVIEW ====================== */
.id-card { --c1:#2563eb; --c2:#1e40af; container-type: inline-size; position: relative; width: 100%; max-width: 360px; aspect-ratio: 1.586; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 6px 20px rgba(15,23,42,.14); border: 1px solid #e2e8f0; text-align: left; font-family: 'Inter', system-ui, sans-serif; }
.id-card.t-blue   { --c1:#2563eb; --c2:#1e40af; }
.id-card.t-green  { --c1:#16a34a; --c2:#166534; }
.id-card.t-red    { --c1:#dc2626; --c2:#991b1b; }
.id-card.t-dark   { --c1:#475569; --c2:#0f172a; }
.id-card.t-purple { --c1:#7c3aed; --c2:#5b21b6; }
.id-card.t-orange { --c1:#ea580c; --c2:#c2410c; }
.id-card .hd { height: 25%; background: linear-gradient(135deg, var(--c1), var(--c2)); color: #fff; display: flex; align-items: center; gap: 3cqw; padding: 0 4cqw; }
.id-card .hd .lg { width: 9cqw; height: 9cqw; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; font-size: 5cqw; flex-shrink: 0; }
.id-card .hd b { font-size: 4.6cqw; font-weight: 700; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id-card .hd .kind { margin-left: auto; font-size: 2.7cqw; letter-spacing: 1px; font-weight: 600; opacity: .85; text-transform: uppercase; white-space: nowrap; }
.id-card .bd { display: flex; gap: 4cqw; padding: 4cqw; }
.id-card .ph { width: 27cqw; height: 33cqw; border-radius: 2cqw; background: #e2e8f0; border: .7cqw solid var(--c1); flex-shrink: 0; display: grid; place-items: center; color: #94a3b8; font-size: 15cqw; overflow: hidden; }
.id-card .ph img { width: 100%; height: 100%; object-fit: cover; }
.id-card .info { min-width: 0; flex: 1; }
.id-card .nm { font-size: 5.6cqw; font-weight: 700; color: #0f172a; line-height: 1.15; word-break: break-word; }
.id-card .tt { font-size: 3.6cqw; color: var(--c1); font-weight: 600; margin: .6cqw 0 2cqw; }
.id-card .rw { font-size: 3.2cqw; color: #475569; line-height: 1.6; }
.id-card .code { position: absolute; right: 4cqw; bottom: 9cqw; font-size: 15cqw; color: #0f172a; line-height: 1; }
.id-card .bar-sm { position: absolute; right: 4cqw; bottom: 9.5cqw; width: 24cqw; height: 8cqw; display: none; }
.id-card .ft { position: absolute; left: 0; right: 0; bottom: 0; height: 6cqw; background: linear-gradient(90deg, var(--c1), var(--c2)); }
.bars { background: repeating-linear-gradient(90deg,#0f172a 0 .5cqw,#fff .5cqw 1cqw,#0f172a 1cqw 2.3cqw,#fff 2.3cqw 2.8cqw,#0f172a 2.8cqw 3.3cqw,#fff 3.3cqw 4.6cqw,#0f172a 4.6cqw 5cqw,#fff 5cqw 5.8cqw); }
.id-card[data-code="barcode"] .code { display: none; }
.id-card[data-code="barcode"] .bar-sm { display: block; }
.id-card[data-code="none"] .code, .id-card[data-code="none"] .bar-sm { display: none; }

/* portrait */
.id-card.portrait { aspect-ratio: .63; max-width: 230px; }
.id-card.portrait .hd { height: 17%; }
.id-card.portrait .bd { flex-direction: column; align-items: center; text-align: center; padding-top: 5cqw; gap: 3cqw; }
.id-card.portrait .ph { width: 38cqw; height: 45cqw; font-size: 22cqw; }
.id-card.portrait .nm { font-size: 7.4cqw; } .id-card.portrait .tt { font-size: 5cqw; margin-bottom: 1cqw; } .id-card.portrait .rw { font-size: 4.4cqw; line-height: 1.5; }
.id-card.portrait .code { right: 50%; transform: translateX(50%); bottom: 9cqw; font-size: 19cqw; }
.id-card.portrait .bar-sm { right: 50%; transform: translateX(50%); bottom: 11cqw; width: 50cqw; height: 12cqw; }
.id-card.portrait .ft { height: 5cqw; }

/* back side */
.id-card.back { padding: 0; }
.id-card.back .stripe { height: 14%; background: #0f172a; margin-top: 7%; }
.id-card.back .bk { padding: 4cqw 5cqw; font-size: 3.2cqw; color: #475569; line-height: 1.55; }
.id-card.back .bk strong { color: #0f172a; }
.id-card.back .sign { margin: 2cqw 5cqw 0; border-top: .4cqw solid #94a3b8; font-size: 2.6cqw; color: #94a3b8; padding-top: .8cqw; }
.id-card.back .bars-big { position: absolute; left: 5cqw; right: 5cqw; bottom: 9cqw; height: 8cqw; }
.id-card.back.portrait .stripe { margin-top: 12%; height: 10%; }
.id-card.back .ft { height: 5cqw; }

.card-stage { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; padding: 28px 12px; background: repeating-conic-gradient(#f1f5f9 0 25%, #f8fafc 0 50%) 0 0/20px 20px; border-radius: 8px; }
.thumb-box { background: #f1f5f9; padding: 18px; display: flex; justify-content: center; align-items: center; min-height: 190px; border-radius: 6px 6px 0 0; }
.thumb-box .id-card { max-width: 240px; box-shadow: 0 3px 10px rgba(15,23,42,.15); }
.thumb-box .id-card.portrait { max-width: 120px; }

/* swatches */
.swatch { position: relative; cursor: pointer; margin: 0; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--sw); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--input-border); transition: box-shadow .15s; }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--sw); }
.swatch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 3px; }

/* misc ui */
.badge-soft.primary { color: #2563eb; border-color: #a5c0fb; background: #eff4ff; }
.dropzone-box { border: 2px dashed var(--input-border); border-radius: 10px; padding: 36px 16px; text-align: center; background: #f8fafc; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone-box:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone-box i { font-size: 36px; color: var(--primary); }
.stepper { display: flex; gap: 10px; flex-wrap: wrap; border: 0; margin-bottom: 18px; }
.stepper .nav-link { flex: 1; min-width: 150px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; border: 1px solid var(--card-border); border-radius: 8px; color: var(--muted); font-weight: 500; }
.stepper .nav-link .n { width: 26px; height: 26px; border-radius: 50%; background: #e2e8f0; display: grid; place-items: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.stepper .nav-link.active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.stepper .nav-link.active .n { background: var(--primary); color: #fff; }
.tpl-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.tpl-pills .btn { border-radius: 20px; padding: 6px 16px; }
.tpl-pills .btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.product-tile { height: 150px; display: grid; place-items: center; font-size: 56px; border-radius: 6px 6px 0 0; }
.qty-sm { width: 76px; }
.sticky-xl { position: static; }
@media (min-width: 1200px) { .sticky-xl { position: sticky; top: 86px; } }
.photo-up { display: flex; align-items: center; gap: 14px; }
.photo-up .pv { width: 64px; height: 76px; border-radius: 6px; background: #e2e8f0; display: grid; place-items: center; color: #94a3b8; font-size: 30px; overflow: hidden; flex-shrink: 0; }
.photo-up .pv img { width: 100%; height: 100%; object-fit: cover; }
.verify-photo { width: 110px; height: 132px; border-radius: 10px; border: 3px solid #16a34a; background: #e2e8f0; display: grid; place-items: center; color: #94a3b8; font-size: 56px; margin: 0 auto; overflow: hidden; }
@media print {
  .print-area .tab-pane { display: block !important; opacity: 1 !important; }
  .id-card { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .card-stage { background: none; }
}

.card-stage .tab-pane { width: 100%; }
.card-stage .tab-pane.active { display: flex; justify-content: center; }
@media print { .print-area .tab-pane { display: flex !important; justify-content: center; margin-bottom: 16px; } }

/* ====================== PREMIUM POLISH ====================== */
:root { --radius: 10px; --input-border: #d6ddea; --shadow-sm: 0 1px 2px rgba(15,23,42,.05), 0 1px 3px rgba(15,23,42,.04); }
.form-label { font-weight: 600; font-size: 13px; color: #334155; margin-bottom: 7px; letter-spacing: .1px; }
.form-control, .form-select {
  min-height: 44px; padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--input-border);
  background-color: #fff; box-shadow: var(--shadow-sm); font-size: 14px; transition: border-color .15s, box-shadow .15s, background .15s;
}
.form-control:hover, .form-select:hover { border-color: #b8c3d6; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,.13); background: #fff; }
.form-control::placeholder { color: #a0abbd; }
.form-control-sm, .form-select-sm { min-height: 34px; padding: 5px 10px; border-radius: 8px; font-size: 13px; }
textarea.form-control { min-height: 96px; }
.input-group > .form-control { box-shadow: var(--shadow-sm); }
.input-group-text { background: #f8fafc !important; border: 1.5px solid var(--input-border); border-radius: 10px; color: #64748b; }
.input-group > .input-group-text:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn.btn-icon { border: 1.5px solid var(--input-border); border-left: 0; border-radius: 0 10px 10px 0; background: #f8fafc; color: #475569; padding: 0 15px; }
.input-group .btn.btn-icon:hover { background: var(--primary-soft); color: var(--primary); }
.input-group .form-control:focus { z-index: 3; }
.input-group-sm > .form-control, .input-group-sm > .input-group-text { min-height: 34px; }
.form-check-input { width: 1.15em; height: 1.15em; border: 1.5px solid #b8c3d6; border-radius: .3em; }
.form-check-input[type=radio] { border-radius: 50%; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-switch .form-check-input { width: 2.4em; border-radius: 2em; }

.select2-container--default .select2-selection--single, .select2-container--default .select2-selection--multiple {
  min-height: 44px; border: 1.5px solid var(--input-border); border-radius: 10px; box-shadow: var(--shadow-sm);
}
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 41px; padding-left: 14px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 41px; }
.select2-container--default.select2-container--focus .select2-selection--single, .select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single, .select2-container--default.select2-container--open .select2-selection--multiple { box-shadow: 0 0 0 4px rgba(37,99,235,.13); }
.select2-container--default .select2-selection--multiple { min-height: 44px; padding: 4px 8px 4px 8px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice { border-radius: 8px; padding: 3px 10px; }
.select2-sm + .select2-container .select2-selection--single { min-height: 34px; border-radius: 8px; }
.select2-sm + .select2-container .select2-selection__rendered { line-height: 31px !important; }
.select2-sm + .select2-container .select2-selection__arrow { height: 31px !important; }
.select2-dropdown { border-radius: 12px; border: 1px solid var(--card-border); box-shadow: 0 16px 40px rgba(15,23,42,.16); }
.select2-results__option { padding: 9px 14px; border-radius: 8px; margin: 2px 6px; }
.select2-results__options { padding: 4px 0; }

.btn { border-radius: 10px; padding: 9px 18px; font-weight: 600; transition: transform .1s, box-shadow .15s, background .15s; }
.btn-sm { padding: 5px 12px; border-radius: 8px; }
.btn-primary { background: linear-gradient(180deg, #3b74f2, #2563eb); border-color: #2158d6; box-shadow: 0 4px 12px rgba(37,99,235,.28); }
.btn-primary:hover, .btn-primary:focus { background: linear-gradient(180deg, #3069e6, #1d4fd0); border-color: #1d4fd0; box-shadow: 0 6px 16px rgba(37,99,235,.34); }
.btn-primary:active { transform: translateY(1px); }
.btn-light.border { border-color: var(--input-border) !important; box-shadow: var(--shadow-sm); }
.btn-light.border:hover { background: #f8fafc; border-color: #b8c3d6 !important; }
.card { border-radius: 14px; box-shadow: var(--shadow-sm); }
.modal-content { border-radius: 16px; }
.modal-header, .modal-footer { padding-left: 26px; padding-right: 26px; }
.modal-body { padding: 22px 26px; }
.badge-soft { border-radius: 8px; }
.pagination .page-link { border-radius: 8px; margin: 0 2px; }
.table thead th { font-size: 13px; color: #475569; text-transform: none; }

.input-icon { position: relative; }
.input-icon > i.lead { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 16px; pointer-events: none; z-index: 4; }
.input-icon .form-control { padding-left: 44px; }
.input-icon .form-control:focus ~ i.lead, .input-icon:focus-within > i.lead { color: var(--primary); }

/* two-sided thumbnails */
.thumb-box.two { gap: 10px; }
.thumb-box.two .id-card { max-width: 48%; }
.thumb-box.two .id-card.portrait { max-width: 30%; }
.thumb-box .side-label { position: absolute; }

/* row action buttons */
.act-btn { width: 34px; height: 34px; border-radius: 9px; border: 1.5px solid var(--input-border); background: #fff; color: #475569; display: inline-grid; place-items: center; padding: 0; transition: all .15s; }
.act-btn:hover { transform: translateY(-1px); }
.act-btn.print:hover { background: #f1f5f9; border-color: #94a3b8; color: #0f172a; }
.act-btn.edit:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.act-btn.del:hover { background: #fef2f2; border-color: #dc2626; color: #dc2626; }
.act-group { display: inline-flex; gap: 6px; }
.co-avatar { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; color: #fff; flex-shrink: 0; font-size: 14px; }
@media print {
  .act-col, .no-print { display: none !important; }
  body.printing-one tbody tr:not(.print-me) { display: none; }
}

